Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Fix SYCL_DEVICE_FILTER setting #203

Merged
merged 4 commits into from
Mar 30, 2021
Merged
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
2 changes: 1 addition & 1 deletion SYCL/Basic/host_always_works.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %HOST_RUN_PLACEHOLDER %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
// RUN: %ACC_RUN_PLACEHOLDER %t1.out
// RUN: env SYCL_DEVICE_FILTER=acc,host %t1.out

//==------ host_always_works.cpp - Host Device Availability test -----------==//
//
Expand Down
8 changes: 4 additions & 4 deletions SYCL/FilterSelector/select_device.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_FILTER="*" %t.out
// RUN: env SYCL_DEVICE_FILTER=cpu %t.out
// RUN: env SYCL_DEVICE_FILTER=cpu,host %t.out
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu %t.out
// RUN: env SYCL_DEVICE_FILTER=opencl:gpu %t.out
// RUN: env SYCL_DEVICE_FILTER=cpu,level_zero:gpu %t.out
Expand All @@ -11,7 +11,7 @@
// Checks that no device is selected when no device of desired type is
// available.
//
// REQUIRES: cpu,gpu,accelerator
// REQUIRES: cpu,gpu,accelerator,host

#include <CL/sycl.hpp>
#include <iostream>
Expand Down Expand Up @@ -50,8 +50,8 @@ int main() {
device d = cs.select_device();
std::cout << "CPU device is found: " << d.is_cpu() << std::endl;
}
// HOST device is always available regardless of SYCL_DEVICE_FILTER
{
if (!envVal || forcedPIs == "*" ||
forcedPIs.find("host") != std::string::npos) {
host_selector hs;
device d = hs.select_device();
std::cout << "HOST device is found: " << d.is_host() << std::endl;
Expand Down
13 changes: 10 additions & 3 deletions SYCL/FilterSelector/select_device_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ int main() {
device d = cs.select_device();
std::cout << "CPU device is found: " << d.is_cpu() << std::endl;
}
// HOST device is always available regardless of SYCL_DEVICE_FILTER
/*
// TODO: enable this once SYCL_DEVICE_FILTER PR is merged.
Copy link
Author

@bso-intel bso-intel Mar 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intel/llvm#3397 needs to be merged first to enable this test.
PR-3397 forces SYCL_DEVICE_FILTER to only provide designated devices.

{
host_selector hs;
device d = hs.select_device();
std::cout << "HOST device is found: " << d.is_host() << std::endl;
try {
device d = hs.select_device();
std::cerr << "HOST device is found: " << d.is_host() << std::endl;
return -1;
} catch (...) {
std::cout << "Expectedly, HOST device is not found";
}
}
*/
{
accelerator_selector as;
try {
Expand Down
4 changes: 2 additions & 2 deletions SYCL/FilterSelector/select_device_level_zero.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu %t.out
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu,host %t.out
//
// Checks if only specified device types can be acquired from select_device
// when SYCL_DEVICE_FILTER is set
// Checks that no device is selected when no device of desired type is
// available.
//
// REQUIRES: level_zero,gpu
// REQUIRES: level_zero,gpu,host

#include <CL/sycl.hpp>
#include <iostream>
Expand Down