Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 8f80cc5

Browse files
committed
Add tests to check the default value of RGBA mask in gather/scatter
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent fd822ce commit 8f80cc5

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

SYCL/ESIMD/acc_gather_scatter_rgba.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ struct Kernel {
4343
uint32_t global_offset = i * VL * STRIDE * NUM_RGBA_CHANNELS * sizeof(T);
4444

4545
simd<uint32_t, VL> byteOffsets(0, STRIDE * sizeof(T) * NUM_RGBA_CHANNELS);
46-
simd<T, VL *numChannels> v =
47-
gather_rgba<CH_MASK>(InAcc, byteOffsets, global_offset);
46+
simd<T, VL *numChannels> v;
47+
if constexpr (CH_MASK == rgba_channel_mask::ABGR)
48+
// Check that the default mask value is ABGR.
49+
v = gather_rgba(InAcc, byteOffsets, global_offset);
50+
else
51+
v = gather_rgba<CH_MASK>(InAcc, byteOffsets, global_offset);
4852
v += (int)i;
4953

5054
simd_mask<VL> pred = 1;

SYCL/ESIMD/usm_gather_scatter_rgba.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@ struct Kernel {
4040
uint32_t global_offset = i * VL * STRIDE * NUM_RGBA_CHANNELS;
4141

4242
simd<uint32_t, VL> byteOffsets(0, STRIDE * sizeof(T) * NUM_RGBA_CHANNELS);
43-
simd<T, VL *numChannels> v =
44-
gather_rgba<CH_MASK>(bufIn + global_offset, byteOffsets);
43+
simd<T, VL *numChannels> v;
44+
if constexpr (CH_MASK == rgba_channel_mask::ABGR)
45+
// Check that the default mask value is ABGR.
46+
v = gather_rgba(bufIn + global_offset, byteOffsets);
47+
else
48+
v = gather_rgba<CH_MASK>(bufIn + global_offset, byteOffsets);
4549
v += (int)i;
4650

4751
simd_mask<VL> pred = 1;
4852
pred[VL - MASKED_LANE_NUM_REV] = 0; // mask out the last lane
49-
scatter_rgba<CH_MASK>(bufOut + global_offset, byteOffsets, v, pred);
53+
if constexpr (CH_MASK == rgba_channel_mask::ABGR)
54+
// Check that the default mask value is ABGR.
55+
scatter_rgba(bufOut + global_offset, byteOffsets, v, pred);
56+
else
57+
scatter_rgba<CH_MASK>(bufOut + global_offset, byteOffsets, v, pred);
5058
}
5159
};
5260

0 commit comments

Comments
 (0)