[Mlir-commits] [mlir] [mlir][sparse][tensor] replace bufferization with empty tensor (PR #66450)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 14 17:21:05 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir
            
<details>
<summary>Changes</summary>
Rationale:
    A bufferization.alloc_tensor can be directly replaced
    with tensor.empty since these are more or less semantically
    equivalent. The latter is considered a bit more "pure"
    with respect to SSA semantics.

--

Patch is 78.42 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/66450.diff

48 Files Affected:

- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir (+4-4) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir (+11-11) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex32.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex64.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex_ops.mlir (+7-7) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_1d_nwc_wcf.mlir (+3-3) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir (+5-5) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nchw_fchw.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nhwc_hwcf.mlir (+4-4) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d.mlir (+4-4) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_ndhwc_dhwcf.mlir (+3-3) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_dot.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_expand.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index.mlir (+5-5) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_1d.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_2d.mlir (+5-5) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_3d.mlir (+4-4) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul_slice.mlir (+5-5) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matrix_ops.mlir (+3-3) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_mult_elt.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_reduction.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pooling_nhwc.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_re_im.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_prod.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_mm_fusion.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_scf_nested.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_select.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_semiring_select.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sign.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_strided_conv_2d_nhwc_hwcf.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_c32.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_ops.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir (+2-2) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose_coo.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir (+6-6) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir (+4-4) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/GPU/CUDA/sparse-gemm-lib.mlir (+1-1) 


<pre>
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir
index 89bf215a2c7788b..4ef8b29ee4e1a84 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir
@@ -71,7 +71,7 @@ module {
     %c2 = arith.constant 2.0 : f64
     %d0 = tensor.dim %arga, %c0 : tensor&lt;?x?xf64, #SparseMatrix&gt;
     %d1 = tensor.dim %arga, %c1 : tensor&lt;?x?xf64, #SparseMatrix&gt;
-    %init = bufferization.alloc_tensor(%d0, %d1) : tensor&lt;?x?xf64, #DenseMatrix&gt;
+    %init = tensor.empty(%d0, %d1) : tensor&lt;?x?xf64, #DenseMatrix&gt;
     %0 = linalg.generic #trait_assign
        ins(%arga: tensor&lt;?x?xf64, #SparseMatrix&gt;)
       outs(%init: tensor&lt;?x?xf64, #DenseMatrix&gt;) {
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir
index 420d3d8c6232744..317c7af990f78c4 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir
@@ -48,7 +48,7 @@ module {
                         %argb: tensor&lt;?xbf16, #SparseVector&gt;) -&gt; tensor&lt;?xbf16, #DenseVector&gt; {
     %c = arith.constant 0 : index
     %d = tensor.dim %arga, %c : tensor&lt;?xbf16, #SparseVector&gt;
-    %xv = bufferization.alloc_tensor (%d) : tensor&lt;?xbf16, #DenseVector&gt;
+    %xv = tensor.empty (%d) : tensor&lt;?xbf16, #DenseVector&gt;
     %0 = linalg.generic #trait_vec_op
        ins(%arga, %argb: tensor&lt;?xbf16, #SparseVector&gt;, tensor&lt;?xbf16, #SparseVector&gt;)
         outs(%xv: tensor&lt;?xbf16, #DenseVector&gt;) {
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir
index 96ea972bd6b5f0e..7c8510d8fbabc92 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir
@@ -49,7 +49,7 @@ module {
                         %argb: tensor&lt;?xf16, #SparseVector&gt;) -&gt; tensor&lt;?xf16, #DenseVector&gt; {
     %c = arith.constant 0 : index
     %d = tensor.dim %arga, %c : tensor&lt;?xf16, #SparseVector&gt;
-    %xv = bufferization.alloc_tensor (%d) : tensor&lt;?xf16, #DenseVector&gt;
+    %xv = tensor.empty (%d) : tensor&lt;?xf16, #DenseVector&gt;
     %0 = linalg.generic #trait_vec_op
        ins(%arga, %argb: tensor&lt;?xf16, #SparseVector&gt;, tensor&lt;?xf16, #SparseVector&gt;)
         outs(%xv: tensor&lt;?xf16, #DenseVector&gt;) {
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir
index 0488f5186a4a77d..6cf99cf45997d43 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir
@@ -51,7 +51,7 @@ module {
 
   func.func @conv2d_all_sparse_DCSR(%input:  tensor&lt;8x8xi32, #DCSR&gt;,
                %filter: tensor&lt;3x3xi32, #DCSR&gt;) -&gt; tensor&lt;6x6xi32, #DCSR&gt; {
-    %s = bufferization.alloc_tensor() : tensor&lt;6x6xi32, #DCSR&gt;
+    %s = tensor.empty() : tensor&lt;6x6xi32, #DCSR&gt;
     %0 = linalg.conv_2d
       ins  (%input, %filter: tensor&lt;8x8xi32, #DCSR&gt;, tensor&lt;3x3xi32, #DCSR&gt;)
       outs (%s: tensor&lt;6x6xi32, #DCSR&gt;) -&gt; tensor&lt;6x6xi32, #DCSR&gt;
@@ -60,7 +60,7 @@ module {
 
   func.func @conv2d_all_sparse_CSR(%input:  tensor&lt;8x8xi32, #CSR&gt;,
                %filter: tensor&lt;3x3xi32, #CSR&gt;) -&gt; tensor&lt;6x6xi32, #CSR&gt; {
-    %s = bufferization.alloc_tensor() : tensor&lt;6x6xi32, #CSR&gt;
+    %s = tensor.empty() : tensor&lt;6x6xi32, #CSR&gt;
     %0 = linalg.conv_2d
       ins  (%input, %filter: tensor&lt;8x8xi32, #CSR&gt;, tensor&lt;3x3xi32, #CSR&gt;)
       outs (%s: tensor&lt;6x6xi32, #CSR&gt;) -&gt; tensor&lt;6x6xi32, #CSR&gt;
@@ -69,7 +69,7 @@ module {
 
   func.func @conv2d_all_sparse_CD(%input:  tensor&lt;8x8xi32, #CDR&gt;,
                %filter: tensor&lt;3x3xi32, #CDR&gt;) -&gt; tensor&lt;6x6xi32, #CDR&gt; {
-    %s = bufferization.alloc_tensor() : tensor&lt;6x6xi32, #CDR&gt;
+    %s = tensor.empty() : tensor&lt;6x6xi32, #CDR&gt;
     %0 = linalg.conv_2d
       ins  (%input, %filter: tensor&lt;8x8xi32, #CDR&gt;, tensor&lt;3x3xi32, #CDR&gt;)
       outs (%s: tensor&lt;6x6xi32, #CDR&gt;) -&gt; tensor&lt;6x6xi32, #CDR&gt;
@@ -78,7 +78,7 @@ module {
 
   func.func @conv2d_all_sparse_CSC(%input:  tensor&lt;8x8xi32, #CSC&gt;,
                %filter: tensor&lt;3x3xi32, #CSC&gt;) -&gt; tensor&lt;6x6xi32, #CSC&gt; {
-    %s = bufferization.alloc_tensor() : tensor&lt;6x6xi32, #CSC&gt;
+    %s = tensor.empty() : tensor&lt;6x6xi32, #CSC&gt;
     %0 = linalg.conv_2d
       ins  (%input, %filter: tensor&lt;8x8xi32, #CSC&gt;, tensor&lt;3x3xi32, #CSC&gt;)
       outs (%s: tensor&lt;6x6xi32, #CSC&gt;) -&gt; tensor&lt;6x6xi32, #CSC&gt;
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir
index 584906034d2d20e..71054e456e49475 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir
@@ -46,7 +46,7 @@ module {
                              -&gt; tensor&lt;?xf64, #SparseVector&gt; {
     %c0 = arith.constant 0 : index
     %d = tensor.dim %arg0, %c0 : tensor&lt;?xf64, #SparseVector&gt;
-    %xin = bufferization.alloc_tensor(%d) : tensor&lt;?xf64, #SparseVector&gt;
+    %xin = tensor.empty(%d) : tensor&lt;?xf64, #SparseVector&gt;
     %0 = linalg.generic #trait_op
       ins(%arg0: tensor&lt;?xf64, #SparseVector&gt;)
       outs(%xin: tensor&lt;?xf64, #SparseVector&gt;) {
@@ -61,7 +61,7 @@ module {
                              -&gt; tensor&lt;?xi32, #SparseVector&gt; {
     %c0 = arith.constant 0 : index
     %d = tensor.dim %arg0, %c0 : tensor&lt;?xi32, #SparseVector&gt;
-    %xin = bufferization.alloc_tensor(%d) : tensor&lt;?xi32, #SparseVector&gt;
+    %xin = tensor.empty(%d) : tensor&lt;?xi32, #SparseVector&gt;
     %0 = linalg.generic #trait_op
       ins(%arg0: tensor&lt;?xi32, #SparseVector&gt;)
       outs(%xin: tensor&lt;?xi32, #SparseVector&gt;) {
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
index 917f8a4838f4de5..826bf0da0ec81f3 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir
@@ -73,7 +73,7 @@ module {
                         %argb: tensor&lt;?xi32, #SparseVector&gt;) -&gt; tensor&lt;?xi32, #SparseVector&gt; {
     %c = arith.constant 0 : index
     %d = tensor.dim %arga, %c : tensor&lt;?xi32, #SparseVector&gt;
-    %xv = bufferization.alloc_tensor(%d) : tensor&lt;?xi32, #SparseVector&gt;
+    %xv = tensor.empty(%d) : tensor&lt;?xi32, #SparseVector&gt;
     %0 = linalg.generic #trait_vec_op
        ins(%arga, %argb: tensor&lt;?xi32, #SparseVector&gt;, tensor&lt;?xi32, #SparseVector&gt;)
         outs(%xv: tensor&lt;?xi32, #SparseVector&gt;) {
@@ -97,7 +97,7 @@ module {
                         %argb: tensor&lt;?xf64&gt;) -&gt; tensor&lt;?xf64, #SparseVector&gt; {
     %c = arith.constant 0 : index
     %d = tensor.dim %arga, %c : tensor&lt;?xf64, #SparseVector&gt;
-    %xv = bufferization.alloc_tensor(%d) : tensor&lt;?xf64, #SparseVector&gt;
+    %xv = tensor.empty(%d) : tensor&lt;?xf64, #SparseVector&gt;
     %0 = linalg.generic #trait_vec_op
        ins(%arga, %argb: tensor&lt;?xf64, #SparseVector&gt;, tensor&lt;?xf64&gt;)
         outs(%xv: tensor&lt;?xf64, #SparseVector&gt;) {
@@ -121,7 +121,7 @@ module {
                             %argb: tensor&lt;?xf64, #SparseVector&gt;) -&gt; tensor&lt;?xf64, #SparseVector&gt; {
     %c = arith.constant 0 : index
     %d = tensor.dim %arga, %c : tensor&lt;?xf64, #SparseVector&gt;
-    %xv = bufferization.alloc_tensor(%d) : tensor&lt;?xf64, #SparseVector&gt;
+    %xv = tensor.empty(%d) : tensor&lt;?xf64, #SparseVector&gt;
     %0 = linalg.generic #trait_vec_op
        ins(%arga, %argb: tensor&lt;?xf64, #SparseVector&gt;, tensor&lt;?xf64, #SparseVector&gt;)
         outs(%xv: tensor&lt;?xf64, #SparseVector&gt;) {
@@ -139,7 +139,7 @@ module {
   func.func @vector_index(%arga: tensor&lt;?xf64, #SparseVector&gt;) -&gt; tensor&lt;?xi32, #SparseVector&gt; {
     %c = arith.constant 0 : index
     %d = tensor.dim %arga, %c : tensor&lt;?xf64, #SparseVector&gt;
-    %xv = bufferization.alloc_tensor(%d) : tensor&lt;?xi32, #SparseVector&gt;
+    %xv = tensor.empty(%d) : tensor&lt;?xi32, #SparseVector&gt;
     %0 = linalg.generic #trait_vec_scale
        ins(%arga: tensor&lt;?xf64, #SparseVector&gt;)
         outs(%xv: tensor&lt;?xi32, #SparseVector&gt;) {
@@ -166,7 +166,7 @@ module {
     %c1 = arith.constant 1 : index
     %d0 = tensor.dim %arga, %c0 : tensor&lt;?x?xf64, #DCSR&gt;
     %d1 = tensor.dim %arga, %c1 : tensor&lt;?x?xf64, #DCSR&gt;
-    %xv = bufferization.alloc_tensor(%d0, %d1) : tensor&lt;?x?xf64, #DCSR&gt;
+    %xv = tensor.empty(%d0, %d1) : tensor&lt;?x?xf64, #DCSR&gt;
     %0 = linalg.generic #trait_mat_op
        ins(%arga, %argb: tensor&lt;?x?xf64, #DCSR&gt;, tensor&lt;?x?xf64, #DCSR&gt;)
         outs(%xv: tensor&lt;?x?xf64, #DCSR&gt;) {
@@ -191,7 +191,7 @@ module {
   // Tensor addition (use semi-ring binary operation).
   func.func @add_tensor_1(%A: tensor&lt;4x4xf64, #DCSR&gt;,
                           %B: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xf64, #DCSR&gt; {
-    %C = bufferization.alloc_tensor() : tensor&lt;4x4xf64, #DCSR&gt;
+    %C = tensor.empty() : tensor&lt;4x4xf64, #DCSR&gt;
     %0 = linalg.generic #trait_mat_op
       ins(%A, %B: tensor&lt;4x4xf64, #DCSR&gt;,
                   tensor&lt;4x4xf64, #DCSR&gt;)
@@ -213,7 +213,7 @@ module {
   // Same as @add_tensor_1, but use sparse_tensor.yield instead of identity to yield value.
   func.func @add_tensor_2(%A: tensor&lt;4x4xf64, #DCSR&gt;,
                           %B: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xf64, #DCSR&gt; {
-    %C = bufferization.alloc_tensor() : tensor&lt;4x4xf64, #DCSR&gt;
+    %C = tensor.empty() : tensor&lt;4x4xf64, #DCSR&gt;
     %0 = linalg.generic #trait_mat_op
       ins(%A, %B: tensor&lt;4x4xf64, #DCSR&gt;,
                   tensor&lt;4x4xf64, #DCSR&gt;)
@@ -241,7 +241,7 @@ module {
   // Performs triangular add/sub operation (using semi-ring binary op).
   func.func @triangular(%A: tensor&lt;4x4xf64, #DCSR&gt;,
                         %B: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xf64, #DCSR&gt; {
-    %C = bufferization.alloc_tensor() : tensor&lt;4x4xf64, #DCSR&gt;
+    %C = tensor.empty() : tensor&lt;4x4xf64, #DCSR&gt;
     %0 = linalg.generic #trait_mat_op
       ins(%A, %B: tensor&lt;4x4xf64, #DCSR&gt;,
                   tensor&lt;4x4xf64, #DCSR&gt;)
@@ -274,7 +274,7 @@ module {
   // Perform sub operation (using semi-ring binary op) with a constant threshold.
   func.func @sub_with_thres(%A: tensor&lt;4x4xf64, #DCSR&gt;,
                             %B: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xf64, #DCSR&gt; {
-    %C = bufferization.alloc_tensor() : tensor&lt;4x4xf64, #DCSR&gt;
+    %C = tensor.empty() : tensor&lt;4x4xf64, #DCSR&gt;
     // Defines out-block constant bounds.
     %thres_out_up = arith.constant 2.0 : f64
     %thres_out_lo = arith.constant -2.0 : f64
@@ -323,7 +323,7 @@ module {
   // Performs isEqual only on intersecting elements.
   func.func @intersect_equal(%A: tensor&lt;4x4xf64, #DCSR&gt;,
                              %B: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xi8, #DCSR&gt; {
-    %C = bufferization.alloc_tensor() : tensor&lt;4x4xi8, #DCSR&gt;
+    %C = tensor.empty() : tensor&lt;4x4xi8, #DCSR&gt;
     %0 = linalg.generic #trait_mat_op
       ins(%A, %B: tensor&lt;4x4xf64, #DCSR&gt;,
                   tensor&lt;4x4xf64, #DCSR&gt;)
@@ -346,7 +346,7 @@ module {
   // Keeps values on left, negate value on right, ignore value when overlapping.
   func.func @only_left_right(%A: tensor&lt;4x4xf64, #DCSR&gt;,
                              %B: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xf64, #DCSR&gt; {
-    %C = bufferization.alloc_tensor() : tensor&lt;4x4xf64, #DCSR&gt;
+    %C = tensor.empty() : tensor&lt;4x4xf64, #DCSR&gt;
     %0 = linalg.generic #trait_mat_op
       ins(%A, %B: tensor&lt;4x4xf64, #DCSR&gt;,
                   tensor&lt;4x4xf64, #DCSR&gt;)
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir
index f6c72581153bfac..87ab88b8d9de99c 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir
@@ -66,7 +66,7 @@ module {
 
   func.func @cmp_lhs_sparse(%arga: tensor&lt;4x4xf64, #DCSR&gt;,
                             %argb: tensor&lt;4x4xf64&gt;) -&gt; tensor&lt;4x4xi8, #DCSR&gt; {
-    %argx = bufferization.alloc_tensor() : tensor&lt;4x4xi8, #DCSR&gt;
+    %argx = tensor.empty() : tensor&lt;4x4xi8, #DCSR&gt;
     %0 = linalg.generic #trait
        ins(%arga, %argb: tensor&lt;4x4xf64, #DCSR&gt;, tensor&lt;4x4xf64&gt;)
       outs(%argx: tensor&lt;4x4xi8, #DCSR&gt;) {
@@ -80,7 +80,7 @@ module {
 
   func.func @cmp_all_sparse(%arga: tensor&lt;4x4xf64, #DCSR&gt;,
                             %argb: tensor&lt;4x4xf64, #DCSR&gt;) -&gt; tensor&lt;4x4xi8, #DCSR&gt; {
-    %argx = bufferization.alloc_tensor() : tensor&lt;4x4xi8, #DCSR&gt;
+    %argx = tensor.empty() : tensor&lt;4x4xi8, #DCSR&gt;
     %0 = linalg.generic #trait
        ins(%arga, %argb: tensor&lt;4x4xf64, #DCSR&gt;, tensor&lt;4x4xf64, #DCSR&gt;)
       outs(%argx: tensor&lt;4x4xi8, #DCSR&gt;) {
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
index 3203473f68b324d..45ea95d1a6f36fd 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir
@@ -43,8 +43,8 @@ module {
     %c1 = arith.constant 1 : index
     %c2 = arith.constant 2 : index
     %c3 = arith.constant 3 : index
-    %t1 = bufferization.alloc_tensor() : tensor&lt;4x5xf64, #DCSR&gt;
-    %t2 = bufferization.alloc_tensor(%c2, %c3) : tensor&lt;?x?xf64, #DCSR&g...
<truncated>
</pre>
</details>


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


More information about the Mlir-commits mailing list