Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TensorExt] Add barrier ops and roundtrip tests 1/2#22577

Merged
IanWood1 merged 2 commits intomainfrom
users/IanWood1/add_tensor_barrier_ops
Nov 10, 2025
Merged

[TensorExt] Add barrier ops and roundtrip tests 1/2#22577
IanWood1 merged 2 commits intomainfrom
users/IanWood1/add_tensor_barrier_ops

Conversation

@IanWood1
Copy link
Contributor

@IanWood1 IanWood1 commented Nov 6, 2025

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.

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]>
@IanWood1 IanWood1 marked this pull request as ready for review November 6, 2025 22:01
@IanWood1 IanWood1 requested a review from hanhanW as a code owner November 6, 2025 22:01
Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@IanWood1 IanWood1 requested a review from hanhanW November 6, 2025 22:51
Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need custom parser and printer in this case I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to keep this as is. I don't think the hassle is worth supporting multiple operands/results.

@IanWood1 IanWood1 merged commit e21ef98 into main Nov 10, 2025
48 of 50 checks passed
@IanWood1 IanWood1 deleted the users/IanWood1/add_tensor_barrier_ops branch November 10, 2025 21:48
@IanWood1 IanWood1 restored the users/IanWood1/add_tensor_barrier_ops branch November 10, 2025 21:49
IanWood1 added a commit that referenced this pull request Nov 12, 2025
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]>
@IanWood1 IanWood1 deleted the users/IanWood1/add_tensor_barrier_ops branch November 13, 2025 17:55
lialan added a commit that referenced this pull request Nov 17, 2025
bangtianliu pushed a commit to bangtianliu/iree that referenced this pull request Nov 19, 2025
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]>
bangtianliu pushed a commit to bangtianliu/iree that referenced this pull request Nov 19, 2025
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]>
pstarkcdpr pushed a commit to pstarkcdpr/iree that referenced this pull request Nov 28, 2025
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]>
pstarkcdpr pushed a commit to pstarkcdpr/iree that referenced this pull request Nov 28, 2025
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants