Repository navigation
[Runtime] Add decode CUDA graph hooks for eager logits processing - #40222
Merged
merrymercy merged 2 commits intoSep 19, 2026
Merged
Conversation
Allow specialized runners to size shared logits buffers, preserve token-row outputs in breakable graphs, and process outputs after replay. Preserve additional LogitsProcessorOutput fields when trimming padded output rows. Co-authored-by: Xiaozhu Meng <mxz297@gmail.com>
mxz297
requested review from
Fridge003,
Ying1123,
hnyls2002,
ispobock and
merrymercy
as code owners
September 18, 2026 18:39
Contributor
Author
|
/tag-and-rerun-ci |
Collaborator
|
/tag-and-rerun-ci |
This was referenced Sep 19, 2026
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.
Motivation
Runners that capture the transformer body and compute logits after replay need to retain every token-row hidden state across graph buckets. Request-count output sizing can truncate those states, and reconstructing
LogitsProcessorOutputdrops fields produced by the eager tail.Modifications
LogitsProcessorOutputfields withdataclasses.replacewhen slicing padded logits and hidden states.ForwardBatch.defer_logits_to_eagerfor model implementations that support transformer-only capture. Copy it into TBO child batches and test inheritance of bothFalseandTrue; otherwise the TBO completeness guard rejects even the default value.The hooks default to current sizing and pass-through behavior. This ports all six shared-runtime files from the source change and adds the TBO inheritance fix and regression subtest from #40226. Current upstream speculative pipeline-output slicing is preserved. Model-specific consumers and verification kernels are outside this port.
Accuracy Tests
46 tests and 16 subtests passed at
75b46430c5. These cover the complete batch-overlap unit directory, decode profiling, shared-read fences, hidden-state capture, backend selection, and adaptive logits-buffer sizing. Before the fix, all four marker tests reproduced the missingdefer_logits_to_eagererror. The previous head also failed both the marker and dummy-token-mask tests in base CI for the same reason.Earlier local CUDA smoke check passed at
066f3ef21e(not rerun for the TBO-only follow-up): real breakable-graph capture/replay with 1- and 4-request buckets, three token rows per request, and a padded 3-request replay. Checked shared output storage across capture sizes, eager-tail timing, preservation of subclass and auxiliary output fields, default hook behavior, and shared logits-buffer capacity. The smoke harness was run locally and is not added to CI.Validation commands
Using an existing Python environment with the checkout's
python/directory onPYTHONPATH:The unit-test invocation hides GPUs with a non-existent device index. The separate local smoke harness used one CUDA device, with graph deduplication, graph-pool borrowing, and pre-carving disabled.
Speed Tests and Profiling
Full-model accuracy evaluations and performance benchmarks were not run for this port. No throughput or latency improvement is claimed here.
Checklist
Original commits
7f3a5b86011525df3a954e0d403ddda4f60041dbCI States
Latest PR Test (Base): β Run #35390299130
Latest PR Test (Extra): β Run #35390297779
Latest PR Test (AMD ROCm 10): β Run #35390298003