Skip to content

Commit 96d744f

Browse files
authored
[ESIMD][NFC] Rework L1/L2 cache hints passing across internal funcs(p2)(#12935)
gather_impl(), scatter_impl(), atomic_update_impl(), prefetch_impl() now accept a list of properties that may include L1/L2 cache-hints instead of L1/L2 template parameters. As part of the clean-up this patch also: * removes __esimd_lsc_load_stateless declaration and lowering to GenX (it is replaced by __esimd_lsc_load_merge_stateless) * all uses of check_cache_hint() are replaced by check_cache_hints() accepting a list of properties * removed check_lsc_cache_hint() Signed-off-by: Klochkov, Vyacheslav N <vyacheslav.n.klochkov@intel.com>
1 parent c00305b commit 96d744f

File tree

8 files changed

+249
-380
lines changed

8 files changed

+249
-380
lines changed

llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,6 @@ class ESIMDIntrinDescTable {
512512
{"lsc.load.merge.bti",
513513
{ai1(0), c8(lsc_subopcode::load), t8(1), t8(2), t16(3), t32(4), t8(5),
514514
t8(6), t8(7), c8(0), a(1), aSI(2), a(3)}}},
515-
{"lsc_load_stateless",
516-
{"lsc.load.stateless",
517-
{ai1(0), c8(lsc_subopcode::load), t8(1), t8(2), t16(3), t32(4), t8(5),
518-
t8(6), t8(7), c8(0), a(1), c32(0)}}},
519515
{"lsc_load_merge_stateless",
520516
{"lsc.load.merge.stateless",
521517
{ai1(0), c8(lsc_subopcode::load), t8(1), t8(2), t16(3), t32(4), t8(5),

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

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,25 @@ constexpr bool are_both(cache_hint First, cache_hint Second, cache_hint Val) {
551551

552552
enum class cache_action { prefetch, load, store, atomic };
553553

554-
template <cache_action Action, cache_hint L1Hint, cache_hint L2Hint>
555-
void check_cache_hint() {
556-
constexpr auto L1H = cache_hint_wrap<L1Hint>{};
557-
constexpr auto L2H = cache_hint_wrap<L2Hint>{};
554+
template <typename PropertyListT> constexpr bool has_cache_hints() {
555+
constexpr cache_hint L1H =
556+
getPropertyValue<PropertyListT, cache_hint_L1_key>(cache_hint::none);
557+
constexpr cache_hint L2H =
558+
getPropertyValue<PropertyListT, cache_hint_L2_key>(cache_hint::none);
559+
return L1H != cache_hint::none || L2H != cache_hint::none;
560+
}
561+
562+
// Currently, this is just a wrapper around 'check_cache_hint' function.
563+
// It accepts the compile-time properties that may include cache-hints
564+
// to be verified.
565+
template <cache_action Action, typename PropertyListT>
566+
void check_cache_hints() {
567+
constexpr auto L1H =
568+
cache_hint_wrap<getPropertyValue<PropertyListT, cache_hint_L1_key>(
569+
cache_hint::none)>{};
570+
constexpr auto L2H =
571+
cache_hint_wrap<getPropertyValue<PropertyListT, cache_hint_L2_key>(
572+
cache_hint::none)>{};
558573
if constexpr (Action == cache_action::prefetch) {
559574
static_assert(
560575
L1H.template is_one_of<cache_hint::cached, cache_hint::uncached,
@@ -590,26 +605,6 @@ void check_cache_hint() {
590605
}
591606
}
592607

593-
template <typename PropertyListT> constexpr bool has_cache_hints() {
594-
constexpr cache_hint L1H =
595-
getPropertyValue<PropertyListT, cache_hint_L1_key>(cache_hint::none);
596-
constexpr cache_hint L2H =
597-
getPropertyValue<PropertyListT, cache_hint_L2_key>(cache_hint::none);
598-
return L1H != cache_hint::none || L2H != cache_hint::none;
599-
}
600-
601-
// Currently, this is just a wrapper around 'check_cache_hint' function.
602-
// It accepts the compile-time properties that may include cache-hints
603-
// to be verified.
604-
template <cache_action Action, typename PropertyListT>
605-
void check_cache_hints() {
606-
constexpr cache_hint L1H =
607-
getPropertyValue<PropertyListT, cache_hint_L1_key>(cache_hint::none);
608-
constexpr cache_hint L2H =
609-
getPropertyValue<PropertyListT, cache_hint_L2_key>(cache_hint::none);
610-
check_cache_hint<Action, L1H, L2H>();
611-
}
612-
613608
constexpr lsc_data_size expand_data_size(lsc_data_size DS) {
614609
if (DS == lsc_data_size::u8)
615610
return lsc_data_size::u8u32;

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -831,33 +831,6 @@ __esimd_lsc_load_merge_stateless(
831831
__ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()> pass_thru = 0)
832832
__ESIMD_INTRIN_END;
833833

834-
/// USM pointer gather.
835-
/// Supported platforms: DG2, PVC
836-
///
837-
/// Collects elements located at specified address and returns them
838-
/// as a single \ref simd object.
839-
///
840-
/// @tparam Ty is element type.
841-
/// @tparam L1H is L1 cache hint.
842-
/// @tparam L2H is L2 cache hint.
843-
/// @tparam AddressScale is the address scale.
844-
/// @tparam ImmOffset is the immediate offset added to each address.
845-
/// @tparam DS is the data size.
846-
/// @tparam VS is the number of elements to load per address.
847-
/// @tparam Transposed indicates if the data is transposed during the transfer.
848-
/// @tparam N is the SIMD size of operation (the number of addresses to access)
849-
/// @param pred is predicates.
850-
/// @param addrs is the load addresses.
851-
/// @return is a vector of type T and N * to_int<VS>()
852-
template <typename Ty, __ESIMD_NS::cache_hint L1H, __ESIMD_NS::cache_hint L2H,
853-
uint16_t AddressScale, int ImmOffset, __ESIMD_DNS::lsc_data_size DS,
854-
__ESIMD_DNS::lsc_vector_size VS,
855-
__ESIMD_DNS::lsc_data_order Transposed, int N>
856-
__ESIMD_INTRIN __ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()>
857-
__esimd_lsc_load_stateless(__ESIMD_DNS::simd_mask_storage_t<N> pred,
858-
__ESIMD_DNS::vector_type_t<uintptr_t, N> addrs)
859-
__ESIMD_INTRIN_END;
860-
861834
/// USM pointer scatter.
862835
/// Supported platforms: DG2, PVC
863836
///

0 commit comments

Comments
 (0)