| 7280 | } |
| 7281 | |
| 7282 | void ForesightSwap::hold(int64_t layer, int32_t expert) { |
| 7283 | if (layer < 0 || layer >= n_layers || expert < 0 || expert >= n_expert) return; |
| 7284 | std::lock_guard<std::mutex> smu_lk(smu_); |
| 7285 | const size_t key = (size_t) (layer * n_expert + expert); |
| 7286 | const int s = where[key]; |
| 7287 | where[key] = kHeld; |
| 7288 | if (s < 0) return; |
| 7289 | Slot& sl = slot[(size_t) (layer * slots + s)]; |
| 7290 | sl.expert = kDropped; // `loading` and `last_ref` stay: a copy in flight and a window that read it are waited for |
| 7291 | sl.ready = false; |
| 7292 | ++dropped; |
| 7293 | } |
| 7294 | |
| 7295 | void ForesightSwap::unhold(int64_t layer, int32_t expert) { |
| 7296 | if (layer < 0 || layer >= n_layers || expert < 0 || expert >= n_expert) return; |
no outgoing calls
no test coverage detected