Skip to content

[SYCL][Test E2E] Add support for device-specific conditions with %{run} #9364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
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
25 changes: 7 additions & 18 deletions sycl/test-e2e/AOT/multiple-devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,31 @@

// CPU, GPU, FPGA
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_all_aot.out
// RUN: %CPU_RUN_PLACEHOLDER %t_all_aot.out
// RUN: %GPU_RUN_PLACEHOLDER %t_all_aot.out
// RUN: %ACC_RUN_PLACEHOLDER %t_all_aot.out
// RUN: %{run} %t_all_aout.out

// CPU, GPU
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_cpu_gpu.out
// RUN: %CPU_RUN_PLACEHOLDER %t_cpu_gpu.out
// RUN: %GPU_RUN_PLACEHOLDER %t_cpu_gpu.out
// RUN: %if gpu || cpu %{ %{run} %t_cpu_gpu.out %}

// CPU, FPGA
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_fpga %t.o -o %t_cpu_fpga.out
// RUN: %CPU_RUN_PLACEHOLDER %t_cpu_fpga.out
// RUN: %ACC_RUN_PLACEHOLDER %t_cpu_fpga.out
// RUN: %if cpu || acc %{ %{run} %t_cpu_fpga.out %}

// GPU, FPGA
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_gpu_fpga.out
// RUN: %GPU_RUN_PLACEHOLDER %t_gpu_fpga.out
// RUN: %ACC_RUN_PLACEHOLDER %t_gpu_fpga.out
// RUN: %if gpu || acc %{ %{run} %t_gpu_fpga.out %}

// No AOT-compiled image for CPU
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_spv_gpu_fpga.out
// RUN: %CPU_RUN_PLACEHOLDER %t_spv_gpu_fpga.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: %GPU_RUN_PLACEHOLDER %t_spv_gpu_fpga.out
// RUN: %ACC_RUN_PLACEHOLDER %t_spv_gpu_fpga.out
// RUN: %{run} %t_spv_gpu_fpga.out

// No AOT-compiled image for GPU
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_fpga %t.o -o %t_spv_cpu_fpga.out
// RUN: %GPU_RUN_PLACEHOLDER %t_spv_cpu_fpga.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: %CPU_RUN_PLACEHOLDER %t_spv_cpu_fpga.out
// RUN: %ACC_RUN_PLACEHOLDER %t_spv_cpu_fpga.out
// RUN: %{run} %t_spv_cpu_fpga.out

// No AOT-compiled image for FPGA
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_spv_cpu_gpu.out
// RUN: %ACC_RUN_PLACEHOLDER %t_spv_cpu_gpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: %CPU_RUN_PLACEHOLDER %t_spv_cpu_gpu.out
// RUN: %GPU_RUN_PLACEHOLDER %t_spv_cpu_gpu.out
// RUN: %{run} %t_spv_cpu_gpu.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// UNSUPPORTED: cuda, hip

// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=%sycl_triple -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_simultaneously_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out %threads_lib
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.cpu.txt || true
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.cpu.txt
// RUN: %if cpu %{ %{run} %t.out &> %t.cpu.txt ; FileCheck %s --input-file %t.cpu.txt %}
//
// Since this is a multi-threaded application enable memory tracking and
// deferred release feature in the Level Zero plugin to avoid releasing memory
Expand All @@ -13,11 +12,12 @@
// release yet.
// Suppress runtime from printing out error messages, so that the test can
// match on assert message generated by the toolchains.
// RUN: env SYCL_PI_LEVEL_ZERO_TRACK_INDIRECT_ACCESS_MEMORY=1 SYCL_PI_SUPPRESS_ERROR_MESSAGE=1 %GPU_RUN_PLACEHOLDER %t.out &> %t.gpu.txt || true
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.gpu.txt

// DEFINE: %{gpu_env} = env SYCL_PI_LEVEL_ZERO_TRACK_INDIRECT_ACCESS_MEMORY=1 SYCL_PI_SUPPRESS_ERROR_MESSAGE=1
// RUN: %if gpu %{ %{gpu_env} %{run} %t.out &> %t.gpu.txt ; FileCheck %s --input-file %t.gpu.txt %}

// Shouldn't fail on ACC as fallback assert isn't enqueued there
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.acc.txt
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --check-prefix=CHECK-ACC --input-file %t.acc.txt
// RUN: %if acc %{ %{run} %t.out &> %t.acc.txt ; FileCheck %s --input-file %t.acc.txt %}
//
// CHECK: this message from file1
// CHECK-NOT: this message from file2
Expand Down
24 changes: 10 additions & 14 deletions sycl/test-e2e/BFloat16/bfloat16_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,34 @@
/// Check if bfloat16 example works using fallback libraries
///

// REQUIRES: opencl-aot, ocloc, cpu, gpu-intel-gen9
// REQUIRES: opencl-aot, ocloc, gpu-intel-gen9
// UNSUPPORTED: cuda
// CUDA is not compatible with SPIR.
// UNSUPPORTED: accelerator

// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-targets=spir64 %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device gen9" %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device *" %s -o %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %if gpu %{ %{run} %t.out %}

// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device gen9" %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen "-device gen9" %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %if cpu %{ %{run} %t.out %}

// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %if cpu %{ %{run} %t.out %}

#include <sycl/sycl.hpp>

Expand Down
8 changes: 4 additions & 4 deletions sycl/test-e2e/BFloat16/bfloat16_type.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: %if cuda %{%{build} -DUSE_CUDA_SM80=1 -Xsycl-target-backend --cuda-gpu-arch=sm_80 -o %t.out %}
// RUN: %if cuda %{%GPU_RUN_PLACEHOLDER %t.out %}
// RUN: %if ext_oneapi_cuda %{ %{run} %t.out %}
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

// TODO currently the feature isn't supported on FPGA.
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUNx: %ACC_RUN_PLACEHOLDER %t.out
// UNSUPPORTED: accelerator
//
// Not currently supported on HIP.
// UNSUPPORTED: hip
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Basic/alloc_pinned_host_memory.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// REQUIRES: level_zero || cuda

// RUN: %{build} -o %t2.out
// RUN: env SYCL_PI_TRACE=2 ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t2.out 2>&1 %GPU_L0_CHECK_PLACEHOLDER
// RUN: env SYCL_PI_TRACE=2 ZE_DEBUG=1 %{run} %t2.out %if ext_oneapi_level_zero %{ 2>&1 | FileCheck %s %}
// RUN: %{run} %t2.out

#include <sycl/sycl.hpp>
Expand Down
5 changes: 1 addition & 4 deletions sycl/test-e2e/Basic/stream/auto_flush.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// RUN: %{build} -o %t.out
// TODO: Enable on host when commands cleanup will be implemented in scheduler
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
// RUN: %GPU_RUN_ON_LINUX_PLACEHOLDER %t.out %GPU_CHECK_ON_LINUX_PLACEHOLDER
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
// RUN: %{run} %t.out %if !gpu || linux %{ | FileCheck %s %}
//
// XFAIL: hip_nvidia
//==-------------- copy.cpp - SYCL stream obect auto flushing test ---------==//
Expand Down
4 changes: 1 addition & 3 deletions sycl/test-e2e/Basic/stream/stream.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// RUN: %{build} -fsycl-device-code-split=per_kernel -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
// RUN: %GPU_RUN_ON_LINUX_PLACEHOLDER %t.out %GPU_CHECK_ON_LINUX_PLACEHOLDER
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
// RUN: %{run} %t.out %if !gpu || linux %{ | FileCheck %s %}

//==------------------ stream.cpp - SYCL stream basic test -----------------==//
//
Expand Down
4 changes: 1 addition & 3 deletions sycl/test-e2e/Basic/stream/stream_copies_buffer_sync.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// RUN: %{build} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
// RUN: %GPU_RUN_ON_LINUX_PLACEHOLDER %t.out %GPU_CHECK_ON_LINUX_PLACEHOLDER
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
// RUN: %{run} %t.out %if !gpu || linux %{ | FileCheck %s %}

#include <sycl/sycl.hpp>

Expand Down
4 changes: 1 addition & 3 deletions sycl/test-e2e/Basic/stream/stream_max_stmt_exceed.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// RUN: %{build} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
// RUN: %GPU_RUN_ON_LINUX_PLACEHOLDER %t.out %GPU_CHECK_ON_LINUX_PLACEHOLDER
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
// RUN: %{run} %t.out %if !gpu || linux %{ | FileCheck %s %}

#include <iostream>
#include <sycl/sycl.hpp>
Expand Down
5 changes: 2 additions & 3 deletions sycl/test-e2e/Config/env_vars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
//
// RUN: %{build} -O0 -o %t.out
//
// RUN: env SYCL_PROGRAM_COMPILE_OPTIONS="-g" %CPU_RUN_PLACEHOLDER %t.out
// RUN: env SYCL_PROGRAM_COMPILE_OPTIONS="-g" %GPU_RUN_PLACEHOLDER %t.out
// RUN: env SYCL_PROGRAM_COMPILE_OPTIONS="-g" %{run} %t.out
//
// Now test for invalid options to make sure they are really passed to
// a device compiler. Intel GPU runtime doesn't give an error for
// invalid options, so we don't test it here.
//
// RUN: env SYCL_PROGRAM_COMPILE_OPTIONS="-enable-link-options -cl-denorms-are-zero" SHOULD_CRASH=1 %CPU_RUN_PLACEHOLDER %t.out
// RUN: %if cpu %{ env SYCL_PROGRAM_COMPILE_OPTIONS="-enable-link-options -cl-denorms-are-zero" SHOULD_CRASH=1 %{run} %t.out %}

#include <cassert>
#include <memory>
Expand Down
7 changes: 2 additions & 5 deletions sycl/test-e2e/DeviceLib/cmath_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

// UNSUPPORTED: hip
// RUN: %{build} -fno-builtin %{mathflags} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %{build} -fno-builtin -fsycl-device-lib-jit-link %{mathflags} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %if !gpu %{ %{run} %t.out %}

