|
| 1 | +//==-- multiple-devices.cpp - Appropriate AOT-compiled image selection -----==// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | + |
| 9 | +// REQUIRES: opencl-aot, ocloc, aoc, cpu, gpu, accelerator |
| 10 | +// UNSUPPORTED: cuda |
| 11 | +// CUDA is not compatible with SPIR. |
| 12 | + |
| 13 | +// 1-command compilation case |
| 14 | +// Targeting CPU, GPU, FPGA |
| 15 | +// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice,spir64_gen-unknown-unknown-sycldevice,spir64_fpga-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_gen-unknown-unknown-sycldevice "-device *" %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 |
| 20 | + |
| 21 | +// Produce object file, spirv, device images to combine these differently |
| 22 | +// at link-time, thus testing various AOT-compiled images configurations |
| 23 | +// RUN: %clangxx -fsycl %S/Inputs/aot.cpp -c -o %t.o |
| 24 | +// RUN: %clangxx -fsycl -fsycl-link-targets=spir64-unknown-unknown-sycldevice %t.o -o %t.spv |
| 25 | +// AOT-compile device binary images |
| 26 | +// RUN: opencl-aot %t.spv -o=%t_cpu.ir --device=cpu |
| 27 | +// RUN: ocloc -file %t.spv -spirv_input -output %t_gen.out -output_no_suffix -device cfl |
| 28 | +// RUN: aoc %t.spv -o %t_fpga.aocx -sycl -dep-files=%t.d |
| 29 | + |
| 30 | +// CPU, GPU |
| 31 | +// RUN: %clangxx -fsycl -fsycl-add-targets=spir64_x86_64:%t_cpu.ir,spir64_gen:%t_gen.out %t.o -o %t_cpu_gpu.out |
| 32 | +// RUN: %HOST_RUN_PLACEHOLDER %t_cpu_gpu.out |
| 33 | +// RUN: %CPU_RUN_PLACEHOLDER %t_cpu_gpu.out |
| 34 | +// RUN: %GPU_RUN_PLACEHOLDER %t_cpu_gpu.out |
| 35 | + |
| 36 | +// CPU, FPGA |
| 37 | +// RUN: %clangxx -fsycl -fsycl-add-targets=spir64_x86_64:%t_cpu.ir,spir64_fpga:%t_fpga.aocx %t.o -o %t_cpu_fpga.out |
| 38 | +// RUN: %HOST_RUN_PLACEHOLDER %t_cpu_fpga.out |
| 39 | +// RUN: %CPU_RUN_PLACEHOLDER %t_cpu_fpga.out |
| 40 | +// RUN: %ACC_RUN_PLACEHOLDER %t_cpu_fpga.out |
| 41 | + |
| 42 | +// GPU, FPGA |
| 43 | +// RUN: %clangxx -fsycl -fsycl-add-targets=spir64_gen:%t_gen.out,spir64_fpga:%t_fpga.aocx %t.o -o %t_gpu_fpga.out |
| 44 | +// RUN: %HOST_RUN_PLACEHOLDER %t_gpu_fpga.out |
| 45 | +// RUN: %GPU_RUN_PLACEHOLDER %t_gpu_fpga.out |
| 46 | +// RUN: %ACC_RUN_PLACEHOLDER %t_gpu_fpga.out |
| 47 | + |
| 48 | +// No AOT-compiled image for CPU |
| 49 | +// 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 |
| 50 | +// RUN: %CPU_RUN_PLACEHOLDER %t_spv_gpu_fpga.out |
| 51 | +// Check that execution on AOT-compatible devices is unaffected |
| 52 | +// RUN: %GPU_RUN_PLACEHOLDER %t_spv_gpu_fpga.out |
| 53 | +// RUN: %ACC_RUN_PLACEHOLDER %t_spv_gpu_fpga.out |
| 54 | + |
| 55 | +// No AOT-compiled image for GPU |
| 56 | +// 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 |
| 57 | +// RUN: %GPU_RUN_PLACEHOLDER %t_spv_cpu_fpga.out |
| 58 | +// Check that execution on AOT-compatible devices is unaffected |
| 59 | +// RUN: %CPU_RUN_PLACEHOLDER %t_spv_cpu_fpga.out |
| 60 | +// RUN: %ACC_RUN_PLACEHOLDER %t_spv_cpu_fpga.out |
| 61 | + |
| 62 | +// No AOT-compiled image for FPGA |
| 63 | +// 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 |
| 64 | +// RUN: %ACC_RUN_PLACEHOLDER %t_spv_cpu_gpu.out |
| 65 | +// Check that execution on AOT-compatible devices is unaffected |
| 66 | +// RUN: %CPU_RUN_PLACEHOLDER %t_spv_cpu_gpu.out |
| 67 | +// RUN: %GPU_RUN_PLACEHOLDER %t_spv_cpu_gpu.out |
0 commit comments