Skip to content

Commit

Permalink
fix missing if constexpr in optimized gelu (unbreak sync of D68745515/
Browse files Browse the repository at this point in the history
#7987) (#8011)

The code gated under this `if` does disallowed `static_cast`s if the `if` condition doesn't pass; this is what `if constexpr` is for.
  • Loading branch information
swolchok authored Jan 28, 2025
1 parent 2307b6f commit 520e0bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernels/optimized/cpu/op_gelu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void gelu(
}
#else
size_t i = 0;
if (std::is_same<CTYPE, float>::value) {
if constexpr (std::is_same_v<CTYPE, float>) {
for (; i + 4 < lim; i += 4) {
const float32x4_t in =
vld1q_f32(static_cast<const float*>(&in_data[i]));
Expand Down

0 comments on commit 520e0bc

Please sign in to comment.