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

Method start

engine/src/core/expert_source.cpp:3565–3583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3563}
3564
3565bool RouterLookahead::start(std::vector<std::vector<uint16_t>> routers, int64_t n_embd, int64_t n_expert, int k,
3566 ExpertSource* src, std::string& err, bool allow_cold_source) {
3567 if (src == nullptr || (!allow_cold_source && !src->warms())) { err = "RouterLookahead: the expert source does not warm"; return false; }
3568 if (n_embd % 8 != 0) { err = "RouterLookahead: n_embd is not a multiple of 8"; return false; }
3569 for (const auto& r : routers)
3570 if (r.size() != (size_t) (n_embd * n_expert)) { err = "RouterLookahead: a router of another shape"; return false; }
3571 routers_ = std::move(routers);
3572 n_embd_ = n_embd;
3573 n_expert_ = n_expert;
3574 k_ = k < 1 ? 1 : k > (int) n_expert ? (int) n_expert : k;
3575 src_ = src;
3576 x_.assign((size_t) (8 * n_embd), 0.f);
3577 thread_ = std::thread([this] {
3578 strata::platform::name_this_thread("strata-lookahead");
3579 strata::aux_cpus::pin_current_thread();
3580 run();
3581 });
3582 return true;
3583}
3584
3585void RouterLookahead::submit(int64_t layer, const float* x, int64_t n_tok, const int32_t* host_res) {
3586 if (layer + 1 >= (int64_t) routers_.size() || n_tok <= 0 || x == nullptr) return;

Callers

nothing calls this directly

Calls 7

moveFunction · 0.85
assignMethod · 0.80
name_this_threadFunction · 0.50
pin_current_threadFunction · 0.50
runFunction · 0.50
warmsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected