MCPcopy Create free account
hub / github.com/Niko1221/Strata / admit

Method admit

engine/src/core/expert_cache.cpp:785–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783}
784
785int32_t ExpertCache::admit(int64_t layer, int64_t expert) {
786 if (sealed_) return kNotResident; // STRATA_EXPERT_NIBBLE: nothing is admitted (and so filled) after the startup fill
787 if (layer < 0 || layer >= n_layers_ || expert < 0 || expert >= n_expert_) return kNotResident;
788 const size_t at = (size_t) (layer * n_expert_ + expert);
789 if (residency_[at] != kNotResident) return residency_[at];
790 // R4.2g: THE PER-LAYER PATH. Same "no eviction" rule, but the ceiling is this layer's own range rather
791 // than one counter shared by all 48 - which is what confined the measured hit rate to 2.97%.
792 if (per_layer_) {
793 if (layer_next_.empty()) return kNotResident;
794 int64_t lo = 0, hi = 0;
795 layer_slot_range(layer, lo, hi);
796 if ((int64_t) layer_next_[(size_t) layer] >= hi) return kNotResident; // this layer's quota is full
797 residency_[at] = layer_next_[(size_t) layer]++;
798 ++admitted_;
799 return residency_[at];
800 }
801 if (next_free_ >= slots_) return kNotResident; // full: no eviction, deliberately - see the header
802 residency_[at] = (int32_t) next_free_;
803 return (int32_t) next_free_++;
804}
805
806uint8_t* ExpertCache::device_slot(int32_t slot) {
807 if (slot < 0 || slot >= slots_) return nullptr;

Callers 11

read_implFunction · 0.45
openMethod · 0.45
openMethod · 0.45
expert_hit_runFunction · 0.45
RigMethod · 0.45
run_percentFunction · 0.45
test_rotating_sourceFunction · 0.45
test_foresight_exchangeFunction · 0.45
test_replace_residentFunction · 0.45
mainFunction · 0.45

Calls 1

emptyMethod · 0.45

Tested by 7

RigMethod · 0.36
run_percentFunction · 0.36
test_rotating_sourceFunction · 0.36
test_foresight_exchangeFunction · 0.36
test_replace_residentFunction · 0.36
mainFunction · 0.36