From 65fd176953ff36788a5deea357d6f97ec0a791ac Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay Date: Tue, 7 Jan 2025 11:34:29 +0100 Subject: [PATCH] Only running the CKF test on NVIDIA and AMD backends. Taught traccc::sycl::test_queue how to figure out what sort of a queue it is. So that the CKF test could be skipped on OpenCL and Level-0 backends as long as those are still not working. --- tests/sycl/test_ckf_toy_detector.cpp | 5 ++++ tests/sycl/test_queue.hpp | 9 +++++++ tests/sycl/test_queue.sycl | 37 ++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/tests/sycl/test_ckf_toy_detector.cpp b/tests/sycl/test_ckf_toy_detector.cpp index 3aeace95f..f3dea30b9 100644 --- a/tests/sycl/test_ckf_toy_detector.cpp +++ b/tests/sycl/test_ckf_toy_detector.cpp @@ -58,6 +58,11 @@ TEST_P(CkfToyDetectorTests, Run) { // SYCL queue. sycl::test_queue queue; + // Only run this test on NVIDIA and AMD backends. + if (!(queue.is_cuda() || queue.is_hip())) { + GTEST_SKIP(); + } + // Memory resources used by the application. vecmem::host_memory_resource host_mr; vecmem::sycl::device_memory_resource device_mr{queue.queue().queue()}; diff --git a/tests/sycl/test_queue.hpp b/tests/sycl/test_queue.hpp index 2a4483f26..5b19824a3 100644 --- a/tests/sycl/test_queue.hpp +++ b/tests/sycl/test_queue.hpp @@ -28,6 +28,15 @@ class test_queue { /// Get the SYCL queue queue_wrapper queue(); + /// Check if it's an OpenCL queue + bool is_opencl() const; + /// Check if it's a Level-0 queue + bool is_level0() const; + /// Check if it's a CUDA queue + bool is_cuda() const; + /// Check if it's a HIP queue + bool is_hip() const; + private: /// Internal data type struct impl; diff --git a/tests/sycl/test_queue.sycl b/tests/sycl/test_queue.sycl index 39696db33..7499b0005 100644 --- a/tests/sycl/test_queue.sycl +++ b/tests/sycl/test_queue.sycl @@ -36,4 +36,41 @@ queue_wrapper test_queue::queue() { return {&(m_impl->m_queue)}; } +bool test_queue::is_opencl() const { + +#if SYCL_BACKEND_OPENCL + return (m_impl->m_queue.get_backend() == ::sycl::backend::opencl); +#else + return false; +#endif +} + +bool test_queue::is_level0() const { + +#if SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO + return (m_impl->m_queue.get_backend() == + ::sycl::backend::ext_oneapi_level_zero); +#else + return false; +#endif +} + +bool test_queue::is_cuda() const { + +#if SYCL_EXT_ONEAPI_BACKEND_CUDA + return (m_impl->m_queue.get_backend() == ::sycl::backend::ext_oneapi_cuda); +#else + return false; +#endif +} + +bool test_queue::is_hip() const { + +#if SYCL_EXT_ONEAPI_BACKEND_HIP + return (m_impl->m_queue.get_backend() == ::sycl::backend::ext_oneapi_hip); +#else + return false; +#endif +} + } // namespace traccc::sycl