[mlir][sparse] Extend sparse_tensor.sort with a enum attribute to specify a sorting implementation.

Currently, all the non-stable sorting algorithms are implemented via the
straightforward quick sort. This will be fixed in the following PR.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D142678
This commit is contained in:
bixia1
2023-01-27 15:16:31 -08:00
parent de66efdb25
commit 0c7f1c1520
13 changed files with 110 additions and 53 deletions

View File

@@ -819,7 +819,8 @@ public:
// in the "added" array prior to applying the compression.
unsigned rank = dstType.getShape().size();
if (isOrderedDim(dstType, rank - 1))
rewriter.create<SortOp>(loc, count, ValueRange{added}, ValueRange{});
rewriter.create<SortOp>(loc, count, ValueRange{added}, ValueRange{},
SparseTensorSortKind::HybridQuickSort);
// While performing the insertions, we also need to reset the elements
// of the values/filled-switch by only iterating over the set elements,
// to ensure that the runtime complexity remains proportional to the