================
@@ -307,6 +307,14 @@ void CodeGenModule::handleCUDALaunchBoundsAttr(
       NVPTXTargetCodeGenInfo::addNVVMMetadata(F, "minctasm",
                                               MinBlocks.getExtValue());
   }
+  if (Attr->getMaxBlocks()) {
+    llvm::APSInt MaxBlocks(32);
+    MaxBlocks = Attr->getMaxBlocks()->EvaluateKnownConstInt(getContext());
+    if (MaxBlocks > 0)
+      // Create !{<func-ref>, metadata !"maxclusterrank", i32 <val>} node
+      NVPTXTargetCodeGenInfo::addNVVMMetadata(F, "maxclusterrank",
----------------
jchlanda wrote:

That's a good question, so `makeLaunchBoundsArgEspr` does perform a [check for 
negative 
values](https://github.com/jchlanda/llvm-project/blob/jakub/launch_bounds_maxclusterrank/clang/lib/Sema/SemaDeclAttr.cpp#L5653),
 but lets the value pass (unlike for the case of values > 32 bits, when it 
returns `nullptr`), I didn't want to change it, so catch the negative case here.

https://github.com/llvm/llvm-project/pull/66496
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to