nx_genblock.nx
buildroot/runtime/nx_genblock.nx
about
nx_genblock.nx -- shared DiT block primitives for the sovereign gen engine.
Extracted from nx_gen_blockrun once a second consumer appeared (nx_gen_ditchain, which loops
these over N layers). Copying them would have been the third instance of this lane's most
expensive recurring mistake -- two implementations of one op drift, and the drift is silent
because both produce finite plausible numbers.
Everything here is layer-agnostic and model-agnostic: tensor names, dimensions and worker
counts are arguments. Hot loops use the HARDWARE __f32_* intrinsics, never the nx_f32_*
software IEEE-754 twins (measured 9-10x slower in this lane).
license_tier: ORIGINAL
dependencies 13 imports · 6 importers
diagram shows first 10 each side; +3 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f16.nxnx_f32_exp.nxnx_f32_activations.nxnx_strconv.nxnx_genfix.nxnx_genver.nxnx_genweights.nxnx_genarch.nx
imported by: nx_gen_blockrun.nxnx_gen_ditchain.nxnx_gen_ditfull.nxnx_gen_embed_verify.nxnx_gen_lora_repr.nxnx_gen_lora_verify.nx
structs
| none |
consts
| 542 | const BR_SCR_SLOTS: i64 = 24 |
functions
| 45 | func br_arch_bind(gw: *i64) -> i64 |
| 57 | func br_arch_ready() -> i64 called by 1: br_block |
| 64 | func br_puts(s: *u8) -> i64 |
| 69 | func br_strlen(s: *u8) -> i64 |
| 77 | func br_load_q8(model: *u8, name: *u8, in_dim: i64, out_dim: i64, scales_out: *i64) -> *u8 |
| 96 | func br_mm_band(w: *u8, scales: *i64, x: *u8, out: *u8, |
| 121 | func br_matmul(w: *u8, scales: *i64, x: *u8, out: *u8, |
| 147 | func br_rmsnorm(x: *u8, w: *u8, mods: *i64, out: *u8, rows: i64, d: i64, eps: i64) -> i64 |
| 175 | func br_gate_resid(inner: *u8, tg: *i64, resid: *u8, out: *u8, rows: i64, d: i64) -> i64 |
| 199 | func br_sdpa_band(qrp: *u8, krp: *u8, qkv: *u8, aop: *u8, called by 2: mainbr_block calls 7: sys_mmapnx_f32_ltnx_f32_expnx_f32_divnx_i32_to_f32nx_le_read_u32+1 |
| 271 | func br_swiglu_band(a: *u8, b: *u8, out: *u8, i0: i64, i1: i64) -> i64 |
| 284 | func br_fork_range(kind: i64, a: *u8, b: *u8, out: *u8, n: i64, nw: i64) -> i64 |
| 309 | func br_gw_q8(gw: *i64, name: *u8, in_dim: i64, out_dim: i64, scales_out: *i64) -> *u8 called by 3: mainmainbr_block calls 8: nx_gw_findbr_strlennx_gw_typenx_gw_dim0nx_gw_dim1nx_gw_data+2 |
| 331 | func br_gw_f32(gw: *i64, name: *u8, n: i64) -> *u8 called by 5: maindf_finalmainbr_adalnbr_block calls 4: nx_gw_findbr_strlensys_mmapnx_gw_to_f32_packed |
| 344 | func br_name_p(out: *u8, prefix: *u8, layer: i64, suffix: *u8) -> *u8 |
| 363 | func br_name(out: *u8, layer: i64, suffix: *u8) -> *u8 |
| 383 | func br_adaln(gw: *i64, prefix: *u8, layer: i64, t_emb: *u8, out: *u8, embed_dim: i64, width: i64) -> i64 |
| 424 | func br_mmf32_band(w: *u8, x: *u8, out: *u8, |
| 459 | func br_matmul_f32(w: *u8, x: *u8, out: *u8, rows: i64, in_dim: i64, out_dim: i64, nw: i64) -> i64 |
| 481 | func br_qk_rope(qkv: *u8, wqn: *u8, wkn: *u8, pe: *u8, qrp: *u8, krp: *u8, |
| 544 | func br_block(gw: *i64, prefix: *u8, layer: i64, modulation: i64, cur: *u8, outb: *u8, scr: *i64, |