Skip to content

Commit 3d506a3

Browse files
[SYCL][ESIMD][EMU] Enable dpas with ESIMD_EMULATOR backend (#6475)
1 parent 53b619f commit 3d506a3

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ __ESIMD_INTRIN __ESIMD_raw_vec_t(T, N)
110110
}
111111
#endif // __SYCL_DEVICE_ONLY__
112112

113+
#ifdef __SYCL_DEVICE_ONLY__
114+
115+
// TODO: __esimd_dpas* should have single declaration for host and device:
116+
// Ret __esimd_dpas*(...)
113117
template <typename T, typename T0, typename T1, typename T2, int N, int N1,
114118
int N2>
115119
SYCL_EXTERNAL SYCL_ESIMD_FUNCTION __ESIMD_DNS::vector_type_t<T, N>
@@ -135,7 +139,7 @@ SYCL_EXTERNAL SYCL_ESIMD_FUNCTION __ESIMD_DNS::vector_type_t<T, N>
135139
__esimd_dpasw2(__ESIMD_DNS::vector_type_t<T1, N1> src1,
136140
__ESIMD_DNS::vector_type_t<T2, N2> src2, int dpas_info);
137141

138-
#ifndef __SYCL_DEVICE_ONLY__
142+
#else // __SYCL_DEVICE_ONLY__
139143

140144
template <typename T0, typename T1, int SZ>
141145
__ESIMD_INTRIN __ESIMD_raw_vec_t(T0, SZ)
@@ -459,10 +463,10 @@ __esimd_dpas_bits_precision(__ESIMD_ENS::argument_type precisionType) {
459463

460464
template <__ESIMD_ENS::argument_type src1_precision,
461465
__ESIMD_ENS::argument_type src2_precision, int systolic_depth,
462-
int repeat_count, typename RT, typename T1, typename T2,
466+
int repeat_count, typename RT, typename T0, typename T1, typename T2,
463467
__ESIMD_NS::uint SZ, __ESIMD_NS::uint N1, __ESIMD_NS::uint N2>
464468
inline __ESIMD_DNS::vector_type_t<RT, SZ>
465-
__esimd_dpas_inner(const __ESIMD_DNS::vector_type_t<RT, SZ> *src0,
469+
__esimd_dpas_inner(const __ESIMD_DNS::vector_type_t<T0, SZ> *src0,
466470
const __ESIMD_DNS::vector_type_t<T1, N1> &src1,
467471
const __ESIMD_DNS::vector_type_t<T2, N2> &src2) {
468472
__ESIMD_DNS::vector_type_t<RT, SZ> retv;
@@ -647,7 +651,8 @@ __esimd_dpas_inner(const __ESIMD_DNS::vector_type_t<RT, SZ> *src0,
647651
static_cast<short>(reinterpret_cast<uint32_t &>(tmpUint) >> 16);
648652
} else
649653
retv[r * SIMDSize + n] =
650-
__ESIMD_EMU_DNS::satur<RT>::saturate(simdAcc[n], sat1);
654+
__ESIMD_EMU_DNS::satur<RT>::template saturate<TmpAccEl>(simdAcc[n],
655+
sat1);
651656
}
652657

653658
} // Repeat.
@@ -663,14 +668,9 @@ inline __ESIMD_DNS::vector_type_t<T, N>
663668
__esimd_dpas(__ESIMD_DNS::vector_type_t<T0, N> src0,
664669
__ESIMD_DNS::vector_type_t<T1, N1> src1,
665670
__ESIMD_DNS::vector_type_t<T2, N2> src2) {
666-
#ifdef __SYCL_EXPLICIT_SIMD_PLUGIN__
667671
return __esimd_dpas_inner<src1_precision, src2_precision, systolic_depth,
668-
repeat_count, T, T1, T2, N, N1, N2>(
672+
repeat_count, T, T0, T1, T2, N, N1, N2>(
669673
std::addressof(src0), src1, src2);
670-
#else // __SYCL_EXPLICIT_SIMD_PLUGIN__
671-
__ESIMD_UNSUPPORTED_ON_HOST;
672-
return __ESIMD_DNS::vector_type_t<T, N>();
673-
#endif // __SYCL_EXPLICIT_SIMD_PLUGIN__
674674
}
675675

676676
template <__ESIMD_ENS::argument_type src1_precision,
@@ -680,14 +680,9 @@ template <__ESIMD_ENS::argument_type src1_precision,
680680
inline __ESIMD_DNS::vector_type_t<T, N>
681681
__esimd_dpas2(__ESIMD_DNS::vector_type_t<T1, N1> src1,
682682
__ESIMD_DNS::vector_type_t<T2, N2> src2) {
683-
#ifdef __SYCL_EXPLICIT_SIMD_PLUGIN__
684683
return __esimd_dpas_inner<src1_precision, src2_precision, systolic_depth,
685-
repeat_count, T, T1, T2, N, N1, N2>(nullptr, src1,
684+
repeat_count, T, T, T1, T2, N, N1, N2>(nullptr, src1,
686685
src2);
687-
#else // __SYCL_EXPLICIT_SIMD_PLUGIN__
688-
__ESIMD_UNSUPPORTED_ON_HOST;
689-
return __ESIMD_DNS::vector_type_t<T, N>();
690-
#endif // __SYCL_EXPLICIT_SIMD_PLUGIN__
691686
}
692687

693688
template <__ESIMD_ENS::argument_type src1_precision,

0 commit comments

Comments
 (0)