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

Function checked_act_kernel

engine/src/quant/selfcheck.cpp:202–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202const ActKernel* checked_act_kernel(Type act, Arith a) noexcept {
203 const Isa top = best_isa();
204 for (int ii = (int) top; ii >= 0; --ii) {
205 const ActKernel* k = act_kernel(act, a, (Isa) ii);
206 if (k == nullptr) return nullptr;
207 Verdicts& vd = verdicts();
208 const uint64_t kk = key(1, act, a, k->isa);
209 bool known = false, ok = false;
210 {
211 std::lock_guard<std::mutex> lk(vd.mu);
212 for (auto& e : vd.v)
213 if (e.first == kk) known = true, ok = e.second;
214 }
215 if (!known) {
216 std::string why;
217 ok = check_act(*k, &why);
218 if (!ok) std::fprintf(stderr, "strata: quant self-check failed, kernel dropped: %s\n", why.c_str());
219 std::lock_guard<std::mutex> lk(vd.mu);
220 vd.v.emplace_back(kk, ok);
221 }
222 if (ok) return k;
223 ii = (int) k->isa; // continue below the failed kernel's level
224 }
225 return nullptr;
226}
227
228} // namespace strata::quant

Callers 2

mainFunction · 0.85
traitsFunction · 0.85

Calls 4

act_kernelFunction · 0.85
check_actFunction · 0.85
best_isaFunction · 0.70
keyFunction · 0.70

Tested by 1

mainFunction · 0.68