rework documentation
Validate Operations / validate-operations (push) Failing after 3h10m55s

add plot generation scripts
adjust validation tools
add up-to-date results
This commit is contained in:
NiccoloN
2026-10-19 16:34:01 +02:00
parent 9053cc5e8b
commit 034c197260
33 changed files with 3077 additions and 1798 deletions
+1
View File
@@ -0,0 +1 @@
plots/
+55 -60
View File
@@ -1,78 +1,73 @@
# Raptor compiler ablation
`run_ablation.py` performs the complete synchronization/Spatial-planning
ablation study on the Pimcomp model suite. By default it runs `vgg8`,
`resnet18`, `resnet34`, and `googlenet` across `arch-a` and `arch-b`, latency,
and throughput pipeline 4. `arch-c` and `yolo11n` are run only when selected
explicitly.
Latency is pipeline 1; the wrapper invokes the suite runner separately for
latency and throughput pipeline 4.
Run the synchronization/Spatial-planning ablation from the repository root:
```bash
.venv/bin/python validation/tools/pim/ablation/run_ablation.py \
--jobs 4
.venv/bin/python validation/tools/pim/ablation/run_ablation.py --jobs 4
```
## Variants
Defaults: `vgg8 resnet18 resnet34 googlenet`, `arch-a arch-b`, latency
(pipeline 1), and throughput (pipeline 4). Select `yolo11n` or `arch-c`
explicitly when needed. Only Raptor runs; Pimcomp validation is `SKIPPED`.
| Variant | Raptor options |
|---|---|
| `baseline` | None. |
| `baseline` | None |
| `no-sync` | `--pim-disable-synchronization` |
| `no-plan` | `--pim-disable-spatial-planning` |
| `no-sync-no-plan` | Both options. |
| `no-sync-no-plan` | Both options |
Every variant runs Raptor only. Pimcomp is not compiled, validated, or
simulated; its validation column is `SKIPPED`, not `FAIL`. Reference inputs and
outputs are generated once under the shared common-artifact root and reused by
every variant. Ctrl+C terminates the active variant and all of its worker jobs.
## Options and outputs
Removing synchronization deliberately removes host-buffer lifetime and pipeline
restart guarantees. The `no-sync` variants can therefore fail numerical
validation, especially across repeated throughput inputs. Those failures remain
`FAIL` and cause a nonzero exit; a completed ablation is not proof that every
variant is correct. Baseline and `no-plan` must still pass numerical validation.
The combined CSV retains `functional_validation` for every row. Performance
percentages from failing variants describe incorrect programs, not valid
speedups. Throughput deadline averages likewise do not establish a converged
steady-state period.
- `--variant NAME`: repeat to select variants; baseline is always included.
- `--out-dir PATH`: artifact root; defaults to `validation/networks/pimcomp_models`.
- `--dry-run`: print commands without modifying files.
The percentage baseline is `baseline`, so its available values are `+0.00%`.
Every other
variant reports the signed percentage difference of its Raptor metrics from
that reference for the same model, architecture, mode, and pipeline. Positive
values mean the metric is higher; negative values mean it is lower.
Other [suite-runner options](../pimcomp/compare/README.md), including `--models`,
`--archs`, and `--no-fast`, are forwarded. Supplying `--mode` or `--pipeline`
replaces the default latency/pipeline-4 case set. `--only` is rejected because
the wrapper always runs Raptor only. Ctrl+C stops the active variant's workers.
## Options
Artifacts use `<out-dir>/<model>/artifacts/<arch>/<mode>[/pipelineN]/ablation/<variant>/`;
reference inputs, outputs, and runners are shared under `artifacts/common/`.
Per-variant summaries use `<out-dir>/ablation/<variant>/results_comparison.csv`.
Normal comparison results are preserved.
| Option | Description and default |
|---|---|
| `-h`, `--help` | Show help and exit. |
| `--out-dir PATH` | Suite root. Default: `validation/networks/pimcomp_models`. Model artifacts are stored below `<out-dir>/<model>/artifacts/<arch>/<mode>[/pipelineN]/ablation/<variant>`. Variant summaries remain under `<out-dir>/ablation/<variant>/`. |
| `--models MODEL [...]` | Models to run. Default: `vgg8 resnet18 resnet34 googlenet`; include `yolo11n` explicitly when needed. |
| `--variant NAME` | Select a variant from the table above; repeat for multiple variants. Default: all variants. The feature-full baseline and percentage reference are added automatically when needed. |
| `--dry-run` | Print the suite-runner commands that would run without modifying files. Default: off. |
By default, the combined [results_ablation.csv](results_ablation.csv) is written
beside this script and printed after the run. An explicit `--out-dir PATH`
writes `PATH/results_ablation.csv`, keeping independent experiments separate.
Default model artifacts and per-variant summaries remain in the locations above.
The aggregate records case identifiers,
`functional_validation`, and signed percentage changes in latency, throughput,
power, and energy against the matching baseline case. Positive means higher;
baseline values are zero.
All options of
[`run_pimcomp_models.py`](../pimcomp/compare/README.md), including
`--archs`, `--mode`, `--pipeline`, `--no-fast`, and
`--raptor-extra-arg=ARG`, are forwarded to each variant. `--out-dir`,
`--variant`, and `--dry-run` belong to this wrapper; `--only` is reserved for
the suite runner's comparison mode and is rejected by this wrapper, which
always invokes `--raptor-only`. If neither `--mode` nor `--pipeline` is
forwarded, the wrapper uses its default latency and throughput/pipeline-4
case set. Supplying either option overrides that default and is passed through
as one suite-runner invocation per variant.
Disabling synchronization removes host-buffer lifetime and pipeline restart
guarantees, so those variants may fail numerical validation and exit nonzero.
Baseline and `no-plan` must pass. Percentages from failing variants are not
valid speedups; deadline averages do not prove steady-state convergence.
The feature-full `baseline` variant is rerun with the same selected cases and
forwarded options as the disabled variants. All four variants are stored below
each model's `artifacts/<arch>/<mode>[/pipelineN]/ablation/` directory. Shared
reference artifacts remain under each model's `artifacts/common` directory.
Normal comparison artifacts and summaries are preserved. Compact per-variant
comparison summaries remain under
`<out-dir>/ablation/<variant>/results_comparison.csv` after aggregation.
The combined table is written to `<out-dir>/results_ablation.csv`; it contains the
variant, case identifiers, actual `functional_validation` status, and signed
percentage `latency`, `throughput`, `power`, and `energy` columns. These are
Raptor metrics; Pimcomp metrics are omitted because the ablation invokes Raptor
only.
## Plots
```bash
.venv/bin/python validation/tools/pim/ablation/generate_plots.py
# For a custom experiment root:
.venv/bin/python validation/tools/pim/ablation/generate_plots.py \
--input /path/to/experiment/results_ablation.csv
```
Requires Matplotlib from the root `requirements.txt`. By default, reads the
canonical CSV beside this script. Plots go to
`plots/png/` and `plots/svg/` beside the selected CSV; override with
`--output-dir PATH`.
Single-variant comparison CSVs are not accepted.
The checked-in CSV is an intentional result dataset; plotting uses its current
contents without running benchmarks. Invalid reciprocal percentage pairs render
as `N/A`; individual legitimate extreme changes are preserved. See
[performance availability](../../../../docs/evaluation/methodology.md#functional-validity-and-performance-availability).
Plots separate modes and pipelines. Throughput-mode latency means output
interval. Failed validation is labeled `INVALID`, other non-PASS statuses keep
their names, and missing measurements show `N/A`. See the
[comparison metric definitions](../../../../docs/evaluation/methodology.md#metric-interpretation).
@@ -0,0 +1,156 @@
#!/usr/bin/env python3
"""Plot percentage changes from an experiment's combined results_ablation.csv."""
from __future__ import annotations
import argparse
import csv
import math
import sys
import warnings
from dataclasses import dataclass
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from plot_style import COLORS, configure_style, save_figure, value_label
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from matplotlib.ticker import PercentFormatter
from run_ablation import ABLATION_DEFAULT_MODELS, DEFAULT_RESULTS_PATH, RESULT_FIELDS, VARIANTS
VARIANT_COLORS = {variant.name: color for variant, color in zip(VARIANTS, COLORS)}
STATUSES = ("PASS", "FAIL", "SKIPPED", "NA")
@dataclass(frozen=True)
class Result:
variant: str
arch: str
model: str
mode: str
pipeline: int
validation: str
metrics: dict[str, float]
def percentage(value: str) -> float:
if value == "NA":
return math.nan
if not value.endswith("%"):
raise ValueError(f"Expected a percentage or NA, got {value!r}")
parsed = float(value[:-1])
if not math.isfinite(parsed):
raise ValueError(f"Non-finite percentage: {value!r}")
return parsed
def load_results(path: Path) -> list[Result]:
rows = []
seen = set()
invalid_pairs = []
with path.open(newline="", encoding="utf-8-sig") as stream:
reader = csv.DictReader(stream)
if not {"variant", *RESULT_FIELDS} <= set(reader.fieldnames or []):
raise ValueError("Expected the combined ablation CSV with variant and percentage columns; "
"a per-variant results_comparison.csv cannot be used here.")
for row in reader:
variant, mode, status = row["variant"], row["mode"], row["functional_validation"]
if variant not in VARIANT_COLORS or mode not in ("latency", "throughput") or status not in STATUSES:
raise ValueError(f"Unknown ablation variant, mode, or validation status: {variant}, {mode}, {status}")
pipeline = int(row["raptor_pipeline"])
key = (variant, row["arch"], row["model"], mode, pipeline)
if key in seen:
raise ValueError(f"Duplicate ablation configuration: {key}")
seen.add(key)
metrics = {metric: percentage(row[metric])
for metric in ("latency", "throughput", "power", "energy")}
# Each may round to -100% alone; reciprocal metrics cannot both do so.
if mode == "throughput" and metrics["latency"] == metrics["throughput"] == -100:
metrics["latency"] = metrics["throughput"] = math.nan
invalid_pairs.append(key)
rows.append(Result(variant, row["arch"], row["model"], mode, pipeline, status, metrics))
if not rows:
raise ValueError("The ablation CSV contains no results")
if invalid_pairs:
warnings.warn(f"{len(invalid_pairs)} invalid reciprocal latency/throughput percentage pairs; "
f"displaying N/A. Examples: {invalid_pairs[:3]}", stacklevel=2)
return rows
def draw_metric(results: list[Result], metric: str, ylabel: str, output_dir: Path) -> None:
architectures = sorted({row.arch for row in results})
present_models = {row.model for row in results}
models = [model for model in ABLATION_DEFAULT_MODELS if model in present_models]
models += sorted(present_models - set(models))
variants = [name for name in VARIANT_COLORS if any(row.variant == name for row in results)]
lookup = {(row.arch, row.model, row.variant): row for row in results}
values = [row.metrics[metric] for row in results if math.isfinite(row.metrics[metric])]
lower, upper = min(0, min(values, default=0)), max(0, max(values, default=0))
padding = max(upper - lower, 1) * 0.35
fig, axes = plt.subplots(1, len(architectures), sharey=True, squeeze=False,
figsize=(7 * len(architectures), 5.2), layout="constrained")
handles = [Patch(facecolor=VARIANT_COLORS[name], label=name) for name in variants]
if len(values) < len(architectures) * len(models) * len(variants):
handles.append(Patch(facecolor="white", edgecolor="#B2BAC5", label="N/A: missing measurement"))
fig.legend(handles=handles, loc="outside upper center", ncol=4, frameon=False, fontsize=9.5)
width = 0.8 / len(variants)
mode, pipeline = results[0].mode, results[0].pipeline
for ax, arch in zip(axes[0], architectures):
ax.set_axisbelow(True)
ax.set_ylim(lower - padding if lower < 0 else 0, upper + padding)
ax.set_xlim(-0.5, len(models) - 0.5)
ax.set_xticks(range(len(models)), [model.upper() for model in models], fontsize=9.5)
ax.set_xlabel(f"{arch.replace('arch-', 'ARCHITECTURE ').upper()}\n"
f"{mode.capitalize()}, {pipeline} stage" + ("s" if pipeline != 1 else ""),
fontsize=11, weight="bold", labelpad=8)
ax.set_ylabel(ylabel, fontsize=10.5)
ax.yaxis.set_major_formatter(PercentFormatter(xmax=100, decimals=0))
ax.tick_params(axis="both", length=0, pad=6, labelleft=True)
ax.grid(axis="y", color="#E6EAF0", linewidth=0.8)
ax.axhline(0, color="#536478", linewidth=1.2, linestyle="--")
for index, model in enumerate(models):
if index % 2 == 0:
ax.axvspan(index - 0.5, index + 0.5, facecolor="#F7F9FC", zorder=0)
for offset, variant in enumerate(variants):
x = index + (offset - (len(variants) - 1) / 2) * width
row = lookup.get((arch, model, variant))
value = row.metrics[metric] if row else math.nan
if not math.isfinite(value):
ax.text(x, padding * 0.05, "N/A", rotation=90, ha="center", va="bottom",
fontsize=8, color="#85909F")
continue
ax.bar(x, value, width=width * 0.9, color=VARIANT_COLORS[variant],
edgecolor="none", linewidth=0, zorder=2)
direction = -1 if value < 0 else 1
value_label(ax, x, value + direction * padding * 0.05, f"{value:+,.2f}%",
row.validation, direction)
save_figure(fig, f"{mode}_pipeline{pipeline}_{metric}", output_dir)
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--input", type=Path, default=DEFAULT_RESULTS_PATH)
parser.add_argument("--output-dir", type=Path)
args = parser.parse_args()
if args.output_dir is None:
args.output_dir = args.input.parent / "plots"
configure_style()
results = load_results(args.input)
print(f"Results: {len(results)} configurations, "
f"{sum(row.validation != 'PASS' for row in results)} without PASS validation")
for mode, pipeline in sorted({(row.mode, row.pipeline) for row in results}):
rows = [row for row in results if row.mode == mode and row.pipeline == pipeline]
for metric, label in (
("latency", "Single-inference latency" if mode == "latency" else "Output interval"),
("throughput", "Throughput"), ("power", "Average power"), ("energy", "Energy per inference"),
):
if metric == "throughput" and mode == "latency":
continue
draw_metric(rows, metric, f"{label} change from baseline (%)", args.output_dir)
if __name__ == "__main__":
main()
@@ -0,0 +1,65 @@
variant,arch,model,mode,raptor_pipeline,functional_validation,latency,throughput,power,energy
baseline,arch-a,googlenet,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-a,googlenet,latency,1,PASS,+0.00%,NA,+0.00%,-0.00%
no-plan,arch-a,googlenet,latency,1,PASS,+11513.29%,NA,-69.42%,+3452.69%
no-sync-no-plan,arch-a,googlenet,latency,1,PASS,+11512.99%,NA,-69.42%,+3452.59%
baseline,arch-a,googlenet,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-a,googlenet,throughput,4,FAIL,+26.17%,-20.74%,+9.97%,+18.50%
no-plan,arch-a,googlenet,throughput,4,PASS,-100.00%,-100.00%,-62.73%,-100.00%
no-sync-no-plan,arch-a,googlenet,throughput,4,FAIL,+4094.63%,-97.62%,-59.86%,+1311.01%
baseline,arch-a,resnet18,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-a,resnet18,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-plan,arch-a,resnet18,latency,1,PASS,+3191.30%,NA,-60.97%,+1184.24%
no-sync-no-plan,arch-a,resnet18,latency,1,PASS,+3191.30%,NA,-60.97%,+1184.24%
baseline,arch-a,resnet18,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-a,resnet18,throughput,4,FAIL,+110.65%,-52.55%,+43.25%,+177.48%
no-plan,arch-a,resnet18,throughput,4,PASS,+1598.93%,-94.12%,-51.04%,+664.87%
no-sync-no-plan,arch-a,resnet18,throughput,4,FAIL,+1174.21%,-92.16%,-45.06%,+543.74%
baseline,arch-a,resnet34,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-a,resnet34,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-plan,arch-a,resnet34,latency,1,PASS,+2361.37%,NA,-56.53%,+969.99%
no-sync-no-plan,arch-a,resnet34,latency,1,PASS,+2361.37%,NA,-56.53%,+969.99%
baseline,arch-a,resnet34,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-a,resnet34,throughput,4,FAIL,+33.65%,-25.21%,+31.76%,+15.56%
no-plan,arch-a,resnet34,throughput,4,PASS,+1726.82%,-94.52%,-54.50%,+455.98%
no-sync-no-plan,arch-a,resnet34,throughput,4,FAIL,+813.41%,-89.04%,-49.77%,+206.84%
baseline,arch-a,vgg8,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-a,vgg8,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-plan,arch-a,vgg8,latency,1,PASS,+1800.66%,NA,-44.65%,+953.39%
no-sync-no-plan,arch-a,vgg8,latency,1,PASS,+1800.66%,NA,-44.65%,+953.39%
baseline,arch-a,vgg8,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-a,vgg8,throughput,4,PASS,+2.33%,-1.72%,+18.49%,-0.98%
no-plan,arch-a,vgg8,throughput,4,PASS,+1251.16%,-92.58%,-56.68%,+577.04%
no-sync-no-plan,arch-a,vgg8,throughput,4,PASS,+1260.47%,-92.63%,-53.36%,+467.83%
baseline,arch-b,googlenet,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-b,googlenet,latency,1,PASS,+0.00%,NA,+0.00%,-0.00%
no-plan,arch-b,googlenet,latency,1,PASS,+9849.64%,NA,-70.51%,+2833.89%
no-sync-no-plan,arch-b,googlenet,latency,1,PASS,+9849.55%,NA,-70.51%,+2833.89%
baseline,arch-b,googlenet,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-b,googlenet,throughput,4,FAIL,+11.45%,-10.29%,+21.82%,+19.27%
no-plan,arch-b,googlenet,throughput,4,PASS,-100.00%,-100.00%,-63.39%,-100.00%
no-sync-no-plan,arch-b,googlenet,throughput,4,FAIL,+3348.28%,-97.10%,-61.58%,+1026.09%
baseline,arch-b,resnet18,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-b,resnet18,latency,1,PASS,+0.00%,NA,+0.00%,-0.00%
no-plan,arch-b,resnet18,latency,1,PASS,+2935.63%,NA,-63.12%,+1019.81%
no-sync-no-plan,arch-b,resnet18,latency,1,PASS,+2936.09%,NA,-63.12%,+1019.97%
baseline,arch-b,resnet18,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-b,resnet18,throughput,4,FAIL,+8.03%,-7.44%,+47.59%,+40.61%
no-plan,arch-b,resnet18,throughput,4,PASS,+1511.85%,-93.80%,-52.93%,+560.80%
no-sync-no-plan,arch-b,resnet18,throughput,4,FAIL,+867.12%,-89.67%,-45.41%,+359.83%
baseline,arch-b,resnet34,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-b,resnet34,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-plan,arch-b,resnet34,latency,1,PASS,+2551.16%,NA,-62.51%,+893.70%
no-sync-no-plan,arch-b,resnet34,latency,1,PASS,+2550.91%,NA,-62.51%,+893.62%
baseline,arch-b,resnet34,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-b,resnet34,throughput,4,FAIL,+28.25%,-22.13%,+49.76%,+57.30%
no-plan,arch-b,resnet34,throughput,4,PASS,+2427.17%,-96.05%,-49.58%,+938.62%
no-sync-no-plan,arch-b,resnet34,throughput,4,FAIL,+531.79%,-84.19%,-42.32%,+197.08%
baseline,arch-b,vgg8,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-sync,arch-b,vgg8,latency,1,PASS,+0.00%,NA,+0.00%,+0.00%
no-plan,arch-b,vgg8,latency,1,PASS,+1784.97%,NA,-49.50%,+849.73%
no-sync-no-plan,arch-b,vgg8,latency,1,PASS,+1784.97%,NA,-49.50%,+849.73%
baseline,arch-b,vgg8,throughput,4,PASS,+0.00%,+0.00%,+0.00%,+0.00%
no-sync,arch-b,vgg8,throughput,4,PASS,+23.91%,-19.82%,+25.67%,+23.93%
no-plan,arch-b,vgg8,throughput,4,PASS,+1158.70%,-92.07%,-58.95%,+408.33%
no-sync-no-plan,arch-b,vgg8,throughput,4,PASS,+1172.83%,-92.17%,-55.83%,+327.00%
1 variant arch model mode raptor_pipeline functional_validation latency throughput power energy
2 baseline arch-a googlenet latency 1 PASS +0.00% NA +0.00% +0.00%
3 no-sync arch-a googlenet latency 1 PASS +0.00% NA +0.00% -0.00%
4 no-plan arch-a googlenet latency 1 PASS +11513.29% NA -69.42% +3452.69%
5 no-sync-no-plan arch-a googlenet latency 1 PASS +11512.99% NA -69.42% +3452.59%
6 baseline arch-a googlenet throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
7 no-sync arch-a googlenet throughput 4 FAIL +26.17% -20.74% +9.97% +18.50%
8 no-plan arch-a googlenet throughput 4 PASS -100.00% -100.00% -62.73% -100.00%
9 no-sync-no-plan arch-a googlenet throughput 4 FAIL +4094.63% -97.62% -59.86% +1311.01%
10 baseline arch-a resnet18 latency 1 PASS +0.00% NA +0.00% +0.00%
11 no-sync arch-a resnet18 latency 1 PASS +0.00% NA +0.00% +0.00%
12 no-plan arch-a resnet18 latency 1 PASS +3191.30% NA -60.97% +1184.24%
13 no-sync-no-plan arch-a resnet18 latency 1 PASS +3191.30% NA -60.97% +1184.24%
14 baseline arch-a resnet18 throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
15 no-sync arch-a resnet18 throughput 4 FAIL +110.65% -52.55% +43.25% +177.48%
16 no-plan arch-a resnet18 throughput 4 PASS +1598.93% -94.12% -51.04% +664.87%
17 no-sync-no-plan arch-a resnet18 throughput 4 FAIL +1174.21% -92.16% -45.06% +543.74%
18 baseline arch-a resnet34 latency 1 PASS +0.00% NA +0.00% +0.00%
19 no-sync arch-a resnet34 latency 1 PASS +0.00% NA +0.00% +0.00%
20 no-plan arch-a resnet34 latency 1 PASS +2361.37% NA -56.53% +969.99%
21 no-sync-no-plan arch-a resnet34 latency 1 PASS +2361.37% NA -56.53% +969.99%
22 baseline arch-a resnet34 throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
23 no-sync arch-a resnet34 throughput 4 FAIL +33.65% -25.21% +31.76% +15.56%
24 no-plan arch-a resnet34 throughput 4 PASS +1726.82% -94.52% -54.50% +455.98%
25 no-sync-no-plan arch-a resnet34 throughput 4 FAIL +813.41% -89.04% -49.77% +206.84%
26 baseline arch-a vgg8 latency 1 PASS +0.00% NA +0.00% +0.00%
27 no-sync arch-a vgg8 latency 1 PASS +0.00% NA +0.00% +0.00%
28 no-plan arch-a vgg8 latency 1 PASS +1800.66% NA -44.65% +953.39%
29 no-sync-no-plan arch-a vgg8 latency 1 PASS +1800.66% NA -44.65% +953.39%
30 baseline arch-a vgg8 throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
31 no-sync arch-a vgg8 throughput 4 PASS +2.33% -1.72% +18.49% -0.98%
32 no-plan arch-a vgg8 throughput 4 PASS +1251.16% -92.58% -56.68% +577.04%
33 no-sync-no-plan arch-a vgg8 throughput 4 PASS +1260.47% -92.63% -53.36% +467.83%
34 baseline arch-b googlenet latency 1 PASS +0.00% NA +0.00% +0.00%
35 no-sync arch-b googlenet latency 1 PASS +0.00% NA +0.00% -0.00%
36 no-plan arch-b googlenet latency 1 PASS +9849.64% NA -70.51% +2833.89%
37 no-sync-no-plan arch-b googlenet latency 1 PASS +9849.55% NA -70.51% +2833.89%
38 baseline arch-b googlenet throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
39 no-sync arch-b googlenet throughput 4 FAIL +11.45% -10.29% +21.82% +19.27%
40 no-plan arch-b googlenet throughput 4 PASS -100.00% -100.00% -63.39% -100.00%
41 no-sync-no-plan arch-b googlenet throughput 4 FAIL +3348.28% -97.10% -61.58% +1026.09%
42 baseline arch-b resnet18 latency 1 PASS +0.00% NA +0.00% +0.00%
43 no-sync arch-b resnet18 latency 1 PASS +0.00% NA +0.00% -0.00%
44 no-plan arch-b resnet18 latency 1 PASS +2935.63% NA -63.12% +1019.81%
45 no-sync-no-plan arch-b resnet18 latency 1 PASS +2936.09% NA -63.12% +1019.97%
46 baseline arch-b resnet18 throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
47 no-sync arch-b resnet18 throughput 4 FAIL +8.03% -7.44% +47.59% +40.61%
48 no-plan arch-b resnet18 throughput 4 PASS +1511.85% -93.80% -52.93% +560.80%
49 no-sync-no-plan arch-b resnet18 throughput 4 FAIL +867.12% -89.67% -45.41% +359.83%
50 baseline arch-b resnet34 latency 1 PASS +0.00% NA +0.00% +0.00%
51 no-sync arch-b resnet34 latency 1 PASS +0.00% NA +0.00% +0.00%
52 no-plan arch-b resnet34 latency 1 PASS +2551.16% NA -62.51% +893.70%
53 no-sync-no-plan arch-b resnet34 latency 1 PASS +2550.91% NA -62.51% +893.62%
54 baseline arch-b resnet34 throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
55 no-sync arch-b resnet34 throughput 4 FAIL +28.25% -22.13% +49.76% +57.30%
56 no-plan arch-b resnet34 throughput 4 PASS +2427.17% -96.05% -49.58% +938.62%
57 no-sync-no-plan arch-b resnet34 throughput 4 FAIL +531.79% -84.19% -42.32% +197.08%
58 baseline arch-b vgg8 latency 1 PASS +0.00% NA +0.00% +0.00%
59 no-sync arch-b vgg8 latency 1 PASS +0.00% NA +0.00% +0.00%
60 no-plan arch-b vgg8 latency 1 PASS +1784.97% NA -49.50% +849.73%
61 no-sync-no-plan arch-b vgg8 latency 1 PASS +1784.97% NA -49.50% +849.73%
62 baseline arch-b vgg8 throughput 4 PASS +0.00% +0.00% +0.00% +0.00%
63 no-sync arch-b vgg8 throughput 4 PASS +23.91% -19.82% +25.67% +23.93%
64 no-plan arch-b vgg8 throughput 4 PASS +1158.70% -92.07% -58.95% +408.33%
65 no-sync-no-plan arch-b vgg8 throughput 4 PASS +1172.83% -92.17% -55.83% +327.00%
+15 -9
View File
@@ -45,6 +45,7 @@ VARIANTS = (
VARIANT_BY_NAME = {variant.name: variant for variant in VARIANTS}
COMPARISON_RESULTS_FILENAME = "results_comparison.csv"
ABLATION_RESULTS_FILENAME = "results_ablation.csv"
DEFAULT_RESULTS_PATH = Path(__file__).with_name(ABLATION_RESULTS_FILENAME)
CASE_FIELDS = ("arch", "model", "mode", "raptor_pipeline")
PERCENTAGE_FIELDS = (
("raptor_latency_ms", "latency"),
@@ -68,8 +69,7 @@ def parse_args(argv: list[str] | None = None) -> tuple[argparse.Namespace, list[
parser.add_argument(
"--out-dir",
type=Path,
default=DEFAULT_OUT_DIR,
help="Artifact root (default: validation/networks/pimcomp_models).",
help="Custom experiment root for artifacts and aggregate CSV. Default: model-suite artifacts and results_ablation.csv beside this script.",
)
add_models_argument(parser, ABLATION_DEFAULT_MODELS)
parser.add_argument(
@@ -160,9 +160,10 @@ def percentage_difference(value: str | None, reference: str | None) -> str:
baseline = float(reference) if reference is not None else math.nan
except ValueError:
return "NA"
if not math.isfinite(current) or not math.isfinite(baseline) or baseline == 0:
if not math.isfinite(current) or not math.isfinite(baseline) or current <= 0 or baseline <= 0:
return "NA"
return f"{(current - baseline) / baseline * 100:+.2f}%"
change = (current / baseline - 1) * 100
return f"{change:+.2f}%" if math.isfinite(change) else "NA"
def aggregate_results(
@@ -170,6 +171,7 @@ def aggregate_results(
variants: list[Variant],
selected_cases: frozenset[tuple[str, str]] | None = None,
selected_models: frozenset[str] | None = None,
output: Path | None = None,
) -> tuple[Path | None, list[str]]:
fields: list[str] | None = None
rows_by_variant: dict[str, list[dict[str, str]]] = {}
@@ -233,7 +235,8 @@ def aggregate_results(
int(row["raptor_pipeline"]),
)
)
output = out_dir / ABLATION_RESULTS_FILENAME
output = output if output is not None else out_dir / ABLATION_RESULTS_FILENAME
output.parent.mkdir(parents=True, exist_ok=True)
with output.open("w", newline="", encoding="utf-8") as stream:
writer = csv.DictWriter(stream, fieldnames=("variant", *RESULT_FIELDS), lineterminator="\n")
writer.writeheader()
@@ -247,7 +250,7 @@ def main(argv: list[str] | None = None) -> int:
print(f"Missing Pimcomp runner: {RUNNER}", file=sys.stderr)
return 1
variants = selected_variants(args.variants)
out_dir = args.out_dir.resolve()
out_dir = args.out_dir.resolve() if args.out_dir is not None else DEFAULT_OUT_DIR
case_sets = runner_argument_sets(forwarded)
if args.dry_run:
for variant in variants:
@@ -299,14 +302,17 @@ def main(argv: list[str] | None = None) -> int:
variants,
selected_cases,
frozenset(args.models),
output=DEFAULT_RESULTS_PATH if args.out_dir is None else None,
)
failed.extend(aggregation_failures)
if output is not None:
print(f"Ablation results: {output}")
print(f"[{output.name}]")
print(output.read_text(encoding="utf-8"), end="", flush=True)
if failed:
print("Failed: " + "; ".join(failed), file=sys.stderr)
return 1
return 0
if output is not None:
print(f"Ablation results: {output}", flush=True)
return 1 if failed else 0
if __name__ == "__main__":