Skip to content

Commit c53d481

Browse files
authored
[SYCL] Fix BE for tests (intel#3825)
- force host device for tests which target host; - use SYCL_DEVICE_FILTER in favor to SYCL_DEVICE_TYPE; - force SYCL BE selected in LIT framework; - disable test which is unstable on CUDA.
1 parent 9b61592 commit c53d481

File tree

10 files changed

+31
-26
lines changed

10 files changed

+31
-26
lines changed

sycl/test/basic_tests/aspects.cpp renamed to sycl/test/on-device/basic_tests/aspects.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clangxx -fsycl %s -o %t.out
2-
// RUN: %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be %t.out
33

44
//==--------------- aspects.cpp - SYCL device test ------------------------==//
55
//

sycl/test/on-device/basic_tests/diagnostics/device-check.cpp

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=cpu %t.out
3-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=gpu %t.out
4-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=acc %t.out
5-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=host %t.out
6-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=CPU %t.out
7-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=GPU %t.out
8-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=ACC %t.out
9-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=HOST %t.out
10-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Cpu %t.out
11-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Gpu %t.out
12-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Acc %t.out
13-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Host %t.out
14-
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=XPU %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=cpu %t.out
3+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=gpu %t.out
4+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=acc %t.out
5+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=host %t.out
6+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=CPU %t.out
7+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=GPU %t.out
8+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=ACC %t.out
9+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=HOST %t.out
10+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=Cpu %t.out
11+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=Gpu %t.out
12+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=Acc %t.out
13+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=Host %t.out
14+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be SYCL_DEVICE_TYPE=XPU %t.out
1515

1616
//==------------------- device-check.cpp --------------------------==//
1717
// This is a diagnostic test which ensures that
@@ -24,7 +24,6 @@
2424

2525
using namespace cl::sycl;
2626

27-
2827
int main() {
2928
try {
3029
queue q = queue();
@@ -34,9 +33,11 @@ int main() {
3433
}
3534

3635
catch (runtime_error &E) {
37-
if (std::string(E.what()).find(
38-
"SYCL_DEVICE_TYPE is not recognized. Must be GPU, CPU, ACC or HOST.") ==
39-
std::string::npos) {
36+
if (std::string(E.what()).find("SYCL_DEVICE_TYPE is not recognized. Must "
37+
"be GPU, CPU, ACC or HOST.") ==
38+
std::string::npos &&
39+
std::string(E.what()).find("No device of requested type available.") ==
40+
std::string::npos) {
4041
std::cout << "Test failed: received error is incorrect." << std::endl;
4142
return 1;
4243
} else {

sycl/test/basic_tests/platform.cpp renamed to sycl/test/on-device/basic_tests/platform.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=%sycl_be %t.out
33
//==--------------- platform.cpp - SYCL platform test ----------------------==//
44
//
55
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

sycl/test/on-device/extensions/intel-ext-device.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: env SYCL_DEVICE_FILTER=opencl:gpu %t.out
44
//
55
// REQUIRES: gpu
6+
// UNSUPPORTED: cuda
67

78
//==--------- intel-ext-device.cpp - SYCL device test ------------==//
89
//

sycl/test/on-device/lit.cfg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir])
9696
backend=lit_config.params.get('SYCL_PLUGIN', "opencl")
9797
lit_config.note("Backend: {}".format(backend))
98-
config.substitutions.append( ('%sycl_be', { 'opencl': 'PI_OPENCL', 'cuda': 'PI_CUDA', 'level_zero': 'PI_LEVEL_ZERO'}[backend]) )
98+
config.substitutions.append( ('%sycl_be', backend) )
9999
config.substitutions.append( ('%BE_RUN_PLACEHOLDER', "env SYCL_DEVICE_FILTER={SYCL_PLUGIN} ".format(SYCL_PLUGIN=backend)) )
100100
config.substitutions.append( ('%RUN_ON_HOST', "env SYCL_DEVICE_FILTER=host ") )
101101

sycl/test/regression/device_num.cpp renamed to sycl/test/on-device/regression/device_num.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: sycl-ls
32
// RUN: env SYCL_DEVICE_FILTER=0 %t.out
43
// RUN: env SYCL_DEVICE_FILTER=1 %t.out
54
// RUN: env SYCL_DEVICE_FILTER=2 %t.out
65
// RUN: env SYCL_DEVICE_FILTER=3 %t.out
76
// RUN: env SYCL_DEVICE_FILTER=4 %t.out
87

8+
// The test is using all available BEs but CUDA machine in CI does not have
9+
// functional OpenCL RT
10+
// UNSUPPORTED: cuda
11+
912
#include <CL/sycl.hpp>
1013
#include <iostream>
1114

sycl/test/regression/isordered.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clangxx -fsycl %s -o %t.out
2-
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=host %t.out
33

44
#include <CL/sycl.hpp>
55

@@ -33,4 +33,4 @@ int main() {
3333
assert(kernelResult[2] == 1 && "Incorrect result");
3434

3535
return 0;
36-
}
36+
}

sycl/test/regression/mad_sat.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clangxx -fsycl %s -o %t.out
2-
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=host %t.out
33

44
#include <CL/sycl.hpp>
55

sycl/test/scheduler/DataMovement.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t.out -g
2-
// RUN: %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=host %t.out
33
//
44
//==-------------------------- DataMovement.cpp ----------------------------==//
55
//

sycl/test/scheduler/MultipleDevices.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t.out
2-
// RUN: %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=host %t.out
33

44
//===- MultipleDevices.cpp - Test checking multi-device execution --------===//
55
//

0 commit comments

Comments
 (0)