Skip to content

Commit 9a94f9f

Browse files
qnixsynapseAD2605
andauthored
refactor code
Co-authored-by: Atharva Dubey <[email protected]>
1 parent bffd38f commit 9a94f9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ggml/src/ggml-sycl/element_wise.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ template<typename T>
8888
static void gelu_erf(const T * x, T * dst, const int k, const sycl::nd_item<3> &item_ct1) {
8989
const T SQRT_2_INV = static_cast<T>(0.70710678118654752440084436210484f);
9090
for(auto i = item_ct1.get_global_id(2); i < (const size_t)k; i += item_ct1.get_global_range(2)) {
91-
dst[i] = static_cast<T>(0.5f)*x[i]*(static_cast<T>(1.0f) + sycl::erf(x[i]*SQRT_2_INV));
91+
auto x_i = x[i];
92+
dst[i] = static_cast<T>(0.5f) * x_i * (static_cast<T>(1.0f) + sycl::erf(x_i * SQRT_2_INV));
9293
}
9394
}
9495

0 commit comments

Comments
 (0)