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

Jakub Chlanda via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 02:10:12 PDT 2023


================
@@ -10,6 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "../Basic/Targets/NVPTX.h"
----------------
jchlanda wrote:

@sam-mccall, apologies for introducing the bug and thank you for drawing my attention to it.

I've got the fix for the problem:
```diff
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 10d1c910d9cd..3b87300e24bc 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//

-#include "../Basic/Targets/NVPTX.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTMutationListener.h"
@@ -5612,7 +5611,8 @@ bool Sema::CheckRegparmAttr(const ParsedAttr &AL, unsigned &numParams) {
 static CudaArch getCudaArch(const TargetInfo &TI) {
   if (!TI.getTriple().isNVPTX())
     llvm_unreachable("getCudaArch is only valid for NVPTX triple");
-  return static_cast<const targets::NVPTXTargetInfo *>(&TI)->getGPU();
+  auto &TO = TI.getTargetOpts();
+  return StringToCudaArch(TO.CPU);
 }

 // Checks whether an argument of launch_bounds attribute is
```

Would you be so king and point me to the process for "reverting the revert" and folding the fix into the original patch?

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


More information about the cfe-commits mailing list