code wiki / _hdl_build / nx_apex_gcc_bench.nx

nx_apex_gcc_bench.nx

buildroot/runtime/_hdl_build/nx_apex_gcc_bench.nx

12583 B249 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind bench
docsdependenciesstructsconstsfunctions

about

nx_apex_gcc_bench.nx -- APEX RUNG 1: FAIR head-to-head vs gcc -O3. EXTENDS runtime/nx_eqsat_vs_gcc_battery_test.nx (global rule #15: reuse, don't reinvent). Same 8-kernel fixed battery, same FAIR deduped op-count metric, but ALSO emits the EQUIVALENCE-CERTIFICATE axis the rung-1 brief requires: prov ON, every merge cited through the single nx_eqsat_union_cited chokepoint; after saturation we verify every logged rule_id is in the proven-sound allow-list {1..10} and prov_overflow==0. A RULE_NONE (0) or overflow POISONS the cert. TWO AXES, reported separately: AXIS A (op-count): deduped arithmetic-node count of the extracted min-cost form, vs the arithmetic ops in gcc -O3 -S of the SAME computation (counted by the FROZEN LEA rule, see bench .c). AXIS B (verified-equivalence): membership-proof certificate -- gcc has none. METRIC NOTE: op-count is ONE-PER-ARITHMETIC-INSTRUCTION on both sides; MUL is NOT double-charged. The internal class_cost (mul=3, div=30) is the EXTRACTION objective only and is reported for context, never as the head-to-head number. Output per kernel: "<id> <emit_total> <arith_ops> <cost> <root_op> <sat> <cert>" cert = 1 PROVEN-EQUIVALENT (all merges cited 1..10, no overflow), 0 POISONED.

dependencies 2 imports · 0 importers

nx_eqsat.nx nx_itoa_lib.nx nx_apex_gcc_bench.nx

imports: nx_eqsat.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main _fresh nx_eqsat_init nx_eqsat_enable_constfold sys_mmap nx_eqsat_enable_prov _mk_apex_table nx_eqsat_builtin_dsl_table nx_eqsat_dsl_set_row nx_eqsat_enable_dsl nx_eqsat_add_var nx_eqsat_add nx_eqsat_op_is_valid nx_eqsat_arity_for nx_cf_intern_const nx_eqsat_add_const nx_eqsat_add ↻ nx_eqsat_mix nx_cf_make_const_node nx_eqsat_new_class nx_eqsat_find nx_eqsat_find ↻ nx_eqsat_fold_value nx_eqsat_op_to_gate_kind nx_gsim_kind_supported nx_eqsat_arity_for ↻ nx_eqsat_find ↻ nx_gsim_eval_cell nx_eqsat_op_cost nx_eqsat_new_class ↻ nx_eqsat_union_cited nx_eqsat_find ↻ nx_eqsat_log_rule nx_eqsat_push_dirty nx_eqsat_fingerprint nx_eqsat_mix ↻ nx_hmap_has nx_hmap_probe_find nx_hmap_hash nx_hmap_entry_at

structs

none

consts

25const K_MAGIC_4096: i64 = 4096

functions

31func _emit_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: _report calls 1: nxi_out
32func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: _report
35func _emit_eq(out: *NxEmitNode, i: i64, j: i64) -> i64
called by 2: _emit_eq_arith_ops calls 1: _emit_eq
52func _arith_ops(out: *NxEmitNode, cnt: i64) -> i64
called by 1: _report calls 1: _emit_eq
79func _cert_ok(g: *NxEGraph) -> i64
called by 1: _report
97func _report(id: i64, g: *NxEGraph, root: i64) -> i64
128func _mk_apex_table() -> *NxDslRule
144func _fresh() -> *NxEGraph
157func main() -> i64