[Mlir-commits] [mlir] [mlir][linalg] convert arith ops to destination-passing-style. (PR #157854)

Adam Siemieniuk llvmlistbot at llvm.org
Mon Sep 15 03:08:51 PDT 2025


adam-smnk wrote:

> After this change, e.g. ` %0 = arith.uitofp %arg0 : tensor<?xi32> to tensor<?xf32>` will get rewritten as:
> 
> ```
>     %c0 = arith.constant 0 : index
>     %dim = tensor.dim %arg0, %c0 : tensor<?xi32>
>     %0 = tensor.empty(%dim) : tensor<?xf32>
>     %1 = linalg.generic
>           {indexing_maps = [#map, #map], iterator_types = ["parallel"]}
>           ins(%arg0 : tensor<?xi32>) outs(%0 : tensor<?xf32>) {
>            ^bb0(%in: i32, %out: f32):
>              %2 = arith.uitofp %in : i32 to f32
>              linalg.yield %2 : f32
>     } -> tensor<?xf32>
> ```

This is covered by the existing `-convert-elementwise-to-linalg` pass.
Not sure if proposed new pass fully duplicates this logic but FYI.


https://github.com/llvm/llvm-project/pull/157854


More information about the Mlir-commits mailing list