[Mlir-commits] [mlir] [MLIR] [Vector] Fix canonicalization for vector.scatter with tensor output (PR #168824)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon Dec 8 10:08:19 PST 2025


================
@@ -3909,6 +3909,40 @@ func.func @contiguous_scatter_step(%base: memref<?xf32>,
 
 // -----
 
+// No canoniclization should happen here as the base is a tensor.
+// CHECK-LABEL: @contiguous_scatter_tensor
+//  CHECK-SAME:   (%[[BASE:.*]]: tensor<16xf32>, %[[MASK:.*]]: vector<16xi1>, %[[VALUE:.*]]: vector<16xf32>) -> tensor<16xf32> {
+//       CHECK:   %[[C0:.*]] = arith.constant 0 : index
+//       CHECK:   %[[INDICES:.*]] = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : vector<16xi32>
+//       CHECK:   %[[SCATTER:.*]] = vector.scatter %[[BASE]][%[[C0]]] [%[[INDICES]]], %[[MASK]], %[[VALUE]] : tensor<16xf32>, vector<16xi32>, vector<16xi1>, vector<16xf32> -> tensor<16xf32>
+//       CHECK:   return %[[SCATTER]] : tensor<16xf32>
----------------
banach-space wrote:

This should be sufficient for what you are trying to check here.
```suggestion
// CHECK-LABEL: @contiguous_scatter_tensor
// CHECK-NOT: vector.maskedstore
//          CHECK:   %[[RES] = vector.scatter
//         CHECK: return %[[RES]]
```

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


More information about the Mlir-commits mailing list