You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use linalg-on-tensors for pre-partitioning linalg fusion #1354
The current IREE flow dialect partitioning is done based solely on limited op matching (xla_hlo.dot and xla_hlo.conv) and generic invocation count calculation. This is sub-optimal for many reasons:
does not fuse many trivial indexing op/broadcasts, leading in additional intermediate tensors and dispatches
does not enable layout-aware linalg optimizations as layout is isolated and fixed
the hardcoded xla_hlo op checking ties our input logic to the source dialect preventing other non-XLA HLO-based inputs
If instead we convert HLO ops to linalg ops and then run linalg optimizations a large majority of those corner cases that matter in performance-sensitive scenarios are eliminated. We need to use linalg-on-tensors (vs. buffers) as we are operating within the value-semantic tensor domain and need to continue in that form for further scheduling work.
This is a meta issue to track progress on augmenting the current system to allow it to operate on linalg-on-tensors:
Try enabling some HLO->linalg lowerings prior to partitioning and see what breaks
Ensure the linalg library approach scales to VMLA ops so that we can always rely on linalg in the compiler flow don't care about VMLA
Remove the existing hardcoded dot/conv logic once those are lowered earlier on
Enable or plan out interesting linalg-on-tensor level optimizations
To really enable the use of Linalg on tensors, would be preferable to hook up linalg on tensors to Vector dialect. Ideally would want to prove out linalg on tensors on CPU side as much as possible, and then make sure we can match whatever perf we are getting currently. In the mean time much of the CPU/GPU pipelines must get unified. That should make the switch to use linalg on tensors on GPU fairly easy.
Also
Remove the existing hardcoded dot/conv logic once those are lowered earlier on
There is no reason to remove it. The conversion from mhlo.conv to linalg.conv are correct. They lower to linalg.conv on buffers. They just need to lower to linalg.conv on tensors.
The specific task here is removing the if (mhlo::ConvOp) return dont_fuse; logic from IdentifyDispatchRegions that we won't need when linalg is used for partitioning instead of the current hacky IREE logic. I'm hoping we can get to that point sooner rather than later regardless of how the linalg.conv ends up in codegen.
Activity
benvanik commentedon Nov 22, 2020
Remember April? hah
MaheshRavishankar commentedon Nov 23, 2020
To really enable the use of Linalg on tensors, would be preferable to hook up linalg on tensors to Vector dialect. Ideally would want to prove out linalg on tensors on CPU side as much as possible, and then make sure we can match whatever perf we are getting currently. In the mean time much of the CPU/GPU pipelines must get unified. That should make the switch to use linalg on tensors on GPU fairly easy.
Also
There is no reason to remove it. The conversion from
mhlo.convtolinalg.convare correct. They lower tolinalg.convon buffers. They just need to lower tolinalg.convon tensors.benvanik commentedon Nov 23, 2020
The specific task here is removing the
if (mhlo::ConvOp) return dont_fuse;logic from IdentifyDispatchRegions that we won't need when linalg is used for partitioning instead of the current hacky IREE logic. I'm hoping we can get to that point sooner rather than later regardless of how the linalg.conv ends up in codegen.Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
Step 0 for using Linalg on tensors for dispatch region creation (Issue …
MaheshRavishankar commentedon Mar 23, 2021
Superceded by this https://github.com/google/iree/projects/23