1
1
// RUN: %{build} -o %t.out
2
2
//
3
3
// RUN: env PRINT_DEVICE_INFO=1 %{run-unfiltered-devices} %t.out > %t1.conf
4
- // RUN: env TEST_DEVICE_AVAILABLE=1 env SYCL_CONFIG_FILE_NAME=%t1.conf %{run-unfiltered-devices} %t.out
4
+ // RUN: env PRINT_DEVICE_INFO=1 env TRACE_CHECK=1 %{run-unfiltered-devices} %t.out > %t1.file_check
5
+ //
6
+ // RUN: env TEST_DEVICE_AVAILABLE=1 env SYCL_UR_TRACE=1 env SYCL_CONFIG_FILE_NAME=%t1.conf %{run-unfiltered-devices} %t.out \
7
+ // RUN: | FileCheck %t1.file_check
5
8
//
6
9
// RUN: env PRINT_PLATFORM_INFO=1 %{run-unfiltered-devices} %t.out > %t2.conf
7
- // RUN: env TEST_PLATFORM_AVAILABLE=1 env SYCL_CONFIG_FILE_NAME=%t2.conf %{run-unfiltered-devices} %t.out
10
+ // RUN: env PRINT_PLATFORM_INFO=1 env TRACE_CHECK=1 %{run-unfiltered-devices} %t.out > %t2.file_check
11
+ //
12
+ // RUN: env TEST_PLATFORM_AVAILABLE=1 env SYCL_UR_TRACE=1 env SYCL_CONFIG_FILE_NAME=%t2.conf %{run-unfiltered-devices} %t.out \
13
+ // RUN: | FileCheck %t2.file_check
8
14
//
9
- // RUN: env TEST_DEVICE_IS_NOT_AVAILABLE=1 env SYCL_DEVICE_ALLOWLIST="PlatformName:{{SUCH NAME DOESN'T EXIST}}" %{run-unfiltered-devices} %t.out
15
+ // RUN: env TEST_DEVICE_IS_NOT_AVAILABLE=1 env SYCL_UR_TRACE=-1 env SYCL_DEVICE_ALLOWLIST="PlatformName:{{SUCH NAME DOESN'T EXIST}}" %{run-unfiltered-devices} %t.out \
16
+ // RUN: | FileCheck %s --check-prefixes=FILTERED
10
17
// RUN: env TEST_INCORRECT_VALUE=1 env SYCL_DEVICE_ALLOWLIST="IncorrectKey:{{.*}}" %{run-unfiltered-devices} %t.out
11
18
19
+ // FILTERED: SYCL_UR_TRACE: Device filtered by SYCL_DEVICE_ALLOWLIST
20
+ // FILTERED-NEXT: SYCL_UR_TRACE: platform: {{.*}}
21
+ // FILTERED-NEXT: SYCL_UR_TRACE: device: {{.*}}
22
+
12
23
#include " ../helpers.hpp"
13
24
#include < algorithm>
14
25
#include < cstdlib>
@@ -46,13 +57,20 @@ int main() {
46
57
for (const sycl::platform &Platform : sycl::platform::get_platforms ()) {
47
58
std::string Name = Platform.get_info <sycl::info::platform::name>();
48
59
std::string Ver = Platform.get_info <sycl::info::platform::version>();
49
- // As a string will be used as regexp pattern, we need to get rid of
50
- // symbols that can be treated in a special way.
51
- replaceSpecialCharacters (Name);
52
- replaceSpecialCharacters (Ver);
53
60
54
- std::cout << " SYCL_DEVICE_ALLOWLIST=PlatformName:{{" << Name
55
- << " }},PlatformVersion:{{" << Ver << " }}" ;
61
+ if (env::isDefined (" TRACE_CHECK" )) {
62
+ std::cout
63
+ << " CHECK: SYCL_UR_TRACE: Device allowed by SYCL_DEVICE_ALLOWLIST\n "
64
+ << " CHECK-NEXT: SYCL_UR_TRACE: platform: " << Name << " \n "
65
+ << " CHECK-NEXT: SYCL_UR_TRACE: device: {{.*}}" << std::endl;
66
+ } else {
67
+ // As a string will be used as regexp pattern, we need to get rid of
68
+ // symbols that can be treated in a special way.
69
+ replaceSpecialCharacters (Name);
70
+ replaceSpecialCharacters (Ver);
71
+ std::cout << " SYCL_DEVICE_ALLOWLIST=PlatformName:{{" << Name
72
+ << " }},PlatformVersion:{{" << Ver << " }}" ;
73
+ }
56
74
57
75
return 0 ;
58
76
}
@@ -65,14 +83,22 @@ int main() {
65
83
const sycl::device Dev = Platform.get_devices ().at (0 );
66
84
std::string Name = Dev.get_info <sycl::info::device::name>();
67
85
std::string Ver = Dev.get_info <sycl::info::device::driver_version>();
68
-
69
- // As a string will be used as regexp pattern, we need to get rid of
70
- // symbols that can be treated in a special way.
71
- replaceSpecialCharacters (Name);
72
- replaceSpecialCharacters (Ver);
73
-
74
- std::cout << " SYCL_DEVICE_ALLOWLIST=DeviceName:{{" << Name
75
- << " }},DriverVersion:{{" << Ver << " }}" ;
86
+ std::string PlatformName =
87
+ Platform.get_info <sycl::info::platform::name>();
88
+
89
+ if (env::isDefined (" TRACE_CHECK" )) {
90
+ std::cout
91
+ << " CHECK: SYCL_UR_TRACE: Device allowed by SYCL_DEVICE_ALLOWLIST\n "
92
+ << " CHECK-NEXT: SYCL_UR_TRACE: platform: " << PlatformName << " \n "
93
+ << " CHECK-NEXT: SYCL_UR_TRACE: device: " << Name << std::endl;
94
+ } else {
95
+ // As a string will be used as regexp pattern, we need to get rid of
96
+ // symbols that can be treated in a special way.
97
+ replaceSpecialCharacters (Name);
98
+ replaceSpecialCharacters (Ver);
99
+ std::cout << " SYCL_DEVICE_ALLOWLIST=DeviceName:{{" << Name
100
+ << " }},DriverVersion:{{" << Ver << " }}" ;
101
+ }
76
102
77
103
return 0 ;
78
104
}
0 commit comments