Skip to content

Commit c407665

Browse files
[SYCL][E2E] Fix shuffle_marray XOR permute shuffle for uneven SG (#15283)
This commit fixes a case for XOR permute shuffles in sycl/test-e2e/GroupAlgorithm/shuffle_marray.cpp when sub-group sizes are uneven. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 62793b7 commit c407665

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sycl/test-e2e/GroupAlgorithm/shuffle_marray.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ int main() {
107107
}
108108

109109
std::cout << "Checking results for shuffle-xor" << std::endl;
110-
for (size_t LID = 0; LID < SubGroupSize; ++LID) {
110+
// XOR permutating shuffles shuffle in pairs, but in the cases where the
111+
// sub-group size is uneven the last element will not have a partner and as
112+
// such its result is UB.
113+
unsigned EvenClampedSubGroupSize = SubGroupSize - (SubGroupSize % 2);
114+
for (size_t LID = 0; LID < EvenClampedSubGroupSize; ++LID) {
111115
size_t GID = GIDOffset + LID;
112116
MarrayT Expected{0};
113117
for (int I = 0; I < NumElems; ++I)

0 commit comments

Comments
 (0)