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
106 lines
4.9 KiB
Python
106 lines
4.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Count prepared-segment use and XY projection reuse in LOD0-2 world views."""
|
|
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/reuse-counts"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARY = ROOT / "Saved/Linux/l98/bin/VoxelForgeCoreHeadless-l98-clang19"
|
|
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),
|
|
}
|
|
REUSE = re.compile(
|
|
r"^\[L98PassageReuseTile\] lod=(-?\d+) projection_columns=(\d+) "
|
|
r"projection_computes=(\d+) projection_hits=(\d+) floor_profile_reads=(\d+) "
|
|
r"carve_prepared=(\d+) support_prepared=(\d+) capsule_prepared=(\d+) "
|
|
r"mouth_prepared=(\d+)$", re.M)
|
|
PREP = re.compile(r"^\[L98PassagePrepare\] (.*)$", re.M)
|
|
MOUTH_PREP = re.compile(r"^\[L98PassageMouthPrepare\] (.*)$", re.M)
|
|
PIPELINE = re.compile(r"^\[StreamPipeline\] (.*)$", re.M)
|
|
PROBE = re.compile(r"^\[L98PassageReuseProbe\] z_runs=(\d+) samples=(\d+) "
|
|
r"scalar_mismatches=(\d+) status=(\S+)$", re.M)
|
|
|
|
|
|
def run(strate: int) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
log = OUT / f"s{strate}.log"
|
|
camera = ",".join(f"{v:.12f}" for v in CAMERAS[strate]) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"env", "VOXELFORGE_L98_PASSAGE_REUSE_COUNTS=1",
|
|
"VOXELFORGE_L98_PASSAGE_PREP_TRACE=1",
|
|
"VOXELFORGE_L98_PASSAGE_REUSE_PROBE=1", "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}",
|
|
]
|
|
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")
|
|
tile_rows = [tuple(map(int, match.groups())) for match in REUSE.finditer(output)]
|
|
prep = PREP.findall(output)
|
|
mouth_prep = MOUTH_PREP.findall(output)
|
|
pipeline = PIPELINE.search(output)
|
|
probe = PROBE.search(output)
|
|
if (result.returncode or not tile_rows or not prep or pipeline is None or probe is None
|
|
or probe.group(4) != "PASS"):
|
|
raise RuntimeError(f"reuse-count run failed or incomplete: exit={result.returncode} {log}")
|
|
totals = [sum(row[index] for row in tile_rows) for index in range(1, 9)]
|
|
lod_totals = {}
|
|
for lod in sorted({row[0] for row in tile_rows}):
|
|
lod_rows = [row for row in tile_rows if row[0] == lod]
|
|
lod_totals[str(lod)] = {
|
|
"tile_scope_rows": len(lod_rows),
|
|
"projection_columns": sum(row[1] for row in lod_rows),
|
|
"projection_computes": sum(row[2] for row in lod_rows),
|
|
"projection_hits": sum(row[3] for row in lod_rows),
|
|
"floor_profile_reads": sum(row[4] for row in lod_rows),
|
|
"carve_prepared_uses": sum(row[5] for row in lod_rows),
|
|
"support_prepared_uses": sum(row[6] for row in lod_rows),
|
|
"capsule_prepared_uses": sum(row[7] for row in lod_rows),
|
|
"mouth_prepared_uses": sum(row[8] for row in lod_rows),
|
|
}
|
|
row = {
|
|
"strate": strate, "exit_code": result.returncode,
|
|
"wall_s": round(time.monotonic() - start, 3), "tile_scope_rows": len(tile_rows),
|
|
"lod_scope_rows": {str(lod): sum(1 for row in tile_rows if row[0] == lod)
|
|
for lod in sorted({row[0] for row in tile_rows})},
|
|
"lod_totals": lod_totals,
|
|
"projection_columns": totals[0], "projection_computes": totals[1],
|
|
"projection_hits": totals[2], "floor_profile_reads": totals[3],
|
|
"carve_prepared_uses": totals[4], "support_prepared_uses": totals[5],
|
|
"capsule_prepared_uses": totals[6], "mouth_prepared_uses": totals[7],
|
|
"projection_probe": {
|
|
"z_runs": int(probe.group(1)), "samples": int(probe.group(2)),
|
|
"scalar_mismatches": int(probe.group(3)), "status": probe.group(4),
|
|
},
|
|
"prepare_traces": prep, "mouth_prepare_traces": mouth_prep,
|
|
"stream_pipeline": pipeline.group(1), "log": str(log.relative_to(ROOT)),
|
|
}
|
|
print("[L98ReuseCountRun] " + 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(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())
|