Skip to content

Commit 23f17ac

Browse files
authored
simd.h: address compiler warnings (#4724)
* We passed a bad flag to _mm512_cvtps_ph intrinsics because of what I can only imagine was a bad cut-and-paste years ago. (Harmless because it set bits never used, but a warning on Windows.) * Remove clauses for AVX512-EL, I'm not sure why they were there, because those instructions were only for "Knights Landing" which was never made available to the general public and has been discontinued. It must be that years ago, I got a little overzealous with the SIMD intrinsics. Signed-off-by: Larry Gritz <[email protected]>
1 parent 0e03e5c commit 23f17ac

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

src/include/OpenImageIO/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ inline bool cpu_has_avx512f() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<16)) !
602602
inline bool cpu_has_avx512dq() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<17)) != 0; }
603603
inline bool cpu_has_avx512ifma() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<21)) != 0; }
604604
inline bool cpu_has_avx512pf() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<26)) != 0; }
605-
inline bool cpu_has_avx512er() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<27)) != 0; }
605+
inline bool cpu_has_avx512er() { return false; /* knights landing only */ }
606606
inline bool cpu_has_avx512cd() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<28)) != 0; }
607607
inline bool cpu_has_avx512bw() {int i[4]; cpuid(i,7,0); return (i[1] & (1<<30)) != 0; }
608608
inline bool cpu_has_avx512vl() {int i[4]; cpuid(i,7,0); return (i[1] & (0x80000000 /*1<<31*/)) != 0; }

