| 3833 | } |
| 3834 | |
| 3835 | void FileExpertSource::begin_layer(int64_t layer, const int32_t* ids, int64_t k) { |
| 3836 | (void) ids; |
| 3837 | (void) k; |
| 3838 | if (!staged()) return; |
| 3839 | bool new_window = false; |
| 3840 | { |
| 3841 | std::lock_guard<std::mutex> lk(stage_mu_); |
| 3842 | if (layer != last_layer_) { |
| 3843 | ++epoch_; |
| 3844 | new_window = layer < last_layer_; |
| 3845 | last_layer_ = layer; |
| 3846 | io_epoch_.store(epoch_, std::memory_order_relaxed); // 149-prefetch: the workers' deadline clock |
| 3847 | } |
| 3848 | } |
| 3849 | if (new_window && io_sched_) io_window_tick(); |
| 3850 | if (new_window && gate_on_ && tl_decode) { gate_capacity(); gate_tick(); } |
| 3851 | } |
| 3852 | |
| 3853 | bool FileExpertSource::transient(int64_t layer, int64_t expert) const { |
| 3854 | // the io-prefetch staging of the experts.bin tier is the decode's: the prompt path keeps reading the mapping |