From 125c771579e311ef2188a2b06ef498a731667b8a Mon Sep 17 00:00:00 2001 From: mmoadeli Date: Thu, 6 Jun 2024 14:22:02 +0100 Subject: [PATCH] [SYCL][TEST-E2E] Refactor the test to address Windows not printing the exception message (#14055) - C++ thrown exception message not shown when running from Windows terminal. - The patch fixes [cuda-max-local-mem-size.cpp](https://github.com/intel/llvm/blob/sycl/sycl/test-e2e/Plugin/cuda-max-local-mem-size.cpp) test failure. --- .../Plugin/cuda-max-local-mem-size.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/sycl/test-e2e/Plugin/cuda-max-local-mem-size.cpp b/sycl/test-e2e/Plugin/cuda-max-local-mem-size.cpp index 5e31a461379ee..aefbbd99a685f 100644 --- a/sycl/test-e2e/Plugin/cuda-max-local-mem-size.cpp +++ b/sycl/test-e2e/Plugin/cuda-max-local-mem-size.cpp @@ -1,8 +1,8 @@ // REQUIRES: cuda // RUN: %{build} -o %t.out -// RUN: not %{run} SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE=0 %t.out 2>&1 | FileCheck --check-prefixes=CHECK-ZERO %s -// RUN: not %{run} SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE=100000000 %t.out 2>&1 | FileCheck --check-prefixes=CHECK-OVERALLOCATE %s +// RUN: %{run} SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE=0 %t.out 2>&1 | FileCheck --check-prefixes=CHECK-ZERO %s +// RUN: %{run} SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE=100000000 %t.out 2>&1 | FileCheck --check-prefixes=CHECK-OVERALLOCATE %s //==---------------------- cuda-max-local-mem-size.cpp --------------------===// //==--- SYCL test to test SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE env var----------===// @@ -16,15 +16,19 @@ #include int main() { - sycl::queue Q{}; - auto LocalSize = - Q.get_device().get_info(); - Q.submit([&](sycl::handler &cgh) { - auto LocalAcc = sycl::local_accessor(LocalSize + 1, cgh); - cgh.parallel_for(sycl::nd_range<1>{32, 32}, [=](sycl::nd_item<1> idx) { - LocalAcc[idx.get_global_linear_id()] *= 2; - }); - }).wait(); + try { + sycl::queue Q{}; + auto LocalSize = + Q.get_device().get_info(); + Q.submit([&](sycl::handler &cgh) { + auto LocalAcc = sycl::local_accessor(LocalSize + 1, cgh); + cgh.parallel_for(sycl::nd_range<1>{32, 32}, [=](sycl::nd_item<1> idx) { + LocalAcc[idx.get_global_linear_id()] *= 2; + }); + }).wait(); + } catch (const std::exception &e) { + std::puts(e.what()); + } // CHECK-ZERO: Local memory for kernel exceeds the amount requested using SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE // CHECK-OVERALLOCATE: Excessive allocation of local memory on the device }