Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions sycl/include/sycl/ext/intel/esimd/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ __ESIMD_API std::enable_if_t<
simd<T, N>>
gather(const T *p, OffsetSimdViewT byte_offsets, simd_mask<N / VS> mask,
PassThruSimdViewT pass_thru, PropertyListT props = {}) {
static_assert(N / VS ==
OffsetSimdViewT::getSizeX() * OffsetSimdViewT::getSizeY(),
"Size of pass_thru parameter must correspond to the size of "
"byte_offsets parameter.");
return gather<T, N, VS>(p, byte_offsets.read(), mask, pass_thru.read(),
props);
}
Expand Down Expand Up @@ -662,6 +666,10 @@ __ESIMD_API std::enable_if_t<
simd<T, N>>
gather(const T *p, OffsetSimdViewT byte_offsets, simd_mask<N / VS> mask,
simd<T, N> pass_thru, PropertyListT props = {}) {
static_assert(N / VS ==
OffsetSimdViewT::getSizeX() * OffsetSimdViewT::getSizeY(),
"Size of pass_thru parameter must correspond to the size of "
"byte_offsets parameter.");
return gather<T, N, VS>(p, byte_offsets.read(), mask, pass_thru, props);
}

Expand Down Expand Up @@ -1012,6 +1020,10 @@ __ESIMD_API std::enable_if_t<
ext::oneapi::experimental::is_property_list_v<PropertyListT>>
scatter(T *p, OffsetSimdViewT byte_offsets, ValuesSimdViewT vals,
simd_mask<N / VS> mask, PropertyListT props = {}) {
static_assert(N / VS ==
OffsetSimdViewT::getSizeX() * OffsetSimdViewT::getSizeY(),
"Size of vals parameter must correspond to the size of "
"byte_offsets parameter.");
scatter<T, N, VS>(p, byte_offsets.read(), vals.read(), mask, props);
}

Expand Down Expand Up @@ -1116,6 +1128,10 @@ __ESIMD_API std::enable_if_t<
ext::oneapi::experimental::is_property_list_v<PropertyListT>>
scatter(T *p, OffsetSimdViewT byte_offsets, simd<T, N> vals,
simd_mask<N / VS> mask, PropertyListT props = {}) {
static_assert(N / VS ==
OffsetSimdViewT::getSizeX() * OffsetSimdViewT::getSizeY(),
"Size of vals parameter must correspond to the size of "
"byte_offsets parameter.");
scatter<T, N, VS>(p, byte_offsets.read(), vals, mask, props);
}

Expand Down Expand Up @@ -1150,6 +1166,10 @@ __ESIMD_API std::enable_if_t<
ext::oneapi::experimental::is_property_list_v<PropertyListT>>
scatter(T *p, OffsetSimdViewT byte_offsets, simd<T, N> vals,
PropertyListT props = {}) {
static_assert(N / VS ==
OffsetSimdViewT::getSizeX() * OffsetSimdViewT::getSizeY(),
"Size of vals parameter must correspond to the size of "
"byte_offsets parameter.");
scatter<T, N, VS>(p, byte_offsets.read(), vals, props);
}

Expand Down Expand Up @@ -1221,8 +1241,11 @@ __ESIMD_API std::enable_if_t<
ext::oneapi::experimental::is_property_list_v<PropertyListT>>
scatter(T *p, OffsetSimdViewT byte_offsets, ValuesSimdViewT vals,
PropertyListT props = {}) {
simd_mask<N / VS> Mask = 1;
scatter<T, N, VS>(p, byte_offsets.read(), vals.read(), Mask, props);
static_assert(N / VS ==
OffsetSimdViewT::getSizeX() * OffsetSimdViewT::getSizeY(),
"Size of vals parameter must correspond to the size of "
"byte_offsets parameter.");
scatter<T, N, VS>(p, byte_offsets.read(), vals.read(), props);
}

/// A variation of \c scatter API with \c offsets represented as scalar.
Expand Down