<div dir="ltr">Doesn't this also need corresponding compiler flags in <a href="http://configure.ac">configure.ac</a> to populate SWR_AVX512_CXXFLAGS?<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">- Chuck<br></div></div></div>
<br><div class="gmail_quote">On Fri, Jun 17, 2016 at 3:25 PM, Tim Rowley <span dir="ltr"><<a href="mailto:timothy.o.rowley@intel.com" target="_blank">timothy.o.rowley@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently, most code paths between AVX2 and AVX512 are identical<br>
(see changes to knobs.h).<br>
---<br>
src/gallium/drivers/swr/rasterizer/common/simdintrin.h | 4 ++--<br>
src/gallium/drivers/swr/rasterizer/core/format_types.h | 8 ++++----<br>
src/gallium/drivers/swr/rasterizer/core/knobs.h | 15 ++++++++++-----<br>
src/gallium/drivers/swr/rasterizer/memory/Convert.h | 4 ++--<br>
src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp | 4 ++--<br>
5 files changed, 20 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/swr/rasterizer/common/simdintrin.h b/src/gallium/drivers/swr/rasterizer/common/simdintrin.h<br>
index 5ec1f71..cc29b5d 100644<br>
--- a/src/gallium/drivers/swr/rasterizer/common/simdintrin.h<br>
+++ b/src/gallium/drivers/swr/rasterizer/common/simdintrin.h<br>
@@ -1002,7 +1002,7 @@ static INLINE simdscalar _simd_abs_ps(simdscalar a)<br>
INLINE<br>
UINT pdep_u32(UINT a, UINT mask)<br>
{<br>
-#if KNOB_ARCH==KNOB_ARCH_AVX2<br>
+#if KNOB_ARCH >= KNOB_ARCH_AVX2<br>
return _pdep_u32(a, mask);<br>
#else<br>
UINT result = 0;<br>
@@ -1035,7 +1035,7 @@ UINT pdep_u32(UINT a, UINT mask)<br>
INLINE<br>
UINT pext_u32(UINT a, UINT mask)<br>
{<br>
-#if KNOB_ARCH==KNOB_ARCH_AVX2<br>
+#if KNOB_ARCH >= KNOB_ARCH_AVX2<br>
return _pext_u32(a, mask);<br>
#else<br>
UINT result = 0;<br>
diff --git a/src/gallium/drivers/swr/rasterizer/core/format_types.h b/src/gallium/drivers/swr/rasterizer/core/format_types.h<br>
index afb6337..6612c83 100644<br>
--- a/src/gallium/drivers/swr/rasterizer/core/format_types.h<br>
+++ b/src/gallium/drivers/swr/rasterizer/core/format_types.h<br>
@@ -98,7 +98,7 @@ struct PackTraits<8, false><br>
__m256i result = _mm256_castsi128_si256(resLo);<br>
result = _mm256_insertf128_si256(result, resHi, 1);<br>
return _mm256_castsi256_ps(result);<br>
-#elif KNOB_ARCH==KNOB_ARCH_AVX2<br>
+#elif KNOB_ARCH>=KNOB_ARCH_AVX2<br>
return _mm256_castsi256_ps(_mm256_cvtepu8_epi32(_mm_castps_si128(_mm256_castps256_ps128(in))));<br>
#endif<br>
#else<br>
@@ -161,7 +161,7 @@ struct PackTraits<8, true><br>
__m256i result = _mm256_castsi128_si256(resLo);<br>
result = _mm256_insertf128_si256(result, resHi, 1);<br>
return _mm256_castsi256_ps(result);<br>
-#elif KNOB_ARCH==KNOB_ARCH_AVX2<br>
+#elif KNOB_ARCH>=KNOB_ARCH_AVX2<br>
return _mm256_castsi256_ps(_mm256_cvtepi8_epi32(_mm_castps_si128(_mm256_castps256_ps128(in))));<br>
#endif<br>
#else<br>
@@ -223,7 +223,7 @@ struct PackTraits<16, false><br>
__m256i result = _mm256_castsi128_si256(resLo);<br>
result = _mm256_insertf128_si256(result, resHi, 1);<br>
return _mm256_castsi256_ps(result);<br>
-#elif KNOB_ARCH==KNOB_ARCH_AVX2<br>
+#elif KNOB_ARCH>=KNOB_ARCH_AVX2<br>
return _mm256_castsi256_ps(_mm256_cvtepu16_epi32(_mm_castps_si128(_mm256_castps256_ps128(in))));<br>
#endif<br>
#else<br>
@@ -285,7 +285,7 @@ struct PackTraits<16, true><br>
__m256i result = _mm256_castsi128_si256(resLo);<br>
result = _mm256_insertf128_si256(result, resHi, 1);<br>
return _mm256_castsi256_ps(result);<br>
-#elif KNOB_ARCH==KNOB_ARCH_AVX2<br>
+#elif KNOB_ARCH>=KNOB_ARCH_AVX2<br>
return _mm256_castsi256_ps(_mm256_cvtepi16_epi32(_mm_castps_si128(_mm256_castps256_ps128(in))));<br>
#endif<br>
#else<br>
diff --git a/src/gallium/drivers/swr/rasterizer/core/knobs.h b/src/gallium/drivers/swr/rasterizer/core/knobs.h<br>
index 55a22a6..2629276 100644<br>
--- a/src/gallium/drivers/swr/rasterizer/core/knobs.h<br>
+++ b/src/gallium/drivers/swr/rasterizer/core/knobs.h<br>
@@ -52,11 +52,16 @@<br>
#define KNOB_SIMD_WIDTH 8<br>
#define KNOB_SIMD_BYTES 32<br>
#elif (KNOB_ARCH == KNOB_ARCH_AVX512)<br>
-#define KNOB_ARCH_ISA AVX512F<br>
-#define KNOB_ARCH_STR "AVX512"<br>
-#define KNOB_SIMD_WIDTH 16<br>
-#define KNOB_SIMD_BYTES 64<br>
-#error "AVX512 not yet supported"<br>
+#define KNOB_ARCH_ISA AVX2<br>
+#define KNOB_ARCH_STR "AVX2"<br>
+#define KNOB_SIMD_WIDTH 8<br>
+#define KNOB_SIMD_BYTES 32<br>
+// Disable AVX512 for now...<br>
+//#define KNOB_ARCH_ISA AVX512F<br>
+//#define KNOB_ARCH_STR "AVX512"<br>
+//#define KNOB_SIMD_WIDTH 16<br>
+//#define KNOB_SIMD_BYTES 64<br>
+//#error "AVX512 not yet supported"<br>
#else<br>
#error "Unknown architecture"<br>
#endif<br>
diff --git a/src/gallium/drivers/swr/rasterizer/memory/Convert.h b/src/gallium/drivers/swr/rasterizer/memory/Convert.h<br>
index 42b973c..b790d35 100644<br>
--- a/src/gallium/drivers/swr/rasterizer/memory/Convert.h<br>
+++ b/src/gallium/drivers/swr/rasterizer/memory/Convert.h<br>
@@ -336,7 +336,7 @@ static void ConvertPixelFromFloat(<br>
// Convert from 32-bit float to 16-bit float using _mm_cvtps_ph<br>
// @todo 16bit float instruction support is orthogonal to avx support. need to<br>
// add check for F16C support instead.<br>
-#if KNOB_ARCH == KNOB_ARCH_AVX2<br>
+#if KNOB_ARCH >= KNOB_ARCH_AVX2<br>
__m128 src128 = _mm_set1_ps(src);<br>
__m128i srci128 = _mm_cvtps_ph(src128, _MM_FROUND_TRUNC);<br>
UINT value = _mm_extract_epi16(srci128, 0);<br>
@@ -519,7 +519,7 @@ INLINE static void ConvertPixelToFloat(<br>
float dst;<br>
if (FormatTraits<SrcFormat>::GetBPC(comp) == 16)<br>
{<br>
-#if KNOB_ARCH == KNOB_ARCH_AVX2<br>
+#if KNOB_ARCH >= KNOB_ARCH_AVX2<br>
// Convert from 16-bit float to 32-bit float using _mm_cvtph_ps<br>
// @todo 16bit float instruction support is orthogonal to avx support. need to<br>
// add check for F16C support instead.<br>
diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp<br>
index 2ab2936..8a26ff6 100644<br>
--- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp<br>
+++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.cpp<br>
@@ -454,7 +454,7 @@ INLINE static void FlatConvert(const uint8_t* pSrc, uint8_t* pDst, uint8_t* pDst<br>
__m256i final = _mm256_castsi128_si256(vRow00);<br>
final = _mm256_insertf128_si256(final, vRow10, 1);<br>
<br>
-#elif KNOB_ARCH == KNOB_ARCH_AVX2<br>
+#elif KNOB_ARCH >= KNOB_ARCH_AVX2<br>
<br>
// logic is as above, only wider<br>
src1 = _mm256_slli_si256(src1, 1);<br>
@@ -542,7 +542,7 @@ INLINE static void FlatConvertNoAlpha(const uint8_t* pSrc, uint8_t* pDst, uint8_<br>
__m256i final = _mm256_castsi128_si256(vRow00);<br>
final = _mm256_insertf128_si256(final, vRow10, 1);<br>
<br>
-#elif KNOB_ARCH == KNOB_ARCH_AVX2<br>
+#elif KNOB_ARCH >= KNOB_ARCH_AVX2<br>
<br>
// logic is as above, only wider<br>
src1 = _mm256_slli_si256(src1, 1);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>