2020-06-14 21:07:31 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
|
|
|
// REQUIRES: amdgpu-registered-target
|
|
|
|
|
|
|
|
// RUN: %clang -c -### -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: %S/Inputs/hip_multiple_inputs/a.cu \
|
|
|
|
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
|
|
|
|
// RUN: 2>&1 | FileCheck %s
|
|
|
|
|
2021-04-24 06:52:49 +08:00
|
|
|
// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
|
|
|
// CHECK-SAME: "-emit-llvm-bc"
|
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
|
|
|
// CHECK-SAME: "-target-cpu" "gfx803"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fgpu-rdc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" "[[A_BC1:.*bc]]" "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
|
|
|
|
|
2021-04-24 06:52:49 +08:00
|
|
|
// CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
|
|
|
// CHECK-SAME: "-emit-llvm-bc"
|
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
|
|
|
// CHECK-SAME: "-target-cpu" "gfx900"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fgpu-rdc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" "[[A_BC2:.*bc]]" "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[A_SRC]]
|
|
|
|
|
|
|
|
// 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" "a.cu"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fgpu-rdc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" "[[A_OBJ_HOST:.*o]]" "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[A_SRC]]
|
|
|
|
|
|
|
|
// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
2021-07-27 00:39:41 +08:00
|
|
|
// CHECK-SAME: "-targets=hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900,host-x86_64-unknown-linux-gnu"
|
2022-04-05 22:44:13 +08:00
|
|
|
// CHECK-SAME: "-output=[[A_O:.*a.o]]" "-input=[[A_BC1]]" "-input=[[A_BC2]]" "-input=[[A_OBJ_HOST]]"
|
2020-06-14 21:07:31 +08:00
|
|
|
|
2021-04-24 06:52:49 +08:00
|
|
|
// CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
|
|
|
// CHECK-SAME: "-emit-llvm-bc"
|
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-fapply-global-visibility-to-externs"
|
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
|
|
|
// CHECK-SAME: "-target-cpu" "gfx803"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fgpu-rdc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" "[[B_BC1:.*bc]]" "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
|
|
|
|
|
2021-04-24 06:52:49 +08:00
|
|
|
// CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
|
|
|
|
// CHECK-SAME: "-emit-llvm-bc"
|
|
|
|
// CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fcuda-is-device"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
|
|
|
|
// CHECK-SAME: "-target-cpu" "gfx900"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fgpu-rdc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" "[[B_BC2:.*bc]]" "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[B_SRC]]
|
|
|
|
|
|
|
|
// 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"
|
2021-02-09 07:51:31 +08:00
|
|
|
// CHECK-SAME: "-fgpu-rdc"
|
2020-06-14 21:07:31 +08:00
|
|
|
// CHECK-SAME: {{.*}} "-o" "[[B_OBJ_HOST:.*o]]" "-x" "hip"
|
|
|
|
// CHECK-SAME: {{.*}} [[B_SRC]]
|
|
|
|
|
|
|
|
// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
2021-07-27 00:39:41 +08:00
|
|
|
// CHECK-SAME: "-targets=hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900,host-x86_64-unknown-linux-gnu"
|
2022-04-05 22:44:13 +08:00
|
|
|
// CHECK-SAME: "-output=[[B_O:.*b.o]]" "-input=[[B_BC1]]" "-input=[[B_BC2]]" "-input=[[B_OBJ_HOST]]"
|
2020-06-14 21:07:31 +08:00
|
|
|
|
|
|
|
// RUN: touch %T/a.o
|
|
|
|
// RUN: touch %T/b.o
|
|
|
|
// RUN: %clang --hip-link -### -target x86_64-linux-gnu \
|
|
|
|
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
|
|
|
// RUN: -fuse-ld=lld -fgpu-rdc -nogpuinc \
|
|
|
|
// RUN: %T/a.o %T/b.o \
|
2022-01-08 02:33:00 +08:00
|
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=LINK,LINK-HOST-UNBUNDLE,LLD-TMP,LINK-BUNDLE,LINK-EMBED %s
|
2020-06-14 21:07:31 +08:00
|
|
|
|
2022-01-08 02:33:00 +08:00
|
|
|
// RUN: %clang --hip-link -### -target x86_64-linux-gnu \
|
|
|
|
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
|
|
|
// RUN: -fuse-ld=lld -fgpu-rdc -nogpuinc \
|
|
|
|
// RUN: %T/a.o %T/b.o --cuda-device-only \
|
|
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-TMP,LINK-BUNDLE,LINK-NOEMBED %s
|
2020-06-14 21:07:31 +08:00
|
|
|
|
2022-01-08 02:33:00 +08:00
|
|
|
// RUN: %clang --hip-link -### -target x86_64-linux-gnu \
|
|
|
|
// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
|
|
|
|
// RUN: -fuse-ld=lld -fgpu-rdc -nogpuinc \
|
|
|
|
// RUN: %T/a.o %T/b.o --cuda-device-only --no-gpu-bundle-output \
|
|
|
|
// RUN: 2>&1 | FileCheck -check-prefixes=LINK,LLD-FIN,LINK-NOBUNDLE,LINK-NOEMBED %s
|
|
|
|
|
|
|
|
// LINK-HOST-UNBUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
|
|
|
// LINK-HOST-UNBUNDLE-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
|
2022-04-05 22:44:13 +08:00
|
|
|
// LINK-HOST-UNBUNDLE-SAME: "-input=[[A_O:.*a.o]]" "-output=[[A_OBJ_HOST:.*o]]" "-output={{.*o}}" "-output={{.*o}}"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-HOST-UNBUNDLE: "-unbundle" "-allow-missing-bundles"
|
|
|
|
|
|
|
|
// LINK-HOST-UNBUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
|
|
|
// LINK-HOST-UNBUNDLE-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
|
2022-04-05 22:44:13 +08:00
|
|
|
// LINK-HOST-UNBUNDLE-SAME: "-input=[[B_O:.*b.o]]" "-output=[[B_OBJ_HOST:.*o]]" "-output={{.*o}}" "-output={{.*o}}"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-HOST-UNBUNDLE: "-unbundle" "-allow-missing-bundles"
|
2020-06-12 02:36:10 +08:00
|
|
|
|
|
|
|
// LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
2021-07-27 00:39:41 +08:00
|
|
|
// LINK-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
|
2022-04-05 22:44:13 +08:00
|
|
|
// LINK-SAME: "-input=[[A_O:.*a.o]]" "-output={{.*o}}" "-output=[[A_BC1:.*o]]" "-output=[[A_BC2:.*o]]"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-SAME: "-unbundle" "-allow-missing-bundles"
|
2020-06-12 02:36:10 +08:00
|
|
|
|
|
|
|
// LINK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
2021-07-27 00:39:41 +08:00
|
|
|
// LINK-SAME: "-targets=host-x86_64-unknown-linux-gnu,hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900"
|
2022-04-05 22:44:13 +08:00
|
|
|
// LINK-SAME: "-input=[[B_O:.*b.o]]" "-output={{.*o}}" "-output=[[B_BC1:.*o]]" "-output=[[B_BC2:.*o]]"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-SAME: "-unbundle" "-allow-missing-bundles"
|
2020-06-14 21:07:31 +08:00
|
|
|
|
|
|
|
// LINK-NOT: "*.llvm-link"
|
|
|
|
// LINK-NOT: ".*opt"
|
|
|
|
// LINK-NOT: ".*llc"
|
2020-06-25 05:34:21 +08:00
|
|
|
// LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-SAME: "-plugin-opt=mcpu=gfx803"
|
|
|
|
// LLD-TMP-SAME: "-o" "[[IMG_DEV1:.*.out]]"
|
|
|
|
// LLD-FIN-SAME: "-o" "[[IMG_DEV1:a.out-.*gfx803]]"
|
|
|
|
// LINK-SAME "[[A_BC1]]" "[[B_BC1]]"
|
2020-06-14 21:07:31 +08:00
|
|
|
|
|
|
|
// LINK-NOT: "*.llvm-link"
|
|
|
|
// LINK-NOT: ".*opt"
|
|
|
|
// LINK-NOT: ".*llc"
|
2020-06-25 05:34:21 +08:00
|
|
|
// LINK: {{".*lld.*"}} {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-SAME: "-plugin-opt=mcpu=gfx900"
|
|
|
|
// LLD-TMP-SAME: "-o" "[[IMG_DEV2:.*.out]]"
|
|
|
|
// LLD-FIN-SAME: "-o" "[[IMG_DEV1:a.out-.*gfx900]]"
|
|
|
|
// LINK-SAME "[[A_BC2]]" "[[B_BC2]]"
|
|
|
|
|
|
|
|
// LINK-BUNDLE: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
|
|
|
|
// LINK-BUNDLE-SAME: "-targets={{.*}},hipv4-amdgcn-amd-amdhsa--gfx803,hipv4-amdgcn-amd-amdhsa--gfx900"
|
2022-04-05 22:44:13 +08:00
|
|
|
// LINK-BUNDLE-SAME: "-input={{.*}}" "-input=[[IMG_DEV1]]" "-input=[[IMG_DEV2]]" "-output=[[BUNDLE:.*]]"
|
2022-01-08 02:33:00 +08:00
|
|
|
// LINK-NOBUNDLE-NOT: {{".*clang-offload-bundler"}} "-type=o"
|
|
|
|
|
|
|
|
// LINK-EMBED: {{".*llvm-mc.*"}} "-o" "[[OBJBUNDLE:.*o]]" "{{.*}}.mcin" "--filetype=obj"
|
|
|
|
// LINK-NOEMBED-NOT: {{".*llvm-mc.*"}} "-o"
|
|
|
|
|
|
|
|
// LINK-EMBED: [[LD:".*ld.*"]] {{.*}} "-o" "a.out" {{.*}} "[[A_OBJ_HOST]]"
|
|
|
|
// LINK-EMBED-SAME: "[[B_OBJ_HOST]]" "[[OBJBUNDLE]]"
|
|
|
|
// LINK-NOEMBED-NOT: {{".*ld.*"}} {{.*}} "-o" "a.out"
|