perf: avoid fixed-width MTP draft host synchronization - #97
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughHost draft-token requirements are derived from speculative methods and propagated through engine scheduling and GPU draft-token handling. Fixed-width modes avoid host copies and return placeholders, while block speculators copy and trim negative-sentinel suffixes. ChangesHost Draft Token ID Handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Provenance clarification: an equivalent optimization existed in v17 as direct release-branch commit |
Summary
copy_event.synchronize()for standard MTPRoot cause
With async scheduling enabled,
DraftTokensHandlercopied draft token IDs to the host andEngineCoreconsumed them after every target decode step. This is required for variable-width block speculators because a-1suffix communicates their actual draft length, but standard MTP always has the configured fixed draft width. Its scheduler does not need the token values; verification continues to use the real IDs retained on the worker.The unnecessary CUDA-event synchronization reduced GLM-5.2 MTP:3 target-step rate while MTP:0 remained unchanged.
Performance validation
Configuration: GLM-5.2 NVFP4, A16, TP8, DCP1, MTP:3, F8 DMA disabled, CC1, temperature 0. Each result uses four runs of three complete 2,048-token requests. Baseline and patched images were swapped between GPU 0-7 and GPU 8-15, and both servers were fully loaded and settled before measurement.
Bootstrap 95% CI for the balanced throughput effect: +3.588% to +5.877%.
Acceptance and mean accepted length did not change significantly:
This isolates the gain to target-step execution rather than a favorable acceptance sample.
Checks
pytest --noconftest -q tests/v1/spec_decode/test_draft_tokens_handler.py(2 passed)ruff checkon all changed Python filesruff format --checkon all changed Python filesSummary by CodeRabbit