[Bugfix][CPU] Fix macOS build: std::sqrt is not constexpr under libc++ (#50915)

Signed-off-by: harjoth <[email protected]>
This commit is contained in:
Harjoth Khara
2026-08-04 14:56:33 +00:00
committed by GitHub
parent 199644d410
commit 122b3d46b6
+2 -2
View File
@@ -101,7 +101,7 @@ struct l2norm_kernel {
using bVec = at::vec::Vectorized<scalar_t>;
using fVec = at::vec::Vectorized<float>;
constexpr int bVecSize = bVec::size();
constexpr float scale = 1.f / std::sqrt(static_cast<float>(D));
const float scale = 1.f / std::sqrt(static_cast<float>(D));
fVec sum_fvec0(0.f), sum_fvec1(0.f);
int d = 0;
@@ -155,7 +155,7 @@ struct l2norm_kernel<at::BFloat16, D, has_scale> {
__m512bh va[COLS];
__m512 vrscale;
constexpr float scale = 1.f / std::sqrt(D);
const float scale = 1.f / std::sqrt(D);
__m512 vscale = _mm512_set1_ps(scale);
// step 1: load input and do reduce with avx512-bf16