mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
With --vram-elastic, a VRAM command shrinks the expert cache by giving its last segments back to the driver. When the driver refused a segment part way, the segments released before the refusal were already gone, but the command returned its error before the residency table was updated. The engine kept serving with experts still listed in slots that were no longer mapped, and the prompt path's loan could still sit past the end of the live slots. Now the residency entries past what stays mapped are evicted after every shrink, refused or not, the table is uploaded again and the loan moves down to the end of the slots left; then the error goes out as before. Also: when the unmap of a segment succeeded and only the release of its handle failed, the segment was still counted as mapped. It now counts as unmapped at once; the handle stays and is released again by the next grow or at close. The eviction is a pure function (strata/core/residency_trim.hpp) with its own CPU test. expert_cache_segmented_test refuses an unmap and a release part way through a shrink, through a test-only hook that the engine never sets (strata/core/expert_cache_refuse.hpp), and checks the slots kept, the entries evicted and a full grow afterwards. A shrink the driver accepts behaves as before.
15 lines
671 B
C++
15 lines
671 B
C++
#pragma once
|
|
// Tests only: make one of the segmented expert cache's driver calls fail on purpose, so a test can check what a shrink
|
|
// that the driver refused part way leaves behind (src/core/expert_cache.cpp). The engine never sets it.
|
|
|
|
#include <cstdint>
|
|
|
|
namespace strata::core::ec_test {
|
|
|
|
/// Asked before each unmap and each release a shrink makes (`call` is "unmap" or "release", `seg` the segment's index).
|
|
/// True: that call counts as refused by the driver and is not made. Null (the default, and always in the engine): every
|
|
/// call is made as usual.
|
|
extern bool (*refuse_segment_call)(const char* call, int64_t seg);
|
|
|
|
} // namespace strata::core::ec_test
|