expert cache: slot_guard() reports the guard applied; a test for slot_tail on uniform and sized caches

- ExpertCache::slot_guard() returns the guard open_sized applied (guard_, reset by close), not the request: 0 for
  uniform slots, when closed, and on SYCL, whose open_sized applies none.
- tests/core/expert_cache_slot_guard_test: slot_stride, slot_room and slot_tail on a uniform cache (empty off_,
  including the last slot) and on sized caches with and without the 256 B guard; no guard gives today's offsets;
  close and reopen.
- generate: the "+256 B guard per sized slot" line only for a sized cache; a uniform one says it has no guard.
- prefill: STRATA_MMQ_DIRECT_LOG=1 (with STRATA_MMQ_DIRECT=1) prints each stage's totals of experts read in place,
  resident and streamed after every prompt, so an engine run can show which walk read what.
This commit is contained in:
havok2-htwo authored and Niko1221 committed 2026-10-14 06:56:49 +02:00
1 parent a5ad4077ef
commit c2b44ca5b8
6 files changed
+146 -4

No files matched your search

+2
View File
@@ -575,6 +575,7 @@ bool ExpertCache::open_sized(const std::vector<int64_t>& slot_bytes, int64_t n_l
live_slots_ = slots_;
blob_ = mx;
off_ = std::move(off);
guard_ = guard_req_;
#if defined(STRATA_USE_HIP)
if (!ensure_blocking_staging((std::size_t) blob_, err)) {
close();
@@ -599,6 +600,7 @@ void ExpertCache::close() {
blocking_staging_bytes_ = 0;
#endif
off_.clear();
guard_ = 0;
if (!segs_.empty()) {
release_segmented();
} else if (vmm_) {