[None][fix] Handle unset attention_dp_relax in ADP routers#14276
Conversation
OpenAI requests can carry a SchedulingParams object while leaving attention_dp_relax unset. The ADP routers used that field directly as the sort key, which makes mixed None and False requests fail when Python tries to compare None with bool values. Treat only an explicit False as strict and keep None aligned with the existing missing-scheduling-params behavior. Apply the same logic to both DefaultADPRouter and KVCacheAwareADPRouter, with regression coverage for both paths. Signed-off-by: peihengh <[email protected]>
|
/bot run |
📝 WalkthroughWalkthroughThe PR normalizes the ChangesAttention DP Relax Boolean Normalization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unittest/_torch/executor/test_adp_router.py (1)
206-221: QA list updates are unnecessary for this PR.This change is unit-scope regression coverage plus router logic; no integration/perf QA test-list entry updates are needed.
As per coding guidelines, “If the PR only touches unittest/ or narrow unit scope, say explicitly whether QA list updates are unnecessary or optional.”
Also applies to: 945-956
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unittest/_torch/executor/test_adp_router.py` around lines 206 - 221, Add an explicit note to the PR description and commit message stating that QA list updates are unnecessary because this change only touches unit tests (e.g., the test_none_attention_dp_relax_is_relaxed test) and router logic in DefaultADPRouter/RankState/_make_request_item/route_requests; also apply the same explicit note to other similar test-only changes in this PR so reviewers know QA list edits are not required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/unittest/_torch/executor/test_adp_router.py`:
- Around line 206-221: Add an explicit note to the PR description and commit
message stating that QA list updates are unnecessary because this change only
touches unit tests (e.g., the test_none_attention_dp_relax_is_relaxed test) and
router logic in DefaultADPRouter/RankState/_make_request_item/route_requests;
also apply the same explicit note to other similar test-only changes in this PR
so reviewers know QA list edits are not required.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 7634e2e2-905e-4070-ad26-e1a91c0b4aa7
📒 Files selected for processing (2)
tensorrt_llm/_torch/pyexecutor/scheduler/adp_router.pytests/unittest/_torch/executor/test_adp_router.py
|
PR_Github #48982 [ run ] triggered by Bot. Commit: |
|
PR_Github #48982 [ run ] completed with state |
Make the relaxed ADP routing default explicit on SchedulingParams instead of encoding it in router sort-key logic. This keeps requests that only carry agent hierarchy scheduling params aligned with the existing missing-scheduling-params behavior. Revert the routers to direct attention_dp_relax field reads and update the regression tests to cover the explicit SchedulingParams default for both DefaultADPRouter and KVCacheAwareADPRouter. Signed-off-by: peihengh <[email protected]>
|
/bot run |
|
PR_Github #49242 [ run ] triggered by Bot. Commit: |
|
PR_Github #49242 [ run ] completed with state |
… ADP routers (#14431) Signed-off-by: peihengh <[email protected]> Signed-off-by: Lance Liao <[email protected]> Co-authored-by: peihengh <[email protected]>
) Signed-off-by: peihengh <[email protected]>
) Signed-off-by: peihengh <[email protected]>
Summary by CodeRabbit
Bug Fixes
Tests
Description
Fix an ADP router crash when a request has
SchedulingParams, butattention_dp_relaxis unset and causing NoneType comparison. Hit this issue when doing perfwork for DS V4 using inferenceX benchmarking script but both main and DS V4 branch will have this issue.SchedulingParams.attention_dp_relaxis typed asOptional[bool]and defaults toNone.The ADP routers were using this field directly as the sort key:
return scheduling_params.attention_dp_relaxThis was previously mostly hidden for OpenAI serving because requests often had no
py_scheduling_params, so the router took the safe path:After a31d650 / #11173, OpenAI chat and harmony paths create SchedulingParams(agent_hierarchy=...) and pass it into generation. That means
scheduling_paramsis present, butattention_dp_relaxremainsNone. With multiple such requests, Python sorting can compareNonevalues and fail with:TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'Fix:
Treat only an explicit False as strict and keep None aligned with the existing missing-scheduling-params behavior. Apply the same logic to both DefaultADPRouter and KVCacheAwareADPRouter, with regression coverage for both paths.
Test Coverage
Added regression coverage for both ADP router implementations where one request has
attention_dp_relax=Noneand another hasattention_dp_relax=False.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.