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

Commit 968c587

Browse files
author
Artem Gindinson
authored
[SYCL] Use full compilation for the multi-device AOT test (#603)
* [SYCL] Use full compilation for the multi-device AOT test Since the introduction of the original test, many changes have been made: - the tests' runtime and the compilation time have been reasonably improved; - the compiler pipeline has been complicated by a bunch of DPC++ tools; - default compiler behavior for many features includes dependency on device libraries, which makes the test increasingly hard to maintain. Therefore, it makes sense to refrain from running the compiler steps manually from now on, relying on E2E compilation as our users would. We will produce a single fat object for all supported device targets + host, and then rely on the driver/tools to unbundle the object & compile only for the needed targets. Drop requirements for standalone tools Signed-off-by: Artem Gindinson <[email protected]>
1 parent cd4bbc3 commit 968c587

File tree

2 files changed

+15
-46
lines changed

2 files changed

+15
-46
lines changed

SYCL/AOT/multiple-devices.cpp

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,54 @@
66
//
77
//===----------------------------------------------------------------------===//
88

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

13-
// 1-command compilation case
14-
// Targeting CPU, GPU, FPGA
15-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %S/Inputs/aot.cpp -o %t_all.out
16-
// RUN: %HOST_RUN_PLACEHOLDER %t_all.out
17-
// RUN: %CPU_RUN_PLACEHOLDER %t_all.out
18-
// RUN: %GPU_RUN_PLACEHOLDER %t_all.out
19-
// RUN: %ACC_RUN_PLACEHOLDER %t_all.out
13+
// Produce a fat object for all targets (generic SPIR-V, CPU, GPU, FPGA)
14+
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_gen,spir64_fpga %S/Inputs/aot.cpp -c -o %t.o
2015

21-
// FIXME: Change the behavior when proper automation for assert support is
22-
// introduced. For the time being, AOT flow can't detect if specific extension
23-
// is available for this or that device. The automation to be introduced is to
24-
// query native binary generator on specific features.
25-
//
26-
// Produce object file, spirv, device images to combine these differently
27-
// at link-time, thus testing various AOT-compiled images configurations
28-
// Disable DAE when performing separate compilation here, as we are not
29-
// using sycl-post-link to fully enable.
30-
// RUN: %clangxx -fsycl -fno-sycl-dead-args-optimization %S/Inputs/aot.cpp -c -o %t.o
31-
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64 %t.o -o %t.spv
32-
// AOT-compile device binary images
33-
// Neither of AOT tools can compile several files, hence, here is this
34-
// workaround
35-
// RUN: %llvm_spirv -r %sycl_libs_dir/libsycl-fallback-cassert.spv -o=%T/fallback-cassert.bc
36-
// RUN: %llvm_spirv -r %t.spv -o=%t.bc
37-
// RUN: %llvm_link %t.bc %T/fallback-cassert.bc -o=%t2.bc
38-
// RUN: %llvm_spirv %t2.bc -o=%t.spv
39-
// RUN: opencl-aot %t.spv -o=%t_cpu.ir --device=cpu
40-
// RUN: ocloc -file %t.spv -spirv_input -output %t_gen.out -output_no_suffix -device cfl
41-
// RUN: aoc %t.spv -o %t_fpga.aocx -sycl -dep-files=%t.d
16+
// CPU, GPU, FPGA
17+
// 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
18+
// RUN: %HOST_RUN_PLACEHOLDER %t_all_aot.out
19+
// RUN: %CPU_RUN_PLACEHOLDER %t_all_aot.out
20+
// RUN: %GPU_RUN_PLACEHOLDER %t_all_aot.out
21+
// RUN: %ACC_RUN_PLACEHOLDER %t_all_aot.out
4222

4323
// CPU, GPU
44-
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64_x86_64:%t_cpu.ir,spir64_gen:%t_gen.out %t.o -o %t_cpu_gpu.out
24+
// 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
4525
// RUN: %HOST_RUN_PLACEHOLDER %t_cpu_gpu.out
4626
// RUN: %CPU_RUN_PLACEHOLDER %t_cpu_gpu.out
4727
// RUN: %GPU_RUN_PLACEHOLDER %t_cpu_gpu.out
4828

4929
// CPU, FPGA
50-
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64_x86_64:%t_cpu.ir,spir64_fpga:%t_fpga.aocx %t.o -o %t_cpu_fpga.out
30+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_fpga %t.o -o %t_cpu_fpga.out
5131
// RUN: %HOST_RUN_PLACEHOLDER %t_cpu_fpga.out
5232
// RUN: %CPU_RUN_PLACEHOLDER %t_cpu_fpga.out
5333
// RUN: %ACC_RUN_PLACEHOLDER %t_cpu_fpga.out
5434

5535
// GPU, FPGA
56-
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64_gen:%t_gen.out,spir64_fpga:%t_fpga.aocx %t.o -o %t_gpu_fpga.out
36+
// 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
5737
// RUN: %HOST_RUN_PLACEHOLDER %t_gpu_fpga.out
5838
// RUN: %GPU_RUN_PLACEHOLDER %t_gpu_fpga.out
5939
// RUN: %ACC_RUN_PLACEHOLDER %t_gpu_fpga.out
6040

6141
// No AOT-compiled image for CPU
62-
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64:%t.spv,spir64_gen:%t_gen.out,spir64_fpga:%t_fpga.aocx %t.o -o %t_spv_gpu_fpga.out
42+
// 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
6343
// RUN: %CPU_RUN_PLACEHOLDER %t_spv_gpu_fpga.out
6444
// Check that execution on AOT-compatible devices is unaffected
6545
// RUN: %GPU_RUN_PLACEHOLDER %t_spv_gpu_fpga.out
6646
// RUN: %ACC_RUN_PLACEHOLDER %t_spv_gpu_fpga.out
6747

6848
// No AOT-compiled image for GPU
69-
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64:%t.spv,spir64_x86_64:%t_cpu.ir,spir64_fpga:%t_fpga.aocx %t.o -o %t_spv_cpu_fpga.out
49+
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_fpga %t.o -o %t_spv_cpu_fpga.out
7050
// RUN: %GPU_RUN_PLACEHOLDER %t_spv_cpu_fpga.out
7151
// Check that execution on AOT-compatible devices is unaffected
7252
// RUN: %CPU_RUN_PLACEHOLDER %t_spv_cpu_fpga.out
7353
// RUN: %ACC_RUN_PLACEHOLDER %t_spv_cpu_fpga.out
7454

7555
// No AOT-compiled image for FPGA
76-
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64:%t.spv,spir64_x86_64:%t_cpu.ir,spir64_gen:%t_gen.out %t.o -o %t_spv_cpu_gpu.out
56+
// 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
7757
// RUN: %ACC_RUN_PLACEHOLDER %t_spv_cpu_gpu.out
7858
// Check that execution on AOT-compatible devices is unaffected
7959
// RUN: %CPU_RUN_PLACEHOLDER %t_spv_cpu_gpu.out

SYCL/lit.cfg.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,6 @@
326326
if find_executable('sycl-ls'):
327327
config.available_features.add('sycl-ls')
328328

329-
llvm_tools = ["llvm-spirv", "llvm-link"]
330-
for llvm_tool in llvm_tools:
331-
llvm_tool_path = find_executable(llvm_tool)
332-
if llvm_tool_path:
333-
lit_config.note("Found " + llvm_tool)
334-
config.available_features.add(llvm_tool)
335-
config.substitutions.append( ('%' + llvm_tool.replace('-', '_'),
336-
os.path.realpath(llvm_tool_path)) )
337-
else:
338-
lit_config.warning("Can't find " + llvm_tool)
339-
340329
# Device AOT compilation tools aren't part of the SYCL project,
341330
# so they need to be pre-installed on the machine
342331
aot_tools = ["ocloc", "aoc", "opencl-aot"]

0 commit comments

Comments
 (0)