[mlir][sparse] refactor dim2lvl/lvl2dim lvlsizes setup (#72474)

This change provides access to the individual components of dim sizes
and lvl sizes after each codegenutil call.

This is step 2 out of 3 to make sparse_tensor.new work for BSR
This commit is contained in:
Aart Bik
2023-11-15 21:41:43 -08:00
committed by GitHub
parent c6b95f3ea2
commit 2323f48e0d
4 changed files with 60 additions and 60 deletions

View File

@@ -1484,11 +1484,12 @@ struct SparseNewConverter : public OpConversionPattern<NewOp> {
createAllocFields(rewriter, loc, dstTp, dynSizes, /*enableInit=*/false,
fields, nse);
// Now construct the dim2lvl and lvl2dim buffers.
// Now construct the lvl sizes and the dim2lvl/lvl2dim buffers.
SmallVector<Value> lvlSizesValues;
Value dim2lvlBuffer;
Value lvl2dimBuffer;
genMapBuffers(rewriter, loc, dstTp, dimShapesValues, dimSizesBuffer,
dim2lvlBuffer, lvl2dimBuffer);
lvlSizesValues, dim2lvlBuffer, lvl2dimBuffer);
// Read the COO tensor data.
MutSparseTensorDescriptor desc(dstTp, fields);