nx_eqsat_vs_gcc_battery_test.nx
buildroot/runtime/nx_eqsat_vs_gcc_battery_test.nx
about
nx_eqsat_vs_gcc_battery_test.nx -- FAIR apples-to-apples op-count battery
for the e-graph optimizer vs gcc -O3 (incumbent oracle, same box).
METRIC (stated explicitly): ARITHMETIC OPERATION COUNT of the optimized
straight-line computation. We count DISTINCT arithmetic nodes in the
emitted DAG (op != CONST, op != VAR), i.e. each shared subexpression once
-- the SAME thing one counts in gcc's asm (add/sub/imul/lea-scale/shl/
shr/sar/and/or/xor/not/neg in the function body, excluding prologue/
epilogue/reg-moves/ret). This is NOT the recursive class_cost (which
double-counts shared children and would UNFAIRLY inflate our number).
NON-CHERRY-PICKED: a fixed battery declared up front; every kernel reported
whatever the verdict (no dropping losers). Each kernel expresses the SAME
computation we hand to gcc in battery.c.
Output per kernel: "<id> <emit_total> <arith_ops> <cost> <root_op> <sat>"
arith_ops is the FAIR metric. cost is class_cost (context only). sat is the
saturate status (4=SATURATED/fixpoint, 5=hit-budget; extraction is sound
either way -- costs only decrease, so budget exhaustion is not an error).
dependencies 1 imports · 0 importers
imports: nx_eqsat.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
| none |
functions
| 23 | func _emit_num(v: i64) -> i64 called by 1: _report |
| 31 | func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 } called by 1: _report |
| 34 | func _emit_eq(out: *NxEmitNode, i: i64, j: i64) -> i64 |
| 51 | func _arith_ops(out: *NxEmitNode, cnt: i64) -> i64 |
| 76 | func _report(id: i64, g: *NxEGraph, root: i64) -> i64 called by 1: main calls 7: nx_eqsat_saturatenx_eqsat_recompute_bestnx_eqsat_best_costnx_eqsat_emit_arith_ops_emit_num+1 |
| 100 | func _fresh(g_out: *i64) -> *NxEGraph |
| 111 | func main() -> i64 |