Repository navigation
[TRTLLM-17659][refactor] Pin down the encoder-to-decoder handoff in PyExecutor - #21768
Conversation
|
/bot run |
|
No actionable comments were generated in the recent review. WalkthroughThe encoder-decoder runner now uses ChangesEncoder-decoder runner and handoff
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Merge Risk:
|
|
PR_Github #82973 [ run ] triggered by Bot. Commit: |
|
PR_Github #82973 [ run ] completed with state
|
2c37ee7 to
91cc8fe
Compare
… it with tests Comments and tests only; no behavior change. Signed-off-by: Lori Ren <lorir@nvidia.com>
…terminates A request terminated before its first context kept its view of the packed encoder output, and with it the whole batch's storage. Signed-off-by: Lori Ren <lorir@nvidia.com>
It was an empty subclass of EncoderConfig. Signed-off-by: Lori Ren <lorir@nvidia.com>
…der-decoder tests Signed-off-by: Lori Ren <lorir@nvidia.com>
Signed-off-by: Lori Ren <lorir@nvidia.com>
…er meets an unconsumed output Signed-off-by: Lori Ren <lorir@nvidia.com>
… pauses Signed-off-by: Lori Ren <lorir@nvidia.com>
91cc8fe to
df96e84
Compare
|
/bot run |
|
PR_Github #83750 [ run ] triggered by Bot. Commit: |
|
Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements. |
|
PR_Github #83750 [ run ] completed with state
|
|
/bot run |
|
PR_Github #83819 [ run ] triggered by Bot. Commit: |
|
PR_Github #83819 [ run ] completed with state
|
|
/bot run |
|
PR_Github #83927 [ run ] triggered by Bot. Commit: |
|
PR_Github #83927 [ run ] completed with state
|
|
/bot run |
|
PR_Github #83988 [ run ] triggered by Bot. Commit: |
|
PR_Github #83988 [ run ] completed with state |
Dev Engineer Review
EncoderStageConfigis removed.EncoderStageandEncoderDecoderRunnernow acceptEncoderConfig, andModelEnginecreates it directly. Verify external callers do not depend on the removed class._do_terminate_requestnow clears an unconsumedpy_encoder_outputand its ready event. This releases the request’s reference to packed encoder storage when termination occurs before the first context step.LlmRequestcomments clarify the handoff fields; they do not change runtime behavior.QA Engineer Review
test_py_executor.pyadds tests for token and feature inputs, async and synchronous execution, TP1 and TP2, cancellation, launch and publication failures, recomputation, cross-KV reservation, and packed-storage release.test_encoder.pyupdates its helper to useEncoderConfigfor encoder-decoder cases.Per-File QA Perspective
tensorrt_llm/_torch/pyexecutor/engine/runners/encoder_decoder.py: Verify callers passEncoderConfignow thatEncoderStageConfighas been removed.tensorrt_llm/_torch/pyexecutor/llm_request.py: Comments clarify handoff-state timing and use. No runtime behavior changed.tensorrt_llm/_torch/pyexecutor/model_engine.py: Verify encoder-decoder runner construction createsEncoderConfig.tensorrt_llm/_torch/pyexecutor/py_executor.py: Verify output publication, stream attachment, cross-KV consumption, and termination cleanup across the handoff lifecycle.tests/unittest/_torch/pyexecutor/engine/runners/test_encoder.py: Updates encoder-decoder test setup to useEncoderConfig. This unit test does not require integration-list membership.tests/unittest/_torch/pyexecutor/test_py_executor.py: Covers handoff lifecycle, cancellation, failures, recomputation, cross-KV behavior, and packed-storage release. This unit test does not require integration-list membership.Description
Encoder-decoder models (BART, T5, Whisper) hand the encoder output to the first decoder context step through the request state and three request fields, which several
PyExecutormethods set and clear. This PR writes that handoff down and pins it with tests: submit, publish, readiness, the single cross-KV projection, recompute, and the transitions around them (cancellation before submission, while the encoder step is pending and after publish; encoder failure; late publish). The lifecycle is the block comment abovePyExecutor's encoder methods and the field comment inLlmRequest.The review found one gap, fixed here: a request terminated after its encoder output was published but before its first context step kept its view of the packed output, and with it the storage of its whole encoder batch.
_do_terminate_requestnow drops an output that was never consumed, next to the existing multimodal release. Nothing else changes behaviour; no new state or record is introduced.A separate commit removes
EncoderStageConfig, an empty subclass ofEncoderConfig, soEncoderStageandEncoderDecoderRunnertakeEncoderConfigdirectly. It overlapped #21428, which removedEncoderRunnerConfigthe same way; this branch is rebased onto it.Test Coverage
tests/unittest/_torch/pyexecutor/test_py_executor.py: the handoff tests next to the existing encoder-decoder cases — each publish path, each cancellation point, encoder failure, recompute through V1 pause and V2 reset, and the release of an unconsumed output on termination.tests/unittest/_torch/pyexecutor/engine/runners/test_encoder_decoder.py,engine/runners/test_encoder.py,kv_cache/test_kv_cache_v2_scheduler.py,kv_cache/test_dual_pool_kv_cache.py.l0_h100, run on H100; a forced-recompute check on T5-small and BART-large-cnn (greedy, fp32 and bf16) gave token-identical outputs for the recomputed requests.Known:
test_bart_pytorch_continuous_admission_replays_encoder_and_mixed_cuda_graphs[tp1]failed once (all-zero tokens on the streaming request) while running the whole list; it passed on every isolated rerun, and the change in this PR is a no-op in that test. Thet5-large/flan-t5-{base,large,xxl}cases were not run for lack of weights on the test cluster.PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.