Skip to content

Commit

Permalink
[SYCL][E2E] Remove use of deprecated device selectors in FilterSelect…
Browse files Browse the repository at this point in the history
…or tests (#15785)

Use new device selector callables, instead of deprecated device selector
objects.

These tests do not run on CI because they require multiple devices, so
they were missed by the addition of `-Werror` to e2e tests.
  • Loading branch information
ayylol authored Oct 21, 2024
1 parent e9d9013 commit f26139e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
15 changes: 5 additions & 10 deletions sycl/test-e2e/FilterSelector/select_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,29 @@ int main() {
}
if (!envVal.empty() || forcedPIs == "*" ||
forcedPIs.find("level_zero:gpu") != std::string::npos) {
default_selector ds;
device d = ds.select_device();
device d(default_selector_v);
string name = d.get_platform().get_info<info::platform::name>();
assert(name.find("Level-Zero") != string::npos);
}
if (envVal.empty() && forcedPIs != "*" &&
forcedPIs.find("opencl:gpu") != std::string::npos) {
gpu_selector gs;
device d = gs.select_device();
device d(gpu_selector_v);
string name = d.get_platform().get_info<info::platform::name>();
assert(name.find("OpenCL") != string::npos);
}
if (!envVal.empty() || forcedPIs == "*" ||
forcedPIs.find("cpu") != std::string::npos) {
cpu_selector cs;
device d = cs.select_device();
device d(cpu_selector_v);
}
if (!envVal.empty() || forcedPIs == "*" ||
forcedPIs.find("fpga") != std::string::npos) {
accelerator_selector as;
device d = as.select_device();
device d(accelerator_selector_v);
}
if (envVal.empty() && (forcedPIs.find("cpu") == std::string::npos &&
forcedPIs.find("opencl") == std::string::npos &&
forcedPIs.find("*") == std::string::npos)) {
try {
cpu_selector cs;
device d = cs.select_device();
device d(cpu_selector_v);
} catch (...) {
return 0; // expected
}
Expand Down
16 changes: 6 additions & 10 deletions sycl/test-e2e/FilterSelector/select_device_opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,22 @@ int main() {
}

{
default_selector ds;
device d = ds.select_device();
device d(default_selector_v);
string name = d.get_platform().get_info<info::platform::name>();
assert(name.find("OpenCL") != string::npos &&
"default_selector failed to find an opencl device");
"default_selector_v failed to find an opencl device");
}
{
gpu_selector gs;
device d = gs.select_device();
device d(gpu_selector_v);
string name = d.get_platform().get_info<info::platform::name>();
assert(name.find("OpenCL") != string::npos &&
"gpu_selector failed to find an opencl device");
"gpu_selector_v failed to find an opencl device");
}
{
cpu_selector cs;
device d = cs.select_device();
device d(cpu_selector_v);
}
{
accelerator_selector as;
device d = as.select_device();
device d(accelerator_selector_v);
}

return 0;
Expand Down

0 comments on commit f26139e

Please sign in to comment.