[clang] [Clang][NFC] Add alias target for amdgpu-arch-tool and nvptx-arch-tool (PR #147558)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 8 08:55:39 PDT 2025
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/147558
Summary:
These commands both do the same thing and behave like the same tool.
Now, the `nvptx-arch` and `amdgpu-arch` tools cause it to only emit
architectures for that name.
>From a24b068349265b2741763711afdcbc81c8282cb7 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 8 Jul 2025 10:47:04 -0500
Subject: [PATCH] [Clang][NFC] Add alias target for amdgpu-arch-tool and
nvptx-arch-tool
Summary:
These commands both do the same thing and behave like the same tool.
Now, the `nvptx-arch` and `amdgpu-arch` tools cause it to only emit
architectures for that name.
---
clang/include/clang/Driver/Options.td | 6 ++++--
clang/lib/Driver/ToolChains/AMDGPU.cpp | 2 +-
clang/lib/Driver/ToolChains/Cuda.cpp | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 4f453aa8b7732..242a6a9a83514 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1173,10 +1173,12 @@ def offload_host_device : Flag<["--"], "offload-host-device">,
def gpu_use_aux_triple_only : Flag<["--"], "gpu-use-aux-triple-only">,
InternalDriverOpt, HelpText<"Prepare '-aux-triple' only without populating "
"'-aux-target-cpu' and '-aux-target-feature'.">;
+def offload_arch_tool_EQ : Joined<["--"], "offload-arch-tool=">,
+ HelpText<"Tool used for detecting offloading architectures in the system.">;
def amdgpu_arch_tool_EQ : Joined<["--"], "amdgpu-arch-tool=">,
- HelpText<"Tool used for detecting AMD GPU arch in the system.">;
+ Alias<offload_arch_tool_EQ>;
def nvptx_arch_tool_EQ : Joined<["--"], "nvptx-arch-tool=">,
- HelpText<"Tool used for detecting NVIDIA GPU arch in the system.">;
+ Alias<offload_arch_tool_EQ>;
defm gpu_rdc : BoolFOption<"gpu-rdc",
LangOpts<"GPURelocatableDeviceCode">, DefaultFalse,
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index b7564a0495da8..7fc34f451f183 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -836,7 +836,7 @@ Expected<SmallVector<std::string>>
AMDGPUToolChain::getSystemGPUArchs(const ArgList &Args) const {
// Detect AMD GPUs availible on the system.
std::string Program;
- if (Arg *A = Args.getLastArg(options::OPT_amdgpu_arch_tool_EQ))
+ if (Arg *A = Args.getLastArg(options::OPT_offload_arch_tool_EQ))
Program = A->getValue();
else
Program = GetProgramPath("amdgpu-arch");
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
index b92c18f1b60f5..2373d945ae509 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -810,7 +810,7 @@ Expected<SmallVector<std::string>>
NVPTXToolChain::getSystemGPUArchs(const ArgList &Args) const {
// Detect NVIDIA GPUs availible on the system.
std::string Program;
- if (Arg *A = Args.getLastArg(options::OPT_nvptx_arch_tool_EQ))
+ if (Arg *A = Args.getLastArg(options::OPT_offload_arch_tool_EQ))
Program = A->getValue();
else
Program = GetProgramPath("nvptx-arch");
More information about the cfe-commits
mailing list