Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
fix comilpe on 2024.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjiweiswift committed Jul 24, 2024
1 parent 3de559e commit 8e7acd8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
5 changes: 5 additions & 0 deletions include/common/core/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,13 @@ enum class atomic_op : uint8_t {
/// xetla dpas argument typ
enum class argument_type : uint8_t {
Invalid = 0,
#if __INTEL_LLVM_COMPILER >= 20240200
U1 __SYCL_DEPRECATED("u1 is reserved/unsupported") = 1, // unsigned 1 bit
S1 __SYCL_DEPRECATED("s1 is reserved/unsupported") = 2, // signed 1 bit
#else
U1 = 1, // unsigned 1 bit
S1 = 2, // signed 1 bit
#endif
U2 = 3, // unsigned 2 bits
S2 = 4, // signed 2 bits
U4 = 5, // unsigned 4 bits
Expand Down
49 changes: 46 additions & 3 deletions include/common/core/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,21 @@ __XETLA_API void xetla_prefetch_global(
T* p,
xetla_vector<uint32_t, N / VS> byte_offsets,
xetla_mask<N / VS> mask = 1) {
#if __INTEL_LLVM_COMPILER >= 20240200
__ESIMD_NS::properties props{
__ESIMD_NS::cache_hint_L1<gpu::xetla::detail::get_cache_hint(L1H)>,
__ESIMD_NS::cache_hint_L2<gpu::xetla::detail::get_cache_hint(L2H)>};
__ESIMD_NS::prefetch<T, N, VS>(p, byte_offsets, mask, props);
#else
constexpr data_size DS = data_size::default_size;
__ESIMD_ENS::lsc_prefetch<
T,
VS,
gpu::xetla::detail::get_data_size(DS),
gpu::xetla::detail::get_cache_hint(L1H),
gpu::xetla::detail::get_cache_hint(L2H),
N / VS>(p, byte_offsets, mask);
#endif
}

/// template <typename T, int VS = 1, typename OffsetT,
Expand All @@ -329,11 +340,22 @@ template <
int VS = 1,
cache_hint L1H = cache_hint::cached,
cache_hint L2H = cache_hint::cached>
__XETLA_API void xetla_prefetch_global(T* p, uint64_t offset = 0) {
__XETLA_API void xetla_prefetch_global(T* p, uint64_t byte_offset = 0) {
#if __INTEL_LLVM_COMPILER >= 20240200
__ESIMD_NS::properties props{
__ESIMD_NS::cache_hint_L1<gpu::xetla::detail::get_cache_hint(L1H)>,
__ESIMD_NS::cache_hint_L2<gpu::xetla::detail::get_cache_hint(L2H)>};
__ESIMD_NS::prefetch<T, VS>(p, offset, props);
__ESIMD_NS::prefetch<T, VS>(p, byte_offset, props);
#else
constexpr data_size DS = data_size::default_size;
__ESIMD_ENS::lsc_prefetch<
T,
VS,
gpu::xetla::detail::get_data_size(DS),
gpu::xetla::detail::get_cache_hint(L1H),
gpu::xetla::detail::get_cache_hint(L2H),
1>(p, (byte_offset / sizeof(T)));
#endif
}

/// simd<T, N> block_load(const T* ptr, size_t byte_offset,
Expand Down Expand Up @@ -523,12 +545,22 @@ __XETLA_API xetla_vector<T, N> xetla_load_global(
T* p,
xetla_vector<OffsetT, N / VS> byte_offsets,
xetla_mask<N / VS> mask = 1) {
#if __INTEL_LLVM_COMPILER >= 20240200
__ESIMD_NS::properties props{
__ESIMD_NS::cache_hint_L1<gpu::xetla::detail::get_cache_hint(L1H)>,
__ESIMD_NS::cache_hint_L2<gpu::xetla::detail::get_cache_hint(L2H)>,
__ESIMD_NS::alignment<alignment>};

return __ESIMD_NS::gather<T, N, VS>(p, byte_offsets, mask, props);
#else
constexpr data_size DS = data_size::default_size;
return __ESIMD_ENS::lsc_gather<
T,
VS,
gpu::xetla::detail::get_data_size(DS),
gpu::xetla::detail::get_cache_hint(L1H),
gpu::xetla::detail::get_cache_hint(L2H),
N / VS>(p, byte_offsets, mask);
#endif
}

/// template <typename T, int N, int VS = 1, typename OffsetT,
Expand Down Expand Up @@ -590,11 +622,22 @@ __XETLA_API void xetla_store_global(
xetla_vector<OffsetT, N / VS> byte_offsets,
xetla_vector<T, N> vals,
xetla_mask<N / VS> mask = 1) {
#if __INTEL_LLVM_COMPILER >= 20240200
__ESIMD_NS::properties props{
__ESIMD_NS::cache_hint_L1<gpu::xetla::detail::get_cache_hint(L1H)>,
__ESIMD_NS::cache_hint_L2<gpu::xetla::detail::get_cache_hint(L2H)>,
__ESIMD_NS::alignment<alignment>};
__ESIMD_NS::scatter<T, N, VS>(p, byte_offsets, vals, mask, props);
#else
constexpr data_size DS = data_size::default_size;
__ESIMD_ENS::lsc_scatter<
T,
VS,
gpu::xetla::detail::get_data_size(DS),
gpu::xetla::detail::get_cache_hint(L1H),
gpu::xetla::detail::get_cache_hint(L2H),
N / VS>((T*)p, byte_offsets, vals, mask);
#endif
}

/// void block_store(T* ptr, size_t byte_offset, // (usm-bs-2)
Expand Down

0 comments on commit 8e7acd8

Please sign in to comment.