[Global Opt] Don't propagate edge reshapes#22320
Conversation
Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
|
|
||
| // ----- | ||
|
|
||
| util.func public @sink_non_involution_through_expand_shape(%arg0 : tensor<2x3x4xf32>) -> tensor<1x3x4x2xf32> { |
There was a problem hiding this comment.
I think we want to keep this behavior... Cause this might allow the transpose to fuse with its consumers...
There was a problem hiding this comment.
The point is that the reshapes are on the edge so that there will be no producer/consumers.
There was a problem hiding this comment.
I am not sure I follow. The test is changing the behavior that is different than what I assume the end state of the code should be. Could you provide more details here?
There was a problem hiding this comment.
The problem is that BubbleUpExpandShapes is not perfect and doesn't currently sink reshapes through reduction operations. The idea is to not touch reshapes that are on the edges of the program since they might get stuck on a reduction operation. This shouldn't harm transpose propagation because these reshapes are on the edges and won't block any transposes from getting propagated throughout the program.
Also, I added some more context on the issue with the mlir before and after this pass #22312
There was a problem hiding this comment.
I think the better solution is make a change to BubbleUpExpandShapes, I'm testing if there are any regressions #22341
| // ----- | ||
|
|
||
| util.func public @bubble_non_involution_through_collapse_shape(%arg0 : tensor<1x2x3x5x7x11xf32>) -> tensor<35x11x6xf32> { | ||
| %collapsed = tensor.collapse_shape %arg0 [[0, 1, 2], [3, 4], [5]] : tensor<1x2x3x5x7x11xf32> into tensor<6x35x11xf32> |
There was a problem hiding this comment.
Same here. The transpose could fuse with its producers.
compiler/src/iree/compiler/GlobalOptimization/test/propagate_linalg_transpose.mlir
Outdated
Show resolved
Hide resolved
|
Could you post some more details of the problem (preferably on the issue) |
Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
MaheshRavishankar
left a comment
There was a problem hiding this comment.
Lets land this for now based on what we see as issues with a "more proper way". We would probably need to revisit this though.
Prevent propagating reshapes on the edges of the program in PropagateLinalgTranspose since these reshapes don't block the propagation of transposes. This is similar to what is done in BubbleUpExpandShapes: https://github.com/iree-org/iree/blob/dad4b2d1cab357720a73c05d7bf6e1b946668082/compiler/src/iree/compiler/DispatchCreation/BubbleUpExpandShapes.cpp#L441-L459 Closes iree-org#22312 --------- Signed-off-by: Ian Wood <ianwood@u.northwestern.edu> Signed-off-by: Philipp <philipp.weidel@intel.com>
…nv3d (#2560) Compiler fix: iree-org/iree#22320 Issue: iree-org/iree#22312
…nv3d (ROCm#2560) Compiler fix: iree-org/iree#22320 Issue: iree-org/iree#22312
…nv3d (ROCm#2560) Compiler fix: iree-org/iree#22320 Issue: iree-org/iree#22312
…nv3d (#2560) Compiler fix: iree-org/iree#22320 Issue: iree-org/iree#22312
Adds flag to allow users to selectively disable the changes from #22320. This is a stopgap for cases where not fusing a transpose into a matmul gives better performance. Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
…2438) Adds flag to allow users to selectively disable the changes from iree-org#22320. This is a stopgap for cases where not fusing a transpose into a matmul gives better performance. Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
…2438) Adds flag to allow users to selectively disable the changes from iree-org#22320. This is a stopgap for cases where not fusing a transpose into a matmul gives better performance. Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
Prevent propagating reshapes on the edges of the program in PropagateLinalgTranspose since these reshapes don't block the propagation of transposes. This is similar to what is done in BubbleUpExpandShapes: https://github.com/iree-org/iree/blob/dad4b2d1cab357720a73c05d7bf6e1b946668082/compiler/src/iree/compiler/DispatchCreation/BubbleUpExpandShapes.cpp#L441-L459 Closes iree-org#22312 --------- Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
…2438) Adds flag to allow users to selectively disable the changes from iree-org#22320. This is a stopgap for cases where not fusing a transpose into a matmul gives better performance. Signed-off-by: Ian Wood <ianwood@u.northwestern.edu>
Prevent propagating reshapes on the edges of the program in PropagateLinalgTranspose since these reshapes don't block the propagation of transposes. This is similar to what is done in BubbleUpExpandShapes:
iree/compiler/src/iree/compiler/DispatchCreation/BubbleUpExpandShapes.cpp
Lines 441 to 459 in dad4b2d
Closes #22312