nx_llm_batch_serve.nx
buildroot/runtime/nx_llm_batch_serve.nx
about
nx_llm_batch_serve.nx -- the SOVEREIGN CONTINUOUS-BATCHING LLM SEAT.
Wraps nx_llm_sched (batch-invariance GATED by nx_llm_sched_gate) in the
proven nx_f32_llm_serve accept-loop pattern: binds 127.0.0.1:11435
(:11434 stays the production single-stream seat), accept WITH TIMEOUT
between decode rounds -- new POST /chat requests admit MID-FLIGHT and
join the running batch; each round = ONE batched forward for every
active request; finished requests get their OpenAI-chat JSON and close.
Modes: (no args) = serve forever. `once <N>` = serve exactly N requests
then exit 0 (the testable smoke mode).
expect: LIVE on :11435 (blocks) / exit 0 in once-mode.
license_tier: ORIGINAL module: nishi-core.seat.llm-batch
dependencies 29 imports · 0 importers
diagram shows first 10 each side; +19 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_connect.nxnx_tier.nxnx_le.nxnx_bpe.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_f32.nxnx_f32_kv_cache.nxnx_f32_lazy_weight.nxnx_f32_llama_block.nxnx_f32_llama_block_v4.nxnx_f32_llama_stack_v4.nxnx_f32_llama_layer_lazy_load.nxnx_f32_llm.nxnx_f32_llm_v4.nxnx_f32_llm_read_dims.nxnx_f32_bpe_load.nxnx_f32_llm_special_tokens.nxnx_f32_sampler.nxnx_prng.nxnx_reasoning.nxnx_kvcache.nxnx_f32_attn_paged.nxnx_f32_llama_v4p.nxnx_f32_llama_v4b.nxnx_llm_sched.nxnx_http_client.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
| 45 | const NX_BSEAT_PORT: i64 = 11435 |
functions
| 47 | func bs_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 48 | func bs_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 49 | func bs_find(buf: *u8, n: i64, ndl: *u8, nl: i64) -> i64 |
| 55 | func bs_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ dst[off]=s[i]; off=off+1; i=i+1 } return off } called by 1: bs_respond |
| 56 | func bs_write_all(fd: i64, buf: *u8, n: i64) -> i64 { var off: i64=0; while off<n { let w: i64=sys_write(fd, ((buf as i64)+off) as *u8, n-off); if w<=0 { off=n } else { off=off+w } } return 0 } |
| 57 | func bs_extract_prompt(body: *u8, blen: i64, out: *u8, cap: i64) -> i64 |
| 78 | func bs_json_esc(src: *u8, sn: i64, dst: *u8, cap: i64) -> i64 called by 1: bs_respond |
| 92 | func bs_atoi(s: *u8) -> i64 called by 1: main |
| 106 | func bs_respond(S: *NxLlmSched, slot: nx_int, fd: i64, |
| 126 | func main(argc: i64, argv: *i64) -> i64 |