Skip to content

Commit

Permalink
Only running the CKF test on NVIDIA and AMD backends.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
krasznaa committed Jan 7, 2025
1 parent b174baa commit 65fd176
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/sycl/test_ckf_toy_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
Expand Down
9 changes: 9 additions & 0 deletions tests/sycl/test_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 37 additions & 0 deletions tests/sycl/test_queue.sycl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 65fd176

Please sign in to comment.