Skip to content

Add MoE route-trace replay and timing validation#94

Draft
Happymic wants to merge 3 commits into
feat/emulator-timing-corefrom
feat/window1-p1-timing-replay
Draft

Add MoE route-trace replay and timing validation#94
Happymic wants to merge 3 commits into
feat/emulator-timing-corefrom
feat/window1-p1-timing-replay

Conversation

@Happymic

@Happymic Happymic commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What This PR Does

This PR adds the first route-trace replay harness for MoE timing. It lets us feed a deterministic routing trace into the emulator, run the corresponding workload, and check the resulting timing/byte accounting.

Concrete Changes

  • Adds a route-trace schema and validator.
  • Adds a sample trace generator for small deterministic timing tests.
  • Adds a replay runner that consumes trace data and drives emulator workloads.
  • Adds export utilities for timing results.
  • Adds validation gates for cycle totals, HBM bytes, overlap assumptions, and timing-stack sanity checks.
  • Adds an opt-in prefetch/compute overlap timing path plus an overlap golden workload.
  • Adds a portable timing smoke script that uses PLENA_VENV, PLENA_PYTHON, or the current Python instead of a hardcoded local path.

Why This Is Separate

This PR proves the measurement workflow on controlled traces before connecting it to Qwen real-routing data. It is the bridge between the timing core in #93 and the Qwen-specific replay in #95.

Validation

Ran locally before the portability cleanup:

nix develop -c bash -lc 'cd transactional_emulator && cargo build --release && cargo test --workspace --release'

export PLENA_ROOT=/path/to/plena
export PYTHONPATH="$PWD:$PWD/PLENA_Compiler:$PWD/PLENA_Tools:$PWD/transactional_emulator/testbench${PYTHONPATH:+:$PYTHONPATH}"
python3 transactional_emulator/testbench/timing_goldens/check_timing_goldens.py --plena-root "$PLENA_ROOT"
python3 transactional_emulator/testbench/timing_goldens/check_timing_goldens.py \
  --fixture transactional_emulator/testbench/timing_goldens/overlap_golden_workloads.json \
  --plena-root "$PLENA_ROOT"

After removing the hardcoded local venv path:

bash -n transactional_emulator/testbench/timing_goldens/run_timing_smoke.sh

@Happymic Happymic changed the title Add Window 1 P1 route-trace timing replay harness Add MoE route-trace replay and timing validation 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