Repository navigation
fix(trtllm): handle rc22 disaggregated request changes #12203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
63a7258
fix(kv-router): return terminal prefill responses directly
krishung5 2e1537d
fix(trtllm): adapt disagg request IDs across API versions
krishung5 fc8b649
fix(trtllm): harden rc22 disagg compatibility
krishung5 1eaf080
test(trtllm): skip request ID tests without CUDA
krishung5 0c2ce13
Merge branch 'main' into krish/fix-terminal-prefill-response
krishung5 3b52606
Merge branch 'main' into krish/fix-terminal-prefill-response
krishung5 b51776d
Merge branch 'main' into krish/fix-terminal-prefill-response
krishung5 875a088
Merge branch 'main' into krish/fix-terminal-prefill-response
krishung5 6314461
Merge branch 'main' into krish/fix-terminal-prefill-response
tanmayv25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
78 changes: 78 additions & 0 deletions
78
components/src/dynamo/trtllm/tests/test_trtllm_disagg_request_id.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from unittest.mock import patch | ||
|
|
||
| import pytest | ||
| import torch | ||
|
|
||
| # Pytest applies marker selection after importing test modules. Importing | ||
| # disagg_utils loads TensorRT-LLM bindings, which require libcuda even though | ||
| # these tests do not execute CUDA kernels, so skip collection on CPU runners. | ||
| if not torch.cuda.is_available(): | ||
| pytest.skip( | ||
| "CUDA/GPU not available, but tensorrt_llm import requires CUDA.", | ||
| allow_module_level=True, | ||
| ) | ||
|
|
||
| from dynamo.trtllm.utils import disagg_utils | ||
|
|
||
| pytestmark = [ | ||
| pytest.mark.unit, | ||
| pytest.mark.trtllm, | ||
| pytest.mark.core, | ||
| pytest.mark.pre_merge, | ||
| pytest.mark.gpu_1, | ||
| ] | ||
|
|
||
|
|
||
| def test_rc22_machine_id_is_split_losslessly(): | ||
| with ( | ||
| patch.object(disagg_utils, "_TRTLLM_DISAGG_ID_HAS_PROCESS_ID", True), | ||
| patch.object( | ||
| disagg_utils, | ||
| "_trtllm_get_global_disagg_request_id", | ||
| return_value=123, | ||
| ) as generate, | ||
| ): | ||
| result = disagg_utils.get_compatible_global_disagg_request_id(1020) | ||
|
|
||
| assert result == 123 | ||
| generate.assert_called_once_with(15, 60) | ||
|
|
||
|
|
||
| def test_rc22_all_dynamo_machine_ids_are_in_range_and_unique(): | ||
| pairs = { | ||
| divmod(machine_id, disagg_utils._TRTLLM_PROCESS_ID_SPACE) | ||
| for machine_id in range(disagg_utils._DYNAMO_DISAGG_MACHINE_ID_SPACE) | ||
| } | ||
|
|
||
| assert len(pairs) == disagg_utils._DYNAMO_DISAGG_MACHINE_ID_SPACE | ||
| assert all( | ||
| 0 <= node_id < disagg_utils._TRTLLM_NODE_ID_SPACE for node_id, _ in pairs | ||
| ) | ||
| assert all( | ||
| 0 <= process_id < disagg_utils._TRTLLM_PROCESS_ID_SPACE | ||
| for _, process_id in pairs | ||
| ) | ||
|
|
||
|
|
||
| def test_rc21_keeps_legacy_machine_id(): | ||
| with ( | ||
| patch.object(disagg_utils, "_TRTLLM_DISAGG_ID_HAS_PROCESS_ID", False), | ||
| patch.object( | ||
| disagg_utils, | ||
| "_trtllm_get_global_disagg_request_id", | ||
| return_value=456, | ||
| ) as generate, | ||
| ): | ||
| result = disagg_utils.get_compatible_global_disagg_request_id(1020) | ||
|
|
||
| assert result == 456 | ||
| generate.assert_called_once_with(1020) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("machine_id", [-1, 1021]) | ||
| def test_invalid_dynamo_machine_id_fails_fast(machine_id): | ||
| with pytest.raises(ValueError, match="machine_id must be in range"): | ||
| disagg_utils.get_compatible_global_disagg_request_id(machine_id) |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.