Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 25298dc

Browse files
author
sergei
authored
[SYCL] Fix tests for assert (#332)
1 parent 0d30e9f commit 25298dc

File tree

10 files changed

+55
-21
lines changed

10 files changed

+55
-21
lines changed

SYCL/AOT/multiple-devices.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// REQUIRES: opencl-aot, ocloc, aoc, cpu, gpu, accelerator
9+
// REQUIRES: opencl-aot, ocloc, aoc, cpu, gpu, accelerator, llvm-link, llvm-spirv
1010
// UNSUPPORTED: cuda
1111
// CUDA is not compatible with SPIR.
1212

@@ -18,11 +18,19 @@
1818
// RUN: %GPU_RUN_PLACEHOLDER %t_all.out
1919
// RUN: %ACC_RUN_PLACEHOLDER %t_all.out
2020

21+
// FIXME: Change the behavior when proper automation for assert support is
22+
// introduced
2123
// Produce object file, spirv, device images to combine these differently
2224
// at link-time, thus testing various AOT-compiled images configurations
2325
// RUN: %clangxx -fsycl %S/Inputs/aot.cpp -c -o %t.o
2426
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64-unknown-unknown-sycldevice %t.o -o %t.spv
2527
// AOT-compile device binary images
28+
// Neither of AOT tools can compile several files, hence, here is this
29+
// workaround
30+
// RUN: %llvm_spirv -r %sycl_libs_dir/libsycl-fallback-cassert.spv -o=%T/fallback-cassert.bc
31+
// RUN: %llvm_spirv -r %t.spv -o=%t.bc
32+
// RUN: %llvm_link %t.bc %T/fallback-cassert.bc -o=%t2.bc
33+
// RUN: %llvm_spirv %t2.bc -o=%t.spv
2634
// RUN: opencl-aot %t.spv -o=%t_cpu.ir --device=cpu
2735
// RUN: ocloc -file %t.spv -spirv_input -output %t_gen.out -output_no_suffix -device cfl
2836
// RUN: aoc %t.spv -o %t_fpga.aocx -sycl -dep-files=%t.d

SYCL/Basic/device_code_dae.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// driver
33
// UNSUPPORTED: cuda
44
// CUDA does not support SPIR-V.
5-
// RUN: %clangxx -fsycl-device-only -Xclang -fenable-sycl-dae -Xclang -fsycl-int-header=int_header.h %s -c -o device_code.bc -Wno-sycl-strict
6-
// RUN: %clangxx %cxx_std_optionc++17 %include_option int_header.h %debug_option -c %s -o host_code.o %sycl_options -Wno-sycl-strict
5+
// FIXME Disabled fallback assert as it'll require either online linking or
6+
// explicit offline linking step here
7+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -fsycl-device-only -Xclang -fenable-sycl-dae -Xclang -fsycl-int-header=int_header.h %s -c -o device_code.bc -Wno-sycl-strict
8+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT %cxx_std_optionc++17 %include_option int_header.h %debug_option -c %s -o host_code.o %sycl_options -Wno-sycl-strict
79
// RUN: llvm-link -o=linked_device_code.bc device_code.bc
810
// RUN: sycl-post-link -emit-param-info linked_device_code.bc
911
// RUN: llvm-spirv -o linked_device_code.spv linked_device_code.bc

SYCL/Basic/fpga_tests/fpga_aocx.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
/// E2E test for AOCX creation/use/run for FPGA
1212
// Produce an archive with device (AOCX) image. To avoid appending objects to
1313
// leftover archives, remove one if exists.
14+
// FIXME Disabled use of devicelib by assert feature until the 2-step build gets
15+
// fixed.
1416
// RUN: rm %t_image.a || true
15-
// RUN: %clangxx -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.a
17+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.a
1618
// Produce a host object
17-
// RUN: %clangxx -fsycl -fintelfpga %S/Inputs/fpga_host.cpp -c -o %t.o
19+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %S/Inputs/fpga_host.cpp -c -o %t.o
1820

1921
// AOCX with source
20-
// RUN: %clangxx -fsycl -fintelfpga %S/Inputs/fpga_host.cpp %t_image.a -o %t_aocx_src.out
22+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %S/Inputs/fpga_host.cpp %t_image.a -o %t_aocx_src.out
2123
// AOCX with object
22-
// RUN: %clangxx -fsycl -fintelfpga %t.o %t_image.a -o %t_aocx_obj.out
24+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %t.o %t_image.a -o %t_aocx_obj.out
2325
//
2426
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_src.out
2527
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_obj.out

SYCL/Basic/fpga_tests/fpga_aocx_win.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
/// E2E test for AOCX creation/use/run for FPGA
1313
// Produce an archive with device (AOCX) image. To avoid appending objects to
1414
// leftover archives, remove one if exists.
15+
// FIXME Disabled use of devicelib by assert feature until the 2-step build gets
16+
// fixed.
1517
// RUN: rm %t_image.a || true
16-
// RUN: %clangxx -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.lib
18+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.lib
1719
// Produce a host object
18-
// RUN: %clangxx -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp -c -o %t.obj
20+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp -c -o %t.obj
1921

2022
// AOCX with source
21-
// RUN: %clangxx -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp %t_image.lib -o %t_aocx_src.out
23+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp %t_image.lib -o %t_aocx_src.out
2224
// AOCX with object
23-
// RUN: %clangxx -fsycl -fintelfpga %t.obj %t_image.lib -o %t_aocx_obj.out
25+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %t.obj %t_image.lib -o %t_aocx_obj.out
2426
//
2527
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_src.out
2628
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_obj.out

SYCL/Config/kernel_from_file.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// UNSUPPORTED: cuda
22
// CUDA does not support SPIR-V.
33

4-
// RUN: %clangxx %cxx_std_optionc++17 -fsycl-device-only -fno-sycl-use-bitcode -Xclang -fsycl-int-header=%t.h -c %s -o %t.spv -Xclang -verify-ignore-unexpected=note,warning -Wno-sycl-strict
5-
// RUN: %clangxx %cxx_std_optionc++17 %include_option %t.h %s -o %t.out %sycl_options -Xclang -verify-ignore-unexpected=note,warning
4+
// FIXME Disabled fallback assert as it'll require either online linking or
5+
// explicit offline linking step here
6+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT %cxx_std_optionc++17 -fsycl-device-only -fno-sycl-use-bitcode -Xclang -fsycl-int-header=%t.h -c %s -o %t.spv -Xclang -verify-ignore-unexpected=note,warning -Wno-sycl-strict
7+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT %cxx_std_optionc++17 %include_option %t.h %s -o %t.out %sycl_options -Xclang -verify-ignore-unexpected=note,warning
68
// RUN: %BE_RUN_PLACEHOLDER env SYCL_USE_KERNEL_SPV=%t.spv %t.out | FileCheck %s
79
// CHECK: Passed
810

SYCL/DeviceLib/assert-aot.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// REQUIRES: opencl-aot, cpu, linux
1+
// REQUIRES: opencl-aot, cpu, linux, UNSUPPORTED
2+
// FIXME re-enable after intel/llvm#3767 is merged
23

34
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/assert.cpp -o %t.aot.out
4-
// RUN: %CPU_RUN_PLACEHOLDER %t.aot.out >%t.aot.msg
5+
// RUN: %CPU_RUN_PLACEHOLDER EXPECTED_SIGNAL=SIGABRT SHOULD_CRASH=1 %t.aot.out 2>%t.aot.msg
56
// RUN: FileCheck %S/assert.cpp --input-file %t.aot.msg --check-prefixes=CHECK-MESSAGE

SYCL/ESIMD/spec_const_redefine_esimd.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// TODO enable on Windows
22
// REQUIRES: linux && gpu
3-
// RUN: %clangxx -fsycl %s -o %t.out
3+
// FIXME Disable fallback assert so that it doesn't interferes with number of
4+
// program builds at run-time
5+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -fsycl %s -o %t.out
46
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
57
// UNSUPPORTED: cuda
68

SYCL/SeparateCompile/test.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
// UNSUPPORTED: cuda
22
// CUDA does not support SPIR-V.
33
//
4+
// FIXME Disabled fallback assert as it'll require either online linking or
5+
// explicit offline linking step here
46
// >> ---- compile src1
57
// >> device compilation...
6-
// RUN: %clangxx -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_a.h %s -c -o a_kernel.bc -Wno-sycl-strict
8+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_a.h %s -c -o a_kernel.bc -Wno-sycl-strict
79
// >> host compilation...
8-
// RUN: %clangxx %cxx_std_optionc++17 %include_option sycl_ihdr_a.h %debug_option -c %s -o a.o %sycl_options -Wno-sycl-strict
10+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT %cxx_std_optionc++17 %include_option sycl_ihdr_a.h %debug_option -c %s -o a.o %sycl_options -Wno-sycl-strict
911
//
1012
// >> ---- compile src2
1113
// >> device compilation...
12-
// RUN: %clangxx -DB_CPP=1 -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_b.h %s -c -o b_kernel.bc -Wno-sycl-strict
14+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -DB_CPP=1 -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_b.h %s -c -o b_kernel.bc -Wno-sycl-strict
1315
// >> host compilation...
14-
// RUN: %clangxx -DB_CPP=1 %cxx_std_optionc++17 %include_option sycl_ihdr_b.h %debug_option -c %s -o b.o %sycl_options -Wno-sycl-strict
16+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -DB_CPP=1 %cxx_std_optionc++17 %include_option sycl_ihdr_b.h %debug_option -c %s -o b.o %sycl_options -Wno-sycl-strict
1517
//
1618
// >> ---- bundle .o with .spv
1719
// >> run bundler

SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// UNSUPPORTED: cuda
22
//
3-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3+
// FIXME Disable fallback assert so that it doesn't interferes with number of
4+
// program builds at run-time
5+
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
46
// RUN: %HOST_RUN_PLACEHOLDER %t.out
57
// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER
68
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER

SYCL/lit.cfg.py

+11
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,17 @@
281281
if find_executable('sycl-ls'):
282282
config.available_features.add('sycl-ls')
283283

284+
llvm_tools = ["llvm-spirv", "llvm-link"]
285+
for llvm_tool in llvm_tools:
286+
llvm_tool_path = find_executable(llvm_tool)
287+
if llvm_tool_path:
288+
lit_config.note("Found " + llvm_tool)
289+
config.available_features.add(llvm_tool)
290+
config.substitutions.append( ('%' + llvm_tool.replace('-', '_'),
291+
os.path.realpath(llvm_tool_path)) )
292+
else:
293+
lit_config.warning("Can't find " + llvm_tool)
294+
284295
# Device AOT compilation tools aren't part of the SYCL project,
285296
# so they need to be pre-installed on the machine
286297
aot_tools = ["ocloc", "aoc", "opencl-aot"]

0 commit comments

Comments
 (0)