In [mlir][tensor] add tensor insert/extract op folders by asraa · Pull Request #142458 · llvm/llvm-project · GitHub (and [mlir][tensor] move tensor insert canonicalization to pattern by asraa · Pull Request #142671 · llvm/llvm-project · GitHub) my colleague @asraa added some relatively simple tensor patterns upstream intended to fold some uses of tensor insert/extract.
A comment of @mehdi_amini suggested dissatisfaction with the practice of exposing upstream patterns (or populateXPatterns
static functions) for downstream users to figure out how to combine consistently.
I’d like to ask the community for some guidance here:
- Why is having lots of patterns upstream bad? My biggest issue with it is actually the lack of a discovery mechanism, and otherwise I like having lots of generally useful patterns available upstream that I can assemble into passes out-of-tree to meet my needs.
- Is there any established guidance or folklore that I can rely on to determine if a pattern is suitable to be upstreamed?
- Is there an implicit expectation that new upstream patterns are provided via a pass (or an op folder, or canonicalizer)?
- Is there some future state of MLIR (organizationally, or featurewise, or auxiliary tooling) that would make it acceptable to have lots of upstream patterns? In other words, is a preference to not have lots of upstream patterns an acute pain or a systemic design preference?