Skip to content

Commit 4a72a4e

Browse files
authored
[NFC][mlir][sparse] remove redundant parameter. (#75551)
1 parent e8a15ec commit 4a72a4e

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static Value genFirstPosOrCrds(OpBuilder &builder, Location loc, Value a,
476476
if (format == CuSparseFormat::kCOO) {
477477
// Library uses SoA COO, direct IR uses AoS COO.
478478
if (enableRT)
479-
return genToCoordinates(builder, loc, a, 0, /*cooStart=*/0);
479+
return genToCoordinates(builder, loc, a, 0);
480480
return genToCoordinatesBuffer(builder, loc, a);
481481
}
482482
// Formats CSR/CSC and BSR use positions at 1.
@@ -490,7 +490,7 @@ static Value genSecondCrds(OpBuilder &builder, Location loc, Value a,
490490
if (isCOO && !enableRT)
491491
return Value(); // nothing needed
492492
// Formats CSR/CSC and BSR use coordinates at 1.
493-
return genToCoordinates(builder, loc, a, 1, /*cooStart=*/isCOO ? 0 : 2);
493+
return genToCoordinates(builder, loc, a, 1);
494494
}
495495

496496
/// Generates the sparse matrix handle.

mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,11 @@ Value sparse_tensor::genToPositions(OpBuilder &builder, Location loc,
564564
}
565565

566566
Value sparse_tensor::genToCoordinates(OpBuilder &builder, Location loc,
567-
Value tensor, Level lvl, Level cooStart) {
567+
Value tensor, Level lvl) {
568568
const auto srcTp = getSparseTensorType(tensor);
569569
const Type crdTp = srcTp.getCrdType();
570-
const Type memTp = get1DMemRefType(crdTp, /*withLayout=*/lvl >= cooStart);
570+
const Type memTp =
571+
get1DMemRefType(crdTp, /*withLayout=*/lvl >= srcTp.getCOOStart());
571572
return builder.create<ToCoordinatesOp>(loc, memTp, tensor,
572573
builder.getIndexAttr(lvl));
573574
}

mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ Value genToPositions(OpBuilder &builder, Location loc, Value tensor, Level lvl);
289289
/// stride and offset. Otherwise, the result type is a memref without
290290
/// any specified layout.
291291
Value genToCoordinates(OpBuilder &builder, Location loc, Value tensor,
292-
Level lvl, Level cooStart);
292+
Level lvl);
293293

294294
/// Infers the result type and generates `ToCoordinatesBufferOp`.
295295
Value genToCoordinatesBuffer(OpBuilder &builder, Location loc, Value tensor);

mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ void LoopEmitter::initializeLoopEmit(
437437
auto stt = getSparseTensorType(tensor);
438438
const Level lvlRank = stt.getLvlRank();
439439
const auto shape = rtp.getShape();
440-
const Level cooStart = stt.getCOOStart();
441440

442441
SmallVector<Value> lvlSzs;
443442
for (Level l = 0; l < stt.getLvlRank(); l++) {
@@ -457,12 +456,10 @@ void LoopEmitter::initializeLoopEmit(
457456
if (isCompressedLT(lvlTp) || isLooseCompressedLT(lvlTp)) {
458457
// Generate sparse primitives to obtain positions and coordinates.
459458
positionsBuffers[t][l] = genToPositions(builder, loc, tensor, l);
460-
coordinatesBuffers[t][l] =
461-
genToCoordinates(builder, loc, tensor, l, cooStart);
459+
coordinatesBuffers[t][l] = genToCoordinates(builder, loc, tensor, l);
462460
} else if (isSingletonLT(lvlTp) || is2OutOf4LT(lvlTp)) {
463461
// Singleton level, fetch coordinates.
464-
coordinatesBuffers[t][l] =
465-
genToCoordinates(builder, loc, tensor, l, cooStart);
462+
coordinatesBuffers[t][l] = genToCoordinates(builder, loc, tensor, l);
466463
} else {
467464
// Dense level, nothing to fetch.
468465
assert(isDenseLT(lvlTp));

0 commit comments

Comments
 (0)