[https://nvbugs/6261164][fix] AutoDeploy: Don't allocate speculative caches when speculation is off - #15020
Conversation
📝 WalkthroughWalkthroughAdd ChangesSpeculative resource handler allocation fix
🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@hnover-nv , @govind-ramnarayan . PTAL. Would it make sense to add a unit test too? |
I have a slightly expanded version of this that I'll push to the branch. The main issue with this is that it only skips over assigning the (default) "Rewind" speculative buffers, but should ideally also skip over the "Replay" ones too. When speculation is off but "replay" is on in the FlashInfer kernel, which is possible right now, these will fall through unmanaged. |
862f01b to
5706bf2
Compare
…_config in AutoDeploy When spec decoding is off, the SSM/causal-conv backends still register intermediate speculative state handlers (SpecSSMResourceHandler / SpecCausalConvResourceHandler). The Mamba cache manager never binds these without spec_config, so they fall through to a full per-layer unmanaged allocation (~650 MiB each) that is never read, OOMing the 44 GiB L40S in TestNemotronV2::test_fp8. Drop these handlers to the existing None sentinel in the kvcache insert transform when spec_config is None, so no buffer is allocated. Remove the corresponding waiver. Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com>
…culativeOnly trait When spec decoding is off, the kvcache insert transform previously dropped only the two intermediate-state handlers (a hard-coded isinstance tuple), so the flashinfer replay-kernel handlers (enabled via ssm_replay) were still registered and leaked as unmanaged per-layer allocations. Generalize the suppression to a SpeculativeOnly trait mixin carried by both intermediate-state handlers and all six Replay* handlers; the gate now keys on the trait (single source of truth) rather than an enumerated type tuple. The decision is extracted into _InsertCachedOperator._suppress_speculative_when_no_spec. Add an AutoDeploy LlmArgs validator that rejects ssm_replay=True when speculative_config is None: replay buffers are only consumed on the speculative extend path, so the combination is invalid and previously mis-allocated silently. Rename SpecSSMResourceHandler/SpecCausalConvResourceHandler to IntermediateSSMStateHandler/IntermediateConvStateHandler to match the intermediate_*_cache keys and avoid colliding with the new trait. Tests: trait-contract coverage (8 spec-only handlers carry the trait, 3 base handlers do not), gate unit tests (spec on/off), and ssm_replay validation tests. Signed-off-by: Govind Ramnarayan <105831528+govind-ramnarayan@users.noreply.github.com>
…, rename suppress helper
- Collapse SpeculativeOnly trait docstring to a single line
- Drop the why-we-mix-in reasoning from Intermediate{SSM,Conv}StateHandler docstrings
- Rename _suppress_speculative_when_no_spec -> _suppress_spec_handlers_maybe (and call sites)
- Update validate_ssm_replay_requires_spec docstring: Replay* handlers are now
SpeculativeOnly and dropped by the transform, so the flag is a no-op without spec_config
Signed-off-by: Govind Ramnarayan <105831528+govind-ramnarayan@users.noreply.github.com>
5706bf2 to
e034795
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #52837 [ run ] triggered by Bot. Commit: |
|
Additionally verified this test now passes on L40s. |
_InsertCachedOperator._apply), when…|
PR_Github #52837 [ run ] completed with state |
fixes: #15120
Summary
spec_config is Nonethey're never bound by the Mamba cache manager and fall through to a full per-layer unmanaged allocation (~650 MiB each), OOMing the 44 GiB L40S._InsertCachedOperator._apply), whencm._spec_config is None, dropSpecSSMResourceHandler/SpecCausalConvResourceHandlerto the existingNonesentinel so no buffer is registered/allocated; removed the waiver.Test plan
Links
Summary by CodeRabbit
New Features
Bug Fixes
Tests