-
Notifications
You must be signed in to change notification settings - Fork 553
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
Lowering of i1 types conflicts with detensoring #6756
Comments
PromoteTensorLoads seems broken/actively harmful. We should kill it. When all working flow should be fine with i1 operations (flow.tensor.load of i1/etc) - so we shouldn't need to do any manipulation in the flow dialect. It's only when we go to HAL that i1s become bad (storage is incompatible). The other thing we should add is a verification step at the end of flow that ensures that there are no more operations acting on tensors besides the flow ops (flow.dispatch/flow.tensor.* etc) - hal issue you are seeing is because that zexti on a tensor type is still around when it cannot be. |
oh, and it's flow->hal that cares about i1 on the outside but codegen will care on the inside - a flow.dispatch.tensor.load/store inside of an executable can operate on i1 but when converting that to hal.interface.* it needs to be adjusted for storage format. |
👍 SGTM. I'll work on untangling this when I get back from vacation. This is another case where documentation (or verification steps) around various types would help (#5223). |
(More notes when I get back, or if someone else wants to chip in...) This also relates to #3102, and that issue has more information about storage formats and points during compilation that type conversions should be handled. The |
…6852) Fixes #6756 (the [`tosa if.mlir`](https://github.com/google/iree/blob/main/iree/test/e2e/tosa_ops/if.mlir) file compiles successfully using `-iree-flow-enable-linalg-detensorize` with this change) The `PromoteTensorLoads` pass was converting `i1` loads to `i8` loads using `ZeroExtendIOp` and `TruncateIOp`. That was producing weird cycles during compilation when detensoring was applied, and `flow` ops should be fine with i1 types. We still need to handle `i1` types when going to the HAL (since storage is incompatible) on the outside (external interface) and inside (codegen).
I'm encountering this while working on #1159. Compiling the
tosa if.mlir
file using-iree-flow-enable-linalg-detensorize
produceserror: TensorRewriteAdaptor newValue is invalid type 'tensor<i8>'
duringConvertToHALPass
, but there are deeper issues with howi1
types are handled throughout the compilation.Here's the relevant section of IR through the compilation flow (the full IR dump is here):
The text was updated successfully, but these errors were encountered: