feat(trtllm): engine-owned conversation-aware ADP routing - #11288
Closed
nv-yna wants to merge 1 commit into
Closed
Conversation
nv-yna
had a problem deploying
to
external_collaborator
July 6, 2026 22:49 — with
GitHub Actions
Failure
nv-yna
temporarily deployed
to
external_collaborator
July 6, 2026 22:49 — with
GitHub Actions
Inactive
nv-yna
force-pushed
the
conv-aware-adp-routing
branch
from
July 6, 2026 22:56
dcc23f7 to
d7aed50
Compare
nv-yna
temporarily deployed
to
external_collaborator
July 6, 2026 22:56 — with
GitHub Actions
Inactive
nv-yna
force-pushed
the
conv-aware-adp-routing
branch
from
July 6, 2026 23:26
d7aed50 to
f5c1d73
Compare
nv-yna
temporarily deployed
to
external_collaborator
July 6, 2026 23:26 — with
GitHub Actions
Inactive
Add opt-in support for TensorRT-LLM's engine-side conversation-affinity ADP router. When attention_dp_config.kv_cache_routing_conversation_affinity is enabled, the worker derives the conversation id from the frontend-forwarded agent_context.session_id, passes it as ConversationParams to generate_async, and stops forcing attention_dp_rank so the engine's ConversationAwareADPRouter pins the conversation to a DP rank (sticky + load-balanced). When disabled, Dynamo-owned strict DP-rank forcing is unchanged. No Rust changes: the session identity already reaches the worker via the serialized PreprocessedRequest.agent_context field. Gated on the resolved engine config (not a Dynamo env var) to avoid split-brain with the engine. Requires a TensorRT-LLM release newer than 1.3.0rc20 (ConversationParams API); the import is guarded and the feature fails startup if enabled without it. Signed-off-by: Yuewei Na <nv-yna@users.noreply.github.com>
nv-yna
force-pushed
the
conv-aware-adp-routing
branch
from
July 7, 2026 02:26
f5c1d73 to
c988b3c
Compare
nv-yna
temporarily deployed
to
external_collaborator
July 7, 2026 02:26 — with
GitHub Actions
Inactive
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.
What this PR does
Adds opt-in support for TensorRT-LLM's engine-owned conversation-affinity ADP routing. When the engine's
attention_dp_config.kv_cache_routing_conversation_affinityis enabled, the TRT-LLM worker:agent_context.session_id,ConversationParamstogenerate_async, andattention_dp_rank, so the engine'sConversationAwareADPRouterpins the conversation to a DP rank (sticky, load-balanced first turn).When the engine policy is off, Dynamo-owned strict DP-rank forcing is byte-for-byte unchanged.
Why this shape (design notes for review)
This is the main-appropriate re-implementation of the DSV4 feature branch's conversation-aware routing (
321567ee83, #10517), following @PeaBrane's review guidance ("avoid duplicate routing plumbing; derive the id from session identity in the engine handlers"):mainthe session identity already reaches the worker via the serializedPreprocessedRequest.agent_contextfield (lib/llm/src/protocols/common/preprocessor.rs:272). The feature branch's approach added a second copy (RoutingHints.conversation_id) — dropped here entirely.agent_context.session_id, not the oldsession_control—maindiverged;session_controldoesn't exist here. Usessession_id(the active reasoning/tool chain), notparent_session_id.DYN_*env var — a Dynamo-side switch could disagree with the engine (e.g. suppress the rank when no engine router exists). The engine config is the single source of truth.ConversationParams, notdisaggregated_params.conversation_id— the feature branch mutated disaggregation metadata (specific to a custom wheel). Upstream shipped a dedicatedConversationParamsargument (generate_async(..., conversation_params=...)), which also covers ordinary aggregated requests (the old path only worked for P/D).exp-H/gap #4instrumentation — all experimental one-shot logging stripped for production.Dependency gate ⛔ (why this is a draft)
ConversationParams,kv_cache_routing_conversation_affinity, andConversationAwareADPRouterrequire a TensorRT-LLM release newer than1.3.0rc20.maincurrently pins1.3.0rc19(pyproject.toml,container/context.yaml), which has none of them — the API only exists on TRT-LLMmaintoday (not in any release tag: rc20 is latest). So this cannot be enabled or e2e-tested here yet.This PR is therefore safe-by-default and CI-clean: the
ConversationParamsimport is guarded, the gate resolvesFalseon rc19, and behavior is identical to today. Enabling it on an incompatible wheel fails fast at startup. The wheel/image bump (and the GPU integration + full handler test matrix) is a prerequisite follow-up to be landed first.Files
components/src/dynamo/trtllm/conversation_affinity.py— new helper: session-id extraction, engine-config gate,ConversationParamsbuilder (guarded import).components/src/dynamo/trtllm/llm_engine.py— unified path: resolve gate at init; suppress rank + passConversationParamswhen enabled.components/src/dynamo/trtllm/request_handlers/handler_base.py— legacy path: same, gate resolved lazily.components/src/dynamo/trtllm/tests/test_conversation_affinity.py— wheel-independent unit tests for the helpers.Testing
ruff check/ruff format --checkclean; helper unit tests pass (6 passed, 1 skipped where the API is absent).cargoexposure.generate_asynchandler matrix.Open questions for review
push_router.rsstill stamps the frontend rank) — needs an e2e accounting pass; must not reintroduce Rust conversation plumbing.