Repository navigation
Conversation
Avoid device-wide waits in the shared capture helper while retaining stream ordering. Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: 0z5a <Dezhen.lu@student.uni-tuebingen.de>
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.
Stack and change
This draft targets
rlt-spec-sched-only(ThinkFlowLab#52, on top of ThinkFlowLab#48), so the diff contains only the speculative CUDA Graph capture change and its GPU test.The capture helper now orders the caller stream and capture stream with
wait_streambefore warmup and before replay. It usesCUDAGraph.capture_begin/endbecausetorch.cuda.graph(...)performs a device-wide synchronize on entry. Graph keys, pool sharing, eager fallbacks, and replay are unchanged. The side-stream handoff follows the pattern used in MiniCPM-o 4.5 Graph capture.Validation
/home/gongji/0z5aenvironment on RTX 5090, PyTorch 2.13.0+cu130: CPU suite 291 passed, 11 skipped; focused speculative GPU suite 9 passed; new cross-stream capture GPU test 1 passed. Ruff check/format and Python compilation passed.58872a72616c736595b8b7662079c5b12c5a162ec16eae94f21c348dfa9885af. BF16/Triton, K=4, 64 output tokens. Baseline and changed arms produced exactly the same token IDs and exit depths for every paired run at each concurrency. The task copy of the checkpoint was removed after testing.Steady-state replay speedups were 1.000×, 0.999×, 0.997×, and 0.999× for 1/4/8/16 requests. Graph cache hit rates and fallback counts were identical between arms. Under a separate synthetic workload with unrelated CUDA stream work queued, median capture host latency fell from 103.37 ms to 0.284 ms; this measures removal of the device-wide wait, not serving throughput.
The speculative draft acceptance rate for this prompt set was 59.2% at 16 requests; running the same 16 prompts individually gave 60.1%. It is distinct from the CUDA Graph cache hit rate above. A separate prompt-level difference between Triton batch sizes is also present in native eager execution, independent of this capture change.