From f6b3d7d84d49a82309da266e62c72f643d6b8874 Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Tue, 14 Mar 2023 06:40:02 -0700 Subject: [PATCH 1/2] [SYCL] Reenable reduction tests and reinforce coverage This commit reenables a selection of reduction tests that were only failing on certain systems. The failure was caused by reductions working outside its work boundaries and was passing due to the values read coincidentally being the same as the identity. To avoid this in the future, this commit also adds test-cases with a different actual identity. Signed-off-by: Larsen, Steffen --- SYCL/Reduction/reduction_range_3d_rw.cpp | 23 +++++++++++++++++++++-- SYCL/Reduction/reduction_utils.hpp | 4 ++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/SYCL/Reduction/reduction_range_3d_rw.cpp b/SYCL/Reduction/reduction_range_3d_rw.cpp index 522669e310..0115c7a279 100644 --- a/SYCL/Reduction/reduction_range_3d_rw.cpp +++ b/SYCL/Reduction/reduction_range_3d_rw.cpp @@ -67,14 +67,12 @@ int main() { tests(Q, 99, PlusWithoutIdentity{}, range<3>{2, 2, 2}); tests(Q, 99, PlusWithoutIdentity{}, range<3>{2, 3, 4}); - /* Temporarily disabled tests(Q, 99, PlusWithoutIdentity{}, range<3>{1, 1, MaxWGSize + 1}); tests(Q, 99, PlusWithoutIdentity{}, range<3>{1, MaxWGSize + 1, 1}); tests(Q, 99, PlusWithoutIdentity{}, range<3>{MaxWGSize + 1, 1, 1}); - */ tests(Q, 99, PlusWithoutIdentity{}, range<3>{2, 5, MaxWGSize * 2}); @@ -83,6 +81,27 @@ int main() { tests(Q, 99, PlusWithoutIdentity{}, range<3>{MaxWGSize * 3, 8, 4}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{1, 1, 1}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{2, 2, 2}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{2, 3, 4}); + + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{1, 1, MaxWGSize + 1}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{1, MaxWGSize + 1, 1}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{MaxWGSize + 1, 1, 1}); + + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{2, 5, MaxWGSize * 2}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{3, MaxWGSize * 3, 2}); + tests(Q, 99, MultipliesWithoutIdentity{}, + range<3>{MaxWGSize * 3, 8, 4}); + printFinalStatus(NumErrors); return NumErrors; } diff --git a/SYCL/Reduction/reduction_utils.hpp b/SYCL/Reduction/reduction_utils.hpp index d5875fbbba..78a097bba9 100644 --- a/SYCL/Reduction/reduction_utils.hpp +++ b/SYCL/Reduction/reduction_utils.hpp @@ -141,6 +141,10 @@ template struct PlusWithoutIdentity { T operator()(const T &A, const T &B) const { return A + B; } }; +template struct MultipliesWithoutIdentity { + T operator()(const T &A, const T &B) const { return A * B; } +}; + template T getMinimumFPValue() { return std::numeric_limits::has_infinity ? static_cast(-std::numeric_limits::infinity()) From c05c6c262a53822880634199e0d75a31071065aa Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Tue, 14 Mar 2023 09:30:10 -0700 Subject: [PATCH 2/2] Fix names Signed-off-by: Larsen, Steffen --- SYCL/Reduction/reduction_range_3d_rw.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SYCL/Reduction/reduction_range_3d_rw.cpp b/SYCL/Reduction/reduction_range_3d_rw.cpp index 0115c7a279..f29c828bea 100644 --- a/SYCL/Reduction/reduction_range_3d_rw.cpp +++ b/SYCL/Reduction/reduction_range_3d_rw.cpp @@ -81,25 +81,25 @@ int main() { tests(Q, 99, PlusWithoutIdentity{}, range<3>{MaxWGSize * 3, 8, 4}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{1, 1, 1}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{2, 2, 2}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{2, 3, 4}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{1, 1, MaxWGSize + 1}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{1, MaxWGSize + 1, 1}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{MaxWGSize + 1, 1, 1}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{2, 5, MaxWGSize * 2}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{3, MaxWGSize * 3, 2}); - tests(Q, 99, MultipliesWithoutIdentity{}, + tests(Q, 99, MultipliesWithoutIdentity{}, range<3>{MaxWGSize * 3, 8, 4}); printFinalStatus(NumErrors);