aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/FunctionImport/Inputs
diff options
context:
space:
mode:
authorAbhishek Varma <avarma094@gmail.com>2026-03-05 12:29:58 +0530
committerGitHub <noreply@github.com>2026-03-05 06:59:58 +0000
commit50826f9c3b9c31bcc77846ba00ef106d0e0abc83 (patch)
treee4a8088c2b65c764a65fe570a74d55c4a5b5431a /llvm/test/Transforms/FunctionImport/Inputs
parenta2407f6d4c5012c0a0375fb097f96cf726833883 (diff)
downloadllvm-main.zip
llvm-main.tar.gz
llvm-main.tar.bz2
[mlir][MemRef] Add position-based matching heuristics for rank-reduction with dynamic strides (#184334)HEADmain
When multiple source dimensions have multiple unit dimensions, stride-based disambiguation can be wrong with dynamic strides. Add position-based matching: for each result dimension in order, pick the leftmost unmatched source dimension with the same size; unmatched source dims are dropped. Example: subview from memref<1x8x1x3> to memref<1x8x3>. Both dim 0 and dim 2 have size 1. Stride-based logic cannot distinguish when strides are dynamic. Position-based matching correctly drops dim 2 (middle unit dim) instead of dim 0. When we have non-trivial static strides, we make use of the stride-based logic, else we fall back to position-based logic as introduced by this patch. INPUT :- ``` func.func @fold_rank_reducing_subview_1x8x1x3_to_1x8x3_drop_middle_unit_dim( %arg0 : memref<?x?x?x?xf32, strided<[?, ?, ?, ?], offset: ?>>, %arg1 : index, %arg2 : index, %arg3 : index, %arg4 : index) -> f32 { %c0 = arith.constant 0 : index %0 = memref.subview %arg0[0, 0, 0, 0][1, 8, 1, 3][1, 1, 1, 1] : memref<?x?x?x?xf32, strided<[?, ?, ?, ?], offset: ?>> to memref<1x8x3xf32, strided<[?, ?, ?], offset: ?>> %1 = memref.load %0[%c0, %arg1, %arg2] : memref<1x8x3xf32, strided<[?, ?, ?], offset: ?>> return %1 : f32 } ``` WITHOUT this patch we get :- ``` memref.load %0[%c0, %c0, %arg1, %arg2] ``` WITH this patch we get :- ``` memref.load %0[%c0, %arg1, %c0, %arg2] ``` Signed-off-by: Abhishek Varma <abhvarma@amd.com>
Diffstat (limited to 'llvm/test/Transforms/FunctionImport/Inputs')
0 files changed, 0 insertions, 0 deletions