Rename options --cuda-gpu-arch and --no-cuda-gpu-arch

Per discussion

http://lists.llvm.org/pipermail/llvm-dev/2017-February/109930.html

Rename -cuda-gpu-arch and --no-cuda-gpu-arch to
--offload-arch and --no-offload-arch.

The original options will be alias to the new options.

Differential Revision: https://reviews.llvm.org/D76987
This commit is contained in:
Yaxun (Sam) Liu 2020-03-28 09:03:13 -04:00
parent 3308732300
commit 764f54bb85
2 changed files with 12 additions and 8 deletions

View File

@ -571,13 +571,17 @@ def cuda_include_ptx_EQ : Joined<["--"], "cuda-include-ptx=">, Flags<[DriverOpti
HelpText<"Include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">; HelpText<"Include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">;
def no_cuda_include_ptx_EQ : Joined<["--"], "no-cuda-include-ptx=">, Flags<[DriverOption]>, def no_cuda_include_ptx_EQ : Joined<["--"], "no-cuda-include-ptx=">, Flags<[DriverOption]>,
HelpText<"Do not include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">; HelpText<"Do not include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.">;
def offload_arch_EQ : Joined<["--"], "offload-arch=">, Flags<[DriverOption]>,
HelpText<"CUDA/HIP offloading device architecture (e.g. sm_35, gfx906). May be specified more than once.">;
def cuda_gpu_arch_EQ : Joined<["--"], "cuda-gpu-arch=">, Flags<[DriverOption]>, def cuda_gpu_arch_EQ : Joined<["--"], "cuda-gpu-arch=">, Flags<[DriverOption]>,
HelpText<"CUDA GPU architecture (e.g. sm_35). May be specified more than once.">; Alias<offload_arch_EQ>;
def hip_link : Flag<["--"], "hip-link">, def hip_link : Flag<["--"], "hip-link">,
HelpText<"Link clang-offload-bundler bundles for HIP">; HelpText<"Link clang-offload-bundler bundles for HIP">;
def no_cuda_gpu_arch_EQ : Joined<["--"], "no-cuda-gpu-arch=">, Flags<[DriverOption]>, def no_offload_arch_EQ : Joined<["--"], "no-offload-arch=">, Flags<[DriverOption]>,
HelpText<"Remove GPU architecture (e.g. sm_35) from the list of GPUs to compile for. " HelpText<"Remove CUDA/HIP offloading device architecture (e.g. sm_35, gfx906) from the list of devices to compile for. "
"'all' resets the list to its default value.">; "'all' resets the list to its default value.">;
def no_cuda_gpu_arch_EQ : Joined<["--"], "no-cuda-gpu-arch=">, Flags<[DriverOption]>,
Alias<no_offload_arch_EQ>;
def cuda_noopt_device_debug : Flag<["--"], "cuda-noopt-device-debug">, def cuda_noopt_device_debug : Flag<["--"], "cuda-noopt-device-debug">,
HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">; HelpText<"Enable device-side debug info generation. Disables ptxas optimizations.">;
def no_cuda_version_check : Flag<["--"], "no-cuda-version-check">, def no_cuda_version_check : Flag<["--"], "no-cuda-version-check">,

View File

@ -2526,13 +2526,13 @@ class OffloadingActionBuilder final {
std::set<CudaArch> GpuArchs; std::set<CudaArch> GpuArchs;
bool Error = false; bool Error = false;
for (Arg *A : Args) { for (Arg *A : Args) {
if (!(A->getOption().matches(options::OPT_cuda_gpu_arch_EQ) || if (!(A->getOption().matches(options::OPT_offload_arch_EQ) ||
A->getOption().matches(options::OPT_no_cuda_gpu_arch_EQ))) A->getOption().matches(options::OPT_no_offload_arch_EQ)))
continue; continue;
A->claim(); A->claim();
const StringRef ArchStr = A->getValue(); const StringRef ArchStr = A->getValue();
if (A->getOption().matches(options::OPT_no_cuda_gpu_arch_EQ) && if (A->getOption().matches(options::OPT_no_offload_arch_EQ) &&
ArchStr == "all") { ArchStr == "all") {
GpuArchs.clear(); GpuArchs.clear();
continue; continue;
@ -2541,9 +2541,9 @@ class OffloadingActionBuilder final {
if (Arch == CudaArch::UNKNOWN) { if (Arch == CudaArch::UNKNOWN) {
C.getDriver().Diag(clang::diag::err_drv_cuda_bad_gpu_arch) << ArchStr; C.getDriver().Diag(clang::diag::err_drv_cuda_bad_gpu_arch) << ArchStr;
Error = true; Error = true;
} else if (A->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) } else if (A->getOption().matches(options::OPT_offload_arch_EQ))
GpuArchs.insert(Arch); GpuArchs.insert(Arch);
else if (A->getOption().matches(options::OPT_no_cuda_gpu_arch_EQ)) else if (A->getOption().matches(options::OPT_no_offload_arch_EQ))
GpuArchs.erase(Arch); GpuArchs.erase(Arch);
else else
llvm_unreachable("Unexpected option."); llvm_unreachable("Unexpected option.");