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

Function native_quant_act

engine/src/kernels/cpu/native_expert.cpp:514–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512} // namespace
513
514void native_quant_act(const NativeFmt& f, const float* x, void* dst) {
515 if (f.had_gu) { // Hadamard-folded gate/up: quantize H (s * x), never x itself (hadamard.hpp)
516 thread_local std::vector<float> tmp;
517 tmp.assign(x, x + f.n_embd);
518 hadamard_rotate(tmp.data(), (int) f.n_embd, f.had_block, f.gu_signs);
519 x = tmp.data();
520 }
521 if (act_dump().on) act_dump_record(f.layer, 0, x, f.n_embd);
522 if (q8k_avx2(f.gu_act)) { q8k_quant_avx2(x, dst, f.n_embd); return; }
523 if (q8k_avx1(f.gu_act)) { q8k_quant_avx1(x, dst, f.n_embd); return; }
524 traits(f.gu_act).from_float(x, dst, f.n_embd);
525}
526
527void native_quant_h(const NativeFmt& f, const float* h, void* dst) {
528 if (f.had_d) {

Callers

nothing calls this directly

Calls 10

hadamard_rotateFunction · 0.85
act_dump_recordFunction · 0.85
q8k_avx2Function · 0.85
q8k_avx1Function · 0.85
assignMethod · 0.80
from_floatMethod · 0.80
q8k_quant_avx2Function · 0.70
q8k_quant_avx1Function · 0.70
traitsClass · 0.50
dataMethod · 0.45

Tested by

no test coverage detected