Repository navigation
Add TileArray pattern rewriting infrastructure - #5
Conversation
|
"rewrite" sounds confusing/ambiguous to me. Pattern match and rewrite has rewrite, what we are doing here is replace sth with existing kernel, rather than mlir pattern rewrite. Can you think about some other candidates for naming? |
How about using "replace"? e.g., |
I have updated accordingly ~ |
Summary
This PR adds infrastructure for replacing computations inside existing Taskflow tasks with reusable TileArray programs.
It introduces:
TileArrayRewritePattern, with an operation root and amatch_and_rewrite()callback;PatternRewriterutilities for replacing and erasing operations;Example
A pattern declares the source operation it handles and performs its checks and replacement in one callback:
The pattern is applied to an existing Taskflow module with:
When the pattern matches, Synapse builds and verifies the TileArray implementation, inserts its Neura kernel into the original task, and removes the matched operation. The task interface and dependency results remain unchanged.
When a pattern rejects the operation, the original IR is preserved.