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

lonely eagle llvmlistbot at llvm.org
Mon Feb 24 23:50:40 PST 2025


linuxlonelyeagle wrote:

Ping @bondhugula @krzysz00 Looks like I need your help.
Describe what the situation is now.
```
    // lattice belongs to %tx (thread_id x in launchOp) it return true.So unroll failed.
    if (lattice->getValue().isUninitialized()) {
      symReplacements.push_back(b.getAffineSymbolExpr(i - numDim));
      continue;
    }
```
I analyzed the following reasons, Although the analysis implements the following Ops, it does not actually run into any of them, because `mlir-opt -debug` will output which Ops were analyzed.
```
  /// Visit an operation. Invoke the transfer function on each operation that
  /// implements `InferIntRangeInterface`.
  LogicalResult
  visitOperation(Operation *op,
                 ArrayRef<const IntegerValueRangeLattice *> operands,
                 ArrayRef<IntegerValueRangeLattice *> results) override;

  /// Visit block arguments or operation results of an operation with region
  /// control-flow for which values are not defined by region control-flow. This
  /// function calls `InferIntRangeInterface` to provide values for block
  /// arguments or tries to reduce the range on loop induction variables with
  /// known bounds.
  void
  visitNonControlFlowArguments(Operation *op, const RegionSuccessor &successor,
                               ArrayRef<IntegerValueRangeLattice *> argLattices,
                               unsigned firstIndex) override;
```
I have extended `LaunchOp::inferResultRanges.` Considering the particularity of the launchOp structure, I have no idea whether I should implement other `visit functions`. This is my first time using the analysis method, and there are indeed some places I don’t understand.Hope you guys can give me some advice (debugging advice would be great too.

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


More information about the Mlir-commits mailing list