src/include/OpenImageIO/simd.h

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@
190190
# else
191191
# define OIIO_AVX512PF_ENABLED 0
192192
# endif
193-
# if defined(__AVX512ER__)
194-
# define OIIO_AVX512ER_ENABLED 1 /* Exponential & reciprocal */
195-
# else
196-
# define OIIO_AVX512ER_ENABLED 0
197-
# endif
198193
# if defined(__AVX512CD__)
199194
# define OIIO_AVX512CD_ENABLED 1 /* Conflict detection */
200195
# else
@@ -215,7 +210,6 @@
215210
# define OIIO_AVX512VL_ENABLED 0
216211
# define OIIO_AVX512DQ_ENABLED 0
217212
# define OIIO_AVX512PF_ENABLED 0
218-
# define OIIO_AVX512ER_ENABLED 0
219213
# define OIIO_AVX512CD_ENABLED 0
220214
# define OIIO_AVX512BW_ENABLED 0
221215
#endif
@@ -6903,7 +6897,7 @@ OIIO_FORCEINLINE void vfloat4::store (float *values, int n) const {
69036897
#if defined(_HALF_H_) || defined(IMATH_HALF_H_)
69046898
OIIO_FORCEINLINE void vfloat4::store (half *values) const {
69056899
#if OIIO_F16C_ENABLED && OIIO_SIMD_SSE
6906-
__m128i h = _mm_cvtps_ph (m_simd, (_MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC));
6900+
__m128i h = _mm_cvtps_ph (m_simd, _MM_FROUND_TO_NEAREST_INT);
69076901
_mm_store_sd ((double *)values, _mm_castsi128_pd(h));
69086902
#elif OIIO_SIMD_NEON
69096903
float16x4_t f16 = vcvt_f16_f32(m_simd);
@@ -7627,10 +7621,7 @@ OIIO_FORCEINLINE vfloat4 rsqrt (const vfloat4 &a)
76277621

76287622
OIIO_FORCEINLINE vfloat4 rsqrt_fast (const vfloat4 &a)
76297623
{
7630-
#if OIIO_SIMD_AVX >= 512 && OIIO_AVX512ER_ENABLED
7631-
// Trickery: in and out of the 512 bit registers to use fast approx rsqrt
7632-
return _mm512_castps512_ps128(_mm512_rsqrt28_round_ps(_mm512_castps128_ps512(a), _MM_FROUND_NO_EXC));
7633-
#elif OIIO_SIMD_AVX >= 512 && OIIO_AVX512VL_ENABLED
7624+
#if OIIO_SIMD_AVX >= 512 && OIIO_AVX512VL_ENABLED
76347625
// Trickery: in and out of the 512 bit registers to use fast approx rsqrt
76357626
return _mm512_castps512_ps128(_mm512_rsqrt14_ps(_mm512_castps128_ps512(a)));
76367627
#elif OIIO_SIMD_SSE
@@ -8794,7 +8785,7 @@ OIIO_FORCEINLINE void vfloat8::store (float *values, int n) const {
87948785
#if defined(_HALF_H_) || defined(IMATH_HALF_H_)
87958786
OIIO_FORCEINLINE void vfloat8::store (half *values) const {
87968787
#if OIIO_SIMD_AVX && OIIO_F16C_ENABLED
8797-
__m128i h = _mm256_cvtps_ph (m_simd, (_MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC));
8788+
__m128i h = _mm256_cvtps_ph (m_simd, _MM_FROUND_TO_NEAREST_INT);
87988789
_mm_storeu_si128 ((__m128i *)values, h);
87998790
#elif OIIO_SIMD_SSE || OIIO_SIMD_NEON
88008791
m_4[0].store(values);
@@ -9285,10 +9276,7 @@ OIIO_FORCEINLINE vfloat8 rsqrt (const vfloat8 &a)
92859276

92869277
OIIO_FORCEINLINE vfloat8 rsqrt_fast (const vfloat8 &a)
92879278
{
9288-
#if OIIO_SIMD_AVX >= 512 && OIIO_AVX512ER_ENABLED
9289-
// Trickery: in and out of the 512 bit registers to use fast approx rsqrt
9290-
return _mm512_castps512_ps256(_mm512_rsqrt28_round_ps(_mm512_castps256_ps512(a), _MM_FROUND_NO_EXC));
9291-
#elif OIIO_SIMD_AVX >= 512 && OIIO_AVX512VL_ENABLED
9279+
#if OIIO_SIMD_AVX >= 512 && OIIO_AVX512VL_ENABLED
92929280
// Trickery: in and out of the 512 bit registers to use fast approx rsqrt
92939281
return _mm512_castps512_ps256(_mm512_rsqrt14_ps(_mm512_castps256_ps512(a)));
92949282
#elif OIIO_SIMD_AVX
@@ -9673,7 +9661,7 @@ OIIO_FORCEINLINE void vfloat16::store (float *values, int n) const {
96739661
#if defined(_HALF_H_) || defined(IMATH_HALF_H_)
96749662
OIIO_FORCEINLINE void vfloat16::store (half *values) const {
96759663
#if OIIO_SIMD_AVX >= 512
9676-
__m256i h = _mm512_cvtps_ph (m_simd, (_MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC));
9664+
__m256i h = _mm512_cvtps_ph (m_simd, _MM_FROUND_TO_NEAREST_INT);
96779665
_mm256_storeu_si256 ((__m256i *)values, h);
96789666
#else
96799667
m_8[0].store (values);
@@ -10113,9 +10101,7 @@ OIIO_FORCEINLINE vint16 rint (const vfloat16& a)
1011310101

1011410102
OIIO_FORCEINLINE vfloat16 rcp_fast (const vfloat16 &a)
1011510103
{
10116-
#if OIIO_SIMD_AVX >= 512 && OIIO_AVX512ER_ENABLED
10117-
return _mm512_rcp28_ps(a);
10118-
#elif OIIO_SIMD_AVX >= 512
10104+
#if OIIO_SIMD_AVX >= 512
1011910105
vfloat16 r = _mm512_rcp14_ps(a);
1012010106
return r * nmadd (r, a, vfloat16(2.0f));
1012110107
#else
@@ -10146,9 +10132,7 @@ OIIO_FORCEINLINE vfloat16 rsqrt (const vfloat16 &a)
1014610132

1014710133
OIIO_FORCEINLINE vfloat16 rsqrt_fast (const vfloat16 &a)
1014810134
{
10149-
#if OIIO_SIMD_AVX >= 512 && OIIO_AVX512ER_ENABLED
10150-
return _mm512_rsqrt28_round_ps(a, _MM_FROUND_NO_EXC);
10151-
#elif OIIO_SIMD_AVX >= 512
10135+
#if OIIO_SIMD_AVX >= 512
1015210136
return _mm512_rsqrt14_ps (a);
1015310137
#else
1015410138
return vfloat16(rsqrt_fast(a.lo()), rsqrt_fast(a.hi()));

src/libOpenImageIO/imageio.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ hw_simd_caps()
170170
if (cpu_has_avx512dq()) caps.emplace_back ("avx512dq");
171171
if (cpu_has_avx512ifma()) caps.emplace_back ("avx512ifma");
172172
if (cpu_has_avx512pf()) caps.emplace_back ("avx512pf");
173-
if (cpu_has_avx512er()) caps.emplace_back ("avx512er");
174173
if (cpu_has_avx512cd()) caps.emplace_back ("avx512cd");
175174
if (cpu_has_avx512bw()) caps.emplace_back ("avx512bw");
176175
if (cpu_has_avx512vl()) caps.emplace_back ("avx512vl");
@@ -202,7 +201,6 @@ oiio_simd_caps()
202201
if (OIIO_AVX512DQ_ENABLED) caps.emplace_back ("avx512dq");
203202
if (OIIO_AVX512IFMA_ENABLED) caps.emplace_back ("avx512ifma");
204203
if (OIIO_AVX512PF_ENABLED) caps.emplace_back ("avx512pf");
205-
if (OIIO_AVX512ER_ENABLED) caps.emplace_back ("avx512er");
206204
if (OIIO_AVX512CD_ENABLED) caps.emplace_back ("avx512cd");
207205
if (OIIO_AVX512BW_ENABLED) caps.emplace_back ("avx512bw");
208206
if (OIIO_AVX512VL_ENABLED) caps.emplace_back ("avx512vl");

0 commit comments

Comments
 (0)