[mlir][sparse] simplify some header code (#70989)

This is a first revision in a small series of changes that removes
duplications between direct encoding methods and sparse tensor type
wrapper methods (in favor of the latter abstraction, since it provides
more safety). The goal is to simply end up with "just" SparseTensorType
This commit is contained in:
Aart Bik
2023-11-02 09:31:11 -07:00
committed by GitHub
parent 4c41e7ce20
commit 22212ca745
9 changed files with 60 additions and 142 deletions

View File

@@ -178,7 +178,7 @@ static void createAllocFields(OpBuilder &builder, Location loc,
SmallVector<Value> dimSizes;
dimSizes.reserve(dimRank);
unsigned i = 0; // cumulative index into `dynSizes`.
for (const DynSize sh : stt.getDimShape())
for (const Size sh : stt.getDimShape())
dimSizes.push_back(ShapedType::isDynamic(sh)
? dynSizes[i++]
: constantIndex(builder, loc, sh));