There is no way to programmatically configure the list of disabled and enabled patterns in the canonicalizer pass, other than the duplicate the whole pass. This patch exposes the disabledPatterns and enabledPatterns options.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Does this work in non-debug builds? I don't remember if pattern names weren't just a debugging thing? It probably should be reflected in the name if we want to expose this publicly.
It apparently does. See https://github.com/llvm/llvm-project/blob/main/mlir/test/Transforms/test-canonicalize-filter.mlir
By default, the "debugName" of a pattern is set to its type name, even in non-debug builds
OK, that is still a "debugName" which I'm wary of providing more expectation than that on, so we should still reflect this in the API.
Update description of API to match that of FrozenRewritePatternSet.
@mehdi_amini I copied the description over from FrozenRewritePatternSet,
which is actually where the capability comes from. Based on how this was
set up in https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Rewrite/PassUtil.td,
I think this is intended to be a somewhat commonly-used API.
It is possible to have pattern with empty name (when added using function pointer api).
Well the issue may be instead into how it is presented in FrozenRewritePatternSet: this does not match the fact that patterns can have naming collision or no name at all (as Ivan indicated).
Make clear that the labels used to filter patterns are debug names, and may be empty.