Merges cleanly. UE start: S1 -9%, S3 +11%, S0/S2 ~+1%. 30 m/s: near coverage 44.2 -> 38.5%, far holes +0.06 pp, p99 +2%. L80 near-ready slower in 6/8 cells (up to +7.9%), whole view faster in 7/8. Sweeps 15/16 each (seed 2). Source/: VoxelForgeCoreAdapter.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
157 lines
6.7 KiB
Python
157 lines
6.7 KiB
Python
#!/usr/bin/env python3
|
|
"""L80 comparison of the planner HEAD with the assembler/world baseline."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import re
|
|
import statistics
|
|
import subprocess
|
|
import time
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
OUT = ROOT / "Saved/Linux/l150/timing"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARIES = {
|
|
"assembler-world": (
|
|
ROOT / "Saved/Linux/l137/bin/VoxelForgeCoreHeadless-l137-aa-a",
|
|
"4499fb2a8a4ede7d6cbc68d1b794f104658cdaae93ed9cacbc91fe7ff3fc3621"),
|
|
"planner-head": (
|
|
ROOT / "Standalone/bin/linux/VoxelForgeCoreHeadless-l150-head-clang",
|
|
"c6b8a100355e271ddc40eb5973569d2ff4e2ba8d9c628c72f8e0af2493f0609f"),
|
|
}
|
|
CAMERAS = {
|
|
0: (8.0, 16.0, -372.2626953125),
|
|
1: (25.8369140625, 3.19921875, -737.0),
|
|
2: (19.166015625, -14.2001953125, -753.3740234375),
|
|
3: (-20.0625, -5.068359375, -900.353515625),
|
|
}
|
|
PIPELINE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
|
|
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
|
NEAR = re.compile(
|
|
r"^\[WorldAssemblerNearLODReady\] lods=0-2 tiles=(\d+)/(\d+) cold_ready_s=([0-9.]+)$",
|
|
re.M)
|
|
STAMP = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]+)$", re.M)
|
|
|
|
|
|
def run(strate: int, workers: int, version: str, phase: str, replicate: int) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
binary, expected_stamp = BINARIES[version]
|
|
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
|
|
label = f"s{strate}-w{workers}-{version}-{phase}{replicate}"
|
|
log = OUT / f"{label}.log"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"timeout", "1740s", str(binary), str(DATA), "--world-assembler-prototype",
|
|
"--stream-benchmark", "--stream-pipeline", f"--workers={workers}",
|
|
"--clip-radius=3", "--max-clip-level=8", "--max-level=8",
|
|
f"--camera={camera}", "--profile-lod-work", "--stream-scheduler-policy=3",
|
|
]
|
|
started = time.monotonic()
|
|
with log.open("w", encoding="utf-8") as output:
|
|
proc = subprocess.run(command, cwd=ROOT, stdout=output,
|
|
stderr=subprocess.STDOUT, check=False, timeout=1740)
|
|
content = log.read_text(encoding="utf-8", errors="replace")
|
|
pipeline, near, stamp = PIPELINE.search(content), NEAR.search(content), STAMP.search(content)
|
|
if (proc.returncode or pipeline is None or near is None or stamp is None
|
|
or stamp.group(1) != expected_stamp):
|
|
raise SystemExit(f"L80 timing failed or source stamp mismatch: {log}; exit={proc.returncode}")
|
|
fields = dict(FIELDS.findall(pipeline.group(1)))
|
|
row = {
|
|
"strate": strate, "workers": workers, "version": version,
|
|
"phase": phase, "replicate": replicate, "source_stamp": stamp.group(1),
|
|
"lod02_ready_s": float(near.group(3)),
|
|
"whole_view_ready_s": float(fields["whole_view_ready"].removesuffix("s")),
|
|
"whole_tiles": int(fields["whole_tiles"].split("/")[0]),
|
|
"wall_s": round(time.monotonic() - started, 3),
|
|
"log": str(log.relative_to(ROOT)),
|
|
}
|
|
print("[L150TimingRun] " + json.dumps(row, sort_keys=True), flush=True)
|
|
return row
|
|
|
|
|
|
def quiet_machine() -> tuple[float, float]:
|
|
load_1m = os.getloadavg()[0]
|
|
|
|
def totals() -> tuple[int, int]:
|
|
fields = Path("/proc/stat").read_text().splitlines()[0].split()
|
|
values = [int(value) for value in fields[1:]]
|
|
return sum(values), values[3] + values[4]
|
|
|
|
before = totals()
|
|
time.sleep(2.0)
|
|
after = totals()
|
|
idle = 100.0 * (after[1] - before[1]) / max(1, after[0] - before[0])
|
|
return load_1m, idle
|
|
|
|
|
|
def main() -> int:
|
|
if any(not path.is_file() for path in [DATA, *(entry[0] for entry in BINARIES.values())]):
|
|
raise SystemExit("missing L150 timing input")
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
load_1m, idle = quiet_machine()
|
|
(OUT / "machine-load-before.txt").write_text(
|
|
f"1-minute load: {load_1m:.2f}\n2-second CPU idle: {idle:.1f}%\n")
|
|
print(f"[L150TimingGate] load_1m={load_1m:.2f} cpu_idle_2s={idle:.1f}%", flush=True)
|
|
if load_1m >= 1.5 or idle < 97.0:
|
|
raise SystemExit("timing refused: machine is above the L80 quiet-load gate")
|
|
|
|
rows = []
|
|
versions = tuple(BINARIES)
|
|
for strate in range(4):
|
|
for workers in (8, 12):
|
|
for version in versions:
|
|
run(strate, workers, version, "warmup", 0)
|
|
for replicate in range(1, 6):
|
|
order = versions if replicate % 2 else tuple(reversed(versions))
|
|
for version in order:
|
|
rows.append(run(strate, workers, version, "measured", replicate))
|
|
(OUT / "runs-partial.json").write_text(
|
|
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
|
|
|
measured = [row for row in rows if row["phase"] == "measured"]
|
|
summary = []
|
|
for strate in range(4):
|
|
for workers in (8, 12):
|
|
group = [row for row in measured
|
|
if row["strate"] == strate and row["workers"] == workers]
|
|
medians = {
|
|
version: {
|
|
key: statistics.median(row[key] for row in group
|
|
if row["version"] == version)
|
|
for key in ("lod02_ready_s", "whole_view_ready_s")
|
|
}
|
|
for version in versions
|
|
}
|
|
entry = {"strate": strate, "workers": workers,
|
|
"replicates_per_version": 5, "medians": medians}
|
|
for key in ("lod02_ready_s", "whole_view_ready_s"):
|
|
entry[f"planner_head_vs_assembler_world_{key}_delta_pct"] = round(
|
|
100.0 * (medians["planner-head"][key]
|
|
/ medians["assembler-world"][key] - 1.0), 2)
|
|
entry[f"{key}_paired_deltas_pct"] = [
|
|
round(100.0 * (
|
|
next(row[key] for row in group
|
|
if row["version"] == "planner-head"
|
|
and row["replicate"] == replicate)
|
|
/ next(row[key] for row in group
|
|
if row["version"] == "assembler-world"
|
|
and row["replicate"] == replicate) - 1.0), 3)
|
|
for replicate in range(1, 6)]
|
|
summary.append(entry)
|
|
(OUT / "summary.json").write_text(json.dumps({
|
|
"a_a_noise_floor_pct": 1.0,
|
|
"timing_protocol": (
|
|
"one warm-up per binary, five interleaved runs per cell, W8/W12, "
|
|
"all four owner layers; L137 A/A median noise floor ±1%"),
|
|
"runs": rows,
|
|
"summary": summary,
|
|
}, indent=2) + "\n", encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|