simplify pimcomp compare workflow
Validate Operations / validate-operations (push) Has been cancelled

This commit is contained in:
NiccoloN
2026-07-28 15:11:56 +02:00
parent 78bfb8a9aa
commit 060a21172e
9 changed files with 231 additions and 149 deletions
+30 -31
View File
@@ -136,12 +136,11 @@ random placement code occasionally segfaults; an unchanged retry succeeded in
the observed cases.
The paper's optimizer uses a genetic algorithm with population 200 and up to
1000 iterations. Select it with `-r=GA` for optimizer studies. The released
source keeps population 200 but sets `max_iteration = 3`, so reproducing the
paper's optimization search also requires changing that value in
`backend/GeneticAlgorithm.h`. GA allocates roughly 32 GB in its fast evaluator;
use monolith below instead of reducing cores or crossbars when local RAM is
insufficient.
1000 iterations. The checked-out PIMCOMP submodule already has both paper
settings in `backend/GeneticAlgorithm.h`; select them with `-r=GA`. Fitness
evaluation uses OpenMP and bounded bandwidth timelines. Set `OMP_NUM_THREADS`
to control its parallelism; otherwise OpenMP uses the available CPUs. The GA
uses the fixed seed `1`, so repeated serial and parallel runs are reproducible.
## Compare Raptor and PIMCOMP
@@ -150,34 +149,37 @@ compiles both instruction streams, runs both through `pimsim-nn`, validates
Raptor through the Rust simulator, and writes Markdown and JSON reports.
PIMCOMP Rust validation also runs when its optional exporter is available.
To reproduce the complete Arch-A latency experiment, use the serial experiment
runner. It creates an isolated PIMCOMP build with population 200 and 1000 GA
iterations, runs only the `element`/batch-1 latency pipeline, and invokes the
comparison driver for one model at a time:
To reproduce the complete Arch-A latency experiment, use the model-by-model
runner. It verifies the paper GA settings, builds Raptor and the existing
`third_party/PIMCOMP-NN/build` tree, then runs the `element`/batch-1 comparison
for one model at a time:
```bash
.venv/bin/python validation/tools/run_pimcomp_paper_latency.py \
--out-dir /tmp/raptor-pimcomp-paper-latency
.venv/bin/python validation/tools/run_pimcomp_paper_latency.py
```
Reports are written under `<out-dir>/<model>/comparison_report.{md,json}`.
Use `--models vgg8` to run one model, `--resume` after an interruption, or
`--dry-run` to inspect every command. The runner continues after a failed model
so all reports are produced.
Each model directory reuses regular validation's ignored `inputs/`, `outputs/`,
`runner/`, `raptor/`, and `simulation/` paths. PIMCOMP-only artifacts and
`comparison_report.{md,json}` live under `pimcomp/`. The frontend regenerates
one isolated `models/JSON/` graph because PIMCOMP requires that relative
layout; it is removed after a successful backend run and the shared submodule
model directory is never modified. Models requiring BatchNormalization folding
also receive a prepared ONNX file; other models use the original ONNX directly.
PIMCOMP's source tree and build directory remain unchanged at runtime. Use
`--models vgg8` to run one model, `--resume` after an interruption, `--dry-run`
to inspect every command, or `--out-dir PATH` to keep results outside
`validation/`. The runner continues after a failed model so all reports are
produced.
Arch-A low-latency example:
```bash
RAPTOR_ROOT=$PWD
PIMCOMP="$RAPTOR_ROOT/third_party/PIMCOMP-NN"
CONFIG_BACKUP=$(mktemp)
cp "$PIMCOMP/config.json" "$CONFIG_BACKUP"
trap 'cp "$CONFIG_BACKUP" "$PIMCOMP/config.json"' EXIT
cp "$RAPTOR_ROOT/validation/pimsim_configs/pimcomp/arch-a/latency_config.json" "$PIMCOMP/config.json"
"$RAPTOR_ROOT/.venv/bin/python" "$RAPTOR_ROOT/validation/tools/compare_raptor_pimcomp.py" \
--model "$RAPTOR_ROOT/validation/networks/pimcomp_models/resnet34/resnet34-v1-7.onnx" \
--out-dir /tmp/compare-resnet34-arch-a-ll \
--out-dir "$RAPTOR_ROOT/validation/networks/pimcomp_models/resnet34" \
--pimcomp-config "$RAPTOR_ROOT/validation/pimsim_configs/pimcomp/arch-a/latency_config.json" \
--core-count 168 \
--crossbar-count 96 \
--crossbar-size 128 \
@@ -196,11 +198,9 @@ If only semantic and instruction comparison is required, add
`--skip-pimsim-nn`. A VGG-8 run with the same Arch-A LL settings passed both
semantic validations with maximum output differences below `5e-10`.
The current PIMCOMP-NN submodule does not include the optional
`verification/export_to_pim_simulator.py` helper. The driver therefore records
PIMCOMP Rust semantic validation as skipped, while PIMCOMP compilation,
instruction reporting, and `pimsim-nn` latency still run. Use
`--fail-on-error` only when that semantic export helper is available.
The comparison runner enables `--fail-on-error`, so a failed compiler,
simulation, or semantic validation makes the command fail while preserving the
generated report.
Current Raptor status:
@@ -247,14 +247,13 @@ python3 -m venv .venv
.venv/bin/python -m pip install numpy onnx onnxruntime onnxsim colorama
# Run every latency comparison serially.
.venv/bin/python validation/tools/run_pimcomp_paper_latency.py \
--out-dir /tmp/raptor-pimcomp-paper-latency
.venv/bin/python validation/tools/run_pimcomp_paper_latency.py
```
Copy reports back without transferring large compiler artifacts:
```bash
rsync -az --include='*/' --include='comparison_report.*' --exclude='*' \
monolith:/tmp/raptor-pimcomp-paper-latency/ \
/tmp/raptor-pimcomp-paper-latency/
"monolith:$REMOTE_REPO/validation/networks/pimcomp_models/" \
validation/networks/pimcomp_models/
```
@@ -25,7 +25,6 @@ No throughput experiment was run.
```bash
.venv/bin/python validation/tools/run_pimcomp_paper_latency.py \
--out-dir /tmp/raptor-pimcomp-paper-latency \
--models googlenet
```