From 1f286cf1d28e8a8c7bee7d210dec7dddbfdf340d Mon Sep 17 00:00:00 2001 From: "Skrobot, Daniel" Date: Tue, 3 Dec 2024 17:45:18 +0100 Subject: [PATCH 1/4] Updated device_info --- tests/common/common.h | 17 +++++++++++++++++ tests/device/device_info.cpp | 9 ++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tests/common/common.h b/tests/common/common.h index 4469681d1..1cbcc5f75 100644 --- a/tests/common/common.h +++ b/tests/common/common.h @@ -36,6 +36,7 @@ #include "get_cts_object.h" #include "macros.h" #include "string_makers.h" +#include "sycl/backend_types.hpp" #include "value_operations.h" #include @@ -158,6 +159,22 @@ void check_get_info_param(const ObjectT& object) { auto returnValue = object.template get_info(); check_return_type(returnValue, "object::get_info()"); } +/** + * @brief Helper function to check an info parameter for specific backend. + */ +template +void check_get_info_param_backend_specific(const ObjectT& object) { + try { + check_get_info_param(object); + CHECK(object.get_backend() == Backend); + } catch (const sycl::exception& e) { + CHECK(e.code() == sycl::make_error_code(sycl::errc::invalid)); + CHECK(object.get_backend() != Backend); + } catch (...) { + FAIL("Unexpected exception"); + } +} /** * @deprecated Use overload without logger. diff --git a/tests/device/device_info.cpp b/tests/device/device_info.cpp index 9f3853d7b..27075076c 100644 --- a/tests/device/device_info.cpp +++ b/tests/device/device_info.cpp @@ -220,7 +220,9 @@ TEST_CASE("device info", "[device]") { check_get_info_param(dev); check_get_info_param(dev); check_get_info_param(dev); - check_get_info_param(dev); + check_get_info_param_backend_specific( + dev); check_get_info_param(dev); check_get_info_param(dev); @@ -230,8 +232,9 @@ TEST_CASE("device info", "[device]") { check_get_info_param>(dev); check_get_info_param(dev); - check_get_info_param( - dev); + check_get_info_param_backend_specific< + sycl::info::device::preferred_interop_user_sync, bool, + sycl::backend::opencl>(dev); auto SupportedProperties = dev.get_info(); if (std::find(SupportedProperties.begin(), SupportedProperties.end(), From 5db47d0e896969d350419e659c3f0c9468e4c0b4 Mon Sep 17 00:00:00 2001 From: "Skrobot, Daniel" Date: Tue, 3 Dec 2024 17:53:51 +0100 Subject: [PATCH 2/4] fix --- tests/common/common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/common/common.h b/tests/common/common.h index 1cbcc5f75..03539aa3a 100644 --- a/tests/common/common.h +++ b/tests/common/common.h @@ -36,7 +36,6 @@ #include "get_cts_object.h" #include "macros.h" #include "string_makers.h" -#include "sycl/backend_types.hpp" #include "value_operations.h" #include From 2d284cc7ca9ba8e73aa20962ef1b6e4b8810fde5 Mon Sep 17 00:00:00 2001 From: Daniel Skrobot Date: Wed, 4 Dec 2024 15:37:33 +0100 Subject: [PATCH 3/4] Update tests/common/common.h Co-authored-by: Alexey Bader --- tests/common/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/common/common.h b/tests/common/common.h index 03539aa3a..f55bca3be 100644 --- a/tests/common/common.h +++ b/tests/common/common.h @@ -158,6 +158,7 @@ void check_get_info_param(const ObjectT& object) { auto returnValue = object.template get_info(); check_return_type(returnValue, "object::get_info()"); } + /** * @brief Helper function to check an info parameter for specific backend. */ From a825b957fccc7402895caa13c30153b0f8b32708 Mon Sep 17 00:00:00 2001 From: "Skrobot, Daniel" Date: Wed, 4 Dec 2024 16:55:27 +0100 Subject: [PATCH 4/4] disabled check with sycl::make_error_code when hipSYCL --- tests/common/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/common/common.h b/tests/common/common.h index f55bca3be..b42f09df7 100644 --- a/tests/common/common.h +++ b/tests/common/common.h @@ -169,7 +169,9 @@ void check_get_info_param_backend_specific(const ObjectT& object) { check_get_info_param(object); CHECK(object.get_backend() == Backend); } catch (const sycl::exception& e) { +#ifndef SYCL_CTS_COMPILING_WITH_HIPSYCL CHECK(e.code() == sycl::make_error_code(sycl::errc::invalid)); +#endif CHECK(object.get_backend() != Backend); } catch (...) { FAIL("Unexpected exception");