Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions sycl/test-e2e/KernelCompiler/kernel_compiler_sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,29 @@

// -- Test the kernel_compiler with SYCL source.
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// RUN: %{l0_leak_check} %{run} %t.out

// If clang++ is not on the PATH, or if sycl was compiled with GCC < 8, then
// the kernel_compiler is not available for SYCL language.
// Note: this 'invoking clang++' version for SYCL language support is temporary,
// and will be replaced by the SYCL_JIT version soon.
// DEFINE: %{available} = %t.out available

// RUN: %if available %{ %{run} %t.out %}
Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this condition doesn't work as expected. Regardless of whether the executable returns 0 or 1, I get

# RUN: at line 21 has no command after substitutions

Can such a substitution be used for the %if construct? The testing guide only mention "features" as conditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right - these tests aren't running at all. This is a problem, the post-commit testing has a pass where the invoking kernel_compiler simply isn't available. Might have to figure out a different way of excluding that pass.

// RUN: %if available %{ %{l0_leak_check} %{run} %t.out %}

// -- Test again, with caching.
// 'reading-from-cache' is just a string we pass to differentiate between the
// two runs.

// DEFINE: %{cache_vars} = %{l0_leak_check} env SYCL_CACHE_PERSISTENT=1 SYCL_CACHE_TRACE=5 SYCL_CACHE_DIR=%t/cache_dir
// RUN: rm -rf %t/cache_dir
// RUN: %{cache_vars} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE
// RUN: %{cache_vars} %t.out reading-from-cache 2>&1 | FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE
// RUN: %if available %{ %{cache_vars} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE %}
// RUN: %if available %{ %{cache_vars} %t.out reading-from-cache 2>&1 | FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE %}

// -- Add leak check.
// RUN: rm -rf %t/cache_dir
// RUN: %{l0_leak_check} %{cache_vars} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE
// RUN: %{l0_leak_check} %{cache_vars} %t.out reading-from-cache 2>&1 | FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE
// RUN: %if available %{ %{l0_leak_check} %{cache_vars} %t.out 2>&1 | FileCheck %s --check-prefixes=CHECK-WRITTEN-TO-CACHE %}
// RUN: %if available %{ %{l0_leak_check} %{cache_vars} %t.out reading-from-cache 2>&1 | FileCheck %s --check-prefixes=CHECK-READ-FROM-CACHE %}

// CHECK-WRITTEN-TO-CACHE: [Persistent Cache]: enabled
// CHECK-WRITTEN-TO-CACHE-NOT: [kernel_compiler Persistent Cache]: using cached binary
Expand Down Expand Up @@ -301,13 +308,18 @@ void test_esimd() {
}

int main(int argc, char *argv[]) {
namespace syclex = sycl::ext::oneapi::experimental;
bool readingFromCache = false;

// Check if the argument is present
if (argc > 1) {
std::string argument(argv[1]);
if (argument == "reading-from-cache") {
readingFromCache = true;
} else if (argument == "available") {
sycl::device d;
bool avail = d.ext_oneapi_can_compile(syclex::source_language::sycl);
return avail;
}
}

Expand Down
Loading