Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux37/RunCostL37.py
T
Fr0zkaandClaude Opus 5.5 5e2fc53d39 planner: four-strate owner plan spawns (L66); pinned 2-strate regression fixture
- Core caps each passage mouth reach to its own strate's usable content band (owner
  DA_Strate1 exports ReachMax=5000 owner voxels, which put the SW->FI lower mouth 79.5 m
  below FI, inside TN).
- Unreal adapter: SW route search keeps the old 64 m candidates first, then a bounded
  single-mouth search with shorter lengths; logs candidate/rejection counts.
- Internal-chain passage floor/support tweaks (only with >2 strates): ripple 1-2 4.78->2.90 cm,
  2-3 3.57->0.10 cm. Interfaces still 0/3 walkable (59/3/2 unsupported).
- verify.py: legacy tiers use Standalone/data/regression/owner_world_2strate_l61.json; new
  four-strate stage reads its expectations from owner_world.json (currently red on interfaces).
- Unreal trace L14 vs HEAD, same assets (16-chunk FlatPlain): 12.20 vs 12.56 worker-s; no x2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-26 22:13:22 +01:00

90 lines
4.3 KiB
Python

#!/usr/bin/env python3
"""Run five interleaved whole-view cost pairs against the L36 Clang binary."""
import csv
import math
import os
import re
import statistics
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l37"
OWNER = Path(os.environ.get("VOXELFORGE_OWNER_DATA",
ROOT / "Standalone/data/owner_world.json"))
BINARIES = {
"l36": ROOT / "Saved/Linux/l36/bin/VoxelForgeCoreHeadless-l36-final-clang",
"l37": OUT / "bin/VoxelForgeCoreHeadless-l37-final-clang",
}
ORDERS = (("l36", "l37"), ("l37", "l36"), ("l36", "l37"),
("l37", "l36"), ("l36", "l37"))
READY = re.compile(r"\bwhole_view_ready=([0-9.]+)s")
STAMP = re.compile(
r"^\[WorldAssemblerRecipeAudit\] requested=([^ ]+) actual=([^ ]+).*status=PASS$", re.M)
rows = []
failed = False
for recipe in ("surface-world", "floating-islands"):
for pair, order in enumerate(ORDERS, 1):
for build in order:
name = f"cost-{recipe}-pair{pair}-{build}"
logfile = OUT / f"{name}.log"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "900s", str(BINARIES[build]),
str(OWNER),
"--workers=12", "--world-assembler-prototype", "--stream-benchmark",
"--stream-pipeline", "--force-generate", "--clip-radius=3",
"--max-clip-level=8", "--max-level=-1", f"--recipe={recipe}",
]
started = time.monotonic()
try:
with logfile.open("w", encoding="utf-8") as stream:
result = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, timeout=900, check=False)
except subprocess.TimeoutExpired:
result = None
elapsed = time.monotonic() - started
output = logfile.read_text(encoding="utf-8", errors="replace")
matches = READY.findall(output)
stamps = STAMP.findall(output)
stamp_ok = stamps == [(recipe, recipe)]
valid = (result is not None and result.returncode == 0 and len(matches) == 1
and "hash=off" in output and "cache_hits=0" in output and stamp_ok)
ready = float(matches[0]) if len(matches) == 1 else math.nan
code = result.returncode if result is not None else "TIMEOUT"
rows.append((recipe, pair, build, ready, elapsed, code, valid))
failed |= not valid
print(f"[L37CostRun] recipe={recipe} pair={pair} build={build} "
f"whole_view_ready={ready:.3f}s process_elapsed={elapsed:.1f}s "
f"{'PASS' if valid else 'FAIL'} log={logfile}", flush=True)
summary = OUT / "cost-l37.csv"
with summary.open("w", newline="", encoding="utf-8") as stream:
writer = csv.writer(stream)
writer.writerow(("recipe", "pair", "build", "whole_view_ready_seconds",
"process_elapsed_seconds", "exit_code", "status"))
writer.writerows((recipe, pair, build, f"{ready:.6f}", f"{elapsed:.3f}", code,
"PASS" if valid else "FAIL")
for recipe, pair, build, ready, elapsed, code, valid in rows)
for recipe in ("surface-world", "floating-islands"):
by_build = {build: [row[3] for row in rows if row[0] == recipe and row[2] == build]
for build in BINARIES}
baseline = statistics.median(by_build["l36"])
current = statistics.median(by_build["l37"])
paired = []
for pair in range(1, 6):
values = {row[2]: row[3] for row in rows if row[0] == recipe and row[1] == pair}
paired.append((values["l37"] - values["l36"]) / values["l36"] * 100.0)
mad = statistics.median(abs(value - statistics.median(paired)) for value in paired)
print(f"[L37CostSummary] recipe={recipe} pairs=5 median_l36_s={baseline:.3f} "
f"median_l37_s={current:.3f} median_change_pct={(current/baseline-1)*100.0:+.2f} "
f"paired_change_pct={','.join(f'{value:+.2f}' for value in paired)} "
f"paired_mad_pct={mad:.2f}", flush=True)
print(f"[L37Cost] runs={len(rows)} status={'FAIL' if failed else 'PASS'} summary={summary}",
flush=True)
raise SystemExit(1 if failed or len(rows) != 20 else 0)