[Mlir-commits] [clang] [llvm] [mlir] [OpenMP] Reserve the main thread's warp for generic mode kernels (PR #218790)
Joseph Huber
llvmlistbot at llvm.org
Wed Aug 26 07:15:08 PDT 2026
================
@@ -199,6 +200,17 @@ static const omp::GV &getGridValue(const Triple &T, Function *Kernel) {
Kernel->getFnAttribute("target-features").getValueAsString();
if (Features.count("+wavefrontsize64"))
return omp::getAMDGPUGridValues<64>();
+ if (Features.count("+wavefrontsize32"))
+ return omp::getAMDGPUGridValues<32>();
+
+ // Clang sets no wavefront size on OpenMP device kernels, so ask the CPU.
+ StringRef CPU = Kernel->getFnAttribute("target-cpu").getValueAsString();
+ AMDGPU::GPUKind Kind = AMDGPU::parseArchAMDGCN(CPU);
+ if (Kind == AMDGPU::GK_NONE)
+ Kind = AMDGPU::getGPUKindFromSubArch(T.getSubArch());
+ if (Kind != AMDGPU::GK_NONE &&
+ !AMDGPU::getFeatureBitset(Kind).test(AMDGPU::FEAT_SUPPORTS_WAVE32))
+ return omp::getAMDGPUGridValues<64>();
return omp::getAMDGPUGridValues<32>();
----------------
jhuber6 wrote:
I'm not entirely convinced that this PR couldn't just be three lines of code in the offload runtime to make sure we widen the launch bounds correctly.
https://github.com/llvm/llvm-project/pull/218790
More information about the Mlir-commits
mailing list