[Mlir-commits] [mlir] [mlir] Speed up resolving ExtractValueOp source (PR #176478)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Jan 18 23:04:13 PST 2026
neildhar wrote:
> can you quantify the performance difference you saw on you example
For the pattern I describe, the current approach costs `O(NumExtract * NumInsert)` and the new approach costs `O(NumExtract + NumInsert)`. The actual performance impact depends on the input, but in Triton I have seen an example recently where the current version took longer than I was willing to wait (several minutes at least), and this fix made it manageable.
> without code duplication between folder and pattern.
That wouldn't be entirely true. The pattern here does not make any attempt to handle nested members. It just resolves the `ExtractValueOp`s to use the first `InsertValueOp` that writes to the same top level member. That is, we only look at the first element of the `Position`. So most of the existing structure in the other traversal will have to remain intact.
For example, we would just add a check in the traversal in `ExtractValueOp::fold` to exit if we hit an `InsertValueOp` where the first element of the position does not match, and let the pattern deal with it.
https://github.com/llvm/llvm-project/pull/176478
More information about the Mlir-commits
mailing list