[mlir][sparse] fix a bug in unpack op that used wrong compare predicate.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D145603
This commit is contained in:
Peiming Liu
2023-03-08 19:49:28 +00:00
parent ffdd5a330c
commit 55270f56d2
2 changed files with 4 additions and 3 deletions

View File

@@ -578,7 +578,8 @@ static Value reallocOrSubView(OpBuilder &builder, Location loc, int64_t len,
Value targetLen = constantIndex(builder, loc, len);
Value bufferLen = linalg::createOrFoldDimOp(builder, loc, buffer, 0);
Value reallocP = builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ult,
// Reallocates if target length is greater than the actual buffer len.
Value reallocP = builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ugt,
targetLen, bufferLen);
scf::IfOp ifOp = builder.create<scf::IfOp>(loc, retTp, reallocP, true);
// If targetLen > bufferLen, reallocate to get enough sparse to return.