code wiki / _hdl_build / nx_nofloat_serve.nx

nx_nofloat_serve.nx

buildroot/runtime/_hdl_build/nx_nofloat_serve.nx

6979 B153 linesdepth 10pulls 21 transitivereach 0 importersview sourcekind servicetopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_serve.nx -- the DEPLOYABLE no-float LLM daemon (ops shell around the gated pure core nx_nofloat_serve_core). Binds 127.0.0.1:8032 and serves the interactive app + JSON API for the sovereign 100pct-integer Qwen2.5-0.5B: POST /gen {prompt,max_new,mode} -> readable text (byte-level-BPE decoded), GET / app page, GET /health, GET /api. FAIL-FAST startup (Rule 20): the model is loaded and BOTH dequant-once caches are built BEFORE bind/listen -- a daemon that accepts is a daemon that can serve. Single accept loop = requests naturally serialize (one 16-core box, one pool). WSL2 forwards localhost to Windows, so the app is browsable at http://localhost:8032/ on the host. Runs forever; build with --build-only, run deliberately (same pattern as nx_relate_daemon :8027). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_nofloat_serve_core.nx nx_nofloat_serve.nx

imports: nx_nofloat_serve_core.nx

imported by: nobody (leaf or entry point)

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

main nsd_puts nsd_pn nsv_init sys_now_ms sys_mmap sys_clock_gettime_mono nsv_log sys_write nf_pool nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn sys_mmap ↻ nx_thread_spawn_fn sys_mmap ↻ sys_mmap ↻ nsv_load_meta sys_mmap ↻ nsv_log ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻

structs

none

consts

10const NSD_MAGIC_131072: i64 = 131072
11const NSD_MAGIC_262144: i64 = 262144
13const NSD_PORT: i64 = 0x1f60 // 8032
14const NSD_MODEL: *u8 = "/home/elderwesto/nx_stage/nx_real_model.gguf"

functions

16func nsd_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
17func nsd_pn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main
19func nsd_addr(out: *u8, port: i64) -> i64
called by 1: main
32func nsd_write_all(fd: i64, buf: *u8, n: i64) -> i64
38func nsd_read_req(fd: i64, buf: *u8, cap: i64) -> i64
calls 1: sys_read
93func main(argc: i64, argv: *i64) -> i64