code wiki / (root) / nx_vecexec.nx

nx_vecexec.nx

buildroot/runtime/nx_vecexec.nx

6767 B169 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_vecexec.nx -- VECTORIZED EXECUTION (vectorized-exec, F-vec). The DuckDB model, single-core: operators consume/produce COLUMN VECTORS (batches of VX_VEC values) over the zero-copy nx_colframe, instead of a tuple-at-a-time pipeline that pays operator-dispatch overhead per row. A filter emits a SELECTION VECTOR; downstream operators gather over it. Batch loops are branch-lean and cache-resident (and the shape a SIMD backend auto-vectorises). NOT threading -- this is the batch/columnar execution model, provably single-core. Composes nx_colframe (reads columns as zero-copy views). license_tier: ORIGINAL No hw writes.

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_colframe.nx nx_vecexec.nx nx_vecexec_gate.nx

imports: nx_syscalls.nxnx_colframe.nx

imported by: nx_vecexec_gate.nx

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

main sys_mmap vx_atoi vx_bench sys_mmap ↻ cf_encoded_bytes cf_slen cf_align8 cf_encode cf_align8 ↻ sys_now_us sys_mmap ↻ sys_clock_gettime_mono vx_scalar_sum_where_ge cf_nrows cf_col cf_data_off vx_pred_ge vx_sum_where_ge vx_filter_ge cf_nrows ↻ cf_col ↻ vx_sum_sel cf_col ↻ vx_raw vx_num sys_mmap ↻ sys_write

structs

none

consts

9const VX_MAGIC_12345: i64 = 12345
10const VX_MAGIC_1103515245: i64 = 1103515245
11const VX_MAGIC_4000000: i64 = 4000000
13const VX_VEC: i64 = 1024 // vector (batch) width -- the granularity operators process
14const VX_OUT: i64 = 4096
15const VX_ZERO: i64 = 48

functions

19func vx_sum(frame: *u8, ci: i64) -> i64
called by 1: main calls 2: cf_nrowscf_col
34func vx_filter_ge(frame: *u8, ci: i64, thr: i64, sel: *i64) -> i64
called by 2: vx_sum_where_gemain calls 2: cf_nrowscf_col
49func vx_sum_sel(frame: *u8, ci: i64, sel: *i64, nsel: i64) -> i64
called by 1: vx_sum_where_ge calls 1: cf_col
57func vx_count_ge(frame: *u8, ci: i64, thr: i64) -> i64
called by 1: main calls 2: cf_nrowscf_col
72func vx_sum_where_ge(frame: *u8, sumci: i64, filtci: i64, thr: i64, sel: *i64) -> i64
called by 2: vx_benchmain calls 2: vx_filter_gevx_sum_sel
78func vx_pred_ge(v: i64, thr: i64) -> i64 { if v >= thr { return 1 } return 0 }
79func vx_scalar_sum_where_ge(frame: *u8, sumci: i64, filtci: i64, thr: i64) -> i64
90func vx_raw(out: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 1: vx_bench
91func vx_num(out: *u8, o: i64, v: i64) -> i64
called by 1: vx_bench calls 1: sys_mmap
103func vx_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; var go: i64 = 1; while go == 1 { let c: i64 = s[i] as i64; if c < 48 { go = 0 } else { if c > 57 { go = 0 } else { v = v * 10 + (c - 48); i = i + 1 } } } return v }
called by 1: main
105func vx_bench(nrows: i64, out: *u8) -> i64
161func main(argc: i64, argv: *i64) -> i64