Per-world prepared chord/length/radius/Catmull-Rom/floor-profile data (310 segments, ~66 KB, <0.04 ms); same expression grouping, divisions and square roots, so output is bit-identical (zero density/tile mismatches, Clang vs GCC equal). No measurable readiness gain - the cost is the number of samples running passage work, not per-sample arithmetic. Note: the report's world labels are shifted by one row (the 2,850-tile row is SurfaceWorld). Fast tier PASS; Linux UE host builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
92 lines
3.8 KiB
Python
92 lines
3.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Three interleaved L77 passage-share censuses for pre-L98 and L98 Core."""
|
|
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/l98/census"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARIES = {
|
|
"pre": ROOT / "Saved/Linux/l98/profile-pre-bin/VoxelForgeCoreHeadless-l98-pre-profile",
|
|
"post": ROOT / "Saved/Linux/l98/profile-post-bin/VoxelForgeCoreHeadless-l98-post-profile",
|
|
}
|
|
CAMERAS = {
|
|
"FI": (25.8369140625, 3.19921875, -737.0),
|
|
"TN": (19.166015625, -14.2001953125, -753.3740234375),
|
|
}
|
|
SAMPLE = re.compile(r"^\[L77Sample\] pc=(0x\w+) 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, label: str, rep: int) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
log = OUT / f"{label}-{world.lower()}-r{rep}.log"
|
|
camera = ",".join(f"{value:.12f}" for value in CAMERAS[world]) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"env", "timeout", "1740s", str(BINARIES[label]), 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()
|
|
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")
|
|
samples = [(int(lod), phase, int(weight))
|
|
for _pc, lod, phase, weight in SAMPLE.findall(output)]
|
|
sampler = SAMPLER.search(output)
|
|
if result.returncode or not samples or sampler is None:
|
|
raise RuntimeError(f"census failed: exit={result.returncode} {log}")
|
|
near = [row for row in samples 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, "binary": label, "replicate": rep,
|
|
"exit_code": result.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,
|
|
"log": str(log.relative_to(ROOT)),
|
|
}
|
|
print("[L98CensusRun] " + json.dumps(row, sort_keys=True), flush=True)
|
|
return row
|
|
|
|
|
|
def main() -> int:
|
|
for binary in (*BINARIES.values(), DATA):
|
|
if not binary.is_file():
|
|
raise SystemExit(f"missing input: {binary}")
|
|
rows = []
|
|
orders = (("pre", "post"), ("post", "pre"), ("pre", "post"))
|
|
for rep, order in enumerate(orders, 1):
|
|
for label in order:
|
|
for world in CAMERAS:
|
|
rows.append(run(world, label, rep))
|
|
(OUT / "runs-partial.json").write_text(json.dumps(rows, indent=2) + "\n",
|
|
encoding="utf-8")
|
|
summary = {}
|
|
for world in CAMERAS:
|
|
summary[world] = {}
|
|
for label in BINARIES:
|
|
values = [row["near_lod_passage_share_pct"] for row in rows
|
|
if row["world"] == world and row["binary"] == label]
|
|
summary[world][label] = {
|
|
"runs_pct": values, "mean_pct": sum(values) / len(values),
|
|
}
|
|
(OUT / "summary.json").write_text(json.dumps(
|
|
{"runs": rows, "near_lod_passage_share": summary}, indent=2) + "\n",
|
|
encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|