[llvm-branch-commits] [clang] clang/SPIRV: Respect __launch_bounds__ for AMDHIP case (PR #215616)

Arseniy Obolenskiy via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 12 03:13:08 PDT 2026


================
@@ -542,8 +542,13 @@ void SPIRVTargetCodeGenInfo::setTargetAttributes(
     return;
 
   unsigned N = M.getLangOpts().GPUMaxThreadsPerBlock;
-  if (auto FlatWGS = FD->getAttr<AMDGPUFlatWorkGroupSizeAttr>())
+  if (auto FlatWGS = FD->getAttr<AMDGPUFlatWorkGroupSizeAttr>()) {
     N = FlatWGS->getMax()->EvaluateKnownConstInt(M.getContext()).getExtValue();
+  } else if (auto LB = FD->getAttr<CUDALaunchBoundsAttr>()) {
+    N = LB->getMaxThreads()
+            ->EvaluateKnownConstInt(M.getContext())
+            .getExtValue();
----------------
aobolensk wrote:

```suggestion
    if (uint64_t MaxThreads = LB->getMaxThreads()
                                  ->EvaluateKnownConstInt(M.getContext())
                                  .getExtValue())
      N = MaxThreads;
```

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


More information about the llvm-branch-commits mailing list