code wiki / (root) / nx_gpu_bench.nx

nx_gpu_bench.nx

buildroot/runtime/nx_gpu_bench.nx

12218 B270 linesdepth 3pulls 7 transitivereach 0 importersview sourcekind benchtopic gpu
docsdependenciesstructsconstsfunctions

about

nx_gpu_bench.nx -- SOVEREIGN three-way GPU-compute benchmark harness: OURS vs CUDA vs Vulkan, the no-wave measured-exceed instrument (operator 2026-06-20: "vm test ours vs cuda vs vulkan ... test all three on this machine" + "how does unsloth or other tools do this"). METHODOLOGY (grounded in how Unsloth / llama-bench / the kernel-bench world actually measure): - WARMUP before timing; MANY reps, report the MEDIAN(p50)+P95 (nx_bench_stats); GPU-clock timing for GPU lanes / monotonic-ns here; CORRECTNESS IS A GATE (a faster-but-wrong lane is DISQUALIFIED); report ABSOLUTE numbers + full config. ROLE: this sovereign harness is the JUDGE/AGGREGATOR. It runs the sovereign lanes (a naive FP32 ref that self-validates the instrument + the REAL fast integer-SIMD GEMM = __i16x16_madd, DETERMINISTIC), INGESTS the incumbent yardstick results (gpu_bench_cuda.out = cuBLAS FP32+BF16), and writes the unified scoreboard + honest verdict. The integer lane proves the DETERMINISM EXCEED: bit-exact (scalar==SIMD), which cuBLAS float CANNOT be. NO fake greens. license_tier: ORIGINAL

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_runtime.nx nx_clock.nx nx_tier.nx nx_bench_stats.nx nx_nofloat_gemm.nx nx_gpu_bench.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_runtime.nxnx_clock.nxnx_tier.nxnx_bench_stats.nxnx_nofloat_gemm.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gb_p gb_w sys_write sys_mmap nx_bst_new sys_mmap ↻ nx_bench_stats_compute _bst_insertion_sort nx_bst_p50 nx_bst_min nx_bst_max nx_bst_mean nx_bst_p95 gb_init gb_gemm nx_clock_monotonic_ns sys_mmap ↻ sys_clock_gettime_mono pack2 scalar_imm simd_imm i32x8_hsum gb_read sys_openat_rd sys_read sys_close gb_has sys_openat_wr gb_w ↻ gb_wn nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_write ↻ sys_close ↻ gb_pn gb_wn ↻

structs

none

consts

22const GB_MAGIC_65536: i64 = 65536
23const GB_MAGIC_65535: i64 = 65535
25const GB_TSV: *u8 = "knowledge/status/gpu_bench.tsv"
26const GB_LOG: *u8 = "knowledge/status/gpu_bench.log"
27const GB_CUDA_OUT: *u8 = "knowledge/status/gpu_bench_cuda.out"

functions

30func gb_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 2: gb_pmain calls 1: sys_write
35func gb_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 2: gb_pnmain calls 1: nxi_fd
36func gb_p(s: *u8) -> i64 { return gb_w(1, s) }
called by 1: main calls 1: gb_w
37func gb_pn(v: i64) -> i64 { return gb_wn(1, v) }
called by 1: main calls 1: gb_wn
39func gb_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
52func gb_has(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64
called by 1: main
66func gb_init(N: i64, A: *i64, B: *i64) -> i64
called by 1: main
75func gb_gemm(N: i64, A: *i64, B: *i64, C: *i64) -> i64
called by 1: main
95func main() -> i64