[Bugfix][CPU] Fix macOS build: std::sqrt is not constexpr under libc++ (#50915)
Signed-off-by: harjoth <harjoth.khara@gmail.com>
Harjoth Khara committed
Aug 4, 2026 at 07:56 UTC
122b3d46b674f8b005a7c9902e27cf3b37b109ec
1 file changed
+2
-2
csrc/cpu/sgl-kernels/fla.cpp
+2
-2
@@ -101,7 +101,7 @@ struct l2norm_kernel {
101
using bVec = at::vec::Vectorized<scalar_t>;
102
using fVec = at::vec::Vectorized<float>;
103
constexpr int bVecSize = bVec::size();
104
- constexpr float scale = 1.f / std::sqrt(static_cast<float>(D));
104
+ const float scale = 1.f / std::sqrt(static_cast<float>(D));
105
106
fVec sum_fvec0(0.f), sum_fvec1(0.f);
107
int d = 0;
@@ -155,7 +155,7 @@ struct l2norm_kernel<at::BFloat16, D, has_scale> {
155
__m512bh va[COLS];
156
__m512 vrscale;
157
158
- constexpr float scale = 1.f / std::sqrt(D);
158
+ const float scale = 1.f / std::sqrt(D);
159
__m512 vscale = _mm512_set1_ps(scale);
160
161
// step 1: load input and do reduce with avx512-bf16