[llvm] [NVPTX] Constant fold blockDim when reqntid is specified (PR #191575)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 20:11:48 PDT 2026


================
@@ -66,47 +66,64 @@ static bool runNVVMIntrRange(Function &F) {
   if (!isKernelFunction(F))
     return false;
 
-  const auto OverallReqNTID = getOverallReqNTID(F);
+  const auto ReqNTID = getReqNTID(F);
   const auto OverallMaxNTID = getOverallMaxNTID(F);
   const auto OverallClusterRank = getOverallClusterRank(F);
 
   // If this function lacks any range information, do nothing.
-  if (!(OverallReqNTID || OverallMaxNTID || OverallClusterRank))
+  if (!(ReqNTID.size() || OverallMaxNTID || OverallClusterRank))
     return false;
 
-  const unsigned FunctionNTID = OverallReqNTID.value_or(
-      OverallMaxNTID.value_or(std::numeric_limits<unsigned>::max()));
+  const unsigned MaxNTID =
+      OverallMaxNTID.value_or(std::numeric_limits<unsigned>::max());
 
   const unsigned FunctionClusterRank =
       OverallClusterRank.value_or(std::numeric_limits<unsigned>::max());
 
-  const Vector3 MaxBlockSize{std::min(1024u, FunctionNTID),
-                             std::min(1024u, FunctionNTID),
-                             std::min(64u, FunctionNTID)};
+  const Vector3 MaxBlockSize{std::min(1024u, MaxNTID), std::min(1024u, MaxNTID),
+                             std::min(64u, MaxNTID)};
----------------
AlexMaclean wrote:

Combined MaxBlockSize and MaxBlockDim?

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


More information about the llvm-commits mailing list