1 // UNSUPPORTED: system-windows
3 // RUN: %clang -### -x hip -target x86_64-linux-gnu --offload=spirv64 \
4 // RUN: --no-offload-new-driver -fgpu-rdc --hip-path=%S/Inputs/hipspv -nohipwrapperinc \
5 // RUN: %S/Inputs/hip_multiple_inputs/a.cu \
6 // RUN: %S/Inputs/hip_multiple_inputs/b.hip \
7 // RUN: 2>&1 | FileCheck %s
9 // Emit objects for host side path
10 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
11 // CHECK-SAME: "-aux-triple" "spirv64"
12 // CHECK-SAME: "-emit-obj"
13 // CHECK-SAME: "-fgpu-rdc"
14 // CHECK-SAME: {{.*}} "-o" [[A_OBJ_HOST:".*o"]] "-x" "hip"
15 // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
17 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
18 // CHECK-SAME: "-aux-triple" "spirv64"
19 // CHECK-SAME: "-emit-obj"
20 // CHECK-SAME: "-fgpu-rdc"
21 // CHECK-SAME: {{.*}} "-o" [[B_OBJ_HOST:".*o"]] "-x" "hip"
22 // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
24 // Emit code (LLVM BC) for device side path.
25 // CHECK: [[CLANG]] "-cc1" "-triple" "spirv64"
26 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
27 // CHECK-SAME: "-emit-llvm-bc"
28 // CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions"
29 // CHECK-SAME: "-fvisibility=hidden" "-fapply-global-visibility-to-externs"
30 // CHECK-SAME: "-fgpu-rdc"
31 // CHECK-SAME: {{.*}} "-o" [[A_BC1:".*bc"]] "-x" "hip"
32 // CHECK-SAME: {{.*}} [[A_SRC]]
34 // CHECK: [[CLANG]] "-cc1" "-triple" "spirv64"
35 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
36 // CHECK-SAME: "-emit-llvm-bc"
37 // CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions"
38 // CHECK-SAME: "-fvisibility=hidden" "-fapply-global-visibility-to-externs"
39 // CHECK-SAME: "-fgpu-rdc"
40 // CHECK-SAME: {{.*}} "-o" [[B_BC1:".*bc"]] "-x" "hip"
41 // CHECK-SAME: {{.*}} [[B_SRC]]
43 // Link device code, lower it with HIPSPV passes and emit SPIR-V binary.
44 // CHECK: {{".*llvm-link.*"}} [[A_BC1]] [[B_BC1]] "-o" [[AB_LINK:".*bc"]]
45 // CHECK: {{".*opt.*"}} [[AB_LINK]] "-load-pass-plugin"
46 // CHECK-SAME: "{{.*}}/Inputs/hipspv/lib/libLLVMHipSpvPasses.so"
47 // CHECK-SAME: "-o" [[AB_LOWER:".*bc"]]
48 // CHECK: {{".*llvm-spirv"}} "--spirv-max-version=1.1" "--spirv-ext=+all"
49 // CHECK-SAME: [[AB_LOWER]] "-o" "[[AB_SPIRV:.*out]]"
51 // Construct fat binary object.
52 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o" "-bundle-align=4096"
53 // CHECK-SAME: "-targets={{.*}},hip-spirv64----generic"
54 // CHECK-SAME: "-input=/dev/null" "-input=[[AB_SPIRV]]"
55 // CHECK-SAME: "-output=[[AB_FATBIN:.*hipfb]]"
56 // CHECK: {{".*clang.*"}} "-o" [[OBJBUNDLE:".*o"]] "{{.*}}.mcin"
58 // Output the executable
59 // CHECK: {{".*ld.*"}} {{.*}}"-o" "a.out" {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]]
60 // CHECK-SAME: [[OBJBUNDLE]]