Near tiles legitimately need floor/ceiling boundary patches, but every hit query scanned the tile's whole XY column. Direction-specific 3D cell bins conservatively index triangle bounds; the existing predicates still decide every hit. Candidate visits per query -88..-99%; identical query and hit counts. Hit-function cost ~1.7-1.9 -> ~0.35 s per FI/TN run. Near-ready @W12: FI 1.63 -> 1.52, TN 1.51 -> 1.38, VS 1.00 -> 0.92 s. All tile/whole hashes equal L103 (Clang/GCC W1/W8/W12). The 24-28% "idle" is in the serial base-shape (~0.24 s) and far-parent (~0.13 s) phases; the LOD0-1 drain is >= 99.4% busy. Fast tier PASS; Linux UE builds; FI Unreal arrival 1.96-1.98 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
81 lines
3.5 KiB
Python
81 lines
3.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Measure exact far-hit triangle probes with the L104 memo disabled/enabled."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import re
|
|
import subprocess
|
|
import time
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
OUT = ROOT / "Saved/Linux/l104/probes"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARY = ROOT / "Saved/Linux/l104/bin/VoxelForgeCoreHeadless-l104-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),
|
|
}
|
|
|
|
|
|
def run(stratum: str, cache: str) -> dict:
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
log = OUT / f"{stratum.lower()}-{cache}.log"
|
|
camera = ",".join(f"{value:.12f}" for value in CAMERAS[stratum]) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"env", f"VOXELFORGE_L104_FAR_HIT_CACHE={0 if cache == 'off' else 1}",
|
|
"VOXELFORGE_L104_FAR_HIT_STATS=1", "timeout", "1740s", str(BINARY), str(DATA),
|
|
"--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline",
|
|
"--workers=12", "--clip-radius=3", "--max-clip-level=8", "--max-level=8",
|
|
f"--camera={camera}", "--stream-scheduler-policy=3",
|
|
]
|
|
started = 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)
|
|
content = log.read_text(encoding="utf-8", errors="replace")
|
|
rows = []
|
|
pattern = re.compile(
|
|
r"^\[FarHitQueryStats\] lod=(\d+) origin=\(([^)]*)\) "
|
|
r"down_queries=(\d+) down_candidate_tests=(\d+) down_hit_queries=(\d+) "
|
|
r"up_queries=(\d+) up_candidate_tests=(\d+) up_hit_queries=(\d+)$", re.M)
|
|
for match in pattern.finditer(content):
|
|
rows.append({
|
|
"lod": int(match.group(1)), "origin": match.group(2),
|
|
"down_queries": int(match.group(3)), "down_candidate_tests": int(match.group(4)),
|
|
"down_hit_queries": int(match.group(5)), "up_queries": int(match.group(6)),
|
|
"up_candidate_tests": int(match.group(7)), "up_hit_queries": int(match.group(8)),
|
|
})
|
|
if result.returncode or not rows:
|
|
raise RuntimeError(f"probe stats failed or missing: {log}; exit={result.returncode}")
|
|
row = {"stratum": stratum, "cache": cache, "exit_code": result.returncode,
|
|
"source_stamp": re.search(r"^\[VoxelForgeSourceStamp\] sha256=(\S+)$", content, re.M).group(1),
|
|
"wall_s": round(time.monotonic() - started, 3), "indices": len(rows),
|
|
"stats": rows, "log": str(log.relative_to(ROOT))}
|
|
(OUT / f"{stratum.lower()}-{cache}.json").write_text(
|
|
json.dumps(row, indent=2) + "\n", encoding="utf-8")
|
|
print("[L104ProbeStatsRun] " + json.dumps(
|
|
{key: value for key, value in row.items() if key != "stats"}, 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 = []
|
|
for stratum in CAMERAS:
|
|
for cache in ("off", "on"):
|
|
rows.append(run(stratum, cache))
|
|
(OUT / "runs-partial.json").write_text(
|
|
json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
|
(OUT / "runs.json").write_text(json.dumps(rows, indent=2) + "\n", encoding="utf-8")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|