Skip to content

Commit df91a6b

Browse files
[SYCL][E2E] Introduce %{sycl_target_opts} substitution (#16614)
...and use it to pass `amd_arch` options to compilation only when compiling for AMD triples instead of unconditional usage in `%clangxx` substitution. That would avoid passing the option unnecessary when running `llvm-lit` with multiple target devices and a given test isn't supported for HIP. We might not have such configuration presently, but the same logic will be applied for "split" build/run of E2E tests and we'd definitely want to build tests for all the possible targets at once. Another use case for it is the "spirv backend" testing where we'd want to pass extra option for any compilations targeting spirv triple.
1 parent 0629c6c commit df91a6b

26 files changed

+55
-53
lines changed

sycl/test-e2e/Assert/assert_in_kernels_ndebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} -DNDEBUG %S/assert_in_kernels.cpp -o %t.out
1+
// RUN: %clangxx -fsycl %{sycl_target_opts} -DNDEBUG %S/assert_in_kernels.cpp -o %t.out
22
// RUN: %{run} %t.out | FileCheck %s
33
//
44
// CHECK-NOT: One shouldn't see this message

sycl/test-e2e/Assert/assert_in_multiple_tus_one_ndebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// XFAIL: (opencl && gpu)
1010
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/11364
1111

12-
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=%{sycl_triple} -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out
12+
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl %{sycl_target_opts} -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out
1313
// Shouldn't fail on ACC as fallback assert isn't enqueued there
1414
// RUN: %{run} %t.out &> %t.txt ; FileCheck %s --input-file %t.txt %if fpga %{ --check-prefix=CHECK-ACC %}
1515
//

sycl/test-e2e/Assert/assert_in_multiple_tus_one_ndebug_win.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: windows
2-
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=%{sycl_triple} -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out
2+
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl %{sycl_target_opts} -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out
33
// Shouldn't fail on ACC as fallback assert isn't enqueued there
44
// RUN: %{run} %t.out &> %t.txt ; FileCheck %s --input-file %t.txt %if fpga %{ --check-prefix=CHECK-ACC %}
55
//

sycl/test-e2e/Assert/assert_in_one_kernel_ndebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} -DNDEBUG %S/assert_in_one_kernel.cpp -o %t.out
1+
// RUN: %clangxx -fsycl %{sycl_target_opts} -DNDEBUG %S/assert_in_one_kernel.cpp -o %t.out
22
// RUN: %{run} %t.out | FileCheck %s
33
//
44
// CHECK-NOT: from assert statement

sycl/test-e2e/Assert/assert_in_simultaneously_multiple_tus_one_ndebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// XFAIL: (opencl && gpu)
66
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/11364
77
//
8-
// 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
8+
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl %{sycl_target_opts} -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_simultaneously_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out %threads_lib
99
// RUN: %if cpu %{ %{run} %t.out &> %t.cpu.txt ; FileCheck %s --input-file %t.cpu.txt %}
1010
//
1111
// Since this is a multi-threaded application enable memory tracking and

sycl/test-e2e/BFloat16/bfloat16_builtins.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// + below sm_80 always uses generic impls
66

77
// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}
8-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %if any-device-is-cuda %{ -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_80 %} %s -o %t.out %{mathflags}
8+
// RUN: %clangxx -fsycl %{sycl_target_opts} %if any-device-is-cuda %{ -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_80 %} %s -o %t.out %{mathflags}
99
// RUN: %{run} %t.out
1010

1111
// Test "new" (ABI breaking) for all platforms ( sm_80/native if CUDA )
12-
// RUN: %if preview-breaking-changes-supported %{ %clangxx -fsycl -fpreview-breaking-changes -fsycl-targets=%{sycl_triple} %if any-device-is-cuda %{ -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_80 %} %s -o %t2.out %{mathflags} %}
12+
// RUN: %if preview-breaking-changes-supported %{ %clangxx -fsycl -fpreview-breaking-changes %{sycl_target_opts} %if any-device-is-cuda %{ -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_80 %} %s -o %t2.out %{mathflags} %}
1313
// RUN: %if preview-breaking-changes-supported %{ %{run} %t2.out %}
1414

1515
#include "bfloat16_builtins.hpp"

sycl/test-e2e/BFloat16/bfloat16_builtins_cuda_generic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}
88

99
// If CUDA, test "new" again for sm_75/generic
10-
// RUN: %if any-device-is-cuda %{ %if preview-breaking-changes-supported %{ %clangxx -fsycl -fpreview-breaking-changes -fsycl-targets=%{sycl_triple} -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_75 %s -o %t3.out %{mathflags} %} %}
10+
// RUN: %if any-device-is-cuda %{ %if preview-breaking-changes-supported %{ %clangxx -fsycl -fpreview-breaking-changes %{sycl_target_opts} -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_75 %s -o %t3.out %{mathflags} %} %}
1111
// RUN: %if any-device-is-cuda %{ %if preview-breaking-changes-supported %{ %{run} %t3.out %} %}
1212

