Skip to content

Commit cfe6339

Browse files
authored
[SYCL] Ensure JIT failure on all Intel devices (intel/llvm-test-suite#452)
Level Zero backend does not generate JIT failure for a missing symbol. There is no single SYCL kernel code which may cause JIT failure on all supported BEs. Update kernels to use unknown inline assembler symbol on GPU and unknown symbol on CPU and accelerator devices.
1 parent f8fde29 commit cfe6339

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

SYCL/KernelAndProgram/build-log.cpp

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: %CPU_RUN_PLACEHOLDER SYCL_PROGRAM_COMPILE_OPTIONS="--unknown-option" %t.out
3-
// RUN: %GPU_RUN_PLACEHOLDER SYCL_PROGRAM_COMPILE_OPTIONS="--unknown-option" %t.out
4-
// RUN: %ACC_RUN_PLACEHOLDER SYCL_PROGRAM_COMPILE_OPTIONS="--unknown-option" %t.out
1+
// XFAIL: cuda
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DGPU %s -o %t_gpu.out
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
4+
// RUN: %CPU_RUN_PLACEHOLDER %t.out
5+
// RUN: %GPU_RUN_PLACEHOLDER %t_gpu.out
6+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
57
//
6-
// Unknown options are silently ignored by IGC and CUDA JIT compilers. The issue
7-
// is under investigation.
8-
// XFAIL: (opencl || level_zero || cuda) && gpu
9-
108
//==--- build-log.cpp - Test log message from faild build ----------==//
119
//
1210
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -16,13 +14,23 @@
1614
//===--------------------------------------------------------------===//
1715

1816
#include <CL/sycl.hpp>
17+
SYCL_EXTERNAL
18+
void symbol_that_does_not_exist();
1919

2020
void test() {
2121
cl::sycl::queue Queue;
2222

2323
// Submitting this kernel should result in a compile_program_error exception
24-
// with a message indicating "Unrecognized build options".
25-
auto Kernel = []() {};
24+
// with a message indicating "CL_BUILD_PROGRAM_FAILURE".
25+
auto Kernel = []() {
26+
#ifdef __SYCL_DEVICE_ONLY__
27+
#ifdef GPU
28+
asm volatile("undefined\n");
29+
#else // GPU
30+
symbol_that_does_not_exist();
31+
#endif // GPU
32+
#endif // __SYCL_DEVICE_ONLY__
33+
};
2634

2735
std::string Msg;
2836
int Result;
@@ -35,7 +43,7 @@ void test() {
3543
} catch (const cl::sycl::compile_program_error &e) {
3644
std::string Msg(e.what());
3745
std::cerr << Msg << std::endl;
38-
assert(Msg.find("unknown-option") != std::string::npos);
46+
assert(Msg.find("CL_BUILD_PROGRAM_FAILURE") != std::string::npos);
3947
} catch (...) {
4048
assert(false && "There must be cl::sycl::compile_program_error");
4149
}

SYCL/KernelAndProgram/cache-build-result.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %clangxx -fsycl -DSYCL_DISABLE_FALLBACK_ASSERT=1 %s -o %t.out
2+
// RUN: %clangxx -fsycl -DSYCL_DISABLE_FALLBACK_ASSERT=1 -DGPU %s -o %t_gpu.out
23
// RUN: env SYCL_CACHE_PERSISTENT=1 %CPU_RUN_PLACEHOLDER %t.out
3-
// RUN: env SYCL_CACHE_PERSISTENT=1 %GPU_RUN_PLACEHOLDER %t.out
4+
// RUN: env SYCL_CACHE_PERSISTENT=1 %GPU_RUN_PLACEHOLDER %t_gpu.out
45
// RUN: env SYCL_CACHE_PERSISTENT=1 %ACC_RUN_PLACEHOLDER %t.out
56
// XFAIL: cuda
67
#include <CL/sycl.hpp>
@@ -13,8 +14,12 @@ void test() {
1314

1415
auto Kernel = []() {
1516
#ifdef __SYCL_DEVICE_ONLY__
17+
#ifdef GPU
18+
asm volatile("undefined\n");
19+
#else // GPU
1620
undefined();
17-
#endif
21+
#endif // GPU
22+
#endif // __SYCL_DEVICE_ONLY__
1823
};
1924

2025
std::string Msg;
@@ -33,7 +38,7 @@ void test() {
3338
Result = e.get_cl_code();
3439
} else {
3540
// Exception constantly adds info on its error code in the message
36-
assert(Msg.find_first_of(e.what()) == 0 && "Exception text differs");
41+
assert(Msg.find_first_of(e.what()) == 0 && "CL_BUILD_PROGRAM_FAILURE");
3742
assert(Result == e.get_cl_code() && "Exception code differs");
3843
}
3944
} catch (...) {

0 commit comments

Comments
 (0)