nx_blockfloat_generate_gate.nx
buildroot/runtime/nx_blockfloat_generate_gate.nx
about
nx_blockfloat_generate_gate.nx -- R2 of the model-assembly arc: AUTOREGRESSIVE GENERATION on block-float weights.
Composes R1's full LM forward (embed -> block -> final norm -> LM head -> logits) in a feedback loop: argmax the
last position (greedy / temperature-0 decoding), append it to the sequence, recompute. This is the loop that turns
a forward into an LLM (prompt -> generated continuation). Greedy decoding is fully deterministic = the determinism
moat at the SEQUENCE level. Proves block-float generation == full-precision generation (lossless), while per-tensor
INT8 CORRUPTS what the model generates.
1 the loop GENERATES n_new valid tokens (sequence grows, all ids in [0,vocab))
2 DETERMINISTIC: block-float generation twice == identical sequence
3 block-float generation == full-precision generation (lossless at the sequence level)
4 per-tensor INT8 CORRUPTS the generated sequence (out_pt != out_fp) -- block-float's win is over real corruption
expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_nofloat_autograd.nxnx_syscalls.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 16 | func bb_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 17 | func bb_pn(v: i64) -> i64 |
| 27 | func bb_chk(name: *u8, ok: i64) -> i64 |
| 31 | func bb_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: bf_scale_abs |
| 32 | func bf_bitlen(x: i64) -> i64 { var b: i64 = 0; var m: i64 = x; while m > 0 { m = m >> 1; b = b + 1 } return b } called by 1: bf_scale_abs |
| 33 | func bf_scale_abs(W: *i64, off: i64, B: i64, MB: i64) -> i64 |
| 38 | func bf_quant_mat(W: *i64, rows: i64, cols: i64, B: i64, MB: i64, out: *i64) -> i64 |
| 53 | func bf_quant_pt(W: *i64, n: i64, MB: i64, out: *i64) -> i64 |
| 59 | func fill_mixed(W: *i64, n: i64, B: i64, sgn: i64) -> i64 called by 1: main |
| 69 | func blk_fwd(tape: *i64, vals: *i64, st: *i64, X: *i64, Wq: *i64, Wk: *i64, Wv: *i64, Wo: *i64, Wg: *i64, Wu: *i64, Wd: *i64, T: i64, dm: i64, ffn: i64, scale: i64) -> i64 |
| 100 | func embed(E: *i64, ids: *i64, T: i64, dm: i64, X: *i64) -> i64 |
| 105 | func lm_logits(tape: *i64, vals: *i64, st: *i64, X: *i64, Wq: *i64, Wk: *i64, Wv: *i64, Wo: *i64, Wg: *i64, Wu: *i64, Wd: *i64, Wlm: *i64, T: i64, dm: i64, ffn: i64, vocab: i64, scale: i64, outLog: *i64) -> i64 |
| 114 | func argmax(logits: *i64, off: i64, n: i64) -> i64 |
| 120 | func ar_generate(tape: *i64, vals: *i64, st: *i64, prompt: *i64, n_prompt: i64, n_new: i64, E: *i64, Wq: *i64, Wk: *i64, Wv: *i64, Wo: *i64, Wg: *i64, Wu: *i64, Wd: *i64, Wlm: *i64, dm: i64, ffn: i64, vocab: i64, scale: i64, seq: *i64, X: *i64, logits: *i64, out_ids: *i64) -> i64 |
| 136 | func tf_check(tape: *i64, vals: *i64, st: *i64, prompt: *i64, n_prompt: i64, gen: *i64, n_new: i64, E: *i64, Wq: *i64, Wk: *i64, Wv: *i64, Wo: *i64, Wg: *i64, Wu: *i64, Wd: *i64, Wlm: *i64, dm: i64, ffn: i64, vocab: i64, scale: i64, fseq: *i64, Xtf: *i64, lgtf: *i64) -> i64 |
| 152 | func seq_eq(a: *i64, b: *i64, n: i64) -> i64 { var i: i64 = 0; while i < n { if a[i] != b[i] { return 0 } i = i + 1 } return 1 } called by 1: main |
| 153 | func print_seq(tag: *u8, s: *i64, n: i64) -> i64 { bb_puts(tag); var i: i64 = 0; while i < n { bb_puts(" "); bb_pn(s[i]); i = i + 1 } bb_puts("\n"); return 0 } |
| 155 | func main() -> i64 |