diff --git a/sycl/test-e2e/Reduction/reduction_internal.cpp b/sycl/test-e2e/Reduction/reduction_internal.hpp similarity index 82% rename from sycl/test-e2e/Reduction/reduction_internal.cpp rename to sycl/test-e2e/Reduction/reduction_internal.hpp index e45037a2ef569..ac2590654b468 100644 --- a/sycl/test-e2e/Reduction/reduction_internal.cpp +++ b/sycl/test-e2e/Reduction/reduction_internal.hpp @@ -1,6 +1,3 @@ -// RUN: %{build} -o %t.out -// RUN: %{run} %t.out - #include #include @@ -120,27 +117,9 @@ void testAllStrategies(RedStorage &Storage, RangeTy Range) { }); } -int main() { - queue q; - RedStorage Storage(q); - - auto TestRange = [&](auto Range) { - testAllStrategies(Storage, Range); - testAllStrategies(Storage, Range); - testAllStrategies(Storage, Range); - testAllStrategies(Storage, Range); - }; - - TestRange(range<1>{42}); - TestRange(range<2>{8, 8}); - TestRange(range<3>{7, 7, 5}); - TestRange(nd_range<1>{range<1>{7}, range<1>{7}}); - TestRange(nd_range<1>{range<1>{3 * 3}, range<1>{3}}); - - // TODO: Strategies historically adopted from sycl::range implementation only - // support 1-Dim case. - // - // TestRange(nd_range<2>{range<2>{7, 3}, range<2> {7, 3}}); - // TestRange(nd_range<2>{range<2>{14, 9}, range<2> {7, 3}}); - return 0; +template void testRange(RedStorage &Storage, RangeTy Range) { + testAllStrategies(Storage, Range); + testAllStrategies(Storage, Range); + testAllStrategies(Storage, Range); + testAllStrategies(Storage, Range); } diff --git a/sycl/test-e2e/Reduction/reduction_internal_nd_range_1dim.cpp b/sycl/test-e2e/Reduction/reduction_internal_nd_range_1dim.cpp new file mode 100644 index 0000000000000..bebbfd13848ae --- /dev/null +++ b/sycl/test-e2e/Reduction/reduction_internal_nd_range_1dim.cpp @@ -0,0 +1,20 @@ +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out + +#include "reduction_internal.hpp" + +int main() { + queue q; + RedStorage Storage(q); + + testRange(Storage, nd_range<1>{range<1>{7}, range<1>{7}}); + testRange(Storage, nd_range<1>{range<1>{3 * 3}, range<1>{3}}); + + // TODO: Strategies historically adopted from sycl::range implementation only + // support 1-Dim case. + // + // testRange(Storage, nd_range<2>{range<2>{7, 3}, range<2> {7, 3}}); + // testRange(Storage, nd_range<2>{range<2>{14, 9}, range<2> {7, 3}}); + + return 0; +} diff --git a/sycl/test-e2e/Reduction/reduction_internal_range_1dim.cpp b/sycl/test-e2e/Reduction/reduction_internal_range_1dim.cpp new file mode 100644 index 0000000000000..832798f656a50 --- /dev/null +++ b/sycl/test-e2e/Reduction/reduction_internal_range_1dim.cpp @@ -0,0 +1,13 @@ +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out + +#include "reduction_internal.hpp" + +int main() { + queue q; + RedStorage Storage(q); + + testRange(Storage, range<1>{42}); + + return 0; +} diff --git a/sycl/test-e2e/Reduction/reduction_internal_range_2dim.cpp b/sycl/test-e2e/Reduction/reduction_internal_range_2dim.cpp new file mode 100644 index 0000000000000..935594aacbe09 --- /dev/null +++ b/sycl/test-e2e/Reduction/reduction_internal_range_2dim.cpp @@ -0,0 +1,13 @@ +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out + +#include "reduction_internal.hpp" + +int main() { + queue q; + RedStorage Storage(q); + + testRange(Storage, range<2>{8, 8}); + + return 0; +} diff --git a/sycl/test-e2e/Reduction/reduction_internal_range_3dim.cpp b/sycl/test-e2e/Reduction/reduction_internal_range_3dim.cpp new file mode 100644 index 0000000000000..0bd5ba9bbfaa1 --- /dev/null +++ b/sycl/test-e2e/Reduction/reduction_internal_range_3dim.cpp @@ -0,0 +1,13 @@ +// RUN: %{build} -o %t.out +// RUN: %{run} %t.out + +#include "reduction_internal.hpp" + +int main() { + queue q; + RedStorage Storage(q); + + testRange(Storage, range<3>{7, 7, 5}); + + return 0; +}