nx_linear_attn_bench.nx
buildroot/runtime/nx_linear_attn_bench.nx
about
nx_linear_attn_bench.nx -- measure SANA linear attention O(n·d^2) vs softmax O(n^2·d) at scale.
Confirms the DiT-IC/SANA lever concretely: at n=512 tokens, head_dim=64, linear attention should be
materially faster than softmax (which builds the 512x512 score matrix + 512x512 exps). Linear attention
copied inline (nx_f32_linear_attention has a main); softmax via the nx_f32_attention lib.
license_tier: ORIGINAL
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f32_attention.nxnx_clock.nxnx_strconv.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
| 15 | func lab_phi(x: i64) -> i64 |
| 21 | func lab_linear(Q: *i64, K: *i64, V: *i64, n_tokens: i64, head_dim: i64, out: *i64, S: *i64, z: *i64) -> i64 |
| 56 | func lab_emit(fd: i64, key: *u8, kl: i64, v: i64) -> i64 |
| 70 | func main() -> i64 |