This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Adding isSorted bit to SparseTensorCOO
ClosedPublic

Authored by wrengr on Sep 13 2022, 10:09 PM.

Details

Summary

This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Diff Detail

Event Timeline

wrengr created this revision.Sep 13 2022, 10:09 PM
wrengr requested review of this revision.Sep 13 2022, 10:09 PM
aartbik added inline comments.Sep 14 2022, 9:17 AM
mlir/include/mlir/ExecutionEngine/SparseTensor/COO.h
84–85

maybe move these to also to constructor as initializer?

85

nit: isSorted(true), also moved to L74 as initializer? technically, when we start empty, we are sorted, this would also play nicer with the TODO below, where only the first out of order "add" invalides the flag

wrengr updated this revision to Diff 460260.Sep 14 2022, 4:02 PM

Finished TODO: the add method only invalidates the isSorted bit if the new element is not strictly-greater than the previously final element.

wrengr marked 2 inline comments as done.Sep 14 2022, 4:04 PM
aartbik accepted this revision.Sep 16 2022, 4:04 PM

Very neat! This will avoid the sort step in many cases where the external format already appears in the right order.

This revision is now accepted and ready to land.Sep 16 2022, 4:04 PM
This revision was automatically updated to reflect the committed changes.