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

+7 -2
View File
@@ -5343,8 +5343,13 @@ int main(int argc, char** argv) {
}
// STRATA_MMQ_DIRECT: the guard after each sized slot (kept across the retry loop's close/open)
xcache.set_slot_guard(slot_guard);
if (slot_guard > 0)
std::fprintf(stderr, "strata generate: +%lld B guard per sized slot (STRATA_MMQ_DIRECT)\n", (long long) slot_guard);
if (slot_guard > 0 && o.expert_cache > 0) {
if (!sized_slots.empty())
std::fprintf(stderr, "strata generate: +%lld B guard per sized slot (STRATA_MMQ_DIRECT)\n", (long long) slot_guard);
else // xcache.open below: every slot is the largest blob's size, and no guard is added
std::fprintf(stderr, "strata generate: uniform expert slots, no guard (STRATA_MMQ_DIRECT): an expert is read "
"in its slot where the slot's slack covers the over-read\n");
}
if (o.expert_cache > 0) {
// keep the first `keep_bytes` of the cache (the profile's hottest experts first); false when nothing is left
auto shrink_to = [&](int64_t keep_bytes) -> bool {