Repository navigation
Conversation
thrust::sequence in thrust_sort ignored the TVM stream policy, so it synchronized the legacy default stream and invalidated CUDA graph capture. Segmented sort also left its argsort-order and segment-id buffers allocated in the thrust pool. Pass the execution policy into both sequence calls and free those buffers when the sort returns. Cover segmented results, repeated-call GPU memory, and stream capture in the thrust tests.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
thrust_sortcalledthrust::sequencewithout the TVM CUDA execution policy. As a result, sequence ran on the legacy default stream and synchronized. That races laterpar_nosyncwork and makes CUDA graph capture fail withcudaErrorStreamCaptureInvalidated.On the segmented path, the argsort-order and segment-id buffers were allocated from the Thrust caching pool and never released. Each segmented sort without an explicit workspace kept
12 * sizebytes of device memory.Both sequence calls now take the stream policy. A scoped allocator owns the temporary buffers and returns them to the pool on every exit, including when a later Thrust call throws.
A Thrust contrib test checks three things: segmented sort results, that repeated segmented sorts do not grow device memory, and that 1D and 2D sorts can be captured on the TVM stream. The test skips when Thrust or CUDA is unavailable.
Fixes #21116