From c6b7ea5a0b8c744d7756c1e93aa370eb3158768d Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Wed, 25 Oct 2023 12:36:21 +0100 Subject: [PATCH] Improve support detection for USM copy tests Different USM allocation types are locked behind different aspects. The USM tests account for this by skipping the test if the aspect for the destination allocation is not present. However, two tests (copy and memcpy) have an allocation for the source memory, which is not checked. This change adds a "supports_device" method to the USM tests that takes a queue and returns whether the test supports that queue. For the copy and memcpy tests, this checks that the source allocation is supported by the device. All other tests just return true. --- tests/usm/usm_api.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/usm/usm_api.h b/tests/usm/usm_api.h index 1a00e3a62..13bfd663d 100644 --- a/tests/usm/usm_api.h +++ b/tests/usm/usm_api.h @@ -251,6 +251,13 @@ class copy : public copyGeneric { */ static constexpr bool has_non_usm_support() { return true; } + /** @brief This test only works on devices with `sourceAllocation` support + */ + static bool supports_device(sycl_cts::util::logger& log, + const sycl::queue& queue) { + return check_device_support(log, queue); + } + template static std::string description() { return "copy from " + get_allocation_decription() + @@ -276,6 +283,13 @@ class memcpy : public copyGeneric { */ static constexpr bool has_non_usm_support() { return true; } + /** @brief This test only works on devices with `sourceAllocation` support + */ + static bool supports_device(sycl_cts::util::logger& log, + const sycl::queue& queue) { + return check_device_support(log, queue); + } + template static std::string description() { return "memcpy from " + get_allocation_decription() + @@ -322,6 +336,13 @@ class fill { */ static constexpr bool has_non_usm_support() { return false; } + /** @brief This test doesn't have any device requirements + */ + static bool supports_device(sycl_cts::util::logger& log, + const sycl::queue& queue) { + return true; + } + template static std::string description() { return "fill using " + get_allocation_decription(); @@ -355,6 +376,13 @@ class memset { */ static constexpr bool has_non_usm_support() { return false; } + /** @brief This test doesn't have any device requirements + */ + static bool supports_device(sycl_cts::util::logger& log, + const sycl::queue& queue) { + return true; + } + template static std::string description() { return "memset using " + get_allocation_decription(); @@ -386,6 +414,13 @@ class prefetch { */ static constexpr bool has_non_usm_support() { return false; } + /** @brief This test doesn't have any device requirements + */ + static bool supports_device(sycl_cts::util::logger& log, + const sycl::queue& queue) { + return true; + } + template static std::string description() { return "prefetch using " + get_allocation_decription(); @@ -414,6 +449,13 @@ class mem_advise { */ static constexpr bool has_non_usm_support() { return false; } + /** @brief This test doesn't have any device requirements + */ + static bool supports_device(sycl_cts::util::logger& log, + const sycl::queue& queue) { + return true; + } + template static std::string description() { return "mem_advise using " + get_allocation_decription(); @@ -565,6 +607,7 @@ struct test { try { auto queue = sycl_cts::util::get_cts_object::queue(); + if (!verifier_t::supports_device(log, queue)) return; if (!check_device_support(log, queue)) return; log.debug("... allocate USM memory storage");