Closed
Description
// a.cpp
#include <CL/sycl.hpp>
#include <iostream>
int main(void) {
sycl::device d;
try {
sycl::device pd = d.get_info<sycl::info::device::parent_device>();
} catch (const sycl::runtime_error &re) {
std::cerr << "No parent" << std::endl;
}
return 0;
}
Compiling this with clang++ -fsycl a.cpp
generates lots of SYCL_2020 deprecation warnings.
A way to change this code to conform to SYCL 2020 spec is as follows:
// a_sycl2020_conformant.cpp
#include <CL/sycl.hpp>
#include <iostream>
int main(void) {
sycl::device d;
try {
sycl::device pd = d.get_info<sycl::info::device::parent_device>();
} catch (const sycl::exception &e) {
if (e.category() == sycl::sycl_category() && e.code() == sycl::errc::runtime) {
std::cerr << "No parent" << std::endl;
} else {
std::cerr << "Unknown exception occurred: " << ex.what() << std::endl;
std::terminate();
}
}
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels