Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update checks for sycl::info::device::preferred_interop_user_sync and sycl::info::device::profile in device_info test #992

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ void check_get_info_param(const ObjectT& object) {
check_return_type<ReturnT>(returnValue, "object::get_info()");
}

/**
* @brief Helper function to check an info parameter for specific backend.
*/
template <typename InfoDesc, typename ReturnT, sycl::backend Backend,
typename ObjectT>
void check_get_info_param_backend_specific(const ObjectT& object) {
try {
check_get_info_param<InfoDesc, ReturnT>(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");
}
}

/**
* @deprecated Use overload without logger.
*/
Expand Down
9 changes: 6 additions & 3 deletions tests/device/device_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ TEST_CASE("device info", "[device]") {
check_get_info_param<sycl::info::device::name, std::string>(dev);
check_get_info_param<sycl::info::device::vendor, std::string>(dev);
check_get_info_param<sycl::info::device::driver_version, std::string>(dev);
check_get_info_param<sycl::info::device::profile, std::string>(dev);
check_get_info_param_backend_specific<sycl::info::device::profile,
std::string, sycl::backend::opencl>(
dev);
check_get_info_param<sycl::info::device::version, std::string>(dev);
check_get_info_param<sycl::info::device::backend_version, std::string>(dev);

Expand All @@ -230,8 +232,9 @@ TEST_CASE("device info", "[device]") {
check_get_info_param<sycl::info::device::extensions,
std::vector<std::string>>(dev);
check_get_info_param<sycl::info::device::printf_buffer_size, size_t>(dev);
check_get_info_param<sycl::info::device::preferred_interop_user_sync, bool>(
dev);
check_get_info_param_backend_specific<
sycl::info::device::preferred_interop_user_sync, bool,
sycl::backend::opencl>(dev);
auto SupportedProperties =
dev.get_info<sycl::info::device::partition_properties>();
if (std::find(SupportedProperties.begin(), SupportedProperties.end(),
Expand Down