code wiki / _hdl_build / nx_ptx_emit.nx

nx_ptx_emit.nx

buildroot/runtime/_hdl_build/nx_ptx_emit.nx

5052 B77 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_ptx_emit.nx -- the SEED of the sovereign PTX emitter: a NishiLang program (compiled by nx_cc) that GENERATES dispatchable PTX text for an elementwise integer kernel, parameterized by OP. Not hand-written, not nvcc -- OUR stack emits the GPU kernel. Writes emitted_vadd.ptx; the driver harness then launches it on the RTX 5080. Proves nx_cc -> (program that emits) PTX -> GPU. Grow this into the nx_cc backend proper. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_ptx_emit.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_openat_wr w sys_write emit_gemm_head w ↻ emit_gemm_idx w ↻ emit_gemm_bounds w ↻ emit_gemm_body w ↻ sys_close

structs

none

consts

9const OP: i64 = 0 // 0=add.s32 1=mul.lo.s32 2=max.s32

functions

7func 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 }
11func emit_head(fd: i64) -> i64
calls 1: w
17func emit_index(fd: i64) -> i64
calls 1: w
23func emit_load(fd: i64) -> i64
calls 1: w
29func emit_op(fd: i64) -> i64
calls 1: w
35func emit_tail(fd: i64) -> i64
calls 1: w
41func emit_gemm_head(fd: i64) -> i64
called by 1: main calls 1: w
47func emit_gemm_idx(fd: i64) -> i64
called by 1: main calls 1: w
54func emit_gemm_bounds(fd: i64) -> i64
called by 1: main calls 1: w
60func emit_gemm_body(fd: i64) -> i64
called by 1: main calls 1: w
68func main() -> i64