code wiki / (root) / nx_gpu_embed_gate.nx

nx_gpu_embed_gate.nx

buildroot/runtime/nx_gpu_embed_gate.nx

9279 B231 linesdepth 10pulls 22 transitivereach 0 importersview sourcekind gate/prooftopic gpu
docsdependenciesstructsconstsfunctions

about

nx_gpu_embed_gate.nx -- E-ARC e4 (2026-07-15): the NISHILANG GPU-EMBED CLIENT, gated BIT-EXACT vs the CPU path. This organ IS the #23 serve-integration contract rehearsed end-to-end: NishiLang keeps tokenize (tk_bpe_encode) + dequant_row (embedding lookup); the resident-weight GPU server (/home/elderwesto/nx_stage/nx_gpu.sock, gpu_embed_serve.c --serve, C=bootstrap oracle) runs the 24-layer forward; embed protocol = send [pos:-(i+1) i64][x1: 896 i64] per token, reply = the last-token pooled final-norm hidden state [896 i64] (the jina-recipe embedding, no LM head). GATES: T1/T2 BIT-EXACT two texts: GPU-socket embedding == nsv_embed (CPU i8) vector, 896/896 T3 DISTINCT the two texts' vectors differ (comparator sanity) T4 NEG perturbing the last token's embedding row by +1 MUST break equality Requires: coder GGUF staged + GPU server running persistent. The 2nd model read (~676MB) is the price of file-scoped serve statics -- the real serve integration runs in-process and pays nothing. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_nofloat_serve_core.nx nx_lib_std.nx nx_gpu_embed_gate.nx

imports: nx_nofloat_serve_core.nxnx_lib_std.nx

imported by: nobody (leaf or entry point)

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

main ge2_ws 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 ↻ nx_le_read_u32 ↻

structs

none

consts

17const GE_NE: i64 = 896

functions

19func ge2_ws(s: *u8) -> i64
called by 2: ge2_kvmain
26func ge2_kv(label: *u8, v: i64) -> i64
called by 1: main calls 2: ge2_wsstd_pdec
35func ge2_connect() -> i64
called by 1: main calls 2: sys_socketsys_connect
49func ge2_wall(fd: i64, buf: *u8, count: i64) -> i64
called by 1: ge2_gpu_embed
60func ge2_rall(fd: i64, buf: *u8, count: i64) -> i64
called by 1: ge2_gpu_embed calls 1: sys_read
71func ge2_slen(s: *u8) -> i64
called by 1: main
81func ge2_gpu_embed(sock: i64, mp: *i64, text: *u8, tlen: i64, gpuvec: *i64, perturb_last: i64) -> i64
105func ge2_mismatches(a: *i64, b: *i64) -> i64
called by 1: main
112func main() -> i64