Skip to content

[mlir][sparse] cleanup sparse tensor materialization parameter setup #68956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down