[all-commits] [llvm/llvm-project] 773ad5: [mlir][linalg][nfc] Clean-up leftover code post #1...
Andrzej WarzyĆski via All-commits
all-commits at lists.llvm.org
Wed Jul 30 06:26:56 PDT 2025
Branch: refs/heads/users/banach-space/linalg/unpack_vec_update
Home: https://github.com/llvm/llvm-project
Commit: 773ad5202da08b718d1468d8169b3dcb7c55446f
https://github.com/llvm/llvm-project/commit/773ad5202da08b718d1468d8169b3dcb7c55446f
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Log Message:
-----------
[mlir][linalg][nfc] Clean-up leftover code post #149156
In https://github.com/llvm/llvm-project/pull/149156, I ensured that we
no longer generate spurious `tensor.empty` ops when vectorizing
`linalg.unpack`.
This follow-up removes leftover code that is now redundant but was
missed in the original PR and in #150602 that was also meant to clean-up
left-over code.
Note, this is removing code to compute "write-vector-sizes". Instead,
these are fully inferred from previous Ops.
Commit: aa3b4d86ecc4a6f52d5b36536149128d19fc8648
https://github.com/llvm/llvm-project/commit/aa3b4d86ecc4a6f52d5b36536149128d19fc8648
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/include/mlir/Dialect/Vector/Utils/VectorUtils.h
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
M mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
M mlir/test/Dialect/Linalg/vectorization/linalg-ops.mlir
Log Message:
-----------
[mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
This patch updates `vectorizeAsTensorUnpackOp` to support scalable
vectorization by requiring user-specified vector sizes for both the
_read_ and _write_ operations involved in `linalg.unpack`. Detailed
rationale and an example are provided below.
Conceptually, `linalg.unpack` consists of the following high-level steps:
1. _Read_ from the source tensor.
2. Transpose the value read in step (1).
3. _Write_ the value from step (2) into the destination tensor.
Currently, when vectorizing with user-provided vector sizes, only the
sizes for the _write_ operation (step 3) are required. Sizes for the
_read_ operation (step 1) are inferred from static shapes and inner tile
sizes.
This logic breaks when the input shapes or tile sizes are dynamic
(indeed, `vectorizeUnPackOpPrecondition` rejects such cases ATM and the
vectorization fails). This patch addresses the issue by requiring
explicit vector sizes for both the read and write sides, enabling
scalable vectorization in such cases.
Example:
```mlir
func.func @unpack(%in: tensor<1x1x8x?xf32>, %out: tensor<8x?xf32>) -> tensor<8x?xf32> {
%vs = vector.vscale
%c8 = arith.constant 8 : index
%tile_size = arith.muli %vs, %c8 : index
%unpack = linalg.unpack %in
inner_dims_pos = [0, 1]
inner_tiles = [8, %tile_size]
into %out : tensor<1x1x8x?xf32> -> tensor<8x?xf32>
return %unpack : tensor<8x?xf32>
}
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["linalg.unpack"]} in %arg0 : (!transform.any_op) -> !transform.any_op
transform.structured.vectorize %0 vector_sizes [1, 1, 8, [8], 8, [8]] : !transform.any_op
// \ / \ /
// read-sizes write-sizes
transform.yield
}
}
```
Finally, this patch also extends `createReadOrMaskedRead` and
`createWriteOrMaskedWrite` to take scalable flags.
Commit: 02f7f0c6ac0858fd38ff216599495dd1e4739fe7
https://github.com/llvm/llvm-project/commit/02f7f0c6ac0858fd38ff216599495dd1e4739fe7
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Log Message:
-----------
fixup! [mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
Remove leftover code + comments
Commit: fe14a6a9c6dab11b625e51e4e70ec69a3d33f8d9
https://github.com/llvm/llvm-project/commit/fe14a6a9c6dab11b625e51e4e70ec69a3d33f8d9
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Log Message:
-----------
fixup! fixup! [mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
Fix pre-condition calculation
Commit: d06a197c121e5a97d02c374696311350261df5e0
https://github.com/llvm/llvm-project/commit/d06a197c121e5a97d02c374696311350261df5e0
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
M mlir/test/Dialect/Linalg/vectorization/linalg-ops.mlir
Log Message:
-----------
fixup! fixup! [mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
Improve documentation + fix test after rebasing on top of
* https://github.com/llvm/llvm-project/pull/150602
Commit: 057e9bbd00edea471c1892687426bfef239d8c67
https://github.com/llvm/llvm-project/commit/057e9bbd00edea471c1892687426bfef239d8c67
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/test/Dialect/Linalg/vectorization/linalg-ops.mlir
Log Message:
-----------
fixup! fixup! fixup! [mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
Remove unintended test change
Commit: 51000f0a8335a8dca803cee8e1e9f25d33aed6e6
https://github.com/llvm/llvm-project/commit/51000f0a8335a8dca803cee8e1e9f25d33aed6e6
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Log Message:
-----------
fixup! fixup! fixup! fixup! [mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
Remove TODO
Commit: 7f888902c5102105b8b0ea8f6c57eb5046e283f1
https://github.com/llvm/llvm-project/commit/7f888902c5102105b8b0ea8f6c57eb5046e283f1
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Log Message:
-----------
fixup! fixup! fixup! fixup! fixup! [mlir][linalg] Enable scalable vectorization of linalg.unpack (WIP)
Fix comment
Commit: 2f565cf22b9519c3fe522b4c0dabb0fae58d9ccb
https://github.com/llvm/llvm-project/commit/2f565cf22b9519c3fe522b4c0dabb0fae58d9ccb
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
M mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
Log Message:
-----------
Simplify code as per comments from HanHan
Commit: 56108b1df69e150c475adc58880ca7dce5355b21
https://github.com/llvm/llvm-project/commit/56108b1df69e150c475adc58880ca7dce5355b21
Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: 2025-07-30 (Wed, 30 Jul 2025)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
Log Message:
-----------
Address the remaining comments from HanHan
Compare: https://github.com/llvm/llvm-project/compare/a7423f83f6c9...56108b1df69e
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list