[https://nvbugs/6418912][test] Fix detached-block eviction tests - #16011
[https://nvbugs/6418912][test] Fix detached-block eviction tests#16011chienchunhung wants to merge 4 commits into
Conversation
Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
… mode Signed-off-by: Chien-Chun Hung <2679986+chienchunhung@users.noreply.github.com>
📝 WalkthroughWalkthroughUnit test expectations in ChangesKV-cache manager test expectation updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cpp/tests/unit_tests/batch_manager/kvCacheManagerTest.cpp (1)
440-505: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPartial-copy verification is tightly coupled to internal free-block selection order.
partialCopyBlockId = 6is fetched viagetBlockByIdand its primary-pool memory is memset to zero beforeaddSequenceBatchruns forseq2, assuming the block manager will pick exactly block 6 (and that it's currently resident in the primary pool) as the partial-copy destination. This is inherent to white-box testing of the new detached-block-first eviction order and appears intentional (validated per PR description via integration testing), but it means this test will silently need re-tuning again if the free-queue/eviction policy changes further. A brief comment explaining why block 6 is guaranteed to be primary at this point would help future maintainers avoid re-deriving this from BlockManager internals.🤖 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 `@cpp/tests/unit_tests/batch_manager/kvCacheManagerTest.cpp` around lines 440 - 505, Add a short clarifying comment in the partial-copy verification test around the `partialCopyBlockId`, `getBlockById`, and `addSequenceBatch` flow to explain why block 6 is expected to be the primary destination for the partial copy at that point. Note that this test is intentionally white-box and depends on the current detached-block-first selection behavior in `BlockManager`, so future changes to free-block ordering or eviction policy may require updating the test assumptions.
🤖 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 `@cpp/tests/unit_tests/batch_manager/kvCacheManagerTest.cpp`:
- Around line 440-505: Add a short clarifying comment in the partial-copy
verification test around the `partialCopyBlockId`, `getBlockById`, and
`addSequenceBatch` flow to explain why block 6 is expected to be the primary
destination for the partial copy at that point. Note that this test is
intentionally white-box and depends on the current detached-block-first
selection behavior in `BlockManager`, so future changes to free-block ordering
or eviction policy may require updating the test assumptions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 1d721ff5-a8ac-4302-ba92-ec33c5237ced
📒 Files selected for processing (1)
cpp/tests/unit_tests/batch_manager/kvCacheManagerTest.cpp
|
/bot run --disable-fail-fast |
|
PR_Github #58043 [ run ] triggered by Bot. Commit: |
|
Closing this PR as it is subsumed by #16019 |
Pull request was closed
|
PR_Github #58043 [ run ] completed with state
|
Summary by CodeRabbit
Bug Fixes
Tests
Description
PR #11685 changed the KV-cache free queue so detached blocks are recycled before reusable cached blocks. The production behavior is intentional, but 17 tests still encode the previous physical block-allocation order. Once PR #15994 allows the A30 suite to advance past the earlier BufferIndexHolder timeout, those stale block-ID and event-count expectations fail.
Update the affected expectations and comments to match detached-block-first eviction. The nine partial-copy variants also used the same
test_copy0GDS directory from parallel test processes; use a per-process, per-datatype directory to prevent NIXL/GDS registration collisions. Production behavior is unchanged.This was exposed while validating NVBUG 6418912 / PR #15994, but is independent of the BufferIndexHolder fix.
Affected tests
KVCacheManagerTest.BlockManagerTestPartialCopyINT64KVCacheManagerTest.BlockManagerTestPartialCopyINT32KVCacheManagerTest.BlockManagerTestPartialCopyFLOATKVCacheManagerTest.BlockManagerTestPartialCopyBF16KVCacheManagerTest.BlockManagerTestPartialCopyHALFKVCacheManagerTest.BlockManagerTestPartialCopyBOOLKVCacheManagerTest.BlockManagerTestPartialCopyUINT8KVCacheManagerTest.BlockManagerTestPartialCopyINT8KVCacheManagerTest.BlockManagerTestPartialCopyFP8KVCacheManagerTest.BlockManagerReuseTestKVCacheManagerTest.BlockManagerReuseWithExtraIdTestKVCacheManagerTest.BlockManagerReuseWithMultimodalHashTestKVCacheManagerTest.BlockManagerReuseWithLoraTaskIdTestKVCacheManagerTest.BlockManagerReuseWithCacheSaltTestKVCacheManagerTest.KVCacheManagerLeafBlockTestKVCacheManagerTest.KVCacheManagerEventStreamKVCacheManagerTest.KVCacheManagerMaxAttentionWindowWithReuseTestTest Coverage
pre-commit run --files cpp/tests/unit_tests/batch_manager/kvCacheManagerTest.cppA30-CPP-1pipeline #46619 completed SUCCESS on integration head1248a186.FillKvCacheWithRequestsAndCompleteOneByOne/5crash that remained after these expectation fixes.This combined result validates the changes together; it is not an independent CI run of this PR alone.