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

Commit 6a3a82a

Browse files
authored
[SYCL] Fix SYCL_DEVICE_FILTER setting (#203)
Signed-off-by: Byoungro So <[email protected]>
1 parent f491aa0 commit 6a3a82a

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

SYCL/Basic/host_always_works.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %HOST_RUN_PLACEHOLDER %t1.out
33
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
5-
// RUN: %ACC_RUN_PLACEHOLDER %t1.out
5+
// RUN: env SYCL_DEVICE_FILTER=acc,host %t1.out
66

77
//==------ host_always_works.cpp - Host Device Availability test -----------==//
88
//

SYCL/FilterSelector/select_device.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
22
// RUN: env SYCL_DEVICE_FILTER="*" %t.out
3-
// RUN: env SYCL_DEVICE_FILTER=cpu %t.out
3+
// RUN: env SYCL_DEVICE_FILTER=cpu,host %t.out
44
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu %t.out
55
// RUN: env SYCL_DEVICE_FILTER=opencl:gpu %t.out
66
// RUN: env SYCL_DEVICE_FILTER=cpu,level_zero:gpu %t.out
@@ -11,7 +11,7 @@
1111
// Checks that no device is selected when no device of desired type is
1212
// available.
1313
//
14-
// REQUIRES: cpu,gpu,accelerator
14+
// REQUIRES: cpu,gpu,accelerator,host
1515

1616
#include <CL/sycl.hpp>
1717
#include <iostream>
@@ -50,8 +50,8 @@ int main() {
5050
device d = cs.select_device();
5151
std::cout << "CPU device is found: " << d.is_cpu() << std::endl;
5252
}
53-
// HOST device is always available regardless of SYCL_DEVICE_FILTER
54-
{
53+
if (!envVal || forcedPIs == "*" ||
54+
forcedPIs.find("host") != std::string::npos) {
5555
host_selector hs;
5656
device d = hs.select_device();
5757
std::cout << "HOST device is found: " << d.is_host() << std::endl;

SYCL/FilterSelector/select_device_cpu.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,19 @@ int main() {
4545
device d = cs.select_device();
4646
std::cout << "CPU device is found: " << d.is_cpu() << std::endl;
4747
}
48-
// HOST device is always available regardless of SYCL_DEVICE_FILTER
48+
/*
49+
// TODO: enable this once SYCL_DEVICE_FILTER PR is merged.
4950
{
5051
host_selector hs;
51-
device d = hs.select_device();
52-
std::cout << "HOST device is found: " << d.is_host() << std::endl;
52+
try {
53+
device d = hs.select_device();
54+
std::cerr << "HOST device is found: " << d.is_host() << std::endl;
55+
return -1;
56+
} catch (...) {
57+
std::cout << "Expectedly, HOST device is not found";
58+
}
5359
}
60+
*/
5461
{
5562
accelerator_selector as;
5663
try {

SYCL/FilterSelector/select_device_level_zero.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu,host %t.out
33
//
44
// Checks if only specified device types can be acquired from select_device
55
// when SYCL_DEVICE_FILTER is set
66
// Checks that no device is selected when no device of desired type is
77
// available.
88
//
9-
// REQUIRES: level_zero,gpu
9+
// REQUIRES: level_zero,gpu,host
1010

1111
#include <CL/sycl.hpp>
1212
#include <iostream>

0 commit comments

Comments
 (0)