Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DispatchCreation] Add support for hoisting Flow ops. #20346

Merged
merged 5 commits into from
Mar 25, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add a test
Signed-off-by: hanhanW <hanhan0912@gmail.com>
hanhanW committed Mar 21, 2025
commit 5cd8ce5b0b94cb0d598cdd56cb7644b1a5fa5fd9
Original file line number Diff line number Diff line change
@@ -226,3 +226,24 @@ util.func public @hoist_both_src_and_encoding() -> tensor<640x320xf32> {
// CHECK: %[[CST:.+]] = arith.constant
// CHECK: %[[SET_ENCODING:.+]] = iree_encoding.set_encoding %[[CST]]
// CHECK: flow.dispatch.region

// -----

// It tests that the constant-like source is already outside the region, and the
// hoisting does not happen to it. Otherwise, it crashes.

#encoding = #iree_encoding.testing_encoding<>
util.func private @get_tensor(tensor<640x320xf32, #encoding>) -> tensor<640x320xf32>
util.func public @hoist_encoding_only() -> tensor<640x320xf32> {
%cst = arith.constant dense<1.0> : tensor<640x320xf32>
%0 = flow.dispatch.region -> (tensor<640x320xf32>) {
%1 = iree_encoding.set_encoding %cst : tensor<640x320xf32> -> tensor<640x320xf32, #encoding>
%2 = util.call @get_tensor(%1) : (tensor<640x320xf32, #encoding>) -> tensor<640x320xf32>
flow.return %2 : tensor<640x320xf32>
}
util.return %0 : tensor<640x320xf32>
}
// CHECK-LABEL: util.func public @hoist_encoding_only(
// CHECK: %[[CST:.+]] = arith.constant
// CHECK: %[[SET_ENCODING:.+]] = iree_encoding.set_encoding %[[CST]]
// CHECK: flow.dispatch.region