| 
11 | 11 | 
 
  | 
12 | 12 | // -- Test the kernel_compiler with SYCL source.  | 
13 | 13 | // RUN: %{build} -o %t.out  | 
14 |  | -// RUN: %{run} %t.out  | 
15 |  | -// RUN: %{l0_leak_check} %{run} %t.out  | 
 | 14 | + | 
 | 15 | +// If clang++ is not on the PATH, or if sycl was compiled with GCC < 8, then  | 
 | 16 | +// the kernel_compiler is not available for SYCL language.  | 
 | 17 | +// Note: this 'invoking clang++' version for SYCL language support is temporary,  | 
 | 18 | +// and will be replaced by the SYCL_JIT version soon.  | 
 | 19 | +// DEFINE: %{available} = %t.out available  | 
 | 20 | + | 
 | 21 | +// RUN: %if available %{  %{run} %t.out  %}  | 
 | 22 | +// RUN: %if available %{ %{l0_leak_check} %{run} %t.out %}  | 
16 | 23 | 
 
  | 
17 | 24 | // -- Test again, with caching.  | 
18 | 25 | // 'reading-from-cache' is just a string we pass to differentiate between the  | 
19 | 26 | // two runs.  | 
20 | 27 | 
 
  | 
21 | 28 | // DEFINE: %{cache_vars} = %{l0_leak_check} env SYCL_CACHE_PERSISTENT=1 SYCL_CACHE_TRACE=5 SYCL_CACHE_DIR=%t/cache_dir  | 
22 | 29 | // RUN: rm -rf %t/cache_dir  | 
23 |  | -// RUN:  %{cache_vars} %t.out 2>&1 |  FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE  | 
24 |  | -// RUN:  %{cache_vars} %t.out reading-from-cache 2>&1 |  FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE  | 
 | 30 | +// RUN:  %if available %{  %{cache_vars} %t.out 2>&1 |  FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE %}  | 
 | 31 | +// RUN:  %if available %{  %{cache_vars} %t.out reading-from-cache 2>&1 |  FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE %}  | 
25 | 32 | 
 
  | 
26 | 33 | // -- Add leak check.  | 
27 | 34 | // RUN: rm -rf %t/cache_dir  | 
28 |  | -// RUN:   %{l0_leak_check} %{cache_vars} %t.out 2>&1 |  FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE  | 
29 |  | -// RUN:   %{l0_leak_check} %{cache_vars} %t.out reading-from-cache 2>&1 |  FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE  | 
 | 35 | +// RUN: %if available %{  %{l0_leak_check} %{cache_vars} %t.out 2>&1 |  FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE  %}  | 
 | 36 | +// RUN: %if available %{ %{l0_leak_check} %{cache_vars} %t.out reading-from-cache 2>&1 |  FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE  %}  | 
30 | 37 | 
 
  | 
31 | 38 | // CHECK-WRITTEN-TO-CACHE: [Persistent Cache]: enabled  | 
32 | 39 | // CHECK-WRITTEN-TO-CACHE-NOT: [kernel_compiler Persistent Cache]: using cached binary  | 
@@ -301,13 +308,18 @@ void test_esimd() {  | 
301 | 308 | }  | 
302 | 309 | 
 
  | 
303 | 310 | int main(int argc, char *argv[]) {  | 
 | 311 | +  namespace syclex = sycl::ext::oneapi::experimental;  | 
304 | 312 |   bool readingFromCache = false;  | 
305 | 313 | 
 
  | 
306 | 314 |   // Check if the argument is present  | 
307 | 315 |   if (argc > 1) {  | 
308 | 316 |     std::string argument(argv[1]);  | 
309 | 317 |     if (argument == "reading-from-cache") {  | 
310 | 318 |       readingFromCache = true;  | 
 | 319 | +    } else if (argument == "available") {  | 
 | 320 | +      sycl::device d;  | 
 | 321 | +      bool avail = d.ext_oneapi_can_compile(syclex::source_language::sycl);  | 
 | 322 | +      return avail;  | 
311 | 323 |     }  | 
312 | 324 |   }  | 
313 | 325 | 
 
  | 
 | 
0 commit comments