[TensorExt] Add barrier ops and roundtrip tests 1/2#22577
Conversation
Add iree_tensor_ext.barrier.start and iree_tensor_ext.barrier.end operations to control where reshape operations can be propagated during compilation. These are identity operations that pass through their operands unchanged. These barriers prevent undesirable reshape movement, which is useful for controlling reshape propagation at the edges of the program where reshapes exist to convert between function ABI shapes and program dimensionality. Signed-off-by: Ian Wood <[email protected]>
hanhanW
left a comment
There was a problem hiding this comment.
let's add a few invalid tests to invalid.mlir: https://github.com/iree-org/iree/tree/main/compiler/src/iree/compiler/Dialect/TensorExt/IR/test
(you have to create the file)
compiler/src/iree/compiler/Dialect/TensorExt/IR/TensorExtOps.td
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/Dialect/TensorExt/IR/TensorExtOps.td
Outdated
Show resolved
Hide resolved
Signed-off-by: Ian Wood <[email protected]>
hanhanW
left a comment
There was a problem hiding this comment.
Thanks. The PR itself looks good to me. Let me review the other one, just in case if we need to update the semantics.
| }]; | ||
|
|
||
| let arguments = (ins | ||
| AnyRankedTensor:$value, |
There was a problem hiding this comment.
To make the IR a bit more succinct did you want to take multiple operands and return multiple results such that every operand maps to the corresponding result? I know the dynamic dims will get complicated. Just a suggestion.
There was a problem hiding this comment.
Is it possible to do this with tablegen's "assemblyFormat"? I don't see a way to split value_dims so that each argument has its own set of dynamic dims.
There was a problem hiding this comment.
you'll need custom parser and printer in this case I think.
There was a problem hiding this comment.
I'm going to keep this as is. I don't think the hassle is worth supporting multiple operands/results.
This change adds 2 passes to insert and remove tensor barrier ops. - **InsertTensorBarriersPass**: Inserts barrier.start and barrier.end operations at the boundaries of computation regions (tensor/linalg/linalgext ops). This identifies values flowing into and out of compute operations and wraps them with barrier operations. - **RemoveTensorBarriersPass**: Removes barrier operations by replacing their results with their operands, since barriers are identity operations. Depends on #22577 --------- Signed-off-by: Ian Wood <[email protected]>
Add `iree_tensor_ext.barrier.start` and `iree_tensor_ext.barrier.end` operations to control where reshape operations can be propagated during compilation. These barriers prevent undesirable reshape movement, which is useful for controlling reshape propagation at the edges of the program where reshapes exist to convert between function ABI shapes and program dimensionality. --------- Signed-off-by: Ian Wood <[email protected]>
This change adds 2 passes to insert and remove tensor barrier ops. - **InsertTensorBarriersPass**: Inserts barrier.start and barrier.end operations at the boundaries of computation regions (tensor/linalg/linalgext ops). This identifies values flowing into and out of compute operations and wraps them with barrier operations. - **RemoveTensorBarriersPass**: Removes barrier operations by replacing their results with their operands, since barriers are identity operations. Depends on iree-org#22577 --------- Signed-off-by: Ian Wood <[email protected]>
Add `iree_tensor_ext.barrier.start` and `iree_tensor_ext.barrier.end` operations to control where reshape operations can be propagated during compilation. These barriers prevent undesirable reshape movement, which is useful for controlling reshape propagation at the edges of the program where reshapes exist to convert between function ABI shapes and program dimensionality. --------- Signed-off-by: Ian Wood <[email protected]>
This change adds 2 passes to insert and remove tensor barrier ops. - **InsertTensorBarriersPass**: Inserts barrier.start and barrier.end operations at the boundaries of computation regions (tensor/linalg/linalgext ops). This identifies values flowing into and out of compute operations and wraps them with barrier operations. - **RemoveTensorBarriersPass**: Removes barrier operations by replacing their results with their operands, since barriers are identity operations. Depends on iree-org#22577 --------- Signed-off-by: Ian Wood <[email protected]>
Add
iree_tensor_ext.barrier.startandiree_tensor_ext.barrier.endoperations to control where reshape operations can be propagated during compilation. These barriers prevent undesirable reshape movement, which is useful for controlling reshape propagation at the edges of the program where reshapes exist to convert between function ABI shapes and program dimensionality.