code wiki / (root) / nx_zimage_real_qkv.nx

nx_zimage_real_qkv.nx

buildroot/runtime/nx_zimage_real_qkv.nx

4612 B114 linesdepth 8pulls 18 transitivereach 0 importersview sourcekind tooltopic zimage
docsdependenciesstructsconstsfunctions

about

nx_zimage_real_qkv.nx -- REAL Qwen layer-0 Q/K/V projections on REAL weights, sovereignly. sd-server -> Nishi migration: extends the real forward from Q to the FULL attention input -- computes Q, K and V projections of token-0's real embedding against blk.0.attn_{q,k,v}.weight (all Q6_K, ~335MB into the file) with our own f32 matmul, and records the out-dims (confirming GQA: q_out=4096 > kv_out). Real Qwen weights -> our sovereign matmuls -> the real attention inputs. Bounded 384MB prefix; only the slices we need are dequantized. license_tier: ORIGINAL

dependencies 13 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_le.nx nx_strconv.nx nx_tensor.nx nx_gguf.nx nx_gguf_load.nx nx_gguf_meta.nx nx_placement.nx nx_gguf_load_lazy.nx nx_zimage_real_qkv.nx

diagram shows first 10 each side; +3 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_q6_k_to_f32.nxnx_f32.nxnx_f32_cvt.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_rd sys_mmap sys_read sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻ nx_le_read_u32 ↻ _gguf_skip_value ↻ sys_mmap ↻ nx_gguf_find_tensor nx_gguf_tensor_at nx_gguf_name_equals nx_gguf_tensor_at ↻ nx_q6_k_to_f32 _nx_q6_k_block_to_f32 nx_le_read_u16 nx_f16_to_f32 nx_le_read_u8 _q6k_emit qkv_proj4 sys_mmap ↻ nx_q6_k_to_f32 ↻ nx_f32_add nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ sys_openat_wr

structs

none

consts

none

functions

23func qkv_emit(fd: i64, key: *u8, key_len: i64, value: i64) -> i64
39func qkv_proj4(buf: *u8, w_off: i64, HID: i64, embed: *i64, out: *i64) -> i64
54func main() -> i64