Skip to content

Commit c3b1981

Browse files
committed
Address code-reviewer's comment - fix computation of ops per channel
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent 501772a commit c3b1981

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

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

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -448,27 +448,15 @@ __esimd_dpas_inner(const __ESIMD_DNS::vector_type_t<T0, SZ> *src0,
448448
__ESIMD_EMU_DNS::SetSatur<T2,
449449
__ESIMD_EMU_DNS::is_inttype<RT>::value>::set();
450450

451-
constexpr __ESIMD_NS::uint ops_per_chan =
452-
src1_precision == __ESIMD_ENS::argument_type::TF32 ||
453-
src2_precision == __ESIMD_ENS::argument_type::TF32
454-
? 1
455-
: src1_precision == __ESIMD_ENS::argument_type::BF16 ||
456-
src1_precision == __ESIMD_ENS::argument_type::FP16 ||
457-
src2_precision == __ESIMD_ENS::argument_type::BF16 ||
458-
src2_precision == __ESIMD_ENS::argument_type::FP16
459-
? 2
460-
: src1_precision == __ESIMD_ENS::argument_type::S8 ||
461-
src1_precision == __ESIMD_ENS::argument_type::U8 ||
462-
src2_precision == __ESIMD_ENS::argument_type::S8 ||
463-
src2_precision == __ESIMD_ENS::argument_type::U8
464-
? 4
465-
: 8;
466-
467451
__ESIMD_NS::uint V = 0, U = 0, k = 0, temp = 0, src1_ops_per_dword = 0, p = 0;
468452

469453
constexpr auto src1_el_bits = __esimd_dpas_bits_precision(src1_precision);
470454
constexpr auto src2_el_bits = __esimd_dpas_bits_precision(src2_precision);
471455

456+
constexpr auto max_el_bits = std::max(src1_el_bits, src2_el_bits);
457+
constexpr __ESIMD_NS::uint ops_per_chan =
458+
std::min(32 / max_el_bits, static_cast<__ESIMD_NS::uint>(8));
459+
472460
uint32_t src1_signed =
473461
src1_precision == __ESIMD_ENS::argument_type::S2 ||
474462
src1_precision == __ESIMD_ENS::argument_type::S4 ||

0 commit comments

Comments
 (0)