This guarantees the preconditions of fromCOO; whereas prior to this, one could call the constructor directly with an unsorted tensor, which would cause fromCOO to misbehave.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
At one point the idea was the perhaps some paths do not need a sort, since it is already sorted at construction time.
In the long run, perhaps we should add a "isSorted" field to the tensor and skip sorting when already done.
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp | ||
---|---|---|
274 | sort lexicographically |
addressing comments
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp | ||
---|---|---|
274 | I fleshed out the comment a bit more, but imo it's redundant to say lexicographic since that's always what SparseTensorCOO::sort does. If we really need that to be explicit everywhere, then we should rename the method to lexicographicSort |
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp | ||
---|---|---|
274 | It was more that the originally comment was dropped. The new version seems way to verbose, how about going back to the original: // We sort the tensor lexicographically here, to ensure the preconditions for `fromCOO`. |
sort lexicographically