#include "math_utils.hpp"
#include <cmath>
Expand Down
7 changes: 2 additions & 5 deletions sycl/test-e2e/DeviceLib/math_fp64_test.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// REQUIRES: aspect-fp64
// UNSUPPORTED: hip
// RUN: %{build} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-device-lib-jit-link %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %if !gpu %{ %{run} %t.out %}

#include "math_utils.hpp"
#include <cstdint>
Expand Down
7 changes: 2 additions & 5 deletions sycl/test-e2e/DeviceLib/math_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// UNSUPPORTED: hip
// RUN: %{build} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %{build} -fsycl-device-lib-jit-link -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %if !gpu %{ %{run} %t.out %}

#include "math_utils.hpp"
#include <cstdint>
Expand Down
7 changes: 2 additions & 5 deletions sycl/test-e2e/DeviceLib/string_test.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// UNSUPPORTED: hip
// RUN: %{build} -fno-builtin -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %{run} %t.out

// RUN: %{build} -fno-builtin -fsycl-device-lib-jit-link -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %if !gpu %{ %{run} %t.out %}

#include <cassert>
#include <cstdint>
Expand Down
4 changes: 1 addition & 3 deletions sycl/test-e2e/KernelAndProgram/build-log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

// RUN: %{build} -DGPU -o %t_gpu.out
// RUN: %{build} -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t_gpu.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out
// RUN: %{run} %if gpu %{ %t_gpu.out %} %else %{ %t.out %}
//
//==--- build-log.cpp - Test log message from faild build ----------==//
//
Expand Down
4 changes: 1 addition & 3 deletions sycl/test-e2e/KernelAndProgram/cache-build-result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

// RUN: %{build} -DSYCL_DISABLE_FALLBACK_ASSERT=1 -o %t.out
// RUN: %{build} -DSYCL_DISABLE_FALLBACK_ASSERT=1 -DGPU -o %t_gpu.out
// RUN: env SYCL_CACHE_PERSISTENT=1 %CPU_RUN_PLACEHOLDER %t.out
// RUN: env SYCL_CACHE_PERSISTENT=1 %GPU_RUN_PLACEHOLDER %t_gpu.out
// RUN: env SYCL_CACHE_PERSISTENT=1 %ACC_RUN_PLACEHOLDER %t.out
// RUN: env SYCL_CACHE_PERSISTENT=1 %{run} %if gpu %{ %t_gpu.out %} %else %{ %t.out %}

#include <sycl/sycl.hpp>

Expand Down
8 changes: 2 additions & 6 deletions sycl/test-e2e/Regression/barrier_with_work.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// RUN: %{build} -o %t.event_list.out
// RUN: %CPU_RUN_PLACEHOLDER %t.event_list.out
// RUN: env SYCL_PI_LEVEL_ZERO_USE_MULTIPLE_COMMANDLIST_BARRIERS=1 %GPU_RUN_PLACEHOLDER %t.event_list.out
// RUN: %ACC_RUN_PLACEHOLDER %t.event_list.out
// RUN: %if gpu %{ env SYCL_PI_LEVEL_ZERO_USE_MULTIPLE_COMMANDLIST_BARRIERS=1 %} %{run} %t.event_list.out
// RUN: %{build} -DUSE_QUEUE_WIDE_BARRIER -o %t.queue_wide.out
// RUN: %CPU_RUN_PLACEHOLDER %t.queue_wide.out
// RUN: env SYCL_PI_LEVEL_ZERO_USE_MULTIPLE_COMMANDLIST_BARRIERS=1 %GPU_RUN_PLACEHOLDER %t.queue_wide.out
// RUN: %ACC_RUN_PLACEHOLDER %t.queue_wide.out
// RUN: %if gpu %{ env SYCL_PI_LEVEL_ZERO_USE_MULTIPLE_COMMANDLIST_BARRIERS=1 %} %{run} %t.queue_wide.out
//
// Tests that barriers block all following execution on queues with active work.
// For L0 we currently need to set
Expand Down
11 changes: 10 additions & 1 deletion sycl/test-e2e/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,22 @@ def execute(self, test, litConfig):
cmd = directive.command.replace(
'%{run}',
'env ONEAPI_DEVICE_SELECTOR={} {}'.format(sycl_device, test.config.run_launcher))
# Expand device-specific condtions (%if ... %{ ... %}).
tmp_script = [ cmd ]
conditions = {x: True for x in sycl_device.split(':')}
for os in ['linux', 'windows']:
if os in test.config.available_features:
conditions[os] = True

tmp_script = lit.TestRunner.applySubstitutions(
tmp_script, [], conditions, recursion_limit=test.config.recursiveExpansionLimit)

new_script.append(
lit.TestRunner.CommandDirective(
directive.start_line_number,
directive.end_line_number,
directive.keyword,
cmd))
tmp_script[0]))
script = new_script

conditions = { feature: True for feature in test.config.available_features }
Expand Down