From 9fa44eab010ff42041154fb8cc6ce904947ecafd Mon Sep 17 00:00:00 2001 From: Artur Gainullin Date: Mon, 19 Oct 2026 15:47:28 -0700 Subject: [PATCH] [SYCL][E2E] Match big-data reduction work group sizing to runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test exercises reductions with large element types. Match the runtime’s reduGetMaxWGSize() calculation by applying the device cap before conditionally halving, so the chosen work-group size stays within the runtime limit. Assisted-By: OpenCode, GPT-6.1-Sol --- .../test-e2e/Reduction/reduction_big_data.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sycl/test-e2e/Reduction/reduction_big_data.cpp b/sycl/test-e2e/Reduction/reduction_big_data.cpp index f317bea555d6c..399fed980ae4c 100644 --- a/sycl/test-e2e/Reduction/reduction_big_data.cpp +++ b/sycl/test-e2e/Reduction/reduction_big_data.cpp @@ -20,7 +20,11 @@ size_t getSafeMaxWGSize(size_t MaxWGSize, size_t MemSize, size_t OneElemSize) { size_t MaxNumElems = MemSize / OneElemSize; if ((MaxNumElems & (MaxNumElems - 1)) != 0) MaxNumElems--; // Need 1 additional element in mem if not pow of 2 - return std::min(MaxNumElems / 2, MaxWGSize); + // Match the runtime's reduGetMaxWGSize() for memory-limited reductions. + size_t WGSize = std::min(MaxNumElems, MaxWGSize); + if (WGSize >= 4 && MaxNumElems < MaxWGSize * 2) + WGSize /= 2; + return WGSize; } template @@ -66,15 +70,16 @@ int test(queue &Q, T Identity) { return checkResults(Q, BOp, NDRange, ComputedOut, CorrectOut); } -template struct BigCustomVec : public CustomVec { +template +struct BigCustomVec : public CustomVec { BigCustomVec() : CustomVec() {} BigCustomVec(T X, T Y) : CustomVec(X, Y) {} BigCustomVec(T V) : CustomVec(V) {} - unsigned char OtherData[512 - sizeof(CustomVec)]; + unsigned char OtherData[Size - sizeof(CustomVec)]; }; -template struct BigCustomVecPlus { - using CV = BigCustomVec; +template struct BigCustomVecPlus { + using CV = BigCustomVec; CV operator()(const CV &A, const CV &B) const { return CV(A.X + B.X, A.Y + B.Y); } @@ -89,6 +94,10 @@ int main() { using BCV = BigCustomVec; NumErrors += test>(Q, BCV(0)); + using CV96 = BigCustomVec; + NumErrors += + test>(Q, CV96(0)); + printFinalStatus(NumErrors); return NumErrors; }