[Mlir-commits] [mlir] [mlir][sparse] cleanup sparse tensor materializaiton parameter setup (PR #68956)
Aart Bik
llvmlistbot at llvm.org
Thu Oct 12 22:18:35 PDT 2023
https://github.com/aartbik created https://github.com/llvm/llvm-project/pull/68956
None
>From 29e9f15429eb584574db7afea58b37e6fac8c2d0 Mon Sep 17 00:00:00 2001
From: Aart Bik <ajcbik at google.com>
Date: Thu, 12 Oct 2023 22:16:45 -0700
Subject: [PATCH] [mlir][sparse] cleanup sparse tensor materializaiton
parameter setup
---
.../Transforms/SparseTensorConversion.cpp | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
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 different 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