Skip to content

Add Qwen3 MoE route-trace generation and replay#95

Draft
Happymic wants to merge 3 commits into
feat/window1-p1-timing-replayfrom
feat/window1-p2-qwen-replay
Draft

Add Qwen3 MoE route-trace generation and replay#95
Happymic wants to merge 3 commits into
feat/window1-p1-timing-replayfrom
feat/window1-p2-qwen-replay

Conversation

@Happymic

@Happymic Happymic commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What This PR Does

This PR connects the generic replay harness to Qwen3 MoE routing. It adds the scripts needed to build Qwen route traces from real model inputs/weights and replay those traces through the emulator for pilot timing runs.

Concrete Changes

  • Adds Qwen route-trace generation from tokenized benchmark inputs and local model weights.
  • Adds a Qwen trace replay test that builds deterministic emulator workloads from those traces.
  • Adds a batch runner for many traces with resume, skip-existing, keep-going, and failure logging.
  • Adds result export utilities for pilot timing summaries.
  • Adds artifact pruning so successful runs do not keep large .pt/memory dump files unnecessarily.
  • Uses the repo-derived REPO_ROOT for subprocess cwd instead of a hardcoded local path.

What This PR Does Not Do

  • It does not commit model weights.
  • It does not commit generated route traces or timing outputs.
  • It does not claim final GPQA/BFCL results. It adds the pilot harness needed to produce them.

Why This Is Separate

P1 (#94) proves replay on controlled traces. This PR makes replay useful for the real Qwen MoE workload path.

Validation

Ran locally:

export PLENA_ROOT=/path/to/plena
source "$PLENA_ROOT/venvs/plena-py311/bin/activate"
export PYTHONPATH="$PWD:$PWD/PLENA_Compiler:$PWD/PLENA_Tools:$PWD/transactional_emulator/testbench${PYTHONPATH:+:$PYTHONPATH}"
python -m compileall -q transactional_emulator/testbench/emulator_runner.py transactional_emulator/testbench/window1_p2
python -m transactional_emulator.testbench.window1_p2.build_route_traces --help
python -m transactional_emulator.testbench.window1_p2.run_trace_batch --help
python -m transactional_emulator.testbench.window1_p2.qwen3_trace_replay_test --help
python -m transactional_emulator.testbench.window1_p2.generate_true_routing_with_weights --help

After the portable cwd cleanup:

python -m compileall -q transactional_emulator/testbench/window1_p2
python -m transactional_emulator.testbench.window1_p2.run_trace_batch --help

Michael C Li and others added 3 commits July 6, 2026 18:46
Sidecar harness that turns real BFCL/GPQA samples into router traces
(true Qwen3 top-k expert ids + route weights) and replays them through
the Rust emulator to emit timing / routing-tax / stage-stack / bytes
tables. Additive only: no default timing path, RTL, or compiler changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Happymic Happymic changed the title Add Window 1 P2 Qwen route-trace replay harness Add Qwen3 MoE route-trace generation and replay Jul 6, 2026
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