Skip to content

Commit

Permalink
Merge pull request #822 from RossBrunton/sharedusm
Browse files Browse the repository at this point in the history
Improve support detection for USM copy tests
  • Loading branch information
bader authored Nov 2, 2023
2 parents 81f5d92 + c6b7ea5 commit af71f0d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/usm/usm_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ class copy : public copyGeneric<T, count, sourceAllocation> {
*/
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<sourceAllocation>(log, queue);
}

template <allocation alloc>
static std::string description() {
return "copy from " + get_allocation_decription<sourceAllocation>() +
Expand All @@ -276,6 +283,13 @@ class memcpy : public copyGeneric<T, count, sourceAllocation> {
*/
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<sourceAllocation>(log, queue);
}

template <allocation alloc>
static std::string description() {
return "memcpy from " + get_allocation_decription<sourceAllocation>() +
Expand Down Expand Up @@ -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 <allocation alloc>
static std::string description() {
return "fill using " + get_allocation_decription<alloc>();
Expand Down Expand Up @@ -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 <allocation alloc>
static std::string description() {
return "memset using " + get_allocation_decription<alloc>();
Expand Down Expand Up @@ -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 <allocation alloc>
static std::string description() {
return "prefetch using " + get_allocation_decription<alloc>();
Expand Down Expand Up @@ -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 <allocation alloc>
static std::string description() {
return "mem_advise using " + get_allocation_decription<alloc>();
Expand Down Expand Up @@ -564,6 +606,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<alloc>(log, queue)) return;

log.debug("... allocate USM memory storage");
Expand Down

0 comments on commit af71f0d

Please sign in to comment.