llvm-project
67b9d3ff - [mlir] computeSliceParameters: Fix offset when m(0) != 0 (#122492)

Commit
1 year ago
[mlir] computeSliceParameters: Fix offset when m(0) != 0 (#122492) For affine maps where `m(0) != 0`, like `affine_map<(d0) -> (d0 + 3)` in ``` %generic = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0 + 3)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%arg0: tensor<9xf32>) outs(%empty : tensor<6xf32>) { ^bb0(%in : f32, %out: f32): linalg.yield %in : f32 } -> tensor<6xf32> ``` tiling currently computes the wrong slice offsets. When tiling above example with a size of 3, it would compute ``` scf.for %i = ... %slice = tensor.extract_slice %arg0[%i + 3] [6] [1] linalg.generic {indexing_maps = [affine_map<(d0) -> (d0 + 3)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%slice: tensor<6xf32>) ``` and thus apply the `+3` twice (once in the extract slice and a second time in the linalg.generic). This PR fixes this to yield an offset of `tensor.extract_slice %arg0[%i] [6] [1]` instead.
Author
Parents
Loading