[Mlir-commits] [mlir] [mlir] Speed up resolving ExtractValueOp source (PR #176478)

Tobias Gysi llvmlistbot at llvm.org
Sun Jan 18 23:42:45 PST 2026


gysit wrote:

> 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.

Are you interested in the result of the folding? We could also introduce a constant upper bound for the walk in the folder which would reduce the asymptotic complexity to O(numExtract).

> That wouldn't be entirely true. The pattern here does not make any attempt to handle nested members. It just resolves the ExtractValueOps 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.

Ok, I was hoping we could do the entire walking in one or more patterns somehow? Maybe more than one pattern application is needed to handle dimension by dimension?

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


More information about the Mlir-commits mailing list