[Mlir-commits] [mlir] [mlir][affine][gpu] support unroll dynamic value and apply it to gpu.thread_id op (PR #128113)

Krzysztof Drewniak llvmlistbot at llvm.org
Thu Feb 27 15:00:57 PST 2025


================
@@ -250,26 +250,34 @@ void SubgroupSizeOp::inferResultRanges(ArrayRef<ConstantIntRanges>,
 void LaunchOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
                                  SetIntRangeFn setResultRange) {
   auto setRange = [&](const ConstantIntRanges &argRange, Value dimResult,
-                      Value idxResult) {
+                      Value idxResult, Value size) {
     if (argRange.umin().getBitWidth() != IndexType::kInternalStorageBitWidth)
       return;
-    ConstantIntRanges dimRange =
-        argRange.intersection(getIndexRange(1, kMaxDim));
-    setResultRange(dimResult, dimRange);
-    ConstantIntRanges idxRange =
-        getIndexRange(0, dimRange.umax().getZExtValue() - 1);
-    setResultRange(idxResult, idxRange);
+    APInt sizeInt;
+    if (matchPattern(size, m_ConstantInt(&sizeInt))) {
----------------
krzysz00 wrote:

You shouldn't need this branch. The analysis will know `size` is a constant

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


More information about the Mlir-commits mailing list