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

Method submit

engine/src/core/expert_source.cpp:3585–3604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;
3587 {
3588 std::lock_guard<std::mutex> lk(mu_);
3589 // Zero-drop latest-submission overwrite: even when busy_ is true, overwrite the pending staging slot
3590 // (worker runs from work_x_ / work_res_) so the freshest L+1/L+2 prediction is never skipped!
3591 if (pending_) skipped_.fetch_add(1, std::memory_order_relaxed); // superseded unstarted older layer
3592 n_tok_ = std::min<int64_t>(n_tok, 8);
3593 std::memcpy(x_.data(), x, (size_t) (n_tok_ * n_embd_) * sizeof(float));
3594 layer_ = layer + 1;
3595 has_res_ = host_res != nullptr;
3596 if (has_res_) { // the rows of layer + 1 .. + depth, as they are now: the table changes while this runs
3597 const int64_t l1 = std::min<int64_t>(layer_ + depth_, (int64_t) routers_.size());
3598 res_.assign(host_res + (size_t) (layer_ * n_expert_), host_res + (size_t) (l1 * n_expert_));
3599 }
3600 sub_gen_ = gen_.load(std::memory_order_relaxed);
3601 pending_ = true;
3602 }
3603 cv_.notify_one();
3604}
3605
3606void RouterLookahead::enable_stats(int64_t n_layers) {
3607 words_ = (n_expert_ + 63) / 64;

Callers 15

runFunction · 0.45
mainFunction · 0.45
run_stream_encodeFunction · 0.45
_parallel_gzipFunction · 0.45
stage_uploadMethod · 0.45
rangedFunction · 0.45
concurrent_roundMethod · 0.45
_cancel_phaseFunction · 0.45
_phaseFunction · 0.45

Calls 6

memcpyFunction · 0.85
fetch_addMethod · 0.80
assignMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
loadMethod · 0.45