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

[SYCL] Fix tests for assert #332

Merged
merged 19 commits into from
Jul 12, 2021
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
10 changes: 9 additions & 1 deletion SYCL/AOT/multiple-devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

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

Expand All @@ -18,11 +18,19 @@
// RUN: %GPU_RUN_PLACEHOLDER %t_all.out
// RUN: %ACC_RUN_PLACEHOLDER %t_all.out

// FIXME: Change the behavior when proper automation for assert support is
// introduced
Comment on lines +21 to +22

Choose a reason for hiding this comment

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

Will it be fixed by intel/llvm#3767 ?

Copy link
Author

Choose a reason for hiding this comment

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

Per offline discussion, agreed to elaborate on the comment in distinct patch.

// Produce object file, spirv, device images to combine these differently
// at link-time, thus testing various AOT-compiled images configurations
// RUN: %clangxx -fsycl %S/Inputs/aot.cpp -c -o %t.o
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64-unknown-unknown-sycldevice %t.o -o %t.spv
// AOT-compile device binary images
// Neither of AOT tools can compile several files, hence, here is this
// workaround
// RUN: %llvm_spirv -r %sycl_libs_dir/libsycl-fallback-cassert.spv -o=%T/fallback-cassert.bc
// RUN: %llvm_spirv -r %t.spv -o=%t.bc
// RUN: %llvm_link %t.bc %T/fallback-cassert.bc -o=%t2.bc
// RUN: %llvm_spirv %t2.bc -o=%t.spv
// RUN: opencl-aot %t.spv -o=%t_cpu.ir --device=cpu
// RUN: ocloc -file %t.spv -spirv_input -output %t_gen.out -output_no_suffix -device cfl
// RUN: aoc %t.spv -o %t_fpga.aocx -sycl -dep-files=%t.d
Expand Down
6 changes: 4 additions & 2 deletions SYCL/Basic/device_code_dae.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// driver
// UNSUPPORTED: cuda
// CUDA does not support SPIR-V.
// 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
// RUN: %clangxx %cxx_std_optionc++17 %include_option int_header.h %debug_option -c %s -o host_code.o %sycl_options -Wno-sycl-strict
// FIXME Disabled fallback assert as it'll require either online linking or
// explicit offline linking step here

Choose a reason for hiding this comment

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

Why not to add explicit offline linking like in previous test?

Copy link
Author

Choose a reason for hiding this comment

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

Per offline discussion, agreed to add offline linking to this test in distinct patch.

// 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
// 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
// RUN: llvm-link -o=linked_device_code.bc device_code.bc
// RUN: sycl-post-link -emit-param-info linked_device_code.bc
// RUN: llvm-spirv -o linked_device_code.spv linked_device_code.bc
Expand Down
10 changes: 6 additions & 4 deletions SYCL/Basic/fpga_tests/fpga_aocx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@
/// E2E test for AOCX creation/use/run for FPGA
// Produce an archive with device (AOCX) image. To avoid appending objects to
// leftover archives, remove one if exists.
// FIXME Disabled use of devicelib by assert feature until the 2-step build gets
// fixed.
Comment on lines +14 to +15

Choose a reason for hiding this comment

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

Will it be fixed by intel/llvm#3767 ?

Copy link
Author

Choose a reason for hiding this comment

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

This one won't be fixed by intel/llvm#3767. There's an issue in driver which isn't connected to intel/llvm#3767. The issue can be encountered when using any devicelib function and compiling the same way it's done in this test. @mdtoguchi is aware of the issue.

// RUN: rm %t_image.a || true
// RUN: %clangxx -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.a
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.a
// Produce a host object
// RUN: %clangxx -fsycl -fintelfpga %S/Inputs/fpga_host.cpp -c -o %t.o
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %S/Inputs/fpga_host.cpp -c -o %t.o

// AOCX with source
// RUN: %clangxx -fsycl -fintelfpga %S/Inputs/fpga_host.cpp %t_image.a -o %t_aocx_src.out
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %S/Inputs/fpga_host.cpp %t_image.a -o %t_aocx_src.out
// AOCX with object
// RUN: %clangxx -fsycl -fintelfpga %t.o %t_image.a -o %t_aocx_obj.out
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %t.o %t_image.a -o %t_aocx_obj.out
//
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_src.out
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_obj.out
10 changes: 6 additions & 4 deletions SYCL/Basic/fpga_tests/fpga_aocx_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
/// E2E test for AOCX creation/use/run for FPGA
// Produce an archive with device (AOCX) image. To avoid appending objects to
// leftover archives, remove one if exists.
// FIXME Disabled use of devicelib by assert feature until the 2-step build gets
// fixed.
// RUN: rm %t_image.a || true
// RUN: %clangxx -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.lib
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -fsycl-link=image %S/Inputs/fpga_device.cpp -o %t_image.lib
// Produce a host object
// RUN: %clangxx -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp -c -o %t.obj
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp -c -o %t.obj

