102 lines
4.4 KiB
Plaintext
102 lines
4.4 KiB
Plaintext
|
// REQUIRES: clang-driver
|
||
|
// REQUIRES: x86-registered-target
|
||
|
// REQUIRES: amdgpu-registered-target
|
||
|
|
||
|
// RUN: %clang -### -target x86_64-linux-gnu \
|
||
|
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
||
|
// RUN: --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
|
||
|
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
|
||
|
// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
|
||
|
// RUN: -fuse-ld=lld -fgpu-rdc -nogpuinc \
|
||
|
// RUN: -fhip-dump-offload-linker-script \
|
||
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
||
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
||
|
// RUN: 2>&1 | FileCheck %s
|
||
|
|
||
|
// check code object alignment in dumped llvm-mc input
|
||
|
// CHECK: .p2align 12
|
||
|
|
||
|
// emit objects for host side path
|
||
|
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
|
||
|
// CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
|
||
|
// CHECK-SAME: "-emit-obj"
|
||
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
||
|
// CHECK-SAME: {{.*}} "-o" [[A_OBJ_HOST:".*o"]] "-x" "hip"
|
||
|
// CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
|
||
|
|
||
|
// CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
|
||
|
// CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
|
||
|
// CHECK-SAME: "-emit-obj"
|
||
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
||
|
// CHECK-SAME: {{.*}} "-o" [[B_OBJ_HOST:".*o"]] "-x" "hip"
|
||
|
// CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
|
||
|
|
||
|
// generate image for device side path on gfx803
|
||
|
// CHECK: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
||
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||
|
// CHECK-SAME: "-emit-llvm-bc"
|
||
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
||
|
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||
|
// CHECK-SAME: "-target-cpu" "gfx803"
|
||
|
// CHECK-SAME: {{.*}} "-o" [[A_BC1:".*bc"]] "-x" "hip"
|
||
|
// CHECK-SAME: {{.*}} [[A_SRC]]
|
||
|
|
||
|
// CHECK: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
||
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||
|
// CHECK-SAME: "-emit-llvm-bc"
|
||
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
||
|
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
||
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
||
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||
|
// CHECK-SAME: "-target-cpu" "gfx803"
|
||
|
// CHECK-SAME: {{.*}} "-o" [[B_BC1:".*bc"]] "-x" "hip"
|
||
|
// CHECK-SAME: {{.*}} [[B_SRC]]
|
||
|
|
||
|
// CHECK-NOT: "*.llvm-link"
|
||
|
// CHECK-NOT: ".*opt"
|
||
|
// CHECK-NOT: ".*llc"
|
||
|
// CHECK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
|
||
|
// CHECK-SAME: "-plugin-opt=mcpu=gfx803"
|
||
|
// CHECK-SAME: "-o" "[[IMG_DEV1:.*.out]]" [[A_BC1]] [[B_BC1]]
|
||
|
|
||
|
// generate image for device side path on gfx900
|
||
|
// CHECK: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
||
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||
|
// CHECK-SAME: "-emit-llvm-bc"
|
||
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
||
|
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc"
|
||
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||
|
// CHECK-SAME: "-target-cpu" "gfx900"
|
||
|
// CHECK-SAME: {{.*}} "-o" [[A_BC2:".*bc"]] "-x" "hip"
|
||
|
// CHECK-SAME: {{.*}} [[A_SRC]]
|
||
|
|
||
|
// CHECK: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
||
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
||
|
// CHECK-SAME: "-emit-llvm-bc"
|
||
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
||
|
// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc"
|
||
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
||
|
// CHECK-SAME: "-target-cpu" "gfx900"
|
||
|
// CHECK-SAME: {{.*}} "-o" [[B_BC2:".*bc"]] "-x" "hip"
|
||
|
// CHECK-SAME: {{.*}} [[B_SRC]]
|
||
|
|
||
|
// CHECK-NOT: "*.llvm-link"
|
||
|
// CHECK-NOT: ".*opt"
|
||
|
// CHECK-NOT: ".*llc"
|
||
|
// CHECK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
|
||
|
// CHECK-SAME: "-plugin-opt=mcpu=gfx900"
|
||
|
// CHECK-SAME: "-o" "[[IMG_DEV2:.*.out]]" [[A_BC2]] [[B_BC2]]
|
||
|
|
||
|
// combine images generated into hip fat binary object
|
||
|
// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
||
|
// CHECK-SAME: "-bundle-align=4096"
|
||
|
// CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa--gfx803,hip-amdgcn-amd-amdhsa--gfx900"
|
||
|
// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV1]],[[IMG_DEV2]]" "-outputs=[[BUNDLE:.*hipfb]]"
|
||
|
|
||
|
// CHECK: [[MC:".*llvm-mc.*"]] "-o" [[OBJBUNDLE:".*o"]] "{{.*}}.mcin" "--filetype=obj"
|
||
|
|
||
|
// output the executable
|
||
|
// CHECK: [[LD:".*ld.*"]] {{.*}}"-o" "a.out" {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]] [[OBJBUNDLE]]
|