-
Notifications
You must be signed in to change notification settings - Fork 647
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
[Dispatch] Add pattern to bubble expand through extract 1/2 #19325
[Dispatch] Add pattern to bubble expand through extract 1/2 #19325
Conversation
compiler/src/iree/compiler/DispatchCreation/test/bubble_up_expand_shapes.mlir
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/DispatchCreation/test/bubble_up_expand_shapes.mlir
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/DispatchCreation/BubbleUpExpandShapes.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Ian Wood <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one nit about the doc.
// TODO: move this upstream with other tensor bubbling patterns. | ||
/// Bubbles a `tensor.expand_shape` op through a `tensor.extract_slice` op. This | ||
/// pattern only gets applied when the `extract_slice` doesn't modify dimensions | ||
/// that are expanded by the `expand_shape`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, it only works for static shapes? Dynamic shapes could be very tricky, and I think we're not going to support that in the near future. So we want to document that it only works for static shapes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, only static shapes so I updated the comment to reflect that
Signed-off-by: Ian Wood <[email protected]>
Signed-off-by: Ian Wood <[email protected]>
…#19325) This is the 1/2 changes needed to reland iree-org#18857 (with an open PR iree-org#19113). Adds pattern to bubble up expand shape through extract slice. i.e `expand(extract)` to `extract(expand)`. This only supports the case where the expanded dimensions are not modified by the extract slice and there are no dynamic dimensions. This is important because `tensor.expand_shape` ops _cannot be cloned_ while `tensor.extract_slice` ops _can be cloned_. So, if the `expand_shape` gets stuck on the bottom of the `extract_slice` it will block it from being cloned and the `extract_slice` will have to be put into its own dispatch. --------- Signed-off-by: Ian Wood <[email protected]> Signed-off-by: Giacomo Serafini <[email protected]>
Reland after fixing sdxl int8 regressions via #19012. Running CI revealed further performance regressions that have pending patches: #19325 and #19326. This reverts commit 8d3faf8. --------- Signed-off-by: Ian Wood <[email protected]>
This is the 1/2 changes needed to reland #18857 (with an open PR #19113).
Adds pattern to bubble up expand shape through extract slice. i.e
expand(extract)
toextract(expand)
. This only supports the case where the expanded dimensions are not modified by the extract slice and there are no dynamic dimensions.This is important because
tensor.expand_shape
ops cannot be cloned whiletensor.extract_slice
ops can be cloned. So, if theexpand_shape
gets stuck on the bottom of theextract_slice
it will block it from being cloned and theextract_slice
will have to be put into its own dispatch.