From WikiChip
Editing x86/avx512 vnni

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 14: Line 14:
  
 
:[[File:vnni-vpdpwssd.svg|600px]]
 
:[[File:vnni-vpdpwssd.svg|600px]]
 
+
 
Likewise, for 8-bit values, three instructions are needed - <code>VPMADDUBSW</code> which is used to multiply two 8-bit pairs and add them together, followed by a <code>VPMADDWD</code> with the value <code>1</code> in order to simply up-convert the 16-bit values to  32-bit values, followed by the <code>VPADDD</code> instruction which adds the result to an accumulator.
 
Likewise, for 8-bit values, three instructions are needed - <code>VPMADDUBSW</code> which is used to multiply two 8-bit pairs and add them together, followed by a <code>VPMADDWD</code> with the value <code>1</code> in order to simply up-convert the 16-bit values to  32-bit values, followed by the <code>VPADDD</code> instruction which adds the result to an accumulator.
  
Line 24: Line 24:
  
 
== Detection ==
 
== Detection ==
Support for these instructions is indicated by the AVX512_VNNI feature flag. 128- and 256-bit vectors are supported if the AVX512VL flag is set as well.
 
 
The {{x86|AVX-VNNI}} extension adds AVX (VEX encoded) versions of these instructions operating on 128- and 256-bit vectors.
 
 
 
{| class="wikitable"
 
{| class="wikitable"
! colspan="2" | {{x86|CPUID}} !! rowspan="2" | Instruction Set
+
! colspan="2" | {{x86|CPUID}} !! rowspan="2" | Instruction Set  
 
|-
 
|-
 
! Input !! Output
 
! Input !! Output
 
|-
 
|-
| EAX=07H, ECX=0 || EBX[bit 31] || AVX512VL
+
| EAX=07H, ECX=0 || ECX[bit 11] || AVX512VNNI
|-
 
| EAX=07H, ECX=0 || ECX[bit 11] || AVX512_VNNI
 
 
|}
 
|}
  
 
== Microarchitecture support ==
 
== Microarchitecture support ==
<!-- Wrong/incomplete? Visit https://en.wikichip.org/wiki/Template:avx512_support_matrix -->
+
{| class="wikitable"
{{avx512 support matrix|em=VL+VNNI}}
+
|-
 +
! Instructions !! Introduction
 +
|-
 +
| AVX512VNNI || {{intel|Cascade Lake|l=arch}} (server)<br>{{intel|Ice Lake (client)|Ice Lake|l=arch}} (client)
 +
|}
  
 
== Intrinsic functions ==
 
== Intrinsic functions ==
<source lang=c>
+
<source lang=asm>
// VPDPBUSD
+
# vpdpbusd
__m128i _mm_dpbusd_epi32(__m128i, __m128i, __m128i);
+
__m512i _mm512_dpbusd_epi32 (__m512i src, __m512i a, __m512i b)
__m128i _mm_mask_dpbusd_epi32(__m128i, __mmask8, __m128i, __m128i);
+
__m512i _mm512_mask_dpbusd_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b)
__m128i _mm_maskz_dpbusd_epi32(__mmask8, __m128i, __m128i, __m128i);
+
__m512i _mm512_maskz_dpbusd_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b)
__m256i _mm256_dpbusd_epi32(__m256i, __m256i, __m256i);
+
# vpdpbusds
__m256i _mm256_mask_dpbusd_epi32(__m256i, __mmask8, __m256i, __m256i);
+
__m512i _mm512_dpbusds_epi32 (__m512i src, __m512i a, __m512i b)
__m256i _mm256_maskz_dpbusd_epi32(__mmask8, __m256i, __m256i, __m256i);
+
__m512i _mm512_mask_dpbusds_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b)
__m512i _mm512_dpbusd_epi32 (__m512i src, __m512i a, __m512i b);
+
__m512i _mm512_maskz_dpbusds_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b)
__m512i _mm512_mask_dpbusd_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b);
+
# vpdpwssd
__m512i _mm512_maskz_dpbusd_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b);
+
__m512i _mm512_dpwssd_epi32 (__m512i src, __m512i a, __m512i b)
// VPDPBUSDS
+
__m512i _mm512_mask_dpwssd_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b)
__m128i _mm_dpbusds_epi32(__m128i, __m128i, __m128i);
+
__m512i _mm512_maskz_dpwssd_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b)
__m128i _mm_mask_dpbusds_epi32(__m128i, __mmask8, __m128i, __m128i);
+
# vpdpwssds
__m128i _mm_maskz_dpbusds_epi32(__mmask8, __m128i, __m128i, __m128i);
+
__m512i _mm512_dpwssds_epi32 (__m512i src, __m512i a, __m512i b)
__m256i _mm256_dpbusds_epi32(__m256i, __m256i, __m256i);
+
__m512i _mm512_mask_dpwssds_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b)
__m256i _mm256_mask_dpbusds_epi32(__m256i, __mmask8, __m256i, __m256i);
+
__m512i _mm512_maskz_dpwssds_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b)
__m256i _mm256_maskz_dpbusds_epi32(__mmask8, __m256i, __m256i, __m256i);
 
