code wiki / _hdl_build / nx_eqsat_dsl_bench.nx

nx_eqsat_dsl_bench.nx

buildroot/runtime/_hdl_build/nx_eqsat_dsl_bench.nx

7333 B139 linesdepth 7pulls 9 transitivereach 0 importersview sourcekind benchtopic eqsat
docsdependenciesstructsconstsfunctions

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

nx_eqsat.nx nx_eqsat_dsl_bench.nx

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

main _fill_4rule_table nx_eqsat_dsl_set_row _one_iter nx_eqsat_init 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 nx_hmap_get nx_hmap_probe_find ↻ nx_hmap_entry_at ↻ nx_eqsat_node_matches

structs

none

consts

25const K_MAGIC_100000: i64 = 100000

functions

27func _emit_num(v: i64) -> i64
called by 1: main
35func _emit_str(s: *u8, len: i64) -> i64 { sys_write(1, s, len); return 0 }
called by 1: main
36func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: main
39func _fill_4rule_table(table: *NxDslRule) -> i64
called by 1: main calls 1: nx_eqsat_dsl_set_row
60func _one_iter(eg: *NxEGraph, table: *NxDslRule,
97func main() -> i64