code wiki / (root) / nx_zimage_sdpa_verify.nx

nx_zimage_sdpa_verify.nx

buildroot/runtime/nx_zimage_sdpa_verify.nx

5998 B159 linesdepth 5pulls 11 transitivereach 0 importersview sourcekind orphan librarytopic zimage
docsdependenciesstructsconstsfunctions

about

nx_zimage_sdpa_verify.nx -- SOVEREIGN Z-Image attention sub-piece 2b+2c: qk-norm+rope+SDPA, verified. Small organ (no big linears): takes the oracle's dumped qkv [4,11520], applies per-head QK-RMSNorm(qn/kn) + axial RoPE(cosr/sinr) to Q,K, then per-head SDPA (softmax(q.k/sqrt128) v) -> ao [4,3840]; verifies vs the oracle's dumped ao_pre (attention output BEFORE out-proj). Reference dumps oracle-only; organ = Nishi. license_tier: ORIGINAL

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f32_exp.nx nx_strconv.nx nx_zimage_sdpa_verify.nx

imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f32_exp.nxnx_strconv.nx

imported by: nobody (leaf or entry point)

structs

none

consts

14const K_MAGIC_3840: i64 = 3840
15const K_MAGIC_11520: i64 = 11520
16const K_MAGIC_100000: i64 = 100000

functions

18func zsd_load(name: *u8, nl: i64, n_floats: i64) -> *u8
45func zsd_qknorm_rope(qkv: *i64, off: i64, w: *u8, cosr: *u8, sinr: *u8, t: i64, eps: i64) -> i64
65func main() -> i64