__m512i _mm512_dpbusds_epi32 (__m512i src, __m512i a, __m512i b);
 
__m512i _mm512_mask_dpbusds_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b);
 
__m512i _mm512_maskz_dpbusds_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b);
 
// VPDPWSSD
 
__m128i _mm_dpwssd_epi32(__m128i, __m128i, __m128i);
 
__m128i _mm_mask_dpwssd_epi32(__m128i, __mmask8, __m128i, __m128i);
 
__m128i _mm_maskz_dpwssd_epi32(__mmask8, __m128i, __m128i, __m128i);
 
__m256i _mm256_dpwssd_epi32(__m256i, __m256i, __m256i);
 
__m256i _mm256_mask_dpwssd_epi32(__m256i, __mmask8, __m256i, __m256i);
 
__m256i _mm256_maskz_dpwssd_epi32(__mmask8, __m256i, __m256i, __m256i);
 
__m512i _mm512_dpwssd_epi32 (__m512i src, __m512i a, __m512i b);
 
__m512i _mm512_mask_dpwssd_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b);
 
__m512i _mm512_maskz_dpwssd_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b);
 
// VPDPWSSDS
 
__m128i _mm_dpwssds_epi32(__m128i, __m128i, __m128i);
 
__m128i _mm_mask_dpwssds_epi32(__m128i, __mmask8, __m128i, __m128i);
 
__m128i _mm_maskz_dpwssds_epi32(__mmask8, __m128i, __m128i, __m128i);
 
__m256i _mm256_dpwssds_epi32(__m256i, __m256i, __m256i);
 
__m256i _mm256_mask_dpwssds_epi32(__m256i, __mmask8, __m256i, __m256i);
 
__m256i _mm256_maskz_dpwssds_epi32(__mmask8, __m256i, __m256i, __m256i);
 
__m512i _mm512_dpwssds_epi32 (__m512i src, __m512i a, __m512i b);
 
__m512i _mm512_mask_dpwssds_epi32 (__m512i src, __mmask16 k, __m512i a, __m512i b);
 
__m512i _mm512_maskz_dpwssds_epi32 (__mmask16 k, __m512i src, __m512i a, __m512i b);
 
 
</source>
 
</source>
  
Line 89: Line 63:
 
* {{bib|hc|30|Intel}}
 
* {{bib|hc|30|Intel}}
 
* Rodriguez, Andres, et al. "[https://ai.intel.com/nervana/wp-content/uploads/sites/53/2018/05/Lower-Numerical-Precision-Deep-Learning-Inference-Training.pdf Lower numerical precision deep learning inference and training]." Intel White Paper (2018).
 
* Rodriguez, Andres, et al. "[https://ai.intel.com/nervana/wp-content/uploads/sites/53/2018/05/Lower-Numerical-Precision-Deep-Learning-Inference-Training.pdf Lower numerical precision deep learning inference and training]." Intel White Paper (2018).
* {{cite techdoc|title=Intel® Architecture Instruction Set Extensions and Future Features|url=https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html|publ=Intel|pid=319433|rev=047|date=2022-12}}
 
  
 
[[Category:x86_extensions]]
 
[[Category:x86_extensions]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)