From f0d325f56892730803eeeb817421c4d3c8e6ff68 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Thu, 8 Feb 2024 11:52:28 -0800 Subject: [PATCH] Finish off rewriting regression tests --- sycl/test-e2e/Regression/pf-wg-atomic64.cpp | 5 +++-- .../Regression/range-rounding-this-id.cpp | 18 +++++++++++------- .../Regression/reduction_64bit_atomic64.cpp | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/sycl/test-e2e/Regression/pf-wg-atomic64.cpp b/sycl/test-e2e/Regression/pf-wg-atomic64.cpp index f2985b5a33b1d..d7adc4e6c153b 100644 --- a/sycl/test-e2e/Regression/pf-wg-atomic64.cpp +++ b/sycl/test-e2e/Regression/pf-wg-atomic64.cpp @@ -10,11 +10,12 @@ using AtomicRefT = int main() { queue q; - auto *p = malloc_shared(1, q); + sycl::buffer p_buf{sycl::range{1}}; try { q.submit([&](sycl::handler &cgh) { + sycl::accessor p{p_buf, cgh}; cgh.parallel_for_work_group(range{1}, range{1}, [=](group<1>) { - AtomicRefT feature(*p); + AtomicRefT feature(p[0]); feature += 42; }); }).wait(); diff --git a/sycl/test-e2e/Regression/range-rounding-this-id.cpp b/sycl/test-e2e/Regression/range-rounding-this-id.cpp index 33fa41c60cc68..5e3baf2355084 100644 --- a/sycl/test-e2e/Regression/range-rounding-this-id.cpp +++ b/sycl/test-e2e/Regression/range-rounding-this-id.cpp @@ -30,13 +30,17 @@ template void test(queue &q) { id this_id; id ref_id; }; - std::vector> vec(range.size(), q); - auto *p = vec.data(); - q.parallel_for(range, [=](auto it) { - p[it.get_linear_id()] = {sycl::ext::oneapi::experimental::this_id(), - it.get_id()}; - }).wait_and_throw(); - + std::vector vec(range.size()); + { + sycl::buffer p_buf{vec}; + q.submit([&](sycl::handler &h) { + sycl::accessor p{p_buf, h}; + q.parallel_for(range, [=](auto it) { + p[it.get_linear_id()] = {sycl::ext::oneapi::experimental::this_id(), + it.get_id()}; + }); + }).wait_and_throw(); + } // p_buf goes out of scope here and writed back to vec for (const auto &[this_item, ref_item] : vec) { if (this_item != ref_item) { std::cout << "fail: " << this_item << " != " << ref_item << "\n"; diff --git a/sycl/test-e2e/Regression/reduction_64bit_atomic64.cpp b/sycl/test-e2e/Regression/reduction_64bit_atomic64.cpp index dc138d9b79da8..11affac9df7b9 100644 --- a/sycl/test-e2e/Regression/reduction_64bit_atomic64.cpp +++ b/sycl/test-e2e/Regression/reduction_64bit_atomic64.cpp @@ -2,7 +2,7 @@ // RUN: %{build} -o %t.out // // RUN: %{run} %t.out - +// REQUIRES: aspect-usm_shared_allocations // Tests that a previously known case for reduction doesn't cause a requirement // for atomic64. // TODO: When aspect requirements are added to testing, this test could be set