1313
#include "bfloat16_builtins.hpp"

sycl/test-e2e/Basic/multisource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
// Separate kernel sources and host code sources
1010
// RUN: %{build} -c -o %t.kernel.o -DINIT_KERNEL -DCALC_KERNEL
1111
// RUN: %{build} -c -o %t.main.o -DMAIN_APP
12-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %t.kernel.o %t.main.o -Wno-unused-command-line-argument -o %t1.fat
12+
// RUN: %clangxx -fsycl %{sycl_target_opts} %t.kernel.o %t.main.o -Wno-unused-command-line-argument -o %t1.fat
1313
// RUN: %{run} %t1.fat
1414

1515
// Multiple sources with kernel code
1616
// RUN: %{build} -c -o %t.init.o -DINIT_KERNEL
1717
// RUN: %{build} -c -o %t.calc.o -DCALC_KERNEL
1818
// RUN: %{build} -c -o %t.main.o -DMAIN_APP
19-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %t.init.o %t.calc.o %t.main.o -Wno-unused-command-line-argument -o %t2.fat
19+
// RUN: %clangxx -fsycl %{sycl_target_opts} %t.init.o %t.calc.o %t.main.o -Wno-unused-command-line-argument -o %t2.fat
2020
// RUN: %{run} %t2.fat
2121

2222
#include <sycl/detail/core.hpp>

sycl/test-e2e/Basic/multisource_spv_obj.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
// Separate kernel sources and host code sources
1212
// RUN: %{build} -fsycl-device-obj=spirv -c -o %t.kernel.o -DINIT_KERNEL -DCALC_KERNEL
1313
// RUN: %{build} -fsycl-device-obj=spirv -c -o %t.main.o -DMAIN_APP
14-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %t.kernel.o %t.main.o -Wno-unused-command-line-argument -o %t1.fat
14+
// RUN: %clangxx -fsycl %{sycl_target_opts} %t.kernel.o %t.main.o -Wno-unused-command-line-argument -o %t1.fat
1515
// RUN: %{run} %t1.fat
1616

1717
// Multiple sources with kernel code
1818
// RUN: %{build} -fsycl-device-obj=spirv -c -o %t.init.o -DINIT_KERNEL
1919
// RUN: %{build} -fsycl-device-obj=spirv -c -o %t.calc.o -DCALC_KERNEL
2020
// RUN: %{build} -fsycl-device-obj=spirv -c -o %t.main.o -DMAIN_APP
21-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %t.init.o %t.calc.o %t.main.o -Wno-unused-command-line-argument -o %t2.fat
21+
// RUN: %clangxx -fsycl %{sycl_target_opts} %t.init.o %t.calc.o %t.main.o -Wno-unused-command-line-argument -o %t2.fat
2222
// RUN: %{run} %t2.fat
2323

2424
// Multiple sources with kernel code, mixed SPIR-V and LLVM-IR objects
2525
// RUN: %{build} -fsycl-device-obj=spirv -c -o %t.init.o -DINIT_KERNEL
2626
// RUN: %{build} -fsycl-device-obj=llvmir -c -o %t.calc.o -DCALC_KERNEL
2727
// RUN: %{build} -c -o %t.main.o -DMAIN_APP
28-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} %t.init.o %t.calc.o %t.main.o -Wno-unused-command-line-argument -o %t3.fat
28+
// RUN: %clangxx -fsycl %{sycl_target_opts} %t.init.o %t.calc.o %t.main.o -Wno-unused-command-line-argument -o %t3.fat
2929
// RUN: %{run} %t3.fat
3030

3131
#include <sycl/detail/core.hpp>

sycl/test-e2e/DeviceImageDependencies/dynamic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// RUN: %clangxx %{dynamic_lib_options} %S/Inputs/b.cpp %if windows %{%T/libdevice_c.lib%} -o %T/libdevice_b.%{dynamic_lib_suffix}
1111
// RUN: %clangxx %{dynamic_lib_options} %S/Inputs/a.cpp %if windows %{%T/libdevice_b.lib%} -o %T/libdevice_a.%{dynamic_lib_suffix}
1212

13-
// RUN: %clangxx -fsycl -fsycl-targets=%{sycl_triple} -fsycl-allow-device-image-dependencies -fsycl-device-code-split=per_kernel %S/Inputs/basic.cpp -o %t.out \
13+
// RUN: %clangxx -fsycl %{sycl_target_opts} -fsycl-allow-device-image-dependencies -fsycl-device-code-split=per_kernel %S/Inputs/basic.cpp -o %t.out \
1414
// RUN: %if windows \
1515
// RUN: %{%T/libdevice_a.lib%} \
1616
// RUN: %else \

0 commit comments

Comments
 (0)