[https://nvbugs/6525898][fix] Append a constraint of _max_resident_sequences() + reserved-dummy… - #17071
[https://nvbugs/6525898][fix] Append a constraint of _max_resident_sequences() + reserved-dummy…#17071trtllm-agent wants to merge 2 commits into
_max_resident_sequences() + reserved-dummy…#17071Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughMamba hybrid cache sizing now centralizes required live and dummy SSM slots. V2 initialization, GPU quota calculation, and cache constraints use this count. A regression test verifies the 66-slot floor, and an obsolete integration waiver is removed. ChangesMamba SSM cache floor
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to V2 hybrid Mamba cache configuration now reserves the required live and dummy SSM slots when average sequence length is unset, without increasing attention allocation. The covered regression path indicates no remaining merge-blocking risk. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
8bc2e14 to
e68d27d
Compare
brnguyen2
left a comment
There was a problem hiding this comment.
I don't think the product-code change here does what the description says.
The SSM min-slots constraint block in _build_cache_config already exists at this branch's merge base — git show HEAD~1:tensorrt_llm/_torch/pyexecutor/mamba_cache_manager.py shows the identical if any(isinstance(layer, SsmLayerConfig) ...) block computing ssm_floor_slots = self._max_resident_sequences() + self._num_reserved_dummy_slots. The diff only pulls that expression into _num_required_state_slots() and rewrites two comprehensions as [empty_desc] * n. As far as I can tell the runtime behavior is unchanged, so the only functional change in the PR is the waives.txt deletion.
Separately, the failure recorded on 6525898 is a BrokenPipeError [Errno 108] raised inside flashinfer's JIT module generation, not a slot-count ValueError — nothing in this diff touches that path.
So either this was superseded by an earlier merge and should be reduced to "refactor + test" (with the waive left in place until the real cause is addressed), or I'm missing where the behavior actually changes — if the latter, could you point at it? Rebasing on latest main and re-reading the resulting diff would settle it.
| @@ -2919,14 +2920,9 @@ def _build_cache_config( | |||
| # / __init__). Add a min-slots constraint of zero-capacity requests: | |||
| # these cost no attention pages but reserve one SSM slot each. | |||
| if any(isinstance(layer, SsmLayerConfig) for layer in layers): | |||
| ssm_floor_slots = (self._max_resident_sequences() + | |||
| self._num_reserved_dummy_slots) | |||
| constraints = [ | |||
There was a problem hiding this comment.
This block, including the _max_resident_sequences() + _num_reserved_dummy_slots floor, is already present at the merge base — the change here is just the helper extraction. If that's right, the PR title/description overstate it.
| @@ -198,7 +198,6 @@ full:GB200/accuracy/test_llm_api_pytorch.py::TestMiniMaxM3::test_mxfp8[use_msa=F | |||
| full:GB200/accuracy/test_llm_api_pytorch.py::TestMiniMaxM3::test_nvfp4[use_msa=False] SKIP (https://nvbugs/6479471) | |||
There was a problem hiding this comment.
Un-waiving a P0 GB200 test on the strength of a behavior-preserving refactor looks premature. If the intent is to unwaive because the real fix landed elsewhere, please say which commit fixed it and cite passing runs of this exact node ID (and close the bug), since the recorded failure mode is a flashinfer JIT-cache error rather than a cache-manager sizing error.
| @@ -1603,6 +1603,54 @@ def _slot_sizes(stat): | |||
| assert high_mamba_allocation[1] < low_mamba_allocation[1] | |||
|
|
|||
|
|
|||
| def test_v2_hybrid_constrains_ssm_pool_to_live_slot_floor(): | |||
There was a problem hiding this comment.
This file isn't referenced by any tests/integration/test_lists/test-db/*.yml — that directory is enrolled per-file (see unittest/_torch/executor/test_kv_cache_budget_split.py etc. in l0_a10.yml). As-is the new regression test never runs in pre-merge CI; add the file to an appropriate l0 list.
| KVCacheDesc(capacity=0, history_length=0) | ||
| for _ in range(self._num_reserved_dummy_slots) | ||
| ] | ||
| empty_desc = KVCacheDesc(capacity=0, history_length=0) |
There was a problem hiding this comment.
Nit: KVCacheDesc is a plain (non-frozen) dataclass, so [empty_desc] * n now shares one instance across both dummy_requests and the SSM floor BatchDesc. Harmless today since nothing mutates descs, but the comprehension it replaced was aliasing-proof for free.
|
[by Codex] @VALLIS-NERIA Could you please review PR #17071 for the KV-cache manager changes? Thanks! |
VALLIS-NERIA
left a comment
There was a problem hiding this comment.
Reviewed the KV cache manager portion only. The helper extraction keeps the existing SSM live/dummy-slot accounting consistent across validation, quota calculation, and constraints; I found no KVCM blocker. Approving from the KV cache manager ownership scope.
e68d27d to
a04784a
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
NVBug 6525898 is closed as Bug - Fix unknown. The linked bug appears resolved elsewhere or for a reason that does not prove this PR is redundant. This PR should be judged on its own merits; repair-bot is not auto-closing it. |
MambaHybridCacheManagerV2.__init__ requires the SSM pool to hold one slot per resident lineage plus every reserved dummy slot. When avg_seq_len is unset, _build_base_config emits no constraints, so the storage manager received no min_slots floor for the SSM pool group; only the fallback typical_step steered the pool ratio. A ratio is not a floor, so the grain-based split rounded the SSM pool below the required count and initialization failed with 'The V2 Mamba state pool has only 31 slots but needs at least 34 live/dummy slots'. Emit the live/dummy slot count as an explicit constraint. The descriptors carry no capacity, so the attention pool floor is unchanged. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
a04784a to
52212e2
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Summary
avg_seq_lenunset no constraints are emitted, so the SSM pool group got nomin_slotsfloor and the ratio-based grain split rounded it to 31 slots, below the 34 live/dummy slots__init__requires._max_resident_sequences()+ reserved-dummy zero-capacityKVCacheDescs, which floors the SSM pool without adding attention pages.Test plan
Links
Dev Engineer Review
_num_required_state_slots()to centralize the required live and dummy SSM slot calculation.KVCacheDescconstraint reserves required SSM slots without increasing attention page allocation.avg_seq_lenis unset.QA Engineer Review
tests/unittest/_torch/executor/kv_cache/test_mamba_cache_manager.py.tests/integration/test_lists/; no corresponding test-list coverage was added.tests/integration/test_lists/waives.txtby removingTestNemotronV3Ultra::test_nvfp4_4gpus_static_eplb[moe_backend=TRTLLM]and its NV bug reference. The format and scope are consistent.