https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/204864
Previously this flag was only handled for HIP, and would produce an unused argument warning. Also use a simpler method for forwarding the flag to cc1. >From b8802cd8fed469f9d7e4aadb24760f8c734228ec Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Fri, 19 Jun 2026 17:01:05 +0200 Subject: [PATCH] clang/AMDGPU: Remove artificial restriction on --gpu-max-threads-per-block Previously this flag was only handled for HIP, and would produce an unused argument warning. Also use a simpler method for forwarding the flag to cc1. --- clang/lib/Driver/ToolChains/AMDGPU.cpp | 10 ++-------- clang/test/Driver/amdgpu-openmp-max-threads.c | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 clang/test/Driver/amdgpu-openmp-max-threads.c diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index 6611b133057f5..495f724338250 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -878,16 +878,10 @@ void AMDGPUToolChain::addClangTargetOptions( if (DriverArgs.hasArgNoClaim(options::OPT_hipstdpar)) CC1Args.append({"-mllvm", "-amdgpu-enable-hipstdpar"}); } - - // FIXME: This should not depend on HIP - StringRef MaxThreadsPerBlock = - DriverArgs.getLastArgValue(options::OPT_gpu_max_threads_per_block_EQ); - if (!MaxThreadsPerBlock.empty()) { - CC1Args.push_back(DriverArgs.MakeArgString( - Twine("--gpu-max-threads-per-block=") + MaxThreadsPerBlock)); - } } + DriverArgs.AddLastArg(CC1Args, options::OPT_gpu_max_threads_per_block_EQ); + // Default to "hidden" visibility, as object level linking will not be // supported for the foreseeable future. // TODO: remove the SPIR-V bypass once it can encode (hidden) visibility. diff --git a/clang/test/Driver/amdgpu-openmp-max-threads.c b/clang/test/Driver/amdgpu-openmp-max-threads.c new file mode 100644 index 0000000000000..52f95e0182419 --- /dev/null +++ b/clang/test/Driver/amdgpu-openmp-max-threads.c @@ -0,0 +1,5 @@ +// Test that --gpu-max-threads-per-block is not ignored by openmp. +// RUN: %clang -### -fopenmp --offload-arch=gfx906 --gpu-max-threads-per-block=256 %s 2>&1 | FileCheck %s + +// CHECK: "-cc1" "-triple" "amdgcn-amd-amdhsa" +// CHECK-SAME: "--gpu-max-threads-per-block=256" _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
