Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaef050e

Browse files
seiko2plusamane-ame
authored andcommitted
SIMD: Fix compile 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 parent6421304 commitaef050e

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
@@ -184,7 +184,7 @@ simd_sincos_f32(const float *src, npy_intp ssrc, float *dst, npy_intp sdst,
184184
"larger than 256 bits.");
185185
simd_maski = ((uint8_t *)&simd_maski)[0];
186186
#endif
187-
floatNPY_DECL_ALIGNED(NPY_SIMD_WIDTH) ip_fback[hn::Lanes(f32)];
187+
floatNPY_DECL_ALIGNED(NPY_SIMD_WIDTH) ip_fback[hn::MaxLanes(f32)];
188188
hn::Store(x_in, f32, ip_fback);
189189

190190
// process elements using libc for large elements

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp