https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/123359
>From c6274d5cead4348cd2143c75cf5b80a0e2417d9d Mon Sep 17 00:00:00 2001 From: Joseph Huber <[email protected]> Date: Fri, 17 Jan 2025 09:35:34 -0600 Subject: [PATCH 1/2] [HIP] Move HIP to the new driver by default Summary: This patch matches CUDA, moving the HIP compilation jobs to the new driver by default. The old behavior will return with `--no-offload-new-driver`. The main difference is that objects compiled with the old driver are no longer compatible and will need to be recompiled or the old driver used. Fix after offload binary change --- clang/lib/Driver/Driver.cpp | 29 +++++++-------- clang/lib/Driver/ToolChains/Clang.cpp | 7 ++-- clang/lib/Driver/ToolChains/Darwin.cpp | 4 ++- clang/test/Driver/cl-offload.cu | 5 ++- clang/test/Driver/cuda-arch-translation.cu | 36 +++++++++---------- ...-file-flag-with-multiple-offload-archs.hip | 5 +-- clang/test/Driver/hip-code-object-version.hip | 5 +-- clang/test/Driver/hip-gz-options.hip | 7 ++-- clang/test/Driver/hip-macros.hip | 3 -- clang/test/Driver/hip-offload-arch.hip | 4 +-- clang/test/Driver/hip-options.hip | 11 ++---- clang/test/Driver/hip-sanitize-options.hip | 2 +- clang/test/Driver/hip-save-temps.hip | 12 +++---- clang/test/Driver/hip-thinlto.hip | 8 ++--- .../test/Driver/hip-toolchain-device-only.hip | 4 --- clang/test/Driver/hip-toolchain-mllvm.hip | 2 -- clang/test/Driver/hip-toolchain-no-rdc.hip | 12 +++++-- clang/test/Driver/hip-toolchain-opt.hip | 35 ++++++------------ .../Driver/hipspv-link-static-library.hip | 4 +-- clang/test/Driver/hipspv-pass-plugin.hip | 8 ++--- clang/test/Driver/hipspv-toolchain.hip | 2 +- clang/unittests/Tooling/ToolingTest.cpp | 6 ++-- 22 files changed, 92 insertions(+), 119 deletions(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 04fd68692d8d8..22f70ec988180 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4403,15 +4403,9 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args, void Driver::BuildDefaultActions(Compilation &C, DerivedArgList &Args, const InputList &Inputs, ActionList &Actions) const { - - bool UseNewOffloadingDriver = - C.isOffloadingHostKind(Action::OFK_OpenMP) || - C.isOffloadingHostKind(Action::OFK_SYCL) || - Args.hasFlag(options::OPT_foffload_via_llvm, - options::OPT_fno_offload_via_llvm, false) || - Args.hasFlag(options::OPT_offload_new_driver, - options::OPT_no_offload_new_driver, - C.isOffloadingHostKind(Action::OFK_Cuda)); + bool UseNewOffloadingDriver = Args.hasFlag( + options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, + C.getActiveOffloadKinds() != Action::OFK_None); // Builder to be used to build offloading actions. std::unique_ptr<OffloadingActionBuilder> OffloadBuilder = @@ -5018,8 +5012,8 @@ Action *Driver::BuildOffloadingActions(Compilation &C, bool ShouldBundleHIP = Args.hasFlag(options::OPT_gpu_bundle_output, options::OPT_no_gpu_bundle_output, false) || - (HIPNoRDC && offloadDeviceOnly() && - llvm::none_of(OffloadActions, [](Action *A) { + (!Args.getLastArg(options::OPT_no_gpu_bundle_output) && HIPNoRDC && + offloadDeviceOnly() && llvm::none_of(OffloadActions, [](Action *A) { return A->getType() != types::TY_Image; })); @@ -5195,7 +5189,8 @@ Action *Driver::ConstructPhaseAction( // offload driver, where mid-end is done in linker wrapper. if (TargetDeviceOffloadKind == Action::OFK_HIP && Args.hasFlag(options::OPT_offload_new_driver, - options::OPT_no_offload_new_driver, false) && + options::OPT_no_offload_new_driver, + C.getActiveOffloadKinds() != Action::OFK_None) && !offloadDeviceOnly()) return Input; @@ -5215,8 +5210,13 @@ Action *Driver::ConstructPhaseAction( Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC; return C.MakeAction<BackendJobAction>(Input, Output); } + + bool IsAMDGCNSPIRV = Input->getOffloadingToolChain() && + Input->getOffloadingToolChain()->getTriple().getOS() == + llvm::Triple::OSType::AMDHSA && + Input->getOffloadingToolChain()->getTriple().isSPIRV(); if (Args.hasArg(options::OPT_emit_llvm) || - TargetDeviceOffloadKind == Action::OFK_SYCL || + TargetDeviceOffloadKind == Action::OFK_SYCL || IsAMDGCNSPIRV || (((Input->getOffloadingToolChain() && Input->getOffloadingToolChain()->getTriple().isAMDGPU() && TargetDeviceOffloadKind != Action::OFK_None) || @@ -5237,7 +5237,8 @@ Action *Driver::ConstructPhaseAction( (TargetDeviceOffloadKind == Action::OFK_HIP && !Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, - C.isOffloadingHostKind(Action::OFK_Cuda)))) + C.getActiveOffloadKinds() != + Action::OFK_None))) ? types::TY_LLVM_IR : types::TY_LLVM_BC; return C.MakeAction<BackendJobAction>(Input, Output); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index c5d40c9825fab..ca0914557c5cd 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4804,7 +4804,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, (JA.isHostOffloading(C.getActiveOffloadKinds()) && Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, - C.isOffloadingHostKind(Action::OFK_Cuda))); + C.getActiveOffloadKinds() != Action::OFK_None)); bool IsRDCMode = Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false); @@ -5169,7 +5169,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (IsDeviceOffloadAction && !JA.isDeviceOffloading(Action::OFK_OpenMP) && !Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, - C.isOffloadingHostKind(Action::OFK_Cuda)) && + C.getActiveOffloadKinds() != Action::OFK_None) && !Triple.isAMDGPU()) { D.Diag(diag::err_drv_unsupported_opt_for_target) << Args.getLastArg(options::OPT_foffload_lto, @@ -6651,7 +6651,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.append({"--offload-new-driver", "-foffload-via-llvm"}); } else if (Args.hasFlag(options::OPT_offload_new_driver, options::OPT_no_offload_new_driver, - C.isOffloadingHostKind(Action::OFK_Cuda))) { + C.getActiveOffloadKinds() != Action::OFK_None)) { CmdArgs.push_back("--offload-new-driver"); } @@ -9084,6 +9084,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, OPT_fno_lto, OPT_flto, OPT_flto_partitions_EQ, + OPT_hipspv_pass_plugin_EQ, OPT_flto_EQ}; const llvm::DenseSet<unsigned> LinkerOptions{OPT_mllvm, OPT_Zlinker_input}; auto ShouldForwardForToolChain = [&](Arg *A, const ToolChain &TC) { diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index fc3cd9030f71d..cba9cb4ceef87 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -573,7 +573,9 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { - assert(Output.getType() == types::TY_Image && "Invalid linker output type."); + assert((Output.getType() == types::TY_Image || + Output.getType() == types::TY_Object) && + "Invalid linker output type."); // If the number of arguments surpasses the system limits, we will encode the // input files in a separate file, shortening the command line. To this end, diff --git a/clang/test/Driver/cl-offload.cu b/clang/test/Driver/cl-offload.cu index b05bf3b97b7eb..8f1200f173359 100644 --- a/clang/test/Driver/cl-offload.cu +++ b/clang/test/Driver/cl-offload.cu @@ -18,11 +18,10 @@ // CUDA-SAME: "-Weverything" // CUDA: link -// HIP: "-cc1" "-triple" "x86_64-pc-windows-msvc{{.*}}" "-aux-triple" "amdgcn-amd-amdhsa" -// HIP-SAME: "-Weverything" // HIP: "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-pc-windows-msvc" // HIP-SAME: "-Weverything" -// HIP: {{lld.* "-flavor" "gnu" "-m" "elf64_amdgpu"}} +// HIP: "-cc1" "-triple" "x86_64-pc-windows-msvc{{.*}}" "-aux-triple" "amdgcn-amd-amdhsa" +// HIP-SAME: "-Weverything" // HIP: {{link.* "amdhip64.lib"}} // CMake uses this option when finding packages for HIP, so diff --git a/clang/test/Driver/cuda-arch-translation.cu b/clang/test/Driver/cuda-arch-translation.cu index b4a521df2e6f5..65234d091efd7 100644 --- a/clang/test/Driver/cuda-arch-translation.cu +++ b/clang/test/Driver/cuda-arch-translation.cu @@ -66,7 +66,7 @@ // CUDA-SAME: -m64 // CUDA: fatbinary -// HIP: clang-offload-bundler +// HIP: llvm-offload-binary // SM20:--image3=kind=elf,sm=20{{.*}} // SM21:--image3=kind=elf,sm=21{{.*}} @@ -81,20 +81,20 @@ // SM61:--image3=kind=elf,sm=61{{.*}} // SM62:--image3=kind=elf,sm=62{{.*}} // SM70:--image3=kind=elf,sm=70{{.*}} -// GFX600:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx600 -// GFX601:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx601 -// GFX602:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx602 -// GFX700:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx700 -// GFX701:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx701 -// GFX702:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx702 -// GFX703:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx703 -// GFX704:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx704 -// GFX705:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx705 -// GFX801:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx801 -// GFX802:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx802 -// GFX803:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx803 -// GFX805:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx805 -// GFX810:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx810 -// GFX900:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx900 -// GFX902:-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx902 -// SPIRV:-targets=host-x86_64-unknown-linux-gnu,hip-spirv64-amd-amdhsa--amdgcnspirv +// GFX600:triple=amdgcn-amd-amdhsa,arch=gfx600 +// GFX601:triple=amdgcn-amd-amdhsa,arch=gfx601 +// GFX602:triple=amdgcn-amd-amdhsa,arch=gfx602 +// GFX700:triple=amdgcn-amd-amdhsa,arch=gfx700 +// GFX701:triple=amdgcn-amd-amdhsa,arch=gfx701 +// GFX702:triple=amdgcn-amd-amdhsa,arch=gfx702 +// GFX703:triple=amdgcn-amd-amdhsa,arch=gfx703 +// GFX704:triple=amdgcn-amd-amdhsa,arch=gfx704 +// GFX705:triple=amdgcn-amd-amdhsa,arch=gfx705 +// GFX801:triple=amdgcn-amd-amdhsa,arch=gfx801 +// GFX802:triple=amdgcn-amd-amdhsa,arch=gfx802 +// GFX803:triple=amdgcn-amd-amdhsa,arch=gfx803 +// GFX805:triple=amdgcn-amd-amdhsa,arch=gfx805 +// GFX810:triple=amdgcn-amd-amdhsa,arch=gfx810 +// GFX900:triple=amdgcn-amd-amdhsa,arch=gfx900 +// GFX902:triple=amdgcn-amd-amdhsa,arch=gfx902 +// SPIRV:triple=spirv64-amd-amdhsa,arch=amdgcnspirv diff --git a/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip index f17e56acfb7f7..a73587d77d679 100644 --- a/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip +++ b/clang/test/Driver/dep-file-flag-with-multiple-offload-archs.hip @@ -1,12 +1,9 @@ // RUN: %clang -### -nogpuinc -nogpulib --offload-arch=gfx1030 --offload-arch=gfx1100 --offload-arch=gfx1101 --target=x86_64-linux-gnu -MD -MF tmp.d %s 2>&1 | FileCheck %s // CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1030"{{.*}}"-dependency-file" "tmp.d" -// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1030" // CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1100"{{.*}}"-dependency-file" "tmp.d" -// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1100" // CHECK-NOT: {{.*}}clang{{.*}}"-target-cpu" "gfx1101"{{.*}}"-dependency-file" "tmp.d" -// CHECK: {{.*}}lld{{.*}}"-plugin-opt=mcpu=gfx1101" -// CHECK: {{.*}}clang-offload-bundler +// CHECK: {{.*}}llvm-offload-binary // CHECK: {{.*}}clang{{.*}}"-target-cpu"{{.*}}"-dependency-file" "tmp.d" void main(){} diff --git a/clang/test/Driver/hip-code-object-version.hip b/clang/test/Driver/hip-code-object-version.hip index 6767c27761d0a..d4887609f4547 100644 --- a/clang/test/Driver/hip-code-object-version.hip +++ b/clang/test/Driver/hip-code-object-version.hip @@ -7,7 +7,6 @@ // V4: "-mcode-object-version=4" // V4: "-mllvm" "--amdhsa-code-object-version=4" -// V4: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906" // Check bundle ID for code object version 5. @@ -18,7 +17,6 @@ // V5: "-mcode-object-version=5" // V5: "-mllvm" "--amdhsa-code-object-version=5" -// V5: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906" // Check bundle ID for code object version 6. @@ -29,11 +27,10 @@ // V6: "-mcode-object-version=6" // V6: "-mllvm" "--amdhsa-code-object-version=6" -// V6: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906" // Check bundle ID for code object version default -// RUN: %clang -### --target=x86_64-linux-gnu \ +// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ // RUN: --offload-arch=gfx906 -nogpuinc -nogpulib \ // RUN: %s 2>&1 | FileCheck -check-prefix=VD %s diff --git a/clang/test/Driver/hip-gz-options.hip b/clang/test/Driver/hip-gz-options.hip index 36de8e8404020..6d2709a172784 100644 --- a/clang/test/Driver/hip-gz-options.hip +++ b/clang/test/Driver/hip-gz-options.hip @@ -1,14 +1,13 @@ // REQUIRES: zlib // RUN: %clang -### --target=x86_64-unknown-linux-gnu \ -// RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \ +// RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \ // RUN: -ggdb -gz=zlib 2>&1 | FileCheck %s // RUN: %clang -### --target=x86_64-unknown-linux-gnu \ // RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \ // RUN: -ggdb -gz=zlib 2>&1 | FileCheck %s -// CHECK-DAG: {{".*clang(-[0-9]+)?(.exe)?" .* "--compress-debug-sections=zlib"}} -// CHECK-DAG: {{".*lld(.exe)?" .* "--compress-debug-sections=zlib"}} -// CHECK-DAG: {{".*clang(-[0-9]+)?(.exe)?" .* "--compress-debug-sections=zlib"}} +// CHECK-DAG: {{".*clang(-[0-9]+)?(.exe)?" .* "-triple" "amdgcn-amd-amdhsa" .* "--compress-debug-sections=zlib"}} +// CHECK-DAG: {{".*clang(-[0-9]+)?(.exe)?" .* "-triple" "x86_64-unknown-linux-gnu".* "--compress-debug-sections=zlib"}} // CHECK: "--compress-debug-sections=zlib" diff --git a/clang/test/Driver/hip-macros.hip b/clang/test/Driver/hip-macros.hip index 4c460d50bf39a..c9222ef82936c 100644 --- a/clang/test/Driver/hip-macros.hip +++ b/clang/test/Driver/hip-macros.hip @@ -54,8 +54,6 @@ // RUN: %clang -E -dM --offload-arch=gfx942 --cuda-device-only -nogpuinc -nogpulib \ // RUN: %s 2>&1 | FileCheck --check-prefixes=NOPTS %s // PTS-DAG: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ 1 -// PTS-DAG: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ 1 -// PTS-DAG: #define HIP_API_PER_THREAD_DEFAULT_STREAM 1 // PTS-DAG: #define HIP_API_PER_THREAD_DEFAULT_STREAM 1 // NOPTS-NOT: #define __HIP_API_PER_THREAD_DEFAULT_STREAM__ // NOPTS-NOT: #define HIP_API_PER_THREAD_DEFAULT_STREAM @@ -66,4 +64,3 @@ // RUN: %s 2>&1 | FileCheck --check-prefix=APPROX %s // NOAPPROX-NOT: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ // APPROX: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ 1 -// APPROX: #define __CLANG_GPU_APPROX_TRANSCENDENTALS__ 1 diff --git a/clang/test/Driver/hip-offload-arch.hip b/clang/test/Driver/hip-offload-arch.hip index dd65a0e103ec6..1af53baf63da7 100644 --- a/clang/test/Driver/hip-offload-arch.hip +++ b/clang/test/Driver/hip-offload-arch.hip @@ -4,5 +4,5 @@ // RUN: -nogpuinc -nogpulib \ // RUN: %s 2>&1 | FileCheck %s -// CHECK: {{"[^"]*clang[^"]*".* "-target-cpu" "gfx1030"}} -// CHECK: {{"[^"]*clang[^"]*".* "-target-cpu" "gfx1031"}} +// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx1030" +// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-target-cpu" "gfx1031" diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip index 09f1ffa62d348..43713cc7bc5b8 100644 --- a/clang/test/Driver/hip-options.hip +++ b/clang/test/Driver/hip-options.hip @@ -83,16 +83,12 @@ // RUN: --cuda-gpu-arch=gfx906 -foffload-lto=thin -fwhole-program-vtables %s 2>&1 \ // RUN: | FileCheck -check-prefix=HIPTHINLTO %s -// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ -// RUN: --cuda-gpu-arch=gfx906 -fgpu-rdc -foffload-lto=thin -fwhole-program-vtables %s 2>&1 \ -// RUN: | FileCheck -check-prefix=HIPTHINLTO %s - // Ensure we don't error about -fwhole-program-vtables for the non-device offload compile. // HIPTHINLTO-NOT: error: invalid argument '-fwhole-program-vtables' only allowed with '-flto' // HIPTHINLTO-NOT: "-cc1"{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-flto-unit" // HIPTHINLTO: "-cc1"{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-flto=thin" "-flto-unit" {{.*}} "-fwhole-program-vtables" // HIPTHINLTO-NOT: "-cc1"{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-flto-unit" -// HIPTHINLTO: lld{{.*}}"-plugin-opt=mcpu=gfx906" "-plugin-opt=thinlto" "-plugin-opt=-force-import-all" +// HIPTHINLTO: clang-linker-wrapper{{.*}} "--device-compiler=amdgcn-amd-amdhsa=-flto=thin" // Check that -flto=thin is handled correctly, particularly with -fwhole-program-vtables. // @@ -120,10 +116,7 @@ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ // RUN: --cuda-gpu-arch=gfx906 -fgpu-rdc -Xoffload-linker --build-id=md5 %s 2>&1 \ // RUN: | FileCheck -check-prefix=OFL-LINK %s -// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ -// RUN: --cuda-gpu-arch=gfx906 -Xoffload-linker --build-id=md5 %s 2>&1 \ -// RUN: | FileCheck -check-prefix=OFL-LINK %s -// OFL-LINK: lld{{.*}}"--build-id=md5" +// OFL-LINK: clang-linker-wrapper{{.*}}"--device-linker=--build-id=md5" // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ // RUN: --offload-arch=gfx906 -fhip-kernel-arg-name %s 2>&1 \ diff --git a/clang/test/Driver/hip-sanitize-options.hip b/clang/test/Driver/hip-sanitize-options.hip index 490385173a4cb..5690860b6e374 100644 --- a/clang/test/Driver/hip-sanitize-options.hip +++ b/clang/test/Driver/hip-sanitize-options.hip @@ -61,8 +61,8 @@ // NORDC-NOT: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}} // NORDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} -// RDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} // RDC: {{"[^"]*clang[^"]*".* "-emit-llvm-bc".* "-fcuda-is-device".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.bc]]" +// RDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} // RDC-NOT: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}} // FAIL: error: cannot find ROCm device library for ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library diff --git a/clang/test/Driver/hip-save-temps.hip b/clang/test/Driver/hip-save-temps.hip index 142c3f1611a36..2e8489f65d7e0 100644 --- a/clang/test/Driver/hip-save-temps.hip +++ b/clang/test/Driver/hip-save-temps.hip @@ -1,31 +1,31 @@ // -fno-gpu-rdc without -o with -c // RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \ -// RUN: -nogpuinc --offload-arch=gfx900 -c %s 2>&1 | \ +// RUN: --no-offload-new-driver -nogpuinc --offload-arch=gfx900 -c %s 2>&1 | \ // RUN: FileCheck -check-prefixes=CHECK,NORDC %s // -fno-gpu-rdc without -o // RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \ -// RUN: -nogpuinc --offload-arch=gfx900 %s 2>&1 | \ +// RUN: --no-offload-new-driver -nogpuinc --offload-arch=gfx900 %s 2>&1 | \ // RUN: FileCheck -check-prefixes=CHECK,NORDC,NOUT %s // -fno-gpu-rdc with -o // RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \ -// RUN: -nogpuinc -o executable --offload-arch=gfx900 %s 2>&1 | \ +// RUN: --no-offload-new-driver -nogpuinc -o executable --offload-arch=gfx900 %s 2>&1 | \ // RUN: FileCheck -check-prefixes=CHECK,NORDC,WOUT %s // -fgpu-rdc without -o with -c // RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \ -// RUN: -nogpuinc -fgpu-rdc --offload-arch=gfx900 -c %s 2>&1 | \ +// RUN: --no-offload-new-driver -nogpuinc -fgpu-rdc --offload-arch=gfx900 -c %s 2>&1 | \ // RUN: FileCheck -check-prefixes=CHECK,RDC,RDCC %s // -fgpu-rdc without -o // RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \ -// RUN: -nogpuinc -fgpu-rdc --offload-arch=gfx900 %s 2>&1 | \ +// RUN: --no-offload-new-driver -nogpuinc -fgpu-rdc --offload-arch=gfx900 %s 2>&1 | \ // RUN: FileCheck -check-prefixes=CHECK,RDC,RDCL,NOUT %s // -fgpu-rdc with -o // UN: %clang -### --target=x86_64-linux-gnu -nogpulib -save-temps \ -// UN: -nogpuinc -o executable -fgpu-rdc --offload-arch=gfx900 %s 2>&1 | \ +// UN: --offload-new-driver -nogpuinc -o executable -fgpu-rdc --offload-arch=gfx900 %s 2>&1 | \ // UN: FileCheck -check-prefixes=CHECK,RDC,RDCL,WOUT %s // -fgpu-rdc host object path diff --git a/clang/test/Driver/hip-thinlto.hip b/clang/test/Driver/hip-thinlto.hip index bcb7d4e6cb52e..53fd0485cb16b 100644 --- a/clang/test/Driver/hip-thinlto.hip +++ b/clang/test/Driver/hip-thinlto.hip @@ -1,9 +1,9 @@ // RUN: %clang -foffload-lto=thin -nogpulib -nogpuinc %s -### 2>&1 | FileCheck %s -// CHECK: -plugin-opt=thinlto -// CHECK-SAME: -plugin-opt=-force-import-all -// CHECK-SAME: -plugin-opt=-avail-extern-to-local -// CHECK-SAME: -plugin-opt=-avail-extern-gv-in-addrspace-to-local=3 +// CHECK: "--device-compiler=amdgcn-amd-amdhsa=-flto=thin" +// CHECK-SAME: "--device-linker=amdgcn-amd-amdhsa=-plugin-opt=-force-import-all" +// CHECK-SAME: "--device-linker=amdgcn-amd-amdhsa=-plugin-opt=-avail-extern-to-local" +// CHECK-SAME: "--device-linker=amdgcn-amd-amdhsa=-plugin-opt=-avail-extern-gv-in-addrspace-to-local=3" int main(int, char *[]) { return 0; } diff --git a/clang/test/Driver/hip-toolchain-device-only.hip b/clang/test/Driver/hip-toolchain-device-only.hip index 12097819f6688..c0621854f17ce 100644 --- a/clang/test/Driver/hip-toolchain-device-only.hip +++ b/clang/test/Driver/hip-toolchain-device-only.hip @@ -21,7 +21,3 @@ // CHECK: [[LLD]] "-flavor" "gnu" "-m" "elf64_amdgpu" "--no-undefined" "-shared" // CHECK-SAME: "-o" "[[IMG_DEV_A_900:.*out]]" [[OBJ_DEV_A_900]] - -// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o" -// CHECK-SAME: "-targets={{.*}},hip{{.*}}-amdgcn-amd-amdhsa--gfx803,hip{{.*}}-amdgcn-amd-amdhsa--gfx900" -// CHECK-SAME: "-input={{.*}}" "-input=[[IMG_DEV_A_803]]" "-input=[[IMG_DEV_A_900]]" "-output=[[BUNDLE_A:.*hipfb]]" diff --git a/clang/test/Driver/hip-toolchain-mllvm.hip b/clang/test/Driver/hip-toolchain-mllvm.hip index 33018cc398915..bedb053b9006c 100644 --- a/clang/test/Driver/hip-toolchain-mllvm.hip +++ b/clang/test/Driver/hip-toolchain-mllvm.hip @@ -30,13 +30,11 @@ // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" // CHECK-SAME: {{.*}} "-target-cpu" "gfx803" // CHECK-SAME: {{.*}} "-mllvm" "-unroll-count=10" {{.*}} -// CHECK: [[LLD:".*lld.*"]] {{.*}}"-m" "elf64_amdgpu"{{.*}} "-plugin-opt=-unroll-count=10"{{.*}} "-plugin-opt=-inline-threshold=100" // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" // CHECK-SAME: {{.*}} "-target-cpu" "gfx900" // CHECK-SAME: {{.*}} "-mllvm" "-unroll-count=10" {{.*}} -// CHECK: [[LLD:".*lld.*"]] {{.*}} "-plugin-opt=-unroll-count=10"{{.*}} "-plugin-opt=-inline-threshold=100" // NEG-NOT: {{".*opt"}} // NEG-NOT: {{".*llc"}} diff --git a/clang/test/Driver/hip-toolchain-no-rdc.hip b/clang/test/Driver/hip-toolchain-no-rdc.hip index bc560330d5696..f8999d3638e3e 100644 --- a/clang/test/Driver/hip-toolchain-no-rdc.hip +++ b/clang/test/Driver/hip-toolchain-no-rdc.hip @@ -4,7 +4,7 @@ // 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 -B%S/Inputs/lld -nogpuinc \ +// RUN: -fuse-ld=lld -B%S/Inputs/lld -nogpuinc --no-offload-new-driver \ // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LINK,OLD %s @@ -14,7 +14,7 @@ // 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 -B%S/Inputs/lld -nogpuinc -c \ +// RUN: -fuse-ld=lld -B%S/Inputs/lld -nogpuinc -c --no-offload-new-driver \ // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,OLD %s @@ -36,11 +36,16 @@ // RUN: %t/a.o %t/b.o \ // RUN: 2>&1 | FileCheck -check-prefixes=LKONLY %s -// RUN: %clang -### --target=x86_64-linux-gnu \ +// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ // RUN: --offload-arch=amdgcnspirv --offload-arch=gfx900 \ // RUN: %s -nogpuinc -nogpulib \ // RUN: 2>&1 | FileCheck -check-prefixes=AMDGCNSPIRV %s +// RUN: %clang -### --target=x86_64-linux-gnu --offload-new-driver \ +// RUN: --offload-arch=amdgcnspirv --offload-arch=gfx900 \ +// RUN: %s -nogpuinc -nogpulib \ +// RUN: 2>&1 | FileCheck -check-prefixes=AMDGCNSPIRV-NEW %s + // // Compile device code in a.cu to code object for gfx803. // @@ -214,6 +219,7 @@ // AMDGCNSPIRV: {{".*clang-offload-bundler.*"}} "-type=o" // AMDGCNSPIRV-SAME: "-targets={{.*}}hipv4-spirv64-amd-amdhsa--amdgcnspirv,hipv4-amdgcn-amd-amdhsa--gfx900" // AMDGCNSPIRV-SAME: "-input=[[AMDGCNSPV_CO]]" "-input=[[GFX900_CO]]" +// AMDGCNSPIRV-NEW: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-llvm-bc" {{.*}} "-o" "[[AMDGCNSPV_BC:.*bc]]" // Check verbose printing with the new driver. // RUN: %clang -### --target=x86_64-linux-gnu -fno-gpu-rdc -nogpulib -nogpuinc \ diff --git a/clang/test/Driver/hip-toolchain-opt.hip b/clang/test/Driver/hip-toolchain-opt.hip index b104f6fff2034..bb033717deada 100644 --- a/clang/test/Driver/hip-toolchain-opt.hip +++ b/clang/test/Driver/hip-toolchain-opt.hip @@ -74,30 +74,6 @@ // O0-CGO2-SAME: "-O0" // O0-CGO2-NOT: "--lto-CGO2" -// ALL-NOT: "{{.*}}opt" - -// ALL-NOT: "{{.*}}llc" - -// ALL: "{{.*}}lld{{.*}}" {{.*}} "-plugin-opt=mcpu=gfx900" -// DEFAULT-NOT: "-plugin-opt=O{{.*}}" -// O0-SAME: "-plugin-opt=O0" -// O0-SAME: "--lto-CGO0" -// O1-SAME: "-plugin-opt=O1" -// O1-SAME: "--lto-CGO1" -// O2-SAME: "-plugin-opt=O2" -// O2-SAME: "--lto-CGO2" -// O3-SAME: "-plugin-opt=O3" -// O3-SAME: "--lto-CGO3" -// Os-SAME: "-plugin-opt=O2" -// Os-SAME: "--lto-CGO2" -// Oz-SAME: "-plugin-opt=O2" -// Oz-SAME: "--lto-CGO2" -// Og-SAME: "-plugin-opt=O1" -// Og-SAME: "--lto-CGO1" -// O0-CGO2-SAME: "-plugin-opt=O0" -// O0-CGO2-SAME: "--lto-CGO0" -// O0-CGO2-SAME: "--lto-CGO2" - // ALL: "-cc1" "-triple" "x86_64-unknown-linux-gnu" // DEFAULT-NOT: "-O{{.}}" // O0-SAME: "-O0" @@ -109,3 +85,14 @@ // Og-SAME: "-Og" // O0-CGO2-SAME: "-O0" // O0-CGO2-NOT: "--lto-CGO2" + +// ALL: "{{.*}}clang-linker-wrapper{{.*}}" "--should-extract=gfx900" +// DEFAULT-NOT: "--device-compiler=amdgcn-amd-amdhsa=-O{{.*}}" +// O0-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O0" +// O1-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O1" +// O2-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O2" +// O3-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O3" +// Os-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Os" +// Oz-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Oz" +// Og-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Og" +// O0-CGO2-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O0" diff --git a/clang/test/Driver/hipspv-link-static-library.hip b/clang/test/Driver/hipspv-link-static-library.hip index 03126ae589a09..49365cb75adca 100644 --- a/clang/test/Driver/hipspv-link-static-library.hip +++ b/clang/test/Driver/hipspv-link-static-library.hip @@ -9,13 +9,13 @@ // Test that -l options are passed to llvm-link for --offload=spirv64 // RUN: %clang -### --target=x86_64-linux-gnu --offload=spirv64 \ -// RUN: --hip-path=%S/Inputs/hipspv -nohipwrapperinc %s \ +// RUN: --no-offload-new-driver --hip-path=%S/Inputs/hipspv -nohipwrapperinc %s \ // RUN: -L%t -lSDL \ // RUN: 2>&1 | FileCheck -check-prefix=SDL-LINK %s // Test that .a files are properly unbundled and passed to llvm-link // RUN: %clang -### --target=x86_64-linux-gnu --offload=spirv64 \ -// RUN: --hip-path=%S/Inputs/hipspv -nohipwrapperinc %s \ +// RUN: --no-offload-new-driver --hip-path=%S/Inputs/hipspv -nohipwrapperinc %s \ // RUN: %t/libSDL.a \ // RUN: 2>&1 | FileCheck -check-prefix=SDL-ARCHIVE %s diff --git a/clang/test/Driver/hipspv-pass-plugin.hip b/clang/test/Driver/hipspv-pass-plugin.hip index fc3c64b057352..de6e07b57bd6f 100644 --- a/clang/test/Driver/hipspv-pass-plugin.hip +++ b/clang/test/Driver/hipspv-pass-plugin.hip @@ -1,19 +1,19 @@ // UNSUPPORTED: system-windows // RUN: %clang -### -target x86_64-linux-gnu --offload=spirv64 \ -// RUN: --hip-path=%S/Inputs/hipspv -nogpuinc %s \ +// RUN: --no-offload-new-driver --hip-path=%S/Inputs/hipspv -nogpuinc %s \ // RUN: 2>&1 | FileCheck --check-prefixes=FROM-HIP-PATH %s // RUN: %clang -### -target x86_64-linux-gnu --offload=spirv64 \ -// RUN: -nogpuinc -nogpulib --hipspv-pass-plugin=%S/Inputs/pass-plugin.so %s \ +// RUN: --no-offload-new-driver -nogpuinc -nogpulib --hipspv-pass-plugin=%S/Inputs/pass-plugin.so %s \ // RUN: 2>&1 | FileCheck --check-prefixes=FROM-OPTION %s // RUN: not %clang -### --target=x86_64-linux-gnu --offload=spirv64 \ -// RUN: -nogpuinc -nogpulib --hipspv-pass-plugin=foo.so %s \ +// RUN: --no-offload-new-driver -nogpuinc -nogpulib --hipspv-pass-plugin=foo.so %s \ // RUN: 2>&1 | FileCheck --check-prefixes=FROM-OPTION-INVALID %s // RUN: %clang -### -target x86_64-linux-gnu --offload=spirv64 \ -// RUN: -nogpuinc -nogpulib %s \ +// RUN: --no-offload-new-driver -nogpuinc -nogpulib %s \ // RUN: 2>&1 | FileCheck --check-prefixes=NO-PLUGIN %s // FROM-HIP-PATH: {{".*opt"}} {{".*.bc"}} "-load-pass-plugin" diff --git a/clang/test/Driver/hipspv-toolchain.hip b/clang/test/Driver/hipspv-toolchain.hip index 3c175ebf433cc..76997a27e4065 100644 --- a/clang/test/Driver/hipspv-toolchain.hip +++ b/clang/test/Driver/hipspv-toolchain.hip @@ -41,7 +41,7 @@ // RUN: && chmod +x %t/versioned/llvm-spirv-%llvm-version-major // RUN: env "PATH=%t/versioned" %clang -### -target x86_64-linux-gnu \ // RUN: --offload=spirv64 --hip-path=%S/Inputs/hipspv -nohipwrapperinc \ -// RUN: %s 2>&1 \ +// RUN: --no-offload-new-driver %s 2>&1 \ // RUN: | FileCheck -DVERSION=%llvm-version-major \ // RUN: --check-prefix=VERSIONED %s diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index 25e1d67eb2294..53b5140fdbdb6 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -443,9 +443,9 @@ TEST_F(CommandLineExtractorTest, AcceptOffloadingCompile) { TEST_F(CommandLineExtractorTest, AcceptOffloadingSyntaxOnly) { addFile("test.c", "int main() {}\n"); const char *Args[] = { - "clang", "-target", "arm64-apple-macosx11.0.0", - "-fsyntax-only", "-x", "hip", - "test.c", "-nogpulib", "-nogpuinc"}; + "clang", "-target", "arm64-apple-macosx11.0.0", "-fsyntax-only", + "-x", "hip", "--no-offload-new-driver", "test.c", + "-nogpulib", "-nogpuinc"}; EXPECT_NE(extractCC1Arguments(Args), nullptr); } >From 26385bbaab24bfca41970cf70f8d43a6d756795e Mon Sep 17 00:00:00 2001 From: Joseph Huber <[email protected]> Date: Mon, 17 Nov 2025 10:17:16 -0600 Subject: [PATCH 2/2] update tests --- clang/test/Driver/hip-code-object-version.hip | 9 +------- clang/test/Driver/hip-options.hip | 2 -- clang/test/Driver/hip-sanitize-options.hip | 4 +--- clang/test/Driver/hip-temps-windows.hip | 2 +- clang/test/Driver/hip-toolchain-opt.hip | 22 +++++++++---------- clang/test/Driver/no-gpu-bundle-respected.hip | 4 ++-- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/clang/test/Driver/hip-code-object-version.hip b/clang/test/Driver/hip-code-object-version.hip index d4887609f4547..c57593a4ec478 100644 --- a/clang/test/Driver/hip-code-object-version.hip +++ b/clang/test/Driver/hip-code-object-version.hip @@ -69,11 +69,4 @@ // RUN: %s 2>&1 | FileCheck -check-prefix=CC1 %s // CC1: "-cc1" {{.*}}"-mcode-object-version=5" {{.*}}"-mllvm" "--amdhsa-code-object-version=5" -// CC1: "-cc1as" {{.*}}"-mllvm" "--amdhsa-code-object-version=5" - -// RUN: not %clang -### --target=x86_64-linux-gnu \ -// RUN: -mcode-object-version=5 \ -// RUN: --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm -save-temps \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CC1NEG %s - -// CC1NEG-NOT: "-cc1as" {{.*}}"-mcode-object-version=5" +// CC1: clang-linker-wrapper{{.*}}"--device-compiler=amdgcn-amd-amdhsa=-mcode-object-version=5" diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip index 43713cc7bc5b8..a6a66034f13de 100644 --- a/clang/test/Driver/hip-options.hip +++ b/clang/test/Driver/hip-options.hip @@ -22,7 +22,6 @@ // RUN: %clang -### -nogpulib -nogpuinc --target=x86_64-unknown-linux-gnu -mprintf-kind=hostcall %s -save-temps 2>&1 | FileCheck -check-prefix=HOSTC %s // HOSTC: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-mprintf-kind=hostcall" "-Werror=format-invalid-specifier"{{.*}}"-E" {{.*}} // HOSTC: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}} "-mprintf-kind=hostcall" "-Werror=format-invalid-specifier" {{.*}}"-x" "hip-cpp-output" -// HOSTC: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}} "-mprintf-kind=hostcall" "-Werror=format-invalid-specifier" {{.*}}"-x" "ir" // HOSTC: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}} "-E" {{.*}} // HOSTC: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-x" "ir" @@ -30,7 +29,6 @@ // RUN: %clang -### -nogpulib -nogpuinc --target=x86_64-unknown-linux-gnu -mprintf-kind=buffered %s -save-temps 2>&1 | FileCheck -check-prefix=BUFF %s // BUFF: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}}"-mprintf-kind=buffered" "-Werror=format-invalid-specifier"{{.*}}"-E" {{.*}} // BUFF: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}} "-mprintf-kind=buffered" "-Werror=format-invalid-specifier" {{.*}}"-x" "hip-cpp-output" -// BUFF: "-cc1" "-triple" "amdgcn-amd-amdhsa"{{.*}} "-mprintf-kind=buffered" "-Werror=format-invalid-specifier" {{.*}}"-x" "ir" // BUFF: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}} "-E" {{.*}} // BUFF: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-x" "ir" diff --git a/clang/test/Driver/hip-sanitize-options.hip b/clang/test/Driver/hip-sanitize-options.hip index 5690860b6e374..ff7dceb437e0b 100644 --- a/clang/test/Driver/hip-sanitize-options.hip +++ b/clang/test/Driver/hip-sanitize-options.hip @@ -57,13 +57,11 @@ // CHECK-NOT: {{"[^"]*lld(\.exe){0,1}".* ".*hip.bc"}} // CHECK: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} -// NORDC: {{"[^"]*clang[^"]*".* "-emit-obj".* "-fcuda-is-device".* .* "-mlink-bitcode-file" ".*asanrtl.bc".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.o]]" -// NORDC-NOT: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}} +// NORDC: {{"[^"]*clang[^"]*".* "-emit-llvm-bc".* "-fcuda-is-device".* .* "-mlink-bitcode-file" ".*asanrtl.bc".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.bc]]" // NORDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} // RDC: {{"[^"]*clang[^"]*".* "-emit-llvm-bc".* "-fcuda-is-device".* "-mlink-bitcode-file" ".*asanrtl.bc".* "-fsanitize=address".*}} "-o" "[[OUT:[^"]*.bc]]" // RDC: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}} -// RDC-NOT: {{"[^"]*lld(\.exe){0,1}".*}} "[[OUT]]" {{".*asanrtl.bc" ".*hip.bc"}} // FAIL: error: cannot find ROCm device library for ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library diff --git a/clang/test/Driver/hip-temps-windows.hip b/clang/test/Driver/hip-temps-windows.hip index ac1ac208a65dc..5df4c05b24c56 100644 --- a/clang/test/Driver/hip-temps-windows.hip +++ b/clang/test/Driver/hip-temps-windows.hip @@ -7,7 +7,7 @@ // RUN: mkdir -p %t/mytmp // RUN: env TMP="%t/mytmp" %clang --target=x86_64-pc-windows-msvc -nogpulib -nogpuinc \ // RUN: --rocm-path=%S/Inputs/rocm -nostdinc -nostdlib -c \ -// RUN: --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \ +// RUN: --no-offload-new-driver --offload-arch=gfx1030 -emit-llvm -v %s 2>&1 | \ // RUN: FileCheck -check-prefixes=CHECK %s // RUN: ls %t/mytmp >%t/mytmp.txt 2>&1 // RUN: touch %t/empty.txt diff --git a/clang/test/Driver/hip-toolchain-opt.hip b/clang/test/Driver/hip-toolchain-opt.hip index bb033717deada..22edf4107004e 100644 --- a/clang/test/Driver/hip-toolchain-opt.hip +++ b/clang/test/Driver/hip-toolchain-opt.hip @@ -74,6 +74,17 @@ // O0-CGO2-SAME: "-O0" // O0-CGO2-NOT: "--lto-CGO2" +// ALL: "{{.*}}clang-linker-wrapper{{.*}}" "--should-extract=gfx900" +// DEFAULT-NOT: "--device-compiler=amdgcn-amd-amdhsa=-O{{.*}}" +// O0-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O0" +// O1-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O1" +// O2-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O2" +// O3-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O3" +// Os-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Os" +// Oz-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Oz" +// Og-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Og" +// O0-CGO2-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O0" + // ALL: "-cc1" "-triple" "x86_64-unknown-linux-gnu" // DEFAULT-NOT: "-O{{.}}" // O0-SAME: "-O0" @@ -85,14 +96,3 @@ // Og-SAME: "-Og" // O0-CGO2-SAME: "-O0" // O0-CGO2-NOT: "--lto-CGO2" - -// ALL: "{{.*}}clang-linker-wrapper{{.*}}" "--should-extract=gfx900" -// DEFAULT-NOT: "--device-compiler=amdgcn-amd-amdhsa=-O{{.*}}" -// O0-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O0" -// O1-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O1" -// O2-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O2" -// O3-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O3" -// Os-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Os" -// Oz-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Oz" -// Og-SAME: "--device-compiler=amdgcn-amd-amdhsa=-Og" -// O0-CGO2-SAME: "--device-compiler=amdgcn-amd-amdhsa=-O0" diff --git a/clang/test/Driver/no-gpu-bundle-respected.hip b/clang/test/Driver/no-gpu-bundle-respected.hip index fc93640dc4b90..1272a55e0691f 100644 --- a/clang/test/Driver/no-gpu-bundle-respected.hip +++ b/clang/test/Driver/no-gpu-bundle-respected.hip @@ -10,8 +10,8 @@ // RUN: --no-gpu-bundle-output --offload-arch=gfx900,gfx1030 -O3 -x hip %s \ // RUN: 2>&1 | FileCheck %s --check-prefixes=COMPILER,GFX1030,GFX900,OFFLOAD,NOBUNDLE -// BUNDLE: clang-offload-bundler -// NOBUNDLE-NOT: clang-offload-bundler +// BUNDLE: llvm-offload-binary +// NOBUNDLE-NOT: llvm-offload-binary // COM: sanity checks // COMPILER: compiler _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
