code wiki / _hdl_build / nx_eqsat_dsl_bench.nx
nx_eqsat_dsl_bench.nx
buildroot/runtime/_hdl_build/nx_eqsat_dsl_bench.nx
about
nx_eqsat_dsl_bench.nx -- RULE-HEAVY race: the sovereign NishiLang DSL e-matcher
vs egg 0.11 (race_egg/examples/nx_dsl_bench.rs), SAME expression, SAME 4 rules,
engine-only (build->saturate->recompute_best->extract->read-root), honest us/op.
The DSL e-matcher (nx_eqsat_apply_dsl_table over a DATA table) drives saturation
-- the same general matcher proven byte-equivalent to the inline rules and proven
to apply the new (xor x x)==0 data rule. Here it runs the 4-rule subset that egg
races (add_zero, sub_self, mul_one, mul_pow2) so the e-matching work is 1:1.
Rule-heavy expression (touches 4 rules in ONE graph):
(+ (* (- y y) 1) (* x 8))
(- y y) -> 0 (sub_self)
(* 0 1) -> 0 (mul_one)
(+ 0 (* x 8)) -> (* x 8) (add_zero)
(* x 8) -> (<< x 3) (mul_pow2) best extracted = (<< x 3)
FAIL LOUD: if the extracted root is not SHL the harness sys_exit(nonzero) BEFORE
timing -- a fast wrong answer is not a win. Same honesty discipline as the
existing nx_eqsat_race_bench.nx (egg's exact pipeline, no proxy, no proof
machinery in the timed loop -- egg has none).
Output (one line): NX_DSL_BENCH iters=100000 total_us=<t> us_per_op_ns=<u>
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
| 25 | const K_MAGIC_100000: i64 = 100000 |
functions
| 27 | func _emit_num(v: i64) -> i64 called by 1: main |
| 35 | func _emit_str(s: *u8, len: i64) -> i64 { sys_write(1, s, len); return 0 } called by 1: main |
| 36 | func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 } called by 1: main |
| 39 | func _fill_4rule_table(table: *NxDslRule) -> i64 |
| 60 | func _one_iter(eg: *NxEGraph, table: *NxDslRule, |
| 97 | func main() -> i64 |