11// RUN: %{build} -o %t.out
22//
33// 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
58//
69// 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
814//
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
1017// RUN: env TEST_INCORRECT_VALUE=1 env SYCL_DEVICE_ALLOWLIST="IncorrectKey:{{.*}}" %{run-unfiltered-devices} %t.out
1118
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+
1223#include " ../helpers.hpp"
1324#include < algorithm>
1425#include < cstdlib>
@@ -46,13 +57,20 @@ int main() {
4657 for (const sycl::platform &Platform : sycl::platform::get_platforms ()) {
4758 std::string Name = Platform.get_info <sycl::info::platform::name>();
4859 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);
5360
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+ }
5674
5775 return 0 ;
5876 }
@@ -65,14 +83,22 @@ int main() {
6583 const sycl::device Dev = Platform.get_devices ().at (0 );
6684 std::string Name = Dev.get_info <sycl::info::device::name>();
6785 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+ }
76102
77103 return 0 ;
78104 }
0 commit comments