[clang] clang/AMDGPU: Respect __launch_bounds__ attribute (PR #215615)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 01:36:57 PDT 2026


================
@@ -347,8 +347,28 @@ void AMDGPUTargetCodeGenInfo::setFunctionDeclAttributes(
   const bool IsHIPKernel = M.getLangOpts().HIP && FD->hasAttr<CUDAGlobalAttr>();
 
   const auto *FlatWGS = FD->getAttr<AMDGPUFlatWorkGroupSizeAttr>();
+
+  // The CUDA __launch_bounds__ arguments are honored only if the equivalent
+  // native amdgpu_flat_work_group_size / amdgpu_waves_per_eu attribute was not
+  // also spelled out; those take precedence.
+  const auto *LaunchBounds = FD->getAttr<CUDALaunchBoundsAttr>();
----------------
arsenm wrote:

It turns out nothing enforces this and NVPTX silently ignores it on device functions 

https://github.com/llvm/llvm-project/pull/215615


More information about the cfe-commits mailing list