[Mlir-commits] [mlir] [MLIR][Vector] Add Lowering for vector.step (PR #113655)
Kunwar Grover
llvmlistbot at llvm.org
Mon Oct 28 04:35:37 PDT 2024
Groverkss wrote:
> > Do we? Is there a use case for this? I just want to make that we are not moving code for the sake of ... moving code around 😅
We do actually have a usecase downstream. Sometimes, we see patterns like:
```
%a = vector.step : vector<128xindex>
%b = vector.extract_strided_slice %thread_id, %a : vector<4xindex>
```
If you know it's a vector.step, you can fold the step + slice into:
```
%a = vector.step : vector<4xindex>
%b = arith.constant ...
%c = arith.addi %b, %a
%d = arith.addi %c, %thread_id
```
So you don't have to materialize a big constant like vector<128xindex> into private memory. Having vector.step allows you to know how the arith.constant materializes.
https://github.com/llvm/llvm-project/pull/113655
More information about the Mlir-commits
mailing list