[all-commits] [llvm/llvm-project] 7caf12: [mlir][core] Add an MLIR "pattern catalog" generat...
Jeremy Kun via All-commits
all-commits at lists.llvm.org
Thu Jul 17 09:09:34 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7caf12da0bb09d6b6992bf42afd256d453753dcb
https://github.com/llvm/llvm-project/commit/7caf12da0bb09d6b6992bf42afd256d453753dcb
Author: Jeremy Kun <jkun at google.com>
Date: 2025-07-17 (Thu, 17 Jul 2025)
Changed paths:
M mlir/include/mlir/IR/PatternMatch.h
M mlir/lib/IR/CMakeLists.txt
A mlir/lib/IR/PatternLoggingListener.cpp
M mlir/lib/Rewrite/PatternApplicator.cpp
A mlir/test/IR/test-pattern-logging-listener.mlir
M mlir/test/lit.cfg.py
Log Message:
-----------
[mlir][core] Add an MLIR "pattern catalog" generator (#146228)
This PR adds a feature that attaches a listener to all RewritePatterns that
logs information about the modified operations.
When the MLIR test suite is run, these debug outputs can
be filtered and combined into an index linking operations to the
patterns that insert, modify, or replace them. This index is intended to
be used to create a website that allows one to look up patterns from an
operation name.
The debug logs emitted can be viewed with --debug-only=generate-pattern-catalog,
and the lit config is modified to do this when the env var MLIR_GENERATE_PATTERN_CATALOG is set.
Example usage:
```
mkdir build && cd build
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DLLVM_TARGETS_TO_BUILD="host" \
-DCMAKE_BUILD_TYPE=DEBUG
ninja -j 24 check-mlir
MLIR_GENERATE_PATTERN_CATALOG=1 bin/llvm-lit -j 24 -v -a tools/mlir/test | grep 'pattern-logging-listener' | sed 's/^# | [pattern-logging-listener] //g' | sort | uniq > pattern_catalog.txt
```
Sample pattern catalog output (that fits in a gist):
https://gist.github.com/j2kun/02d1ab8d31c10d71027724984c89905a
---------
Co-authored-by: Jeremy Kun <j2kun at users.noreply.github.com>
Co-authored-by: Mehdi Amini <joker.eph at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list