Skip to content

Commit

Permalink
[SYCL][ESIMD] Move fmax to SPIR-V intrinsic (#14020)
Browse files Browse the repository at this point in the history
Couldn't do this earlier because of a driver issue.

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
  • Loading branch information
sarnex authored Jul 8, 2024
1 parent bd31be7 commit 1f1be9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions sycl/include/sycl/ext/intel/esimd/detail/math_intrin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ __ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
__spirv_ocl_fmin(__ESIMD_raw_vec_t(T, N),
__ESIMD_raw_vec_t(T, N)) __ESIMD_INTRIN_END;

template <typename T, int N>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
__spirv_ocl_fmax(__ESIMD_raw_vec_t(T, N),
__ESIMD_raw_vec_t(T, N)) __ESIMD_INTRIN_END;
// saturation intrinsics
template <typename T0, typename T1, int SZ>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T0, SZ)
Expand Down Expand Up @@ -114,11 +118,7 @@ template <typename T0, typename T1, int SZ>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T0, SZ)
__esimd_sstrunc_sat(__ESIMD_raw_vec_t(T1, SZ) src) __ESIMD_INTRIN_END;

/// 3 kinds of max
template <typename T, int SZ>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, SZ)
__esimd_fmax(__ESIMD_raw_vec_t(T, SZ) src0,
__ESIMD_raw_vec_t(T, SZ) src1) __ESIMD_INTRIN_END;
/// 3 kinds of max, the missing fmax uses spir-v intrinsics above
template <typename T, int SZ>
__ESIMD_INTRIN __ESIMD_raw_vec_t(T, SZ)
__esimd_umax(__ESIMD_raw_vec_t(T, SZ) src0,
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/sycl/ext/intel/esimd/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ __ESIMD_API simd<T, SZ>(max)(simd<T, SZ> src0, simd<T, SZ> src1, Sat sat = {}) {
constexpr bool is_sat = std::is_same_v<Sat, saturation_on_tag>;

if constexpr (std::is_floating_point<T>::value) {
auto Result = __esimd_fmax<T, SZ>(src0.data(), src1.data());
auto Result = __spirv_ocl_fmax<T, SZ>(src0.data(), src1.data());
if constexpr (is_sat)
Result = __esimd_sat<T, T, SZ>(Result);
return simd<T, SZ>(Result);
Expand Down Expand Up @@ -1466,7 +1466,7 @@ template <typename T0, typename T1, int SZ> struct esimd_apply_reduced_max {
template <typename... T>
simd<T0, SZ> operator()(simd<T1, SZ> v1, simd<T1, SZ> v2) {
if constexpr (std::is_floating_point<T1>::value) {
return __esimd_fmax<T1, SZ>(v1.data(), v2.data());
return __spirv_ocl_fmax<T1, SZ>(v1.data(), v2.data());
} else if constexpr (std::is_unsigned<T1>::value) {
return __esimd_umax<T1, SZ>(v1.data(), v2.data());
} else {
Expand Down

0 comments on commit 1f1be9c

Please sign in to comment.