// AOCX with source
// RUN: %clangxx -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp %t_image.lib -o %t_aocx_src.out
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga -DHOST_PART %S/Inputs/fpga_host.cpp %t_image.lib -o %t_aocx_src.out
// AOCX with object
// RUN: %clangxx -fsycl -fintelfpga %t.obj %t_image.lib -o %t_aocx_obj.out
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT=1 -fsycl -fintelfpga %t.obj %t_image.lib -o %t_aocx_obj.out
//
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_src.out
// RUN: %ACC_RUN_PLACEHOLDER %t_aocx_obj.out
6 changes: 4 additions & 2 deletions SYCL/Config/kernel_from_file.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// UNSUPPORTED: cuda
// CUDA does not support SPIR-V.

// 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
// RUN: %clangxx %cxx_std_optionc++17 %include_option %t.h %s -o %t.out %sycl_options -Xclang -verify-ignore-unexpected=note,warning
// FIXME Disabled fallback assert as it'll require either online linking or
// explicit offline linking step here
// 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
// 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
// RUN: %BE_RUN_PLACEHOLDER env SYCL_USE_KERNEL_SPV=%t.spv %t.out | FileCheck %s
// CHECK: Passed

Expand Down
5 changes: 3 additions & 2 deletions SYCL/DeviceLib/assert-aot.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// REQUIRES: opencl-aot, cpu, linux
// REQUIRES: opencl-aot, cpu, linux, UNSUPPORTED
// FIXME re-enable after intel/llvm#3767 is merged

// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/assert.cpp -o %t.aot.out
// RUN: %CPU_RUN_PLACEHOLDER %t.aot.out >%t.aot.msg
// RUN: %CPU_RUN_PLACEHOLDER EXPECTED_SIGNAL=SIGABRT SHOULD_CRASH=1 %t.aot.out 2>%t.aot.msg
// RUN: FileCheck %S/assert.cpp --input-file %t.aot.msg --check-prefixes=CHECK-MESSAGE
4 changes: 3 additions & 1 deletion SYCL/ESIMD/spec_const_redefine_esimd.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// TODO enable on Windows
// REQUIRES: linux && gpu
// RUN: %clangxx -fsycl %s -o %t.out
// FIXME Disable fallback assert so that it doesn't interferes with number of
// program builds at run-time
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -fsycl %s -o %t.out
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
// UNSUPPORTED: cuda

Expand Down
10 changes: 6 additions & 4 deletions SYCL/SeparateCompile/test.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// UNSUPPORTED: cuda
// CUDA does not support SPIR-V.
//
// FIXME Disabled fallback assert as it'll require either online linking or
// explicit offline linking step here
// >> ---- compile src1
// >> device compilation...
// RUN: %clangxx -fsycl-device-only -Xclang -fsycl-int-header=sycl_ihdr_a.h %s -c -o a_kernel.bc -Wno-sycl-strict
// 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
// >> host compilation...
// RUN: %clangxx %cxx_std_optionc++17 %include_option sycl_ihdr_a.h %debug_option -c %s -o a.o %sycl_options -Wno-sycl-strict
// 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
//
// >> ---- compile src2
// >> device compilation...
// 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
// 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
// >> host compilation...
// 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
// 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
//
// >> ---- bundle .o with .spv
// >> run bundler
Expand Down
4 changes: 3 additions & 1 deletion SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// UNSUPPORTED: cuda
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// FIXME Disable fallback assert so that it doesn't interferes with number of
// program builds at run-time
// RUN: %clangxx -DSYCL_DISABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %HOST_RUN_PLACEHOLDER %t.out
// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out 2>&1 %CPU_CHECK_PLACEHOLDER
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
Expand Down
11 changes: 11 additions & 0 deletions SYCL/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,17 @@
if find_executable('sycl-ls'):
config.available_features.add('sycl-ls')

llvm_tools = ["llvm-spirv", "llvm-link"]
for llvm_tool in llvm_tools:
llvm_tool_path = find_executable(llvm_tool)
if llvm_tool_path:
lit_config.note("Found " + llvm_tool)
config.available_features.add(llvm_tool)
config.substitutions.append( ('%' + llvm_tool.replace('-', '_'),
os.path.realpath(llvm_tool_path)) )
else:
lit_config.warning("Can't find " + llvm_tool)

# Device AOT compilation tools aren't part of the SYCL project,
# so they need to be pre-installed on the machine
aot_tools = ["ocloc", "aoc", "opencl-aot"]
Expand Down