[Bugfix][CPU] Fix macOS build: std::sqrt is not constexpr under libc++ (#50915)
Signed-off-by: harjoth <harjoth.khara@gmail.com>
This commit is contained in:
@@ -101,7 +101,7 @@ struct l2norm_kernel {
|
|||||||
using bVec = at::vec::Vectorized<scalar_t>;
|
using bVec = at::vec::Vectorized<scalar_t>;
|
||||||
using fVec = at::vec::Vectorized<float>;
|
using fVec = at::vec::Vectorized<float>;
|
||||||
constexpr int bVecSize = bVec::size();
|
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);
|
fVec sum_fvec0(0.f), sum_fvec1(0.f);
|
||||||
int d = 0;
|
int d = 0;
|
||||||
@@ -155,7 +155,7 @@ struct l2norm_kernel<at::BFloat16, D, has_scale> {
|
|||||||
__m512bh va[COLS];
|
__m512bh va[COLS];
|
||||||
__m512 vrscale;
|
__m512 vrscale;
|
||||||
|
|
||||||
constexpr float scale = 1.f / std::sqrt(D);
|
const float scale = 1.f / std::sqrt(D);
|
||||||
__m512 vscale = _mm512_set1_ps(scale);
|
__m512 vscale = _mm512_set1_ps(scale);
|
||||||
|
|
||||||
// step 1: load input and do reduce with avx512-bf16
|
// step 1: load input and do reduce with avx512-bf16
|
||||||
|
|||||||
Reference in New Issue
Block a user