Repository navigation
Pad handling without changing upstream interface. - #13133
Conversation
37aee5d to
7cecfe1
Compare
Abbreviated Benchmark Summary@ commit 924d826e9fab567ce12774c81c83cf30a209a689 (vs. base cbdd7893d4ab0c883f1336f86c6c9efbf02f10b8) No improved or regressed benchmarks 🏖️ Regressed Compilation Times 🚩
For more information: |
Abbreviated Android Benchmark Summary@ commit a82224eb3e31078c20b060dddafe9389b3375daf (vs. base a7d37df86aa9883c67ac420cf3036f1b129b0a86) No improved or regressed benchmarks 🏖️ For more information: |
nicolasvasilache
left a comment
There was a problem hiding this comment.
Quick heads up, once this lands, this will become functional too: #13191
| if (!tilingInterfaceProducer || | ||
| Operation *definingOp = operand.get().getDefiningOp(); | ||
| auto tilingInterfaceProducer = dyn_cast<TilingInterface>(definingOp); | ||
| if (!tilingInterfaceProducer || isa<tensor::PadOp>(definingOp) || |
There was a problem hiding this comment.
Great, thanks for this, better to bail out ourselves than change the semantics of the op for IREE's purposes.
7cecfe1 to
85b2438
Compare
85b2438 to
8300aae
Compare
|
|
||
| nestedModulePM.addNestedPass<func::FuncOp>(createLLVMCPUTileAndFusePass( | ||
| static_cast<int64_t>(TilingLevel::ParallelTiles))); | ||
| if (clEnablePadConsumerFusion) { |
There was a problem hiding this comment.
Are we able to drop the option entirely? If so, let's remove its definition, i.e., line 46-53 in this file.
There was a problem hiding this comment.
Yes, I think so. I was planning to do that as a follow up.
qcolombet
left a comment
There was a problem hiding this comment.
LGTM.
When do you think you'll merge this?
We need this fix to turn https://github.com/openxla/iree/blob/main/compiler/src/iree/compiler/Codegen/TransformDialectStrategies/GPU/Common.cpp#L37 ON, which would give a 10x boost for unaligned matmul on GPUs
Waiting for integrate... otherwise it is ready to go. |
| // Do not not treat linalg ops that are all parallel as root operations in | ||
| // this sweep. | ||
| if (linalgOp.getNumLoops() == linalgOp.getNumParallelLoops()) continue; |
There was a problem hiding this comment.
Isn't this too much specialization for pad case?
There was a problem hiding this comment.
I dont follow... the order of priority of picking the root op is
- Ops that implement the tiling interface , except for simple elementwise ops.
- Elementwise ops if (1) is not present
- If neither (1) and (2) are present, ops like pack/pad/unpack that are data layout ops.
8300aae to
1ec81ca
Compare
|
Damn... didnt get the commit I needed on the last integrate. Wait continues. |
FMI, which upstream LLVM commit is needed for this to land? |
1ec81ca to
a82224e
Compare
The current default dispatch region formation has options to
- disable splitting pad into fill + tensor.insert_slice
- allow fusion of pad with producer
- allow fusion of pad with consumer.
While none of these are on by default, this PR adds support for handling these in the CPU backend. The current state is
- The pad by itself in a dispatch gets vectorized.
- Pad fused with consumer gets vectorized too
- Pad fused with producer does not get vectorized. This requries more work and potentially some changes to get the IR into a better state w.r.t destination passing.
There is lit test that show the handling of the different modes today within the CPU backend. To get things working, one thing to handle is the code-generated by tiling the pad operation is of the form
```
scf.if {
...
} else {
... tensor.pad
}
```
the if here is to account for cases where a tile could be reading only the padding. This does not happen in IREE, so there is a temporary hack here that just folds the if away. Long term a better solution is needed (probably requiring rethinking of pad specification and tiling).
The current default dispatch region formation has options to
While none of these are on by default, this PR adds support for handling these in the CPU backend. The current state is
There is lit test that show the handling of the different modes today within the CPU backend. To get things working, one thing to handle is the code-generated by tiling the pad operation is of the form
the
ifhere is to account for cases where a tile could be reading only the padding. This does not happen in IREE, so there is a temporary hack here that just folds theifaway. Long term a better solution is needed (probably requiring rethinking of pad specification and tiling).