code wiki / (root) / nx_qwen_hybrid_qkv.nx

nx_qwen_hybrid_qkv.nx

buildroot/runtime/nx_qwen_hybrid_qkv.nx

5708 B129 linesdepth 9pulls 23 transitivereach 0 importersview sourcekind tooltopic qwen
docsdependenciesstructsconstsfunctions

about

nx_qwen_hybrid_qkv.nx -- the hybrid mixed-precision Q/K/V projection stage on real Qwen weights. sd-server -> Nishi migration (integer layer, task#19). The real Q4_K_M blk.0 mixes quant types, so the integer layer is a hybrid: attn_q/attn_k are Q4_K (fast integer path nx_q4k_linear -> Q10), attn_v is Q5_K (f32 path nx_q5_k_to_f32 + f32 dot). This proves those compose correctly on real weights: integer Q/K (converted Q10->f32) match the f32 reference within 2%, and f32 V (via the ggml-verified Q5_K dequant) produces finite values. The Q10<->f32 boundary is the hybrid layer's key seam. license_tier: ORIGINAL

dependencies 18 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_qwen_hybrid_qkv.nx

diagram shows first 10 each side; +8 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_linear.nxnx_q4k_to_f32.nxnx_q5_k_to_f32.nxnx_f32.nxnx_f32_cvt.nxnx_f32_div.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_q10_to_f32 nx_i32_to_f32 nx_q4k_iter_alloc sys_mmap ↻ nx_q4k_linear nx_q4k_dot_row_col nx_q4k_iter_init nx_le_read_u16 _gguf_f16_to_q24 nx_le_read_u8 nx_q4k_iter_scale _q4k_iter_scale_at nx_q4k_iter_min _q4k_iter_min_at nx_le_read_u8 ↻ nx_q4km_q20_to_q10 nx_q4k_to_f32 nx_q4k_block_to_f32 nx_le_read_u16 ↻ nx_f16_to_f32 nx_le_read_u8 ↻ nx_i32_to_f32 ↻

structs

none

consts

none

functions

28func hq_emit(fd: i64, key: *u8, key_len: i64, value: i64) -> i64
43func hq_f32dot(wrow: *i64, act_f32: *i64, in_dim: i64) -> i64
called by 1: main calls 2: nx_f32_addnx_f32_mul
50func main() -> i64