From 9ed02471e84cc409045d1b234b4afe778bd9fb39 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Mon, 28 Jun 2021 18:15:08 +0300 Subject: [PATCH 01/16] Fix kernel_from_file test Signed-off-by: Sergey Kanaev --- SYCL/Config/kernel_from_file.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SYCL/Config/kernel_from_file.cpp b/SYCL/Config/kernel_from_file.cpp index 9d5b4ff8f9..8ad438fcda 100644 --- a/SYCL/Config/kernel_from_file.cpp +++ b/SYCL/Config/kernel_from_file.cpp @@ -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 From ece468c757c41b46b22ad512dd7fd48c8b9d2e25 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Mon, 28 Jun 2021 19:29:40 +0300 Subject: [PATCH 02/16] Fix Basic/device_code_dae.cpp Signed-off-by: Sergey Kanaev --- SYCL/Basic/device_code_dae.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SYCL/Basic/device_code_dae.cpp b/SYCL/Basic/device_code_dae.cpp index 62878c67d3..c511c54f8e 100644 --- a/SYCL/Basic/device_code_dae.cpp +++ b/SYCL/Basic/device_code_dae.cpp @@ -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 +// 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 From 2d9136fd66e7840cd3fc6588cef38415b5e943d2 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Mon, 28 Jun 2021 20:00:31 +0300 Subject: [PATCH 03/16] Fix SYCL/SeparateCompile/test.cpp Signed-off-by: Sergey Kanaev --- SYCL/SeparateCompile/test.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SYCL/SeparateCompile/test.cpp b/SYCL/SeparateCompile/test.cpp index 64a6291bec..0fa09fe51d 100644 --- a/SYCL/SeparateCompile/test.cpp +++ b/SYCL/SeparateCompile/test.cpp @@ -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 @@ -33,7 +35,7 @@ // RUN: clang-offload-wrapper -o wrapper.bc -host=x86_64 -kind=sycl -target=spir64 app.spv // // >> compile .bc to .o -// RUN: %clangxx -c wrapper.bc -o wrapper.o +// RUN: %clangxx SYCL_DISABLE_FALLBACK_ASSERT -c wrapper.bc -o wrapper.o // // >> ---- link the full hetero app // RUN: %clangxx wrapper.o a.o b.o -o app.exe %sycl_options From 4b701aac84fcad13b10503d1eb885b7afffbc3e2 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Mon, 28 Jun 2021 22:31:53 +0300 Subject: [PATCH 04/16] Remove redundant change Signed-off-by: Sergey Kanaev --- SYCL/SeparateCompile/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/SeparateCompile/test.cpp b/SYCL/SeparateCompile/test.cpp index 0fa09fe51d..f3b7caf271 100644 --- a/SYCL/SeparateCompile/test.cpp +++ b/SYCL/SeparateCompile/test.cpp @@ -35,7 +35,7 @@ // RUN: clang-offload-wrapper -o wrapper.bc -host=x86_64 -kind=sycl -target=spir64 app.spv // // >> compile .bc to .o -// RUN: %clangxx SYCL_DISABLE_FALLBACK_ASSERT -c wrapper.bc -o wrapper.o +// RUN: %clangxx -c wrapper.bc -o wrapper.o // // >> ---- link the full hetero app // RUN: %clangxx wrapper.o a.o b.o -o app.exe %sycl_options From 4cafe7430fc314f712b7afd91fb503ade15e0f14 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 1 Jul 2021 15:29:23 +0300 Subject: [PATCH 05/16] Add fallback cassert to multiple devices test Signed-off-by: Sergey Kanaev --- SYCL/AOT/multiple-devices.cpp | 9 ++++++++- SYCL/lit.cfg.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index f7ac3d8969..1dae7c0c5d 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -18,12 +18,19 @@ // RUN: %GPU_RUN_PLACEHOLDER %t_all.out // RUN: %ACC_RUN_PLACEHOLDER %t_all.out +// FIXME: Change the behaviour when proper automaton for assert support is +// introduced // 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 -// RUN: opencl-aot %t.spv -o=%t_cpu.ir --device=cpu +// RUN: opencl-aot %sycl_libs_dir/libsycl-fallback-cassert.spv %t.spv -o=%t_cpu.ir --device=cpu +// neither ocloc nor aoc 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: 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 diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 4b438d2796..7e94bf3ddd 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -281,6 +281,20 @@ if find_executable('sycl-ls'): config.available_features.add('sycl-ls') +llvm_spirv_path = find_executable("llvm-spirv") +if llvm_spirv_path: + lit_config.note("Found llvm-spirv") + config.substitutions.append( ('%LLVM_SPIRV', os.path.realpath(llvm_spirv_path)) ) +else: + lit_config.warning("Can't find llvm_spirv") + +llvm_link_path = find_executable("llvm-link") +if llvm_link_path: + lit_config.note("Found llvm-link") + config.substitutions.append( ('%LLVM_LINK', os.path.realpath(llvm_link_path)) ) +else: + lit_config.warning("Can't find llvm-link") + # 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"] From f423606175a5fe7aa588b802cae149e255a0be59 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 1 Jul 2021 16:01:36 +0300 Subject: [PATCH 06/16] Fix style issue Signed-off-by: Sergey Kanaev --- SYCL/AOT/multiple-devices.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index 1dae7c0c5d..518d34a1b4 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -26,7 +26,8 @@ // RUN: %clangxx -fsycl -fsycl-link-targets=spir64-unknown-unknown-sycldevice %t.o -o %t.spv // AOT-compile device binary images // RUN: opencl-aot %sycl_libs_dir/libsycl-fallback-cassert.spv %t.spv -o=%t_cpu.ir --device=cpu -// neither ocloc nor aoc can compile several files, hence, here is this workaround +// neither ocloc nor aoc 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 From 435ba2e66479771eeede019416b01900b6061eac Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 1 Jul 2021 17:58:46 +0300 Subject: [PATCH 07/16] Add fallback cassert to multiple devices test Signed-off-by: Sergey Kanaev --- SYCL/AOT/multiple-devices.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index 1dae7c0c5d..bd4e1d54d1 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -25,12 +25,13 @@ // 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 -// RUN: opencl-aot %sycl_libs_dir/libsycl-fallback-cassert.spv %t.spv -o=%t_cpu.ir --device=cpu -// neither ocloc nor aoc can compile several files, hence, here is this workaround +// 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 %sycl_libs_dir/libsycl-fallback-cassert.spv %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 From afc916e4a95ee287105f72b2d7f94e5f317f1064 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 1 Jul 2021 21:29:43 +0300 Subject: [PATCH 08/16] Fix multiple-devices.cpp Signed-off-by: Sergey Kanaev --- SYCL/AOT/multiple-devices.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index bd4e1d54d1..2c9f891dff 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -31,7 +31,7 @@ // 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 %sycl_libs_dir/libsycl-fallback-cassert.spv %t.spv -o=%t_cpu.ir --device=cpu +// 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 From 4f2c738023c89146e546d181ed3f9806f5aae6b9 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 2 Jul 2021 12:12:06 +0300 Subject: [PATCH 09/16] Fix and disable assert-aot.cpp test until intel/llvm#3767 merged Signed-off-by: Sergey Kanaev --- SYCL/DeviceLib/assert-aot.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SYCL/DeviceLib/assert-aot.cpp b/SYCL/DeviceLib/assert-aot.cpp index 811f174b39..142384fba7 100644 --- a/SYCL/DeviceLib/assert-aot.cpp +++ b/SYCL/DeviceLib/assert-aot.cpp @@ -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 From 32822d088c8150499032676ec74958084bea7b1e Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 2 Jul 2021 16:38:21 +0300 Subject: [PATCH 10/16] Disable fallback assert in spec const test to not interfere with number of program builds Signed-off-by: Sergey Kanaev --- SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp b/SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp index 19151bee6f..cc0b5d9e82 100644 --- a/SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp +++ b/SYCL/SpecConstants/1.2.1/spec_const_redefine.cpp @@ -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 From edc96e952874a996b5e56a37ed8993d8b2368ded Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Fri, 2 Jul 2021 16:53:36 +0300 Subject: [PATCH 11/16] Disable fallback assert in spec const test to not interfere with number of program builds Signed-off-by: Sergey Kanaev --- SYCL/ESIMD/spec_const_redefine_esimd.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SYCL/ESIMD/spec_const_redefine_esimd.cpp b/SYCL/ESIMD/spec_const_redefine_esimd.cpp index 6c3cdca90b..a2ae9806a5 100755 --- a/SYCL/ESIMD/spec_const_redefine_esimd.cpp +++ b/SYCL/ESIMD/spec_const_redefine_esimd.cpp @@ -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 From 69fa232da9521f3d10dd8ac7432c77982aafa5f3 Mon Sep 17 00:00:00 2001 From: sergei Date: Tue, 6 Jul 2021 09:15:10 +0300 Subject: [PATCH 12/16] Update SYCL/lit.cfg.py Co-authored-by: Dmitry Vodopyanov --- SYCL/lit.cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 7e94bf3ddd..077d98de34 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -286,7 +286,7 @@ lit_config.note("Found llvm-spirv") config.substitutions.append( ('%LLVM_SPIRV', os.path.realpath(llvm_spirv_path)) ) else: - lit_config.warning("Can't find llvm_spirv") + lit_config.warning("Can't find llvm-spirv") llvm_link_path = find_executable("llvm-link") if llvm_link_path: From 075373cbe4a327eb87dbbce31fd0134e36686196 Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Tue, 6 Jul 2021 09:25:43 +0300 Subject: [PATCH 13/16] Disabled use of devicelib by fallback assert in fpga_aocx tests until fixed Signed-off-by: Sergey Kanaev --- SYCL/Basic/fpga_tests/fpga_aocx.cpp | 10 ++++++---- SYCL/Basic/fpga_tests/fpga_aocx_win.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/SYCL/Basic/fpga_tests/fpga_aocx.cpp b/SYCL/Basic/fpga_tests/fpga_aocx.cpp index a01331c50d..5227027091 100644 --- a/SYCL/Basic/fpga_tests/fpga_aocx.cpp +++ b/SYCL/Basic/fpga_tests/fpga_aocx.cpp @@ -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. // 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 diff --git a/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp b/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp index baf7518841..73fae7aec8 100644 --- a/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp +++ b/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp @@ -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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 From 575d040910d5378aa7537f5fa4da0c92cc1d7ada Mon Sep 17 00:00:00 2001 From: sergei Date: Tue, 6 Jul 2021 12:00:08 +0300 Subject: [PATCH 14/16] Fixed typo in Basic/fpga_tests/fpga_aocx_win.cpp --- SYCL/Basic/fpga_tests/fpga_aocx_win.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp b/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp index 73fae7aec8..efc6c98efe 100644 --- a/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp +++ b/SYCL/Basic/fpga_tests/fpga_aocx_win.cpp @@ -15,14 +15,14 @@ // FIXME Disabled use of devicelib by assert feature until the 2-step build gets // fixed. // RUN: rm %t_image.a || true -// RUN: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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: %clangx -DSYCL_DISABLE_FALLBACK_ASSERT=1x -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 From 5bbca4b339362e38708474c3289d19e3b61bd2bb Mon Sep 17 00:00:00 2001 From: Sergey Kanaev Date: Thu, 8 Jul 2021 10:27:21 +0300 Subject: [PATCH 15/16] Address review comments Signed-off-by: Sergey Kanaev --- SYCL/AOT/multiple-devices.cpp | 12 ++++++------ SYCL/lit.cfg.py | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index 2c9f891dff..5f9366c1a0 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -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. @@ -18,7 +18,7 @@ // RUN: %GPU_RUN_PLACEHOLDER %t_all.out // RUN: %ACC_RUN_PLACEHOLDER %t_all.out -// FIXME: Change the behaviour when proper automaton for assert support is +// FIXME: Change the behavior when proper automaton for assert support is // introduced // Produce object file, spirv, device images to combine these differently // at link-time, thus testing various AOT-compiled images configurations @@ -27,10 +27,10 @@ // 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: %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 diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index 077d98de34..e58db585ca 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -284,14 +284,16 @@ llvm_spirv_path = find_executable("llvm-spirv") if llvm_spirv_path: lit_config.note("Found llvm-spirv") - config.substitutions.append( ('%LLVM_SPIRV', os.path.realpath(llvm_spirv_path)) ) + config.available_features.add('llvm-spirv') + config.substitutions.append( ('%llvm_spirv', os.path.realpath(llvm_spirv_path)) ) else: lit_config.warning("Can't find llvm-spirv") llvm_link_path = find_executable("llvm-link") if llvm_link_path: lit_config.note("Found llvm-link") - config.substitutions.append( ('%LLVM_LINK', os.path.realpath(llvm_link_path)) ) + config.available_features.add('llvm-link') + config.substitutions.append( ('%llvm_link', os.path.realpath(llvm_link_path)) ) else: lit_config.warning("Can't find llvm-link") From ce5ca4bec5f49186139361be9d508a5df7c90d07 Mon Sep 17 00:00:00 2001 From: sergei Date: Thu, 8 Jul 2021 21:15:12 +0300 Subject: [PATCH 16/16] Apply suggestions from code review Co-authored-by: Mikhail Lychkov <51128024+mlychkov@users.noreply.github.com> --- SYCL/AOT/multiple-devices.cpp | 2 +- SYCL/lit.cfg.py | 25 ++++++++++--------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/SYCL/AOT/multiple-devices.cpp b/SYCL/AOT/multiple-devices.cpp index 5f9366c1a0..7f77d4bc90 100644 --- a/SYCL/AOT/multiple-devices.cpp +++ b/SYCL/AOT/multiple-devices.cpp @@ -18,7 +18,7 @@ // RUN: %GPU_RUN_PLACEHOLDER %t_all.out // RUN: %ACC_RUN_PLACEHOLDER %t_all.out -// FIXME: Change the behavior when proper automaton for assert support is +// FIXME: Change the behavior when proper automation for assert support is // introduced // Produce object file, spirv, device images to combine these differently // at link-time, thus testing various AOT-compiled images configurations diff --git a/SYCL/lit.cfg.py b/SYCL/lit.cfg.py index e58db585ca..3ff9e79dd2 100644 --- a/SYCL/lit.cfg.py +++ b/SYCL/lit.cfg.py @@ -281,21 +281,16 @@ if find_executable('sycl-ls'): config.available_features.add('sycl-ls') -llvm_spirv_path = find_executable("llvm-spirv") -if llvm_spirv_path: - lit_config.note("Found llvm-spirv") - config.available_features.add('llvm-spirv') - config.substitutions.append( ('%llvm_spirv', os.path.realpath(llvm_spirv_path)) ) -else: - lit_config.warning("Can't find llvm-spirv") - -llvm_link_path = find_executable("llvm-link") -if llvm_link_path: - lit_config.note("Found llvm-link") - config.available_features.add('llvm-link') - config.substitutions.append( ('%llvm_link', os.path.realpath(llvm_link_path)) ) -else: - lit_config.warning("Can't find llvm-link") +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