2018-10-03 01:48:54 +08:00
|
|
|
// REQUIRES: clang-driver
|
|
|
|
// REQUIRES: x86-registered-target
|
|
|
|
// REQUIRES: amdgpu-registered-target
|
|
|
|
|
|
|
|
// RUN: %clang -### -target x86_64-linux-gnu -fno-gpu-rdc \
|
|
|
|
// 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 \
|
2020-06-14 21:07:31 +08:00
|
|
|
// RUN: -fuse-ld=lld -nogpuinc \
|
|
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LINK %s
|
|
|
|
|
|
|
|
// RUN: %clang -### -target x86_64-linux-gnu -fno-gpu-rdc \
|
|
|
|
// 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 -nogpuinc -c \
|
2018-10-03 01:48:54 +08:00
|
|
|
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=CHECK %s
|
|
|
|
|
2020-06-14 21:07:31 +08:00
|
|
|
// RUN: touch %T/a.o
|
|
|
|
// RUN: touch %T/b.o
|
|
|
|
// RUN: %clang -### -target x86_64-linux-gnu \
|
|
|
|
// RUN: --hip-link --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
|
|
|
// RUN: -fuse-ld=lld -nogpuinc \
|
|
|
|
// RUN: %T/a.o %T/b.o \
|
|
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=LKONLY %s
|
|
|
|
|
2018-10-03 01:48:54 +08:00
|
|
|
//
|
|
|
|
// Compile device code in a.cu to code object for gfx803.
|
|
|
|
//
|
|
|
|
|
2020-12-17 01:00:18 +08:00
|
|
|
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
2019-02-14 09:11:32 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: "-emit-obj"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
2020-06-17 02:52:03 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
|
|
|
|
// CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
2019-01-29 01:12:19 +08:00
|
|
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
2019-04-13 00:23:31 +08:00
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-target-cpu" "gfx803"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_A_803:".*o"]] "-x" "hip"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
|
|
|
|
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-NOT: {{".*llvm-link"}}
|
|
|
|
// CHECK-NOT: {{".*opt"}}
|
|
|
|
// CHECK-NOT: {{".*llc"}}
|
2018-10-03 01:48:54 +08:00
|
|
|
|
2020-03-26 23:21:45 +08:00
|
|
|
// CHECK: [[LLD: ".*lld.*"]] "-flavor" "gnu" "--no-undefined" "-shared"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: "-o" "[[IMG_DEV_A_803:.*out]]" [[OBJ_DEV_A_803]]
|
|
|
|
|
|
|
|
//
|
|
|
|
// Compile device code in a.cu to code object for gfx900.
|
|
|
|
//
|
|
|
|
|
2020-12-17 01:00:18 +08:00
|
|
|
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
2019-02-14 09:11:32 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: "-emit-obj"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
2020-06-17 02:52:03 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
|
|
|
|
// CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
2019-01-29 01:12:19 +08:00
|
|
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
2019-04-13 00:23:31 +08:00
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-target-cpu" "gfx900"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_A_900:".*o"]] "-x" "hip"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} [[A_SRC]]
|
|
|
|
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-NOT: {{".*llvm-link"}}
|
|
|
|
// CHECK-NOT: {{".*opt"}}
|
|
|
|
// CHECK-NOT: {{".*llc"}}
|
2018-10-03 01:48:54 +08:00
|
|
|
|
2020-03-26 23:21:45 +08:00
|
|
|
// CHECK: [[LLD]] "-flavor" "gnu" "--no-undefined" "-shared"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: "-o" "[[IMG_DEV_A_900:.*out]]" [[OBJ_DEV_A_900]]
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bundle and embed device code in host object for a.cu.
|
|
|
|
//
|
|
|
|
|
|
|
|
// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
2020-09-26 00:34:38 +08:00
|
|
|
// CHECK-SAME: "-bundle-align=4096"
|
2020-08-14 04:31:51 +08:00
|
|
|
// CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa--gfx803,hip-amdgcn-amd-amdhsa--gfx900"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV_A_803]],[[IMG_DEV_A_900]]" "-outputs=[[BUNDLE_A:.*hipfb]]"
|
|
|
|
|
|
|
|
// CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
|
2019-02-14 09:11:32 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
|
|
|
|
// CHECK-SAME: "-emit-obj"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
2019-05-24 02:35:43 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-fcuda-include-gpubinary" "[[BUNDLE_A]]"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" [[A_OBJ_HOST:".*o"]] "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[A_SRC]]
|
|
|
|
|
|
|
|
//
|
|
|
|
// Compile device code in b.hip to code object for gfx803.
|
|
|
|
//
|
|
|
|
|
2020-12-17 01:00:18 +08:00
|
|
|
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
2019-02-14 09:11:32 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: "-emit-obj"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
2020-06-17 02:52:03 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
|
|
|
|
// CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
2019-01-29 01:12:19 +08:00
|
|
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
2019-04-13 00:23:31 +08:00
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-target-cpu" "gfx803"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_B_803:".*o"]] "-x" "hip"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
|
|
|
|
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-NOT: {{".*llvm-link"}}
|
|
|
|
// CHECK-NOT: {{".*opt"}}
|
|
|
|
// CHECK-NOT: {{".*llc"}}
|
2018-10-03 01:48:54 +08:00
|
|
|
|
2020-03-26 23:21:45 +08:00
|
|
|
// CHECK: [[LLD]] "-flavor" "gnu" "--no-undefined" "-shared"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: "-o" "[[IMG_DEV_B_803:.*out]]" [[OBJ_DEV_B_803]]
|
|
|
|
|
|
|
|
//
|
|
|
|
// Compile device code in b.hip to code object for gfx900.
|
|
|
|
//
|
|
|
|
|
2020-12-17 01:00:18 +08:00
|
|
|
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version={{[0-9]+}}" "-triple" "amdgcn-amd-amdhsa"
|
2019-02-14 09:11:32 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: "-emit-obj"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
2020-06-17 02:52:03 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
|
|
|
|
// CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
2019-01-29 01:12:19 +08:00
|
|
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
2019-04-13 00:23:31 +08:00
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-target-cpu" "gfx900"
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_B_900:".*o"]] "-x" "hip"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} [[B_SRC]]
|
|
|
|
|
2020-06-10 03:02:53 +08:00
|
|
|
// CHECK-NOT: {{".*llvm-link"}}
|
|
|
|
// CHECK-NOT: {{".*opt"}}
|
|
|
|
// CHECK-NOT: {{".*llc"}}
|
2018-10-03 01:48:54 +08:00
|
|
|
|
2020-03-26 23:21:45 +08:00
|
|
|
// CHECK: [[LLD]] "-flavor" "gnu" "--no-undefined" "-shared"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: "-o" "[[IMG_DEV_B_900:.*out]]" [[OBJ_DEV_B_900]]
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bundle and embed device code in host object for b.hip.
|
|
|
|
//
|
|
|
|
|
|
|
|
// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
2020-09-26 00:34:38 +08:00
|
|
|
// CHECK-SAME: "-bundle-align=4096"
|
2020-08-14 04:31:51 +08:00
|
|
|
// CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa--gfx803,hip-amdgcn-amd-amdhsa--gfx900"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV_B_803]],[[IMG_DEV_B_900]]" "-outputs=[[BUNDLE_A:.*hipfb]]"
|
|
|
|
|
|
|
|
// CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
|
2019-02-14 09:11:32 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
|
|
|
|
// CHECK-SAME: "-emit-obj"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
2019-05-24 02:35:43 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-fcuda-include-gpubinary" "[[BUNDLE_A]]"
|
2018-10-03 01:48:54 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" [[B_OBJ_HOST:".*o"]] "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[B_SRC]]
|
|
|
|
|
|
|
|
//
|
|
|
|
// Link host objects.
|
|
|
|
//
|
|
|
|
|
2020-06-18 03:35:33 +08:00
|
|
|
// LINK-NOT: {{".*/llvm-link"}}
|
|
|
|
// LINK-NOT: {{".*/opt"}}
|
|
|
|
// LINK-NOT: {{".*/llc"}}
|
2020-06-14 21:07:31 +08:00
|
|
|
// LINK: [[LD:".*ld.*"]] {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]]
|
|
|
|
// LINK-NOT: "-T" "{{.*}}.lk"
|
|
|
|
|
2020-06-18 03:35:33 +08:00
|
|
|
// LKONLY-NOT: {{".*/llvm-link"}}
|
|
|
|
// LKONLY-NOT: {{".*/opt"}}
|
|
|
|
// LKONLY-NOT: {{".*/llc"}}
|
2020-06-14 21:07:31 +08:00
|
|
|
// LKONLY: [[LD:".*ld.*"]] {{.*}} "{{.*/a.o}}" "{{.*/b.o}}"
|
|
|
|
// LKONLY-NOT: "-T" "{{.*}}.lk"
|