fix(server): evict the least recently used group when two blocks cost the same - #294
Conversation
… the same When a tensor-parallel load had to evict, it freed the block needing the fewest evictions and broke ties by device order. With two resident groups, a load could evict the busy group while an idle one kept its cards, and the busy model and the newcomer would then evict each other in turn. Ties now go to the block whose most recently used resident was used longest ago, the rule single-device displacement of a group already follows.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughMulti-device placement now prioritizes eviction candidates by blocker count and blocker recency. Registry tests verify that the older equal-sized resident group is evicted regardless of device ordering. ChangesPlacement eviction ordering
Suggested reviewers: Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The placement change retains blocker-count priority and applies the intended recency tie-breaker, with coverage for either device ordering. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
Checked on real engines at this head (
Memory per card:
granite-guardian's own completion of a raw prompt returned |
What this changes
When a model with
tensor_parallel_sizeabove one has to evict residents to get a block of devices, the registry frees the block that needs the fewest evictions. Until now, ties between blocks went by device order.With two groups resident on a four-device worker, loading a third group therefore always evicted whichever group held
cuda:0, even if it was the busy one. The idle group kept its devices. Requests alternating between the busy model and the newcomer then evicted each other in turn.Ties now go to the block whose most recently used resident was used longest ago. Single-device loads that displace a group already follow this rule (
_group_holder_to_evict), and both paths now share one helper for a model's last use. The fewest-evictions rule, pinned-model protection and the preference for a free block are unchanged.Tests
test_between_equal_blocks_the_least_recently_used_group_is_evictedruns in both directions (the first group idle, then the second), so device order cannot pass it.cuda:0/cuda:1.packages/sie_server/tests/core/test_registry_device_groups.py: 41 passed.packages/sie_server/tests/core: 1087 passed, 1 skipped, 1 failed. The failure istest_offline_cache_only_derived_snapshot_materializes_without_hub_fallback, a macOSPermissionErrorthat fails the same way onmainwithout this change.ruff format --check,ruff checkandty checkpass on the changed files.Summary by CodeRabbit
Bug Fixes
Tests