[Mlir-commits] [mlir] 933e7e2 - [mlir][sparse] Change getUnorderedCOOFromType to propagate the overhead types.

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Oct 18 08:01:21 PDT 2022


Author: bixia1
Date: 2022-10-18T08:01:16-07:00
New Revision: 933e7e2393060da0dc0f19488ef9829bfcb02085

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

LOG: [mlir][sparse] Change getUnorderedCOOFromType to propagate the overhead types.

Reviewed By: aartbik

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

Added: 
    

Modified: 
    mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
index 73f428af29066..26548871be508 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
@@ -146,12 +146,13 @@ static RankedTensorType getUnorderedCOOFromType(RankedTensorType src) {
   // level should the COO has a unique level at the end. Ends by a unordered
   // unique singleton level.
   dims.push_back(SparseTensorEncodingAttr::DimLevelType::SingletonNo);
+  SparseTensorEncodingAttr encSrc = getSparseTensorEncoding(src);
   // TODO: Maybe pick the bitwidth based on input/output tensors (probably the
   // largest one among them) in the original operation instead of using the
   // default value.
   auto enc = SparseTensorEncodingAttr::get(
-      ctx, dims, AffineMap::getMultiDimIdentityMap(rank, ctx), AffineMap(), 0,
-      0);
+      ctx, dims, AffineMap::getMultiDimIdentityMap(rank, ctx), AffineMap(),
+      encSrc.getPointerBitWidth(), encSrc.getIndexBitWidth());
   return RankedTensorType::get(src.getShape(), src.getElementType(), enc);
 }
 


        


More information about the Mlir-commits mailing list