code wiki / _hdl_build / nx_bench_ingest.nx

nx_bench_ingest.nx

buildroot/runtime/_hdl_build/nx_bench_ingest.nx

11867 B310 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind benchtopic bench
docsdependenciesstructsconstsfunctions

about

nx_bench_ingest.nx -- THE GENERIC BENCHMARK INGEST (rule 15 DRY; the second half of nx_bench_fetch). WHY: nx_swebv_ingest and nx_gmmlu_ingest are ~90% the same body -- an escape-aware JSON row walker whose only real difference is WHICH FIELD NAMES it pulls. Baking field names into source means a new organ per benchmark, and (per the ~119 *_research_fetch family) every copy inherits the original's latent bugs. Here the field names are ARGUMENTS, so a new card axis is a DATA row, not a new organ (rule 11). nx_bench_ingest <rawpath> <first_field> <id_field> <q_field> <opts_csv|-> <a_field> <taskpfx> <goldpfx> first_field = the FIRST feature of the row object; the row anchor is "row":{"<first_field>":" opts_csv = e.g. option_a,option_b,option_c,option_d (or `-` for a non-multiple-choice set) emits taskpfx : id <TAB> question [<TAB> opt]... (NEVER the answer -- contamination split) goldpfx : id <TAB> answer Same correctness core as the bespoke organs it replaces: escape-aware value end (terminating '"' = one preceded by an EVEN run of backslashes, so text containing \" cannot mis-terminate a field), row search BOUNDED to [row,next-row) so a malformed row cannot steal a sibling's fields, values stored JSON-escaped verbatim (TAB/NEWLINE-safe by construction), truncations COUNTED not silent, and fail-closed: task==gold and >0 or NEITHER store is touched. expect_exit: 0 (GREEN) | 1 RED | 2 usage license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_store_seed_lib.nx nx_seg_store.nx nx_syscalls.nx nx_bench_ingest.nx

imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main bi_werr sys_write bi_slen sys_exit sys_mmap bi_cat bi_needle bi_cat ↻ bi_read sys_openat_rd sys_read sys_close bi_scan sys_mmap ↻ bi_needle ↻ bi_find bi_slen ↻ bi_field bi_find ↻ bi_slen ↻ bi_vend bi_t_n bi_t_c sys_mmap ↻ bi_t_slice bi_col sys_mmap ↻ bi_needle ↻ bi_field ↻ bi_t_c ↻ bi_t_slice ↻ bi_opts sys_mmap ↻ bi_col ↻ bi_t_c ↻ bi_g_n bi_g_c sys_mmap ↻ bi_g_slice

structs

none

consts

35const BI_FCAP: i64 = 8388608
36const BI_OCAP: i64 = 4194304
37const BI_FIELDCAP: i64 = 16384
38const BI_NDLCAP: i64 = 256
39const BI_SBCAP: i64 = 2048
40const BI_TAB: i64 = 9
41const BI_NL: i64 = 10
42const BI_Q: i64 = 34
43const BI_BSL: i64 = 92
44const BI_COMMA: i64 = 44
45const BI_STDERR: i64 = 2
46const BI_D0: i64 = 48
47const BI_B10: i64 = 10
48const BI_NUMB: i64 = 24
49const BI_EXIT_RED: i64 = 1
50const BI_EXIT_USAGE: i64 = 2
51const BI_ARGC: i64 = 9
52const BI_DASH: i64 = 45

functions

54func bi_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
55func bi_werr(s: *u8) -> i64 { sys_write(BI_STDERR, s, bi_slen(s)); return 0 }
called by 1: main calls 2: sys_writebi_slen
56func bi_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
70func bi_cat(d: *u8, off: i64, s: *u8) -> i64
called by 2: bi_needlemain
76func bi_catn(d: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
89func bi_needle(dst: *u8, field: *u8) -> i64
called by 3: bi_colbi_scanmain calls 1: bi_cat
101func bi_find(buf: *u8, needle: *u8, from: i64, limit: i64) -> i64
called by 2: bi_fieldbi_scan calls 1: bi_slen
115func bi_vend(buf: *u8, vs: i64, limit: i64) -> i64
called by 1: bi_field
129func bi_field(buf: *u8, needle: *u8, from: i64, limit: i64) -> i64
called by 2: bi_colbi_scan calls 3: bi_findbi_slenbi_vend
136func bi_t_c(c: i64) -> i64 { if g_to < BI_OCAP - 2 { g_t[g_to] = c as u8; g_to = g_to + 1 } return 0 }
called by 3: bi_t_nbi_colbi_scan
137func bi_g_c(c: i64) -> i64 { if g_go < BI_OCAP - 2 { g_g[g_go] = c as u8; g_go = g_go + 1 } return 0 }
called by 2: bi_g_nbi_scan
138func bi_t_slice(buf: *u8, a: i64, b: i64) -> i64
called by 2: bi_colbi_scan
145func bi_g_slice(buf: *u8, a: i64, b: i64) -> i64
called by 1: bi_scan
153func bi_t_n(v: i64) -> i64
called by 1: bi_scan calls 2: bi_t_csys_mmap
164func bi_g_n(v: i64) -> i64
called by 1: bi_scan calls 2: bi_g_csys_mmap
176func bi_col(buf: *u8, f: *u8, a: i64, limit: i64) -> i64
187func bi_opts(buf: *u8, csv: *u8, a: i64, limit: i64) -> i64
called by 1: bi_scan calls 2: sys_mmapbi_col
212func bi_scan(buf: *u8, n: i64, anchor: *u8, idf: *u8, qf: *u8, optcsv: *u8, af: *u8) -> i64
255func main(argc: i64, argv: *i64) -> i64