Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
26 changes: 26 additions & 0 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,32 @@ typename Param::return_type get_device_info(const DeviceImplPtr &Dev) {
return get_device_info_impl<typename Param::return_type, Param>::get(Dev);
}

template <>
inline typename info::device::preferred_interop_user_sync::return_type
get_device_info<info::device::preferred_interop_user_sync>(
const DeviceImplPtr &Dev) {
if (Dev->getBackend() != backend::opencl) {
throw sycl::exception(
errc::invalid,
"the info::device::preferred_interop_user_sync info descriptor can "
"only be queried with an OpenCL backend");
}
using Param = info::device::preferred_interop_user_sync;
return get_device_info_impl<Param::return_type, Param>::get(Dev);
}

template <>
inline typename info::device::profile::return_type
get_device_info<info::device::profile>(const DeviceImplPtr &Dev) {
if (Dev->getBackend() != backend::opencl) {
throw sycl::exception(errc::invalid,
"the info::device::profile info descriptor can "
"only be queried with an OpenCL backend");
}
using Param = info::device::profile;
return get_device_info_impl<Param::return_type, Param>::get(Dev);
}

template <>
inline ext::intel::info::device::device_id::return_type
get_device_info<ext::intel::info::device::device_id>(const DeviceImplPtr &Dev) {
Expand Down
18 changes: 14 additions & 4 deletions sycl/test-e2e/Basic/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,12 @@ int main() {
print_info<info::device::name, std::string>(dev, "Name");
print_info<info::device::vendor, std::string>(dev, "Vendor");
print_info<info::device::driver_version, std::string>(dev, "Driver version");
print_info<info::device::profile, std::string>(dev, "Profile");
try {
print_info<info::device::profile, std::string>(dev, "Profile");
} catch (const sycl::exception &e) {
std::cout << "Expected exception has been caught: " << e.what()
<< std::endl;
}
print_info<info::device::version, std::string>(dev, "Version");
print_info<info::device::backend_version, std::string>(dev,
"Backend version");
Expand All @@ -332,11 +337,16 @@ int main() {
"Extensions");
print_info<info::device::printf_buffer_size, size_t>(dev,
"Printf buffer size");
print_info<info::device::preferred_interop_user_sync, bool>(
dev, "Preferred interop user sync");
try {
print_info<info::device::preferred_interop_user_sync, bool>(
dev, "Preferred interop user sync");
} catch (const sycl::exception &e) {
std::cout << "Expected exception has been caught: " << e.what()
<< std::endl;
}
try {
print_info<info::device::parent_device, device>(dev, "Parent device");
} catch (sycl::exception e) {
} catch (const sycl::exception &e) {
std::cout << "Expected exception has been caught: " << e.what()
<< std::endl;
}
Expand Down