[Mlir-commits] [mlir] [mlir][linalg] convert arith ops to destination-passing-style. (PR #157854)
Javed Absar
llvmlistbot at llvm.org
Fri Sep 12 07:57:45 PDT 2025
javedabsar1 wrote:
> Thanks Javed!
>
> > specifically is useful for loewr-quant-ops which operate on tensors and ops like qcast generates arith ops on tensors which without dps cannot bufferize
>
> This sounds like a very good justification, but could you share a repro so that we can see what the issue is? In particular, it would be good to make sure that we are not missing some other, less involved, solution to this. This could be either here or as a GitHub issue if it's more involved.
>
> > Converts arith ops that operate on tensors but are not in destination passing style (DPS) to equivalent linalg generic which is in DPS.
>
> Hm, isn't this saying "rewrite arith Ops on tensors as a linalg.generic"? As in, DPS is just a by-product/justification for this rewrite (as opposed to being the end goal)?
>
> **EDIT** OK, sorry, I've just realised that you are adding this in `ConvertToDestinationStyle.cpp`, which explains the naming. A bit counter-intuitive to me, but oh well.
Thanks @banach-space for the review.
Reproducer, yes here it is (also @matthias-springer is aware of this) -
```
build$ cat repro.mlir
!qalias = !quant.uniform<i8:f32, 2.0:10>
func.func @reproducer(%arg0: tensor<10xf32>) -> tensor<10xf32> {
%0 = quant.qcast %arg0 : tensor<10xf32> to tensor<10x!qalias>
%1 = quant.dcast %0 : tensor<10x!qalias> to tensor<10xf32>
return %1 : tensor<10xf32>
}
```
https://github.com/llvm/llvm-project/pull/157854
More information about the Mlir-commits
mailing list