code wiki / _hdl_build / nx_nofloat_k3block.nx

nx_nofloat_k3block.nx

buildroot/runtime/_hdl_build/nx_nofloat_k3block.nx

3066 B68 linesdepth 3pulls 3 transitivereach 5 importersview sourcekind librarytopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_k3block.nx -- LOGICALLY-INTEGRATED K3-style transformer BLOCK in no-float (operator 2026-07-19 "logically integrated"). Proves the scattered K3 primitives COMPOSE into one deterministic block, not just exist as separate gates. Minimal K3 block = the KDA/linear-attention sublayer + a SwiGLU-ish FFN sublayer, both with residual connections (the DeepSeek-V3/Moonlight skeleton the real K3 uses): attn_in = x ; q,k,v = x.Wq, x.Wk, x.Wv ; a = linattn(q,k,v) ; h = x + a.Wo (KDA sublayer + residual) f = relu(h.W1).W2 ; out = h + f (FFN sublayer + residual) All PURE INTEGER Q16 (matvec accumulate-then-shift + the proven linear-attn kernel) = bit-exact deterministic K3-style block. Composes nx_nofloat_linattn (the KDA foundation). Grounded arXiv 2510.26692. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 2 importers

nx_nofloat_linattn.nx nx_syscalls.nx nx_nofloat_k3block.nx nx_nofloat_k3block_gate.nx nx_nofloat_k3stack.nx

imports: nx_nofloat_linattn.nxnx_syscalls.nx

imported by: nx_nofloat_k3block_gate.nxnx_nofloat_k3stack.nx

structs

none

consts

13const K3_QBITS: i64 = 16
14const K3_DMAX: i64 = 16
15const K3_FFMAX: i64 = 32

functions

18func k3_matmul(x: *i64, w: *i64, y: *i64, t: i64, d: i64, n: i64) -> i64
called by 2: k3_blockk3il_stack
34func k3_add(a: *i64, b: *i64, out: *i64, t: i64, d: i64) -> i64
called by 2: k3_blockk3il_stack
40func k3_relu(a: *i64, t: i64, d: i64) -> i64
called by 2: k3_blockk3il_stack
46func k3_block(x: *i64, wq: *i64, wk: *i64, wv: *i64, wo: *i64, w1: *i64, w2: *i64, out: *i64, t: i64, d: i64, dff: i64) -> i64