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

Method add

engine/src/spec/draft_policy.cpp:82–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80static_assert(CostLearner::kMaxT == DraftPolicy::kMaxT && CostLearner::kCtxBuckets == DraftPolicy::kCtxBuckets, "one table shape");
81
82void CostLearner::add(int bucket, int t, double ms, double busy_age_s) {
83 if (!(ms > 0.0) || !std::isfinite(ms)) return;
84 bucket = std::clamp(bucket, 0, kCtxBuckets - 1);
85 t = std::clamp(t, 1, kMaxT);
86 const bool late = busy_age_s > kFreshS; // a GPU that has been busy for long can run in another state than a request after a pause finds it
87 ++(late ? late_ : rounds_);
88 auto& v = (late ? late_s_ : s_)[(size_t) bucket][(size_t) t];
89 if ((int) v.size() < kKeep) v.push_back((float) ms);
90}
91
92void CostLearner::reset() {
93 for (auto& b : s_)

Callers 7

verify.cppFile · 0.45
prefill.cppFile · 0.45
mainFunction · 0.45
observe_forcedMethod · 0.45
observeMethod · 0.45
apply_costsMethod · 0.45
observe_chainMethod · 0.45

Calls 3

push_backMethod · 0.80
clampFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected