Skip to content

[ESIMD] Use BGRA as default value for mask in gather/scatter #6141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2022
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
12 changes: 8 additions & 4 deletions sycl/include/sycl/ext/intel/esimd/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ __ESIMD_API void scalar_store(AccessorTy acc, uint32_t offset, T val) {
/// undefined.
/// @return Read data - up to N*4 values of type \c Tx.
///
template <rgba_channel_mask RGBAMask, typename T, int N>
template <rgba_channel_mask RGBAMask = rgba_channel_mask::ABGR, typename T,
int N>
__ESIMD_API std::enable_if_t<(N == 8 || N == 16 || N == 32) && sizeof(T) == 4,
simd<T, N * get_num_channels_enabled(RGBAMask)>>
gather_rgba(const T *p, simd<uint32_t, N> offsets, simd_mask<N> mask = 1) {
Expand Down Expand Up @@ -568,7 +569,8 @@ template <rgba_channel_mask M> static void validate_rgba_write_channel_mask() {
/// predicate are not accessed. Their values in the resulting vector are
/// undefined.
///
template <rgba_channel_mask RGBAMask, typename T, int N>
template <rgba_channel_mask RGBAMask = rgba_channel_mask::ABGR, typename T,
int N>
__ESIMD_API std::enable_if_t<(N == 8 || N == 16 || N == 32) && sizeof(T) == 4>
scatter_rgba(T *p, simd<uint32_t, N> offsets,
simd<T, N * get_num_channels_enabled(RGBAMask)> vals,
Expand Down Expand Up @@ -613,7 +615,8 @@ __ESIMD_API std::
/// undefined.
/// @return Read data - up to N*4 values of type \c Tx.
///
template <rgba_channel_mask RGBAMask, typename AccessorT, int N,
template <rgba_channel_mask RGBAMask = rgba_channel_mask::ABGR,
typename AccessorT, int N,
typename T = typename AccessorT::value_type>
__ESIMD_API std::enable_if_t<((N == 8 || N == 16 || N == 32) &&
sizeof(T) == 4 && !std::is_pointer_v<AccessorT>),
Expand Down Expand Up @@ -642,7 +645,8 @@ gather_rgba(AccessorT acc, simd<uint32_t, N> offsets,
/// @param global_offset Byte offset of the pixels relative to the base pointer.
/// @param mask Operation mask. All-1 by default.
///
template <rgba_channel_mask RGBAMask, typename AccessorT, int N,
template <rgba_channel_mask RGBAMask = rgba_channel_mask::ABGR,
typename AccessorT, int N,
typename T = typename AccessorT::value_type>
__ESIMD_API std::enable_if_t<(N == 8 || N == 16 || N == 32) && sizeof(T) == 4 &&
!std::is_pointer_v<AccessorT>>
Expand Down