nx_nofloat_serve_core.nx
buildroot/runtime/nx_nofloat_serve_core.nx
about
dependencies 12 imports · 19 importers
diagram shows first 10 each side; +2 more imports, +9 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_le.nxnx_tensor.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_nofloat_llm.nxnx_nofloat_tok.nxnx_nofloat_tokdec.nxnx_nofloat_arch.nxnx_nofloat_q4k.nx
imported by: nx_bright_rewrite_lib.nxnx_code_embed_gate.nxnx_coder_gen_nf.nxnx_forge_bestof.nxnx_forge_local_gen.nxnx_forge_repair.nxnx_gpu_embed_gate.nxnx_gramdec_lib.nxnx_jina_embed_gate.nxnx_nofloat_prefill_gate.nxnx_nofloat_prefix_cache_gate.nxnx_nofloat_qgap_probe.nxnx_nofloat_serve.nxnx_nofloat_serve_gate.nxnx_nofloat_speed_bench.nxnx_propose_verify_lib.nxnx_qwen_extract.nxnx_qwen_reader_bench_gate.nxnx_research_synth_qwen.nx
structs
| none |
consts
| 23 | const NSV_MAXT: i64 = 2048 // final prompt+gen TOKEN cap (KV cache rows). L2 raise 384->2048 (FORGE 2026-07-12) |
| 27 | const NSV_MAXIN: i64 = 16384 // max prompt BYTES for the tokenizer's byte-level pretokenize scratch (tok_ptr/tok_len). |
| 31 | const NSV_MAXNEW: i64 = 512 // per-request generation cap (L2 raise 96->512 for whole small organs) |
| 32 | const NSV_CHATML_IDS: i64 = 8 // ids the ChatML wrapper adds around the content (two markers plus the user, newline and assistant pieces) |
| 33 | const NSV_ERR_TOO_LONG: i64 = 3 // meta[5] for a prompt past the byte cap or the token cap: refused at the door, never half-encoded |
| 34 | const NSV_PREFILL_BATCHED_DEFAULT: i64 = 1 // R0r: the i8 route prefills in blocks through nf_prefill_batched (nx_nofloat_prefill_gate proves it bit-identical); declared here because its first reader is the scratch allocator |
| 35 | const NSV_EOS1: i64 = 151643 |
| 36 | const NSV_EOS2: i64 = 151645 |
| 330 | const NSV_MODE_I32: i64 = 0 |
| 331 | const NSV_MODE_I8: i64 = 1 |
| 332 | const NSV_MODE_Q4K: i64 = 3 // 2 is the GPU embed grading mode (nsv_embed) -- never reuse it for a decode route |
functions
| 72 | func nsv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 73 | func nsv_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off+i]=s[i];i=i+1} return off+i } |
| 74 | func nsv_catb(dst: *u8, off: i64, s: *u8, n: i64) -> i64 { var i: i64=0; while i<n {dst[off+i]=s[i];i=i+1} return off+n } |
| 75 | func nsv_catn(dst: *u8, off: i64, v: i64) -> i64 called by 12: br_engine_bodybr_engine_body_llamacppnsv_lognnsv_respnsv_handle_streamnsv_handle+6 calls 1: sys_mmap |
| 88 | func nsv_log(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 96 | func nsv_load_meta(path: *u8) -> i64 called by 1: nsv_init calls 14: sys_mmapnsv_logsys_map_filesys_read_filenx_gguf_parsenac_read_config+8 |
| 172 | func nsv_alloc_scratch() -> i64 |
| 238 | func nsv_init_i8(path: *u8) -> i64 |
| 245 | func nsv_init_i32only(path: *u8) -> i64 |
| 253 | func nsv_init_q4k(path: *u8) -> i64 |
| 258 | func nsv_init(path: *u8) -> i64 called by 20: mainmainmainmainmainmain+14 calls 6: sys_now_msnsv_lognf_poolnsv_load_metansv_alloc_scratchnsv_build_caches |
| 277 | func nsv_build_caches() -> i64 called by 1: nsv_init calls 7: nsv_lognf_dequant_head_all_i32sys_mmapnf_dequant_all_layers_i32nq_build_layersnsv_logn+1 |
| 327 | func nsv_logn(v: i64) -> i64 { let t: *u8 = sys_mmap(32); let n: i64 = nsv_catn(t, 0, v); sys_write(1, t, n); return 0 } |
| 333 | func nsv_step(pos: i64, mode: i64) -> i64 |
| 347 | func nsv_prefill_seq(nprompt: i64, mode: i64) -> i64 |
| 360 | func nsv_prefill_i8_batched(nprompt: i64) -> i64 |
| 379 | func nsv_rand(sp: *i64) -> i64 called by 1: nsv_sample |
| 393 | func nsv_sample(sp: *i64) -> i64 |
| 466 | func nsv_next_token(np: *i64) -> i64 |
| 486 | func nsv_emit_piece(tok: i64, ep: *i64) -> i64 |
| 515 | func nsv_chatml_ids(content: *u8, clen: i64) -> i64 |
| 555 | func nsv_prompt_admit(plen: i64) -> i64 |
| 563 | func nsv_generate(gp: *i64) -> i64 |
| 651 | func nsv_kv_snapshot(P: i64) -> i64 |
| 675 | func nsv_kv_restore() -> i64 called by 1: nsv_generate_pfx |
| 700 | func nsv_kv_snapshot_save(path: *u8) -> i64 |
| 718 | func nsv_kv_snapshot_load(path: *u8) -> i64 |
| 750 | func nsv_generate_pfx(gp: *i64, prefix_len: i64, use_snap: i64) -> i64 called by 4: mainlg_taskmainmain calls 12: nsv_prompt_admitnsv_chatml_idstk_bpe_encode_bsys_mmapsys_now_msnsv_kv_restore+6 |
| 863 | func nsv_gwall(fd: i64, buf: *u8, count: i64) -> i64 |
| 874 | func nsv_grall(fd: i64, buf: *u8, count: i64) -> i64 |
| 885 | func nsv_gpu_connect() -> i64 |
| 905 | func nsv_embed(text: *u8, tlen: i64, mode: i64, outvec: *i64) -> i64 called by 4: ce_embedmaince_embednsv_handle calls 10: nsv_prompt_admittk_bpe_encode_bnsv_gpu_connectsys_mmapdequant_rownsv_gwall+4 |
| 945 | func nsv_resp(resb: *u8, rescap: i64, code: i64, ctype: *u8, body: *u8, blen: i64) -> i64 |
| 959 | func nsv_jesc1(dst: *u8, o: i64, c: i64) -> i64 called by 1: nsv_jesc |
| 970 | func nsv_jesc(dst: *u8, off: i64, src: *u8, n: i64) -> i64 |
| 977 | func nsv_jkey(body: *u8, n: i64, key: *u8) -> i64 called by 4: br_engine_parse_resp_llamacppbr_engine_parse_respnsv_parse_gennsv_parse_embed calls 1: nsv_slen |
| 995 | func nsv_jstr(body: *u8, n: i64, p: i64, dst: *u8, dcap: i64) -> i64 |
| 1021 | func nsv_jint(body: *u8, n: i64, p: i64, def: i64) -> i64 |
| 1045 | func nsv_page(dst: *u8, cap: i64) -> i64 |
| 1053 | func nsv_parse_gen(req: *u8, rn: i64, gp: *i64) -> i64 |
| 1108 | func nsv_embed_prefix(task: *u8, tl: i64, kq: i64) -> *u8 called by 1: nsv_handle |
| 1131 | func nsv_parse_embed(req: *u8, rn: i64, ep: *i64) -> i64 |
| 1183 | func nsv_handle_stream(fd: i64, req: *u8, rn: i64) -> i64 |
| 1228 | func nsv_handle(req: *u8, rn: i64, resb: *u8, rescap: i64) -> i64 |