[Mlir-commits] [mlir] a652e5b - [mlir][sparse] emergency fix after constant -> arith.constant change

Aart Bik llvmlistbot at llvm.org
Wed Oct 13 10:26:26 PDT 2021


Author: Aart Bik
Date: 2021-10-13T10:26:17-07:00
New Revision: a652e5b53a1ab2a19fa96178721c6cf168a511f9

URL: https://github.com/llvm/llvm-project/commit/a652e5b53a1ab2a19fa96178721c6cf168a511f9
DIFF: https://github.com/llvm/llvm-project/commit/a652e5b53a1ab2a19fa96178721c6cf168a511f9.diff

LOG: [mlir][sparse] emergency fix after constant -> arith.constant change

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D111743

Added: 
    

Modified: 
    mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
    mlir/test/Dialect/SparseTensor/invalid.mlir
    mlir/test/Dialect/SparseTensor/roundtrip.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
index 365d97c804a9..8a0e4677d505 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
@@ -225,9 +225,9 @@ static LogicalResult verify(InitOp op) {
   for (unsigned i = 0; i < rank; i++) {
     if (shape[i] == ShapedType::kDynamicSize)
       continue;
-    auto constantOp = op.sizes()[i].getDefiningOp<ConstantOp>();
+    auto constantOp = op.sizes()[i].getDefiningOp<arith::ConstantOp>();
     if (!constantOp ||
-        constantOp.getValue().cast<IntegerAttr>().getInt() != shape[i])
+        constantOp.value().cast<IntegerAttr>().getInt() != shape[i])
       return op.emitError("unexpected mismatch with static dimension size ")
              << shape[i];
   }

diff  --git a/mlir/test/Dialect/SparseTensor/invalid.mlir b/mlir/test/Dialect/SparseTensor/invalid.mlir
index 7d4b8b481a60..03abcb5e82d0 100644
--- a/mlir/test/Dialect/SparseTensor/invalid.mlir
+++ b/mlir/test/Dialect/SparseTensor/invalid.mlir
@@ -37,8 +37,8 @@ func @invalid_init_rank(%arg0: index) -> tensor<?xf32, #SparseVector> {
 #SparseMatrix = #sparse_tensor.encoding<{dimLevelType = ["compressed", "compressed"]}>
 
 func @invalid_init_size() -> tensor<?x10xf32, #SparseMatrix> {
-  %c10 = constant 10 : index
-  %c20 = constant 20 : index
+  %c10 = arith.constant 10 : index
+  %c20 = arith.constant 20 : index
   // expected-error at +1 {{unexpected mismatch with static dimension size 10}}
   %0 = sparse_tensor.init [%c10, %c20] : tensor<?x10xf32, #SparseMatrix>
   return %0 : tensor<?x10xf32, #SparseMatrix>

diff  --git a/mlir/test/Dialect/SparseTensor/roundtrip.mlir b/mlir/test/Dialect/SparseTensor/roundtrip.mlir
index e04f3e166d9a..507eb4e1de52 100644
--- a/mlir/test/Dialect/SparseTensor/roundtrip.mlir
+++ b/mlir/test/Dialect/SparseTensor/roundtrip.mlir
@@ -16,13 +16,13 @@ func @sparse_new(%arg0: !llvm.ptr<i8>) -> tensor<128xf64, #SparseVector> {
 #SparseMatrix = #sparse_tensor.encoding<{dimLevelType = ["compressed", "compressed"]}>
 
 // CHECK-LABEL: func @sparse_init()
-//   CHECK-DAG: %[[C16:.*]] = constant 16 : index
-//   CHECK-DAG: %[[C32:.*]] = constant 32 : index
+//   CHECK-DAG: %[[C16:.*]] = arith.constant 16 : index
+//   CHECK-DAG: %[[C32:.*]] = arith.constant 32 : index
 //       CHECK: %[[T:.*]] = sparse_tensor.init[%[[C16]], %[[C32]]] : tensor<?x32xf64, #{{.*}}>
 //       CHECK: return %[[T]] : tensor<?x32xf64, #{{.*}}>
 func @sparse_init() -> tensor<?x32xf64, #SparseMatrix> {
-  %d1 = constant 16 : index
-  %d2 = constant 32 : index
+  %d1 = arith.constant 16 : index
+  %d2 = arith.constant 32 : index
   %0 = sparse_tensor.init [%d1, %d2] : tensor<?x32xf64, #SparseMatrix>
   return %0 : tensor<?x32xf64, #SparseMatrix>
 }


        


More information about the Mlir-commits mailing list