[Mlir-commits] [mlir] bbecd42 - [mlir][sparse] cleanup sparse tensor materialization parameter setup (#68956)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 13 09:41:57 PDT 2023


Author: Aart Bik
Date: 2023-10-13T09:41:53-07:00
New Revision: bbecd422a9bf5423109a754ba3417451946027a7

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

LOG: [mlir][sparse] cleanup sparse tensor materialization parameter setup (#68956)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
index ce3b49915319ceb..a76f81410aa87a0 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
@@ -209,27 +209,12 @@ class NewCallParams final {
         genMapBuffers(builder, loc, stt, dimSizesValues, params[kParamDimSizes],
                       params[kParamDim2Lvl], params[kParamLvl2Dim]);
     // Secondary and primary types encoding.
-    setTemplateTypes(stt);
-    // Finally, make note that initialization is complete.
-    assert(isInitialized() && "Initialization failed");
-    // And return `this` for method chaining.
-    return *this;
-  }
-
-  /// (Re)sets the C++ template type parameters, and returns `this`
-  /// for method chaining. This is already done as part of `genBuffers`,
-  /// but is factored out so that it can also be called independently
-  /// whenever subsequent `genNewCall` calls want to reuse the same
-  /// buffers but 
diff erent type parameters.
-  //
-  // TODO: This is only ever used by sparse2sparse-viaCOO `ConvertOp`;
-  // is there a better way to handle that than this one-off setter method?
-  NewCallParams &setTemplateTypes(SparseTensorType stt) {
     const auto enc = stt.getEncoding();
     params[kParamPosTp] = constantPosTypeEncoding(builder, loc, enc);
     params[kParamCrdTp] = constantCrdTypeEncoding(builder, loc, enc);
     params[kParamValTp] =
         constantPrimaryTypeEncoding(builder, loc, stt.getElementType());
+    // Return `this` for method chaining.
     return *this;
   }
 


        


More information about the Mlir-commits mailing list