even better more structured throughput scheduling
Validate Operations / validate-operations (push) Has been cancelled
Validate Operations / validate-operations (push) Has been cancelled
plot adjustments validation adjustments
This commit is contained in:
@@ -12,10 +12,14 @@ explicitly when needed. Only Raptor runs; Pimcomp validation is `SKIPPED`.
|
||||
|
||||
| Variant | Raptor options |
|
||||
|---|---|
|
||||
| `baseline` | None |
|
||||
| `no-sync` | `--pim-disable-synchronization` |
|
||||
| `no-plan` | `--pim-disable-spatial-planning` |
|
||||
| `no-sync-no-plan` | Both options |
|
||||
| `baseline` | None; planning and synchronization enabled |
|
||||
| `no-sync` | `--pim-disable-synchronization`; throughput only |
|
||||
| `no-plan` | `--pim-disable-spatial-planning`; synchronization remains enabled |
|
||||
|
||||
Latency runs compare `baseline` with `no-plan`. Throughput runs compare
|
||||
`baseline` with each disabled feature separately. No run disables both features.
|
||||
The `baseline` artifact name identifies the fully enabled program, not the
|
||||
denominator used for percentage gains.
|
||||
|
||||
## Options and outputs
|
||||
|
||||
@@ -25,7 +29,9 @@ explicitly when needed. Only Raptor runs; Pimcomp validation is `SKIPPED`.
|
||||
|
||||
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
|
||||
replaces the default latency/pipeline-4 case set. Mode-only selection runs all
|
||||
suite pipelines for that mode. Pipeline-only selection uses its matching mode.
|
||||
`--only` is rejected because
|
||||
the wrapper always runs Raptor only. Ctrl+C stops the active variant's workers.
|
||||
|
||||
Artifacts use `<out-dir>/<model>/artifacts/<arch>/<mode>[/pipelineN]/ablation/<variant>/`;
|
||||
@@ -37,19 +43,44 @@ 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.
|
||||
The aggregate contains one row per comparison:
|
||||
|
||||
| Mode | `comparison` | `baseline_variant` | Main gain |
|
||||
|---|---|---|---|
|
||||
| Latency | `plan` | `no-plan` | `latency_gain_percent` |
|
||||
| Throughput | `plan` | `no-plan` | `throughput_gain_percent` |
|
||||
| Throughput | `sync` | `no-sync` | `throughput_gain_percent` |
|
||||
|
||||
Throughput gain is `100 × (enabled / disabled − 1)`.
|
||||
Latency, power, and energy gains are reductions: `100 × (1 − enabled / disabled)`.
|
||||
The corresponding columns use the suffix `_gain_percent`. Positive means improvement;
|
||||
negative means a cost. Synchronization gain can be negative. No sign is forced.
|
||||
Both programs' functional statuses are recorded as `functional_validation`
|
||||
and `baseline_functional_validation`. The latter belongs to the disabled feature.
|
||||
|
||||
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.
|
||||
Baseline and `no-plan` must pass. Percentages involving failing programs remain
|
||||
diagnostic comparisons, not valid speedups.
|
||||
|
||||
When fast-mode convergence fails, positive fallback throughput remains available.
|
||||
Its output interval uses the full simulation window. The per-case JSON report
|
||||
records `throughput_measurement: full_duration_fallback` and
|
||||
`fast_throughput_converged: false`. This result does not prove steady-state convergence.
|
||||
Zero completed outputs still produce `NA` for per-inference metrics.
|
||||
|
||||
The `no-sync` compiler option keeps the normal selected schedule and omits
|
||||
SYNC/WAIT instructions during code generation. Selection costs describe the
|
||||
`synchronized-reference` program. Each backend attempt also reports a separate
|
||||
`synchronization_ablation_cost`, with zero SYNC/WAIT work and no synchronization
|
||||
dependencies. This diagnostic estimate is not used for selection. Its complete-state
|
||||
recurrence can remain unproved because cores can advance independently.
|
||||
Numerical validation still checks the emitted program and can fail.
|
||||
|
||||
## Result data
|
||||
|
||||
The checked-in `results_ablation.csv` is an intentional result dataset for tabular
|
||||
reporting. Ablation experiments and aggregation remain available through the
|
||||
The checked-in `results_ablation.csv` is a historical dataset until the next run
|
||||
regenerates it with the comparison schema above. Existing measurements are preserved.
|
||||
Ablation experiments and aggregation remain available through the
|
||||
runner above. Percentages from failing variants are not valid speedups. See the
|
||||
[comparison metric definitions](../../../../docs/evaluation/methodology.md#metric-interpretation).
|
||||
|
||||
@@ -37,10 +37,6 @@ VARIANTS = (
|
||||
Variant("baseline", ()),
|
||||
Variant("no-sync", ("--pim-disable-synchronization",)),
|
||||
Variant("no-plan", ("--pim-disable-spatial-planning",)),
|
||||
Variant(
|
||||
"no-sync-no-plan",
|
||||
("--pim-disable-synchronization", "--pim-disable-spatial-planning"),
|
||||
),
|
||||
)
|
||||
VARIANT_BY_NAME = {variant.name: variant for variant in VARIANTS}
|
||||
COMPARISON_RESULTS_FILENAME = "results_comparison.csv"
|
||||
@@ -53,17 +49,19 @@ PERCENTAGE_FIELDS = (
|
||||
("raptor_power_mw", "power"),
|
||||
("raptor_energy_pj", "energy"),
|
||||
)
|
||||
RESULT_FIELDS = (*CASE_FIELDS, "functional_validation", *(target for _, target in PERCENTAGE_FIELDS))
|
||||
RESULT_FIELDS = (
|
||||
"comparison", *CASE_FIELDS, "baseline_variant", "baseline_functional_validation",
|
||||
"functional_validation", *(f"{target}_gain_percent" for _, target in PERCENTAGE_FIELDS),
|
||||
)
|
||||
DEFAULT_CASE_ARGUMENTS = (
|
||||
("latency", ("--mode", "latency")),
|
||||
("throughput/pipeline4", ("--mode", "throughput", "--pipeline", "4")),
|
||||
)
|
||||
DEFAULT_CASE_KEYS = frozenset({("latency", "1"), ("throughput", "4")})
|
||||
|
||||
|
||||
def parse_args(argv: list[str] | None = None) -> tuple[argparse.Namespace, list[str]]:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Run the complete compiler ablation matrix on the Pimcomp model suite.",
|
||||
description="Measure planning and synchronization gains on the Pimcomp model suite.",
|
||||
allow_abbrev=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -97,12 +95,30 @@ def has_option(arguments: list[str], option: str) -> bool:
|
||||
|
||||
|
||||
def runner_argument_sets(forwarded: list[str]) -> tuple[tuple[str, list[str]], ...]:
|
||||
if has_option(forwarded, "--mode") or has_option(forwarded, "--pipeline"):
|
||||
return (("requested", forwarded),)
|
||||
return tuple(
|
||||
(label, [*forwarded, *case_arguments])
|
||||
for label, case_arguments in DEFAULT_CASE_ARGUMENTS
|
||||
)
|
||||
if not has_option(forwarded, "--mode") and not has_option(forwarded, "--pipeline"):
|
||||
return tuple(
|
||||
(label, [*forwarded, *case_arguments])
|
||||
for label, case_arguments in DEFAULT_CASE_ARGUMENTS
|
||||
)
|
||||
parser = argparse.ArgumentParser(add_help=False, allow_abbrev=False)
|
||||
parser.add_argument("--mode", nargs="+", choices=("latency", "throughput"))
|
||||
parser.add_argument("--pipeline", type=int, choices=(1, 2, 4, 8))
|
||||
args, remaining = parser.parse_known_args(forwarded)
|
||||
cases = [(mode, pipeline) for mode, pipeline in
|
||||
(("latency", 1), ("throughput", 2), ("throughput", 4), ("throughput", 8))
|
||||
if (args.mode is None or mode in args.mode)
|
||||
and (args.pipeline is None or pipeline == args.pipeline)]
|
||||
if not cases:
|
||||
parser.error("--pipeline does not belong to the selected --mode")
|
||||
return tuple((f"{mode}/pipeline{pipeline}",
|
||||
[*remaining, "--mode", mode, "--pipeline", str(pipeline)])
|
||||
for mode, pipeline in cases)
|
||||
|
||||
|
||||
def case_key(arguments: list[str]) -> tuple[str, str]:
|
||||
mode = arguments[arguments.index("--mode") + 1]
|
||||
pipeline = arguments[arguments.index("--pipeline") + 1] if "--pipeline" in arguments else "1"
|
||||
return mode, pipeline
|
||||
|
||||
|
||||
def variant_output_dir(out_dir: Path, variant: Variant) -> Path:
|
||||
@@ -154,7 +170,9 @@ def terminate_process_group(process: subprocess.Popen[bytes]) -> None:
|
||||
process.wait()
|
||||
|
||||
|
||||
def percentage_difference(value: str | None, reference: str | None) -> str:
|
||||
def percentage_difference(
|
||||
value: str | None, reference: str | None, *, lower_is_better: bool = False
|
||||
) -> str:
|
||||
try:
|
||||
current = float(value) if value is not None else math.nan
|
||||
baseline = float(reference) if reference is not None else math.nan
|
||||
@@ -162,7 +180,8 @@ def percentage_difference(value: str | None, reference: str | None) -> str:
|
||||
return "NA"
|
||||
if not math.isfinite(current) or not math.isfinite(baseline) or current <= 0 or baseline <= 0:
|
||||
return "NA"
|
||||
change = (current / baseline - 1) * 100
|
||||
ratio = current / baseline
|
||||
change = (1 - ratio if lower_is_better else ratio - 1) * 100
|
||||
return f"{change:+.2f}%" if math.isfinite(change) else "NA"
|
||||
|
||||
|
||||
@@ -202,25 +221,43 @@ def aggregate_results(
|
||||
selected_rows.append(row)
|
||||
if fields is None:
|
||||
return None, failures
|
||||
baseline_rows = {
|
||||
enabled_rows = {
|
||||
tuple(row.get(field, "") for field in CASE_FIELDS): row
|
||||
for row in rows_by_variant.get("baseline", [])
|
||||
}
|
||||
if "baseline" not in rows_by_variant:
|
||||
failures.append("baseline: missing percentage reference results")
|
||||
failures.append("baseline: missing fully enabled results")
|
||||
result_rows = []
|
||||
variant_order = {variant.name: index for index, variant in enumerate(VARIANTS)}
|
||||
for variant in variants:
|
||||
if variant.name == "baseline":
|
||||
continue
|
||||
disabled_keys = {
|
||||
tuple(row.get(field, "") for field in CASE_FIELDS)
|
||||
for row in rows_by_variant.get(variant.name, [])
|
||||
}
|
||||
for key, row in enabled_rows.items():
|
||||
if variant.name == "no-sync" and row.get("mode") != "throughput":
|
||||
continue
|
||||
if key not in disabled_keys:
|
||||
failures.append(f"{variant.name}: missing baseline case " + "/".join(key))
|
||||
for row in rows_by_variant.get(variant.name, []):
|
||||
reference = baseline_rows.get(tuple(row.get(field, "") for field in CASE_FIELDS))
|
||||
if variant.name == "no-sync" and row.get("mode") != "throughput":
|
||||
continue
|
||||
enabled = enabled_rows.get(tuple(row.get(field, "") for field in CASE_FIELDS))
|
||||
if enabled is None:
|
||||
failures.append(f"{variant.name}: missing fully enabled case "
|
||||
+ "/".join(row.get(field, "") for field in CASE_FIELDS))
|
||||
result_rows.append(
|
||||
{
|
||||
"variant": variant.name,
|
||||
"comparison": "plan" if variant.name == "no-plan" else "sync",
|
||||
**{field: row.get(field, "") for field in CASE_FIELDS},
|
||||
"functional_validation": row.get("raptor_functional_validation", "NA"),
|
||||
"baseline_variant": variant.name,
|
||||
"baseline_functional_validation": row.get("raptor_functional_validation", "NA"),
|
||||
"functional_validation": enabled.get("raptor_functional_validation", "NA") if enabled else "NA",
|
||||
**{
|
||||
target: percentage_difference(
|
||||
row.get(source), reference.get(source) if reference else None
|
||||
f"{target}_gain_percent": percentage_difference(
|
||||
enabled.get(source) if enabled else None, row.get(source),
|
||||
lower_is_better=target != "throughput",
|
||||
)
|
||||
for source, target in PERCENTAGE_FIELDS
|
||||
},
|
||||
@@ -231,14 +268,14 @@ def aggregate_results(
|
||||
row["arch"],
|
||||
row["model"],
|
||||
row["mode"],
|
||||
variant_order[row["variant"]],
|
||||
int(row["raptor_pipeline"]),
|
||||
row["comparison"],
|
||||
)
|
||||
)
|
||||
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 = csv.DictWriter(stream, fieldnames=RESULT_FIELDS, lineterminator="\n")
|
||||
writer.writeheader()
|
||||
writer.writerows(result_rows)
|
||||
return output, failures
|
||||
@@ -252,9 +289,13 @@ def main(argv: list[str] | None = None) -> int:
|
||||
variants = selected_variants(args.variants)
|
||||
out_dir = args.out_dir.resolve() if args.out_dir is not None else DEFAULT_OUT_DIR
|
||||
case_sets = runner_argument_sets(forwarded)
|
||||
if not any(case_key(arguments)[0] == "throughput" for _, arguments in case_sets):
|
||||
variants = [variant for variant in variants if variant.name != "no-sync"]
|
||||
if args.dry_run:
|
||||
for variant in variants:
|
||||
for _, case_forwarded in case_sets:
|
||||
if variant.name == "no-sync" and case_key(case_forwarded)[0] != "throughput":
|
||||
continue
|
||||
print(
|
||||
shlex.join(
|
||||
runner_command(
|
||||
@@ -275,6 +316,8 @@ def main(argv: list[str] | None = None) -> int:
|
||||
try:
|
||||
for variant in variants:
|
||||
for case_label, case_forwarded in case_sets:
|
||||
if variant.name == "no-sync" and case_key(case_forwarded)[0] != "throughput":
|
||||
continue
|
||||
command = runner_command(
|
||||
out_dir, variant, args.models, case_forwarded, out_dir, False
|
||||
)
|
||||
@@ -296,7 +339,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
return 130
|
||||
|
||||
remove_lock_files(out_dir)
|
||||
selected_cases = DEFAULT_CASE_KEYS if len(case_sets) > 1 else None
|
||||
selected_cases = frozenset(case_key(arguments) for _, arguments in case_sets)
|
||||
output, aggregation_failures = aggregate_results(
|
||||
out_dir,
|
||||
variants,
|
||||
|
||||
Reference in New Issue
Block a user