Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix stream compaction's
drop_duplicates
API to use stable sort (#9417)
Currently, stream compaction API `drop_duplicates` uses unstable sort for all of its internal sorting. This is wrong since we may want to have stable sorting results so we can choose to keep the first or the last duplicate element from the repeated sequences. This PR does two things: * Fixes the issue mentioned above by using stable sort if the input option is to keep the first or last duplicate element, and * Adds a new keep option into the enum class `duplicate_keep_option`: `KEEP_ANY`. This option allows the user to choose to keep one element from the repeated sequence at any position. Note that the issue did not show up by any failed test because thrust default (unstable) sort, which is called internally in `drop_duplicate`, still produces the same results as thrust stable sort most of the time (but this is not guaranteed). As such, the current `drop_duplicate` still produces correct results in its tests. This PR blocks #9345. Authors: - Nghia Truong (https://github.com/ttnghia) Approvers: - Bradley Dice (https://github.com/bdice) - MithunR (https://github.com/mythrocks) URL: #9417
- Loading branch information