summaryrefslogtreecommitdiff
path: root/mlir/lib/Analysis/DataFlow/StridedMetadataRangeAnalysis.cpp
AgeCommit message (Collapse)Author
2025-10-14Reland "[mlir] Add strided metadata range dataflow analysis" (#163403)" ↵Fabian Mora
(#163408) This relands commit aa8499863ad23350da0912d99d189f306d0ea139. That commit was originally reverted because it caused failures in shared lib builds due to missing link dependencies. This patch relands the commit with the missing libs added. Signed-off-by: Fabian Mora <fabian.mora-cordero@amd.com>
2025-10-14Revert "[mlir] Add strided metadata range dataflow analysis" (#163403)Fabian Mora
Reverts llvm/llvm-project#161280
2025-10-14[mlir] Add strided metadata range dataflow analysis (#161280)Fabian Mora
Introduces a dataflow analysis for tracking offset, size, and stride ranges of operations. Inference of the metadata is accomplished through the implementation of the interface `InferStridedMetadataOpInterface`. To keep the size of the patch small, this patch only implements the interface for the `memref.subview` operation. It's future work to add more operations. Example: ```mlir func.func @memref_subview(%arg0: memref<8x16x4xf32, strided<[64, 4, 1]>>) { %c0 = arith.constant 0 : index %c1 = arith.constant 1 : index %c2 = arith.constant 2 : index %0 = test.with_bounds {smax = 13 : index, smin = 11 : index, umax = 13 : index, umin = 11 : index} : index %1 = test.with_bounds {smax = 7 : index, smin = 5 : index, umax = 7 : index, umin = 5 : index} : index %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1]>> to memref<?x?x?xf32, strided<[?, ?, ?], offset: ?>> return } ``` Applying `mlir-opt --test-strided-metadata-range-analysis` prints: ``` Op: %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1]>> to memref<?x?x?xf32, strided<[?, ?, ?], offset: ?>> result[0]: strided_metadata<offset = [{unsigned : [1, 1] signed : [1, 1]}], sizes = [{unsigned : [5, 7] signed : [5, 7]}, {unsigned : [11, 13] signed : [11, 13]}, {unsigned : [2, 2] signed : [2, 2]}], strides = [{unsigned : [64, 64] signed : [64, 64]}, {unsigned : [4, 4] signed : [4, 4]}, {unsigned : [1, 1] signed : [1, 1]}]> ``` --------- Signed-off-by: Fabian Mora <fabian.mora-cordero@amd.com>