nx_q4k_linear.nx
buildroot/runtime/nx_q4k_linear.nx
about
nx_q4k_linear.nx -- the integer GEMM linear: real Q4_K weights x Q10 activation -> Q10 output.
sd-server -> Nishi migration (CPU speed path). The integer analogue of qw_linear (nx_f32_qwen_layer):
out[t][o] = sum_i act[t][i] * W[o][i], with W a real Q4_K tensor (ggml-correct dequant, ~26x faster than
emulated f32) and the activation in Q10 fixed-point. Each output neuron o is one fused nx_q4k_dot_row_col
over weight row o (byte stride = n_blocks*144). This is the reusable matmul brick for an integer Qwen
layer. Gate proves it matches the f32 path across MULTIPLE real output neurons on blk.0.attn_q.
license_tier: ORIGINAL
dependencies 16 imports · 4 importers
diagram shows first 10 each side; +6 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_strconv.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_placement.nxnx_gguf_load_lazy.nxnx_q4k_matmul.nxnx_dequant_iter.nxnx_q4k_to_f32.nxnx_f32.nxnx_f32_cvt.nxnx_f32_div.nx
imported by: nx_q4k_linear_hp.nxnx_qwen_hybrid_attn.nxnx_qwen_hybrid_ffn.nxnx_qwen_hybrid_qkv.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 27 | func nx_q4k_linear(buf: *u8, w_off: i64, out_dim: i64, in_dim: i64, |
| 45 | func lin_emit(fd: i64, key: *u8, key_len: i64, value: i64) -> i64 |
| 59 | func main() -> i64 |