fix(trtllm): populate disagg_request_id for PYTHON transceiver - #7604
Conversation
|
👋 Hi yifjiang! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
bbd13fe to
b78c17b
Compare
WalkthroughModified the disaggregated request handling in PREFILL mode to ensure Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/src/dynamo/trtllm/request_handlers/handler_base.py`:
- Around line 474-476: The highlighted assignment to
disaggregated_params.disagg_request_id using get_global_disagg_request_id(0) is
causing CI formatting failures; update the file by running the project's
formatting and lint hooks (e.g., ruff format, ruff check --fix or pre-commit,
and isort --profile=black) so the line and surrounding code are rewritten to the
project's style, then re-stage the formatted changes — specifically ensure the
line with disaggregated_params.disagg_request_id = (
get_global_disagg_request_id(0) ) is reformatted to match black/isort
expectations.
- Around line 470-476: Replace the defensive getattr usage and access
disagg_request_id directly on disaggregated_params so missing attributes
fail-fast; change the check to use disaggregated_params.disagg_request_id is
None and, if so, assign disaggregated_params.disagg_request_id =
get_global_disagg_request_id(0). This keeps the type contract enforced for
disaggregated_params and allows AttributeError to surface when the attribute is
missing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9b420290-5bd9-4c07-b9b2-963a349018be
📒 Files selected for processing (1)
components/src/dynamo/trtllm/request_handlers/handler_base.py
b78c17b to
7caf764
Compare
Use TRT-LLM's get_global_disagg_request_id() snowflake ID generator to assign unique disagg_request_ids in the prefill path. Without this, TRT-LLM rc9 crashes with AssertionError on every request when using the PYTHON cache transceiver (transceiver_runtime=PYTHON). Changes: - Import get_global_disagg_request_id from tensorrt_llm.llmapi.disagg_utils - Derive machine_id from dynamo's endpoint.connection_id() % 1021, using the worker's etcd lease ID for per-worker uniqueness - Set disagg_request_id on new LlmDisaggregatedParams and as a guard on ep_disaggregated_params when disagg_request_id is None - Add unit tests for ID population, uniqueness, config-based machine_id Signed-off-by: Yifan Jiang <19356972+yifjiang@users.noreply.github.com>
7caf764 to
822c131
Compare
Summary
transceiver_runtime=PYTHON) with NIXLdisagg_request_idonDisaggregatedParamsin the prefill path using TRT-LLM'sget_global_disagg_request_id()snowflake ID generatorProblem
When dynamo creates
DisaggregatedParams(request_type="context_only")in the prefill worker, it never setsdisagg_request_id. TRT-LLM's Python transceiver usesget_unique_rid()which prefersdisagg_request_idoverrequest_id. Whendisagg_request_idisNone:transfer.py:140assertsparams.disagg_request_id is not None— 100% failure rate, every single request crashesNone) in the transceiver's session trackingTRT-LLM's native serving path (
openai_disagg_service.py) callsget_global_disagg_request_id()to generate unique IDs, but dynamo bypasses that path.Proof: HEAD crashes without this fix
Built from dynamo HEAD (
f849e1a69) + TRT-LLM 1.3.0rc9, deployed 1P1D disagg withtransceiver_runtime: PYTHONon GB200. Every request fails:Image:
nvcr.io/goirlvsxnepa/llm_nim/dynamo-trtllm:head-no-fix(local only, not pushed)Fix
Call
get_global_disagg_request_id(self.disagg_machine_id)when creatingDisaggregatedParamsin the prefill path. This generates a snowflake ID (timestamp + machine_id + counter) that is globally unique and persists across the prefill→decode handoff via theparams_dicttransport.Machine ID derivation:
endpoint.connection_id() % 1021— uses the worker's etcd lease ID (dynamo's per-worker unique identifier) mod the largest prime < 1024. This matches the 10-bit machine_id space used by TRT-LLM's snowflake generator (ref) and provides per-worker uniqueness even when multiple workers run on the same host.Also ensures
disagg_request_idis set when usingep_disaggregated_paramsfrom the encode worker (EPD flow) if it comes in asNone.Test Plan
test_trtllm_handler_base.py:transceiver_runtime: PYTHONsha256:65cda0da...)head-no-fiximage, same setup)Related
Signed-off-by: Yifan Jiang 19356972+yifjiang@users.noreply.github.com