Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux99/RunL99SweepCounts.py
T
Fr0zkaandClaude Opus 5.5 fa6363b31a passages: two-pass swept-tube tunnels (owner design, L99, v215) - pending owner visual review
Route plan unchanged. Per tile, route segments whose bounded influence (tube + 4 m) touches the
tile write min-combined tube distance (base sweep); relief/floor/mouth shaping only in the shell
(detail sweep); 0.5 m edge blend into the strate field. Near-ready @W12: SW 1.01->0.80,
FI 2.23->1.43, TN 2.18->1.37, VS 1.09->0.98 s; whole view FI 3.38->2.37 s. All passage walk
audits pass (21,425/21,425 canonical, 3/3 interfaces); 24-run Clang/GCC W1/W8/W12 determinism;
0 sign flips. Change: mean 0.02 cm / 0.05 deg; max 25.9 cm (passage walls/roofs ~3.5 m from
route, LOD2) and 49.8 deg (rock walls 13-25 m from routes, LOD2). Captures with diffs in
Linux99/captures. Fast tier PASS (v215 pins).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
2026-10-28 14:38:45 +01:00

79 lines
3.2 KiB
Python

#!/usr/bin/env python3
"""Count bounded-sweep candidates, outside-volume rejects, and cache lookups."""
from __future__ import annotations
import json
import re
import subprocess
import time
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
OUT = ROOT / "Saved/Linux/l99/sweep-counts"
DATA = ROOT / "Standalone/data/owner_world.json"
HEADLESS = ROOT / "Saved/Linux/l99/bin/VoxelForgeCoreHeadless-l99-clang"
CAMERAS = {
"SW": (8.0, 16.0, -372.2626953125),
"FI": (25.8369140625, 3.19921875, -737.0),
"TN": (19.166015625, -14.2001953125, -753.3740234375),
"VS": (-20.0625, -5.068359375, -900.353515625),
}
LINE = re.compile(r"^\[PassageComposerTile\] key=\([^,]+,[^,]+,[^,]+,lod(\d+)\) (.*)$", re.M)
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
COUNT_KEYS = (
"route_candidates", "sweep_segments", "sweep_pairs", "sweep_outside_pairs",
"sweep_min_updates", "sweep_base_samples", "sweep_detail_samples",
"sweep_grid_samples", "sweep_no_influence_samples", "sweep_lookups",
"sweep_cache_hits", "sweep_base_hits", "sweep_outside_hits", "sweep_missing",
)
def run(strate: str) -> dict:
OUT.mkdir(parents=True, exist_ok=True)
log = OUT / f"profile-sweep-{strate.lower()}.log"
camera = ",".join(f"{value:.12f}" for value in CAMERAS[strate]) + ",0,0"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"timeout", "1740s", str(HEADLESS), str(DATA), "--world-assembler-prototype",
"--stream-benchmark", "--stream-pipeline", "--workers=8", "--clip-radius=3",
"--max-clip-level=8", "--max-level=8", f"--camera={camera}",
"--profile-passage-composer",
]
start = time.monotonic()
with log.open("w", encoding="utf-8") as stream:
result = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1740)
output = log.read_text(encoding="utf-8", errors="replace")
if result.returncode != 0:
raise RuntimeError(f"sweep count run failed: exit={result.returncode} {log}")
rows = []
for level_text, tail in LINE.findall(output):
level = int(level_text)
if level > 2:
continue
fields = dict(FIELDS.findall(tail))
rows.append({"lod": level, **{key: int(fields.get(key, 0)) for key in COUNT_KEYS}})
if not rows:
raise RuntimeError(f"no profiled near-set passage tiles: {log}")
totals = {key: sum(row[key] for row in rows) for key in COUNT_KEYS}
row = {
"strate": strate, "workers": 8, "near_profiled_tiles": len(rows),
"near_tiles_by_lod": {str(level): sum(1 for item in rows if item["lod"] == level)
for level in range(3)},
"counters": totals, "wall_s": round(time.monotonic() - start, 3),
"log": str(log.relative_to(ROOT)),
}
print("[L99SweepCounts] " + json.dumps(row, sort_keys=True), flush=True)
return row
def main() -> int:
rows = [run(strate) for strate in CAMERAS]
(OUT / "summary.json").write_text(json.dumps({"runs": rows}, indent=2) + "\n",
encoding="utf-8")
return 0
if __name__ == "__main__":
raise SystemExit(main())