Skip to content

iwls_runner: pipeline driving mig_egg on IWLS 2026 contest benchmarks#9

Open
kvisaweb wants to merge 1 commit into
Flians:mainfrom
kvisaweb:iwls-runner
Open

iwls_runner: pipeline driving mig_egg on IWLS 2026 contest benchmarks#9
kvisaweb wants to merge 1 commit into
Flians:mainfrom
kvisaweb:iwls-runner

Conversation

@kvisaweb

Copy link
Copy Markdown
Collaborator

Summary

Adds a self-contained pipeline that drives mig_egg on the IWLS 2026 contest benchmarks (100 truth tables ex200..ex299). Two coupled pieces in one atomic commit:

1. mig_egg/src/lib.rs (133-line diff)

  • rules() switched to AIG-only: the 5 AND rewrites already defined in the file (comm_and, comp_and, dup_and, and_true, and_false) are uncommented; majority-language rules are off because they cannot fire on AIG-form input (& a b). associ_and stays off — its O(N²) match cost blows past node_limit on dense ASTs.
  • simplify_depth / simplify_best runners: iter_limit(1000)iter_limit(10) at three sites. egg's time_limit is best-effort and does not bound a single iteration on large e-graphs; tightening iter_limit is what actually keeps wall-clock bounded.
  • New iwls_run test entry: reads $IWLS_PREFIX_FILE (one PO per line, <idx>\t<expr>), calls simplify_best per PO, prints iwls case <idx> best_expr[0] = <expr> for the Python wrapper to grep. $IWLS_FIRST_DEPTH={true,false} switches delay-first vs area-first cost.

2. iwls_runner/ (new top-level folder)

  • 100 IWLS truth tables under benchmarks/
  • scripts/aig_to_prefix.py + prefix_to_aig.py for the two conversions
  • run_one_bench.py (end-to-end one bench), run_all.py (parallel runner), finalize.py (per-bench Pareto + cec verify + contest-shaped zip)
  • examples/smoke_one.sh (ex212, ~30s) and examples/full_run.sh (100 benches, ~30 min on 16 cores)

Full pipeline: truth → ABC strash → AIG → Lisp prefix → mig_egg simplify_best per PO → EQN → ABC strash + resyn2 → AIG → ABC cec -n.

Test plan

  • Smoke validated: ex212 (16in × 16out): 1409 AND / lev 24571 AND / lev 11 (−59% area, −54% delay), cec equivalent, 1.94s wall
  • All paths in scripts use env vars (ELOGIC_REPO_DIR, ABC) or package-relative; no hardcoded absolute paths
  • .gitignore covers results/ so per-run outputs don't leak into commits
  • Full 100-bench run on reviewer's hardware (~30 min on 16 cores; long-tail benches like ex299, ex230, ex252 are expected to hit egg's node_limit(5000) ceiling — that's a real saturation cap of the AIG ruleset on densely shared graphs, not a timeout)

Quick start

git checkout iwls-runner
cd mig_egg && cargo build --release --tests --no-default-features
cd ../iwls_runner
export ELOGIC_REPO_DIR="$(cd .. && pwd)"
export ABC=/path/to/abc
bash examples/smoke_one.sh        # 30s sanity check
bash examples/full_run.sh         # full 100-bench + finalize

Full doc in iwls_runner/README.md on the branch.

🤖 Generated with Claude Code

Two coupled pieces, intentionally atomic:

1. mig_egg/src/lib.rs (133-line diff)
   - rules() switched to AIG-only. Majority-language rewrites are
     commented out because they cannot fire on AIG-form input (& a b);
     the 5 AND-language rules already defined in the file (comm_and,
     comp_and, dup_and, and_true, and_false) are uncommented. associ_and
     stays off because its O(N^2) match cost blows past node_limit on
     dense ASTs.
   - simplify_depth / simplify_best runners: iter_limit(1000) ->
     iter_limit(10). egg's time_limit is best-effort and does not bound
     a single iteration on large e-graphs; tightening iter_limit is what
     actually keeps wall-clock bounded.
   - New iwls_run test entry: reads $IWLS_PREFIX_FILE (one PO per line,
     "<idx>\t<expr>"), calls simplify_best per PO, and prints
     "iwls case <idx> best_expr[0] = <expr>" so a Python wrapper can
     grep the optimized expressions out. $IWLS_FIRST_DEPTH={true,false}
     chooses delay-first vs area-first cost.

2. iwls_runner/ (new top-level folder)
   - 100 IWLS contest truth tables under benchmarks/ex2NN.truth.
   - Pipeline: truth -> ABC strash -> AIG -> Lisp prefix
     -> mig_egg simplify_best per PO -> EQN -> ABC strash + resyn2
     -> binary AIGER -> ABC cec -n.
   - scripts/aig_to_prefix.py + prefix_to_aig.py for the two conversions;
     scripts/run_one_bench.py for end-to-end one bench;
     scripts/run_all.py for parallel; scripts/finalize.py for
     per-bench Pareto + cec + contest zip.
   - examples/smoke_one.sh (ex212, ~30s) and examples/full_run.sh
     (100 benches, ~30 min on 16 cores).

Quick start (with this branch checked out):

  cd mig_egg && cargo build --release --tests --no-default-features
  cd ../iwls_runner
  export ELOGIC_REPO_DIR="$(cd .. && pwd)"
  export ABC=/path/to/abc
  bash examples/smoke_one.sh

Smoke validation (ex212): 1409 AND / lev 24 -> 571 AND / lev 11
(-59% area, -54% delay), cec equivalent, 1.94s wall.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant