code wiki / _hdl_build / nx_apex_gcc_bench.nx
nx_apex_gcc_bench.nx
buildroot/runtime/_hdl_build/nx_apex_gcc_bench.nx
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
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
structs
| none |
consts
| 25 | const K_MAGIC_4096: i64 = 4096 |
functions
| 31 | func _emit_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 32 | func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 } called by 1: _report |
| 35 | func _emit_eq(out: *NxEmitNode, i: i64, j: i64) -> i64 |
| 52 | func _arith_ops(out: *NxEmitNode, cnt: i64) -> i64 |
| 79 | func _cert_ok(g: *NxEGraph) -> i64 called by 1: _report |
| 97 | func _report(id: i64, g: *NxEGraph, root: i64) -> i64 called by 1: main calls 8: nx_eqsat_saturatenx_eqsat_recompute_bestnx_eqsat_best_costnx_eqsat_emit_arith_ops_cert_ok+2 |
| 128 | func _mk_apex_table() -> *NxDslRule |
| 144 | func _fresh() -> *NxEGraph |
| 157 | func main() -> i64 |