[clang] [NVPTX] Add support for maxclusterrank in launch_bounds (PR #66496)

Jakub Chlanda via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 06:08:31 PDT 2023


================
@@ -5662,22 +5677,39 @@ Sema::CreateLaunchBoundsAttr(const AttributeCommonInfo &CI, Expr *MaxThreads,
       return nullptr;
   }
 
+  if (MaxBlocks) {
+    // Feature '.maxclusterrank' requires .target sm_90 or higher.
+    auto SM = getCudaArch(Context.getTargetInfo());
+    if (SM == CudaArch::UNKNOWN || SM < CudaArch::SM_90) {
+      Diag(MaxBlocks->getBeginLoc(), diag::warn_cuda_maxclusterrank_sm_90)
+          << CudaArchToString(SM) << CI << MaxBlocks->getSourceRange();
+      // Ignore it by setting MaxBlocks to null;
+      MaxBlocks = nullptr;
+    } else {
+      MaxBlocks = makeLaunchBoundsArgExpr(*this, MaxBlocks, TmpAttr, 2);
+      if (MaxBlocks == nullptr)
----------------
jchlanda wrote:

I wanted to align with the checks that are already in the body of `Sema::CreateLaunchBoundsAttr`, but I'm with you and like to use the fact that pointers are truthy, will change them all.

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


More information about the cfe-commits mailing list