Add same hoisting transformation existing for transfer ops on buffers for transfer_ops on tensor. The logic is significantly different so this is done as a separate transformation and it is expect that user would know which transformation to use based on the flow.
Details
Diff Detail
Event Timeline
mlir/include/mlir/Dialect/Vector/VectorUtils.h | ||
---|---|---|
171 | xxxIndices | |
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp | ||
84 | significantly | |
94 | removed by the | |
100 | forOp.getTerminator() | |
114 | please hoist into a static helper function | |
126 | Same, can we please isolate in a helper function and document each subcase? | |
132 | // Skip the candidate use, only inspect the "other" uses. | |
135 | // Consider all transitive uses through a vector.transfer_write. | |
139 | // Consider all nested uses through an scf::ForOp. | |
148 | This case looks like it could fold into the previous scf::ForOp by considering both the uses of the corresponding BBArg as well as the uses of the corresponding result? | |
mlir/lib/Dialect/Vector/VectorUtils.cpp | ||
351 | xxxIndices |
mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h | ||
---|---|---|
38 | Good point. I updated the comment above. | |
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp | ||
100 | Looks like ForOp doesn't have such a method but there is a simpler way indeed. Replaced it with forOp.getBody()->getTerminator() | |
114 | Makes sense, moved the logic and the one below into two helper functions. | |
148 | The problem is that it wouldn't work for the case where we have several nested ForOp where the tensor is just pass-through. Since I rely on separate canonicalization to remove those I need to handle this case if I want to support hoisting out of nested loops. |
perhaps add the "on buffers" restriction explicitly in the doc of L36 method