Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux81/RunL81Census.py
T
Fr0zkaandClaude Opus 5.5 9cb5e53b17 passages: exact density-aware outer bound skips passage work beyond its reach (L81, v214)
The carve is max(source, -roughSDF/Q), so its reach grows with -source; the outer test uses
-d*Q + 0.24 m (wall relief 0.21 + margin) beyond the route radius, disabled in mouth-support
and column-overlap tiles. Skips 16% of passage iterations on the highest-activity tiles and
all of them on ordinary tiles. 84 candidate/full pairs identical in every hash; 0 changed samples.
Evaluator 214 for cache invalidation only. Cold LOD0-2 (L80 protocol): SW 1.30->1.25,
FI 3.59->2.93, TN 3.18->3.51 (noise?), VS 1.33->1.22 s. Fast tier PASS.

Note: the export's legacy 26-point root route owner_world.passages[0] fails a full-view
pre-audit (65 solid samples, unchanged since L70); the canonical 211-point route used by the
plan passes. Stale data to clean up.

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

84 lines
3.7 KiB
Python

#!/usr/bin/env python3
"""Repeat the L77 phase census on FI/TN with the L81 exact cut enabled."""
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/l81/census"
DATA = ROOT / "Standalone/data/owner_world.json"
BINARY = ROOT / "Saved/Linux/l81/profile-bin/VoxelForgeCoreHeadless-l81-profile-clang"
CAMERAS = {
"FI": (25.8369140625, 3.19921875, -737.0),
"TN": (19.166015625, -14.2001953125, -753.3740234375),
}
SAMPLE = re.compile(r"^\[L77Sample\] .*?lod=(\d+) .*?phase=(\S+) .*?weight=(\d+)$", re.M)
SAMPLER = re.compile(r"^\[L77Sampler\] action=stop .*?samples=(\d+).*?status=PASS$", re.M)
def run(world: str, rep: int, mode: str, padding: str) -> dict:
OUT.mkdir(parents=True, exist_ok=True)
log = OUT / f"l77-phase-{world.lower()}-{mode}-r{rep}.log"
camera = ",".join(f"{value:.12f}" for value in CAMERAS[world]) + ",0,0"
command = [
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
"env", f"VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS={padding}", "timeout", "1740s",
str(BINARY), 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-lod-work", "--linux77-profile",
]
start = time.monotonic()
try:
with log.open("w", encoding="utf-8") as stream:
proc = subprocess.run(command, cwd=ROOT, stdout=stream,
stderr=subprocess.STDOUT, check=False, timeout=1740)
except subprocess.TimeoutExpired as exc:
raise RuntimeError(f"census run exceeded 1,740 seconds: {log}") from exc
content = log.read_text(encoding="utf-8", errors="replace")
matches = [(int(lod), phase, int(weight)) for lod, phase, weight in SAMPLE.findall(content)]
sampler = SAMPLER.search(content)
if proc.returncode or not matches or not sampler:
raise RuntimeError(f"census failed exit={proc.returncode}: {log}")
near = [row for row in matches if row[0] <= 2]
passage = sum(weight for _, phase, weight in near if phase == "passages")
total = sum(weight for _, _, weight in near)
row = {
"world": world, "mode": mode, "padding_voxels": padding,
"replicate": rep, "exit_code": proc.returncode,
"wall_s": round(time.monotonic() - start, 3),
"sampler_samples": int(sampler.group(1)), "near_lod_samples": len(near),
"near_lod_weighted_ticks": total, "near_lod_passage_weighted_ticks": passage,
"near_lod_passage_share_pct": 100.0 * passage / total if total else 0.0,
"log": str(log.relative_to(ROOT)),
}
print("[L81CensusRun] " + json.dumps(row, sort_keys=True), flush=True)
return row
def main() -> int:
if not BINARY.is_file() or not DATA.is_file():
raise SystemExit(f"missing input: {BINARY} or {DATA}")
rows = [run(world, rep, mode, padding)
for mode, padding in (("full", "inf"), ("exact", "0"))
for rep in (1, 2) for world in ("FI", "TN")]
by_world = {}
for world in CAMERAS:
by_world[world] = {}
for mode in ("full", "exact"):
values = [row["near_lod_passage_share_pct"] for row in rows
if row["world"] == world and row["mode"] == mode]
by_world[world][mode] = {
"runs_pct": values, "mean_pct": sum(values) / len(values)}
(OUT / "l77-phase-summary.json").write_text(
json.dumps({"runs": rows, "near_lod_passage_share": by_world}, indent=2) + "\n",
encoding="utf-8")
return 0
if __name__ == "__main__":
raise SystemExit(main())