[mlir][sparse] Change sparse_tensor.print format (#91528)
1. Remove the trailing comma for the last element of memref and add closing parenthesis. 2. Change integration tests to use the new format.
This commit is contained in:
@@ -830,11 +830,17 @@ private:
|
||||
vector::PrintPunctuation::Comma);
|
||||
rewriter.create<vector::PrintOp>(loc, imag,
|
||||
vector::PrintPunctuation::Close);
|
||||
rewriter.create<vector::PrintOp>(loc, vector::PrintPunctuation::Comma);
|
||||
} else {
|
||||
rewriter.create<vector::PrintOp>(loc, val,
|
||||
vector::PrintPunctuation::Comma);
|
||||
rewriter.create<vector::PrintOp>(
|
||||
loc, val, vector::PrintPunctuation::NoPunctuation);
|
||||
}
|
||||
// Terminating comma (except at end).
|
||||
auto bound = rewriter.create<arith::AddIOp>(loc, idxs.back(), step);
|
||||
Value cond = rewriter.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ne,
|
||||
bound, size);
|
||||
scf::IfOp ifOp = rewriter.create<scf::IfOp>(loc, cond, /*else*/ false);
|
||||
rewriter.setInsertionPointToStart(&ifOp.getThenRegion().front());
|
||||
rewriter.create<vector::PrintOp>(loc, vector::PrintPunctuation::Comma);
|
||||
}
|
||||
idxs.pop_back();
|
||||
rewriter.setInsertionPointAfter(forOp);
|
||||
|
||||
Reference in New Issue
Block a user