8000 SIMD: Fix compile error by using MaxLanes instead of Lanes for array … · numpy/numpy@c7884f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7884f0

Browse files
committed
SIMD: Fix comp 8000 ile error by using MaxLanes instead of Lanes for array size
Replace hn::Lanes(f64) with hn::MaxLanes(f64) when defining the index array size to fix error C2131: "expression did not evaluate to a constant". This error occurs because Lanes() isn't always constexpr compatible, especially with scalable vector extensions. MaxLanes() provides a compile-time constant value suitable for static array allocation and should be used with non-scalable SIMD extensions when defining fixed-size arrays.
1 parent e494878 commit c7884f0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

numpy/_core/src/umath/loops_hyperbolic.dispatch.cpp.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ simd_tanh_f64(const double *src, npy_intp ssrc, double *dst, npy_intp sdst, npy_
393393
vec_f64 b, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16;
394394
if constexpr(hn::MaxLanes(f64) == 2){
395395
vec_f64 e0e1_0, e0e1_1;
396-
uint64_t index[hn::Lanes(f64)];
396+
uint64_t index[hn::MaxLanes(f64)];
397397
hn::StoreU(idx, u64, index);
398398

399399
/**begin repeat

numpy/_core/src/umath/loops_trigonometric.dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ simd_sincos_f32(const float *src, npy_intp ssrc, float *dst, npy_intp sdst,
186186
"larger than 256 bits.");
187187
simd_maski = ((uint8_t *)&simd_maski)[0];
188188
#endif
189-
float NPY_DECL_ALIGNED(NPY_SIMD_WIDTH) ip_fback[hn::Lanes(f32)];
189+
float NPY_DECL_ALIGNED(NPY_SIMD_WIDTH) ip_fback[hn::MaxLanes(f32)];
190190
hn::Store(x_in, f32, ip_fback);
191191

192192
// process elements using libc for large elements

0 commit comments

Comments
 (0)
0