Skip to content

Commit 1f1be9c

Browse files
authored
[SYCL][ESIMD] Move fmax to SPIR-V intrinsic (#14020)
Couldn't do this earlier because of a driver issue. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent bd31be7 commit 1f1be9c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

sycl/include/sycl/ext/intel/esimd/detail/math_intrin.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ __ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
8585
__spirv_ocl_fmin(__ESIMD_raw_vec_t(T, N),
8686
__ESIMD_raw_vec_t(T, N)) __ESIMD_INTRIN_END;
8787

88+
template <typename T, int N>
89+
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
90+
__spirv_ocl_fmax(__ESIMD_raw_vec_t(T, N),
91+
__ESIMD_raw_vec_t(T, N)) __ESIMD_INTRIN_END;
8892
// saturation intrinsics
8993
template <typename T0, typename T1, int SZ>
9094
__ESIMD_INTRIN __ESIMD_raw_vec_t(T0, SZ)
@@ -114,11 +118,7 @@ template <typename T0, typename T1, int SZ>
114118
__ESIMD_INTRIN __ESIMD_raw_vec_t(T0, SZ)
115119
__esimd_sstrunc_sat(__ESIMD_raw_vec_t(T1, SZ) src) __ESIMD_INTRIN_END;
116120

117-
/// 3 kinds of max
118-
template <typename T, int SZ>
119-
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, SZ)
120-
__esimd_fmax(__ESIMD_raw_vec_t(T, SZ) src0,
121-
__ESIMD_raw_vec_t(T, SZ) src1) __ESIMD_INTRIN_END;
121+
/// 3 kinds of max, the missing fmax uses spir-v intrinsics above
122122
template <typename T, int SZ>
123123
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, SZ)
124124
__esimd_umax(__ESIMD_raw_vec_t(T, SZ) src0,

sycl/include/sycl/ext/intel/esimd/math.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ __ESIMD_API simd<T, SZ>(max)(simd<T, SZ> src0, simd<T, SZ> src1, Sat sat = {}) {
185185
constexpr bool is_sat = std::is_same_v<Sat, saturation_on_tag>;
186186

187187
if constexpr (std::is_floating_point<T>::value) {
188-
auto Result = __esimd_fmax<T, SZ>(src0.data(), src1.data());
188+
auto Result = __spirv_ocl_fmax<T, SZ>(src0.data(), src1.data());
189189
if constexpr (is_sat)
190190
Result = __esimd_sat<T, T, SZ>(Result);
191191
return simd<T, SZ>(Result);
@@ -1466,7 +1466,7 @@ template <typename T0, typename T1, int SZ> struct esimd_apply_reduced_max {
14661466
template <typename... T>
14671467
simd<T0, SZ> operator()(simd<T1, SZ> v1, simd<T1, SZ> v2) {
14681468
if constexpr (std::is_floating_point<T1>::value) {
1469-
return __esimd_fmax<T1, SZ>(v1.data(), v2.data());
1469+
return __spirv_ocl_fmax<T1, SZ>(v1.data(), v2.data());
14701470
} else if constexpr (std::is_unsigned<T1>::value) {
14711471
return __esimd_umax<T1, SZ>(v1.data(), v2.data());
14721472
} else {

0 commit comments

Comments
 (0)