Replies: 1 comment 2 replies
-
Another way to phrase the goal here is "you never need to call This allows us to, in cases where things are decently straightforward, to look through generics, copies, and so on before align-tiling in order to analyze vectorization and thus not lose performance because there's a transpose hiding behind a type conversion generic, for example. But in order to do that, we need to decide if each linalg.generic is going to be input-fused or output-fused, which is a whole-function analysis that you need to keep state for. And pattern rewrites are supposed to be stateless. |
Beta Was this translation helpful? Give feedback.
-
The expectation of the pass
Now that we support input and output fusions, the distinction between
reader
s andwriter
s becoms irrelevant. What matters is we need to maintain the invariant of "no views between thealloc
and all users where one is aRockFusingOp
". Correct me here if I am wrong ? No point reading beyond this point if this assumption is wrong.How this could be a pattern rewrite ?
So basically it feels to me like memref.alloc &
RockFusingOp
op rewrite to me which finally achieves "no views between thealloc
and all users where one is aRockFusingOp
"Ok, but how do you keep fusing towards functions inputs/outputs ?
So this is where I think
readers
andwriters
become important.The way to achieve "no views between the
alloc
and all users where one is aRockFusingOp
":if
RockFusingOp
is a reading/writing user of the alloc, we do two steps:R1) We invert view between alloc and
RockFusingOp
append them onto writing/reading users of the allocThis is
memref.alloc
rewrite (see diagram below). Then we annotate writing users of the allocs asRockFusingOps
Input
Output
R2) Then we do
RockFusingOp
rewrite to conform to "no views between thealloc
and all users where one is aRockFusingOp
". So that d be inverting all the views betweenRockFusingOp
s and the alloc but as aRockFusingOp
rewrite (not amemref.alloc
rewrite).So we end up with :
Then we back to doing R1, because now there are new
RockFusingOp
s that violate "no views between thealloc
and all users where one is aRockFusingOp
" and follow by R2. We do this until now new RockFusingOp are not idenfied.Summary
I think #1590 is doing the a similiar thing in effect but it feels more stateful and Im doubtful about stability of that design. Hence Im proposing this which is more inline with PatternRewrite style of writing passes.
I d like to hear @krzysz00 thoughts here -- at least why we went away from PatternRewrite style of writing passes. I agree we might need AlignTilingRewriter style one where we signal things to be rewritten.
Beta Was this translation helpful? Give feedback.
All reactions