aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/Object.cpp
diff options
context:
space:
mode:
authorAndrzej WarzyƄski <andrzej.warzynski@arm.com>2025-10-13 10:48:03 +0200
committerGitHub <noreply@github.com>2025-10-13 09:48:03 +0100
commite90f8d84b0063b47455430fd8b57c1b1dafe7735 (patch)
tree26014fb43de37c2b1fe418e163d527bebd17f78c /llvm/lib/Object/Object.cpp
parent9ace31123d86220544f6d668e83ee3ff6f9f20db (diff)
downloadllvm-e90f8d84b0063b47455430fd8b57c1b1dafe7735.zip
llvm-e90f8d84b0063b47455430fd8b57c1b1dafe7735.tar.gz
llvm-e90f8d84b0063b47455430fd8b57c1b1dafe7735.tar.bz2
[mlir][linalg] Extend DecomposeOuterUnitDimsPackOpPattern (linalg.pack) (#162666)
Similarly to #152960, this PR fixes `getTiledOuterDims` for `linalg.pack` by ensuring that the `outer_dims_perm` attributeis properly taken into account. This enables the main change in this PR: relaxing the constraints in * `DecomposeOuterUnitDimsPackOpPattern`. Specifically, the pattern is extended to allow non-unit untiled outer dimensions. For example: ```mlir func.func @example( %src: tensor<2x32x16x8xf32>, %dest: tensor<2x1x16x8x32xf32>) -> tensor<2x1x16x8x32xf32> { %pack = linalg.pack %src inner_dims_pos = [1] inner_tiles = [32] into %dest : tensor<2x32x16x8xf32> -> tensor<2x1x16x8x32xf32> return %pack : tensor<2x1x16x8x32xf32> } ``` decomposes as: ```mlir func.func @example( %src: tensor<2x32x16x8xf32>, %dest: tensor<2x1x16x8x32xf32>) -> tensor<2x1x16x8x32xf32> { %0 = tensor.empty() : tensor<2x16x8x32xf32> %transposed = linalg.transpose ins(%src : tensor<2x32x16x8xf32>) outs(%init : tensor<2x16x8x32xf32>) permutation = [0, 2, 3, 1] %inserted_slice = tensor.insert_slice %transposed into %dest[0, 0, 0, 0, 0] [2, 1, 16, 8, 32] [1, 1, 1, 1, 1] : tensor<2x16x8x32xf32> into tensor<2x1x16x8x32xf32> return %inserted_slice : tensor<2x1x16x8x32xf32> } ``` Importantly, this change makes `DecomposeOuterUnitDimsPackOpPattern` (the decomposition pattern for `linalg.pack`) consistent with the corresponding pattern for `linalg.unpack`: * `DecomposeOuterUnitDimsUnPackOpPattern`. One notable assumption remains: untiled outer dimensions are not permuted. This was already the case but is now explicitly documented. Co-authored by: Max Bartel <bartel@roofline.ai>
Diffstat (limited to 'llvm/lib/Object/Object.cpp')
0 files changed, 0 insertions, 0 deletions