Representing matmuls as a sum of outer products is central to various
matrix extensions (e.g. Arm's SME). This test demonstrates how to use
Linalg's vectoriser and Vector's lowerings to represent linalg.matmul
as a chain of vector.outerproduct Ops.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/test/Dialect/Linalg/vectorization.mlir | ||
---|---|---|
85 ↗ | (On Diff #521690) | I don't think CHECK-SAME is well defined after a CHECK-LABEL. It might work now but conceptually it feels wrong to me. It should be after a CHECK: I'd rather duplicate the CHECK func.func @outerproduct_matmul @jdenny Is CHECK-SAME after CHECK-LABEL officially supported? I couldn't find anything obvious in the documentation. |
mlir/test/Dialect/Linalg/vectorization.mlir | ||
---|---|---|
85 ↗ | (On Diff #521690) | That said, a lot of tests already follow this pattern so maybe it should just be documented as expected to work. In other words, no objection on this patch. |
Thanks @awarzynski! LGTM, just one comment.
mlir/test/Dialect/Linalg/vectorization.mlir | ||
---|---|---|
110 ↗ | (On Diff #521690) | This looks like a small integration test. Should we create two tests, one for vectorize and one for lower_contraction? If not, I think we should move it to a different .mlir file as here we are only testing vectorize. |
mlir/test/Dialect/Linalg/vectorization.mlir | ||
---|---|---|
110 ↗ | (On Diff #521690) | I agree and am glad that you have pointed this out :)
An updated version is on its way :) |
Btw, I've just learnt that matmul_step_04_tile_and_vector_mask.mlir in IREE demonstrates similar lowering path (albeit much more elaborate). @qcolombet, thank you for sharing!
mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir | ||
---|---|---|
1 | Just noticed, does it requires -split-input-file option here? I think it work without it also. |
mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir | ||
---|---|---|
1 | Good catch and sorry that I missed that! Fixed here: https://github.com/llvm/llvm-project/commit/c2d55ef563a96933db8c171a7b624a75b67c2a0f |
mlir/test/Dialect/Linalg/transform-op-matmul-to-outerproduct.mlir | ||
---|---|---|
1 | Thanks for addressing the comment! |
Just noticed, does it requires -split-input-file option here? I think it work without it also.