L78's strict near-first order starved far LODs at 30 m/s (100% far holes, never completed). Unreal policy 2: once the collision ring is ready, LOD0-2 keep their reserve and far tiles are admitted as low-priority Horizon work; headless gives far work 1 of every 16 requests. Moving camera, far holes while moving: 1.4 m/s L77 8% / L78 29% / L79 31%; 30 m/s L77 8% / L78 100% / L79 72% (completes on dwell). Near readiness while moving at 30 m/s: 52 / 51 / 67%. Still worse than L77 for fast travel -> speed-adaptive policy next. World unchanged (v213). 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
125 lines
6.0 KiB
Python
125 lines
6.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Measure streaming coverage while the standalone queue follows a moving camera."""
|
|
from __future__ import annotations
|
|
|
|
import csv
|
|
import json
|
|
import re
|
|
import subprocess
|
|
import time
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
OUT = ROOT / "Saved/Linux/l79/movement/headless"
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BINARY = ROOT / "Saved/Linux/l79/bin/VoxelForgeCoreHeadless-l79-final"
|
|
CAMERA_M = (19.166015625, -14.2001953125, -753.3740234375)
|
|
POLICIES = {0: "L77", 1: "L78", 2: "L79"}
|
|
SPEEDS = {"walk": 1.4, "fast": 30.0}
|
|
SAMPLE = re.compile(r"^\[L79MovingSample\] (.*)$", re.M)
|
|
SUMMARY = re.compile(r"^\[L79MovingSummary\] (.*)$", re.M)
|
|
FIELDS = re.compile(r"([a-zA-Z0-9_]+)=([^ ]+)")
|
|
|
|
|
|
def run(policy: int, speed_name: str) -> tuple[dict, list[dict]]:
|
|
label = f"{speed_name}-{POLICIES[policy]}"
|
|
log = OUT / f"{label}.log"
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
camera = ",".join(f"{value:.12f}" for value in CAMERA_M) + ",0,0"
|
|
command = [
|
|
"taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--",
|
|
"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",
|
|
f"--stream-scheduler-policy={policy}",
|
|
f"--moving-camera-speed-mps={SPEEDS[speed_name]:.1f}",
|
|
"--moving-camera-duration-s=12", "--moving-camera-dwell-s=5",
|
|
]
|
|
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")
|
|
samples = [dict(FIELDS.findall(match.group(1))) for match in SAMPLE.finditer(content)]
|
|
summary_match = SUMMARY.search(content)
|
|
engine_summary = dict(FIELDS.findall(summary_match.group(1))) if summary_match else {}
|
|
if result.returncode != 0 or not samples or not engine_summary:
|
|
raise SystemExit(f"moving-camera run failed or trace missing: {log}; exit={result.returncode}")
|
|
for row in samples:
|
|
for name in ("policy", "speed_mps", "t_s", "x_m", "near_ready_pct", "far_missing_pct",
|
|
"far_hole_pct",
|
|
"far_stale_mean_s", "far_stale_max_s", "generation_failures", "queue_update_ms"):
|
|
row[name] = float(row[name])
|
|
row["label"] = label
|
|
if int(float(engine_summary.get("generation_failures", "-1"))) != 0:
|
|
raise SystemExit(f"tile generation failure: {log}")
|
|
run_info = {
|
|
"label": label, "policy": POLICIES[policy], "policy_id": policy,
|
|
"speed": speed_name, "speed_mps": SPEEDS[speed_name],
|
|
"exit_code": result.returncode, "elapsed_s": round(time.monotonic() - started, 3),
|
|
"samples": len(samples), "engine_summary": engine_summary,
|
|
"log": str(log.relative_to(ROOT)),
|
|
}
|
|
print("[L79HeadlessMoveRun] " + json.dumps(run_info, sort_keys=True), flush=True)
|
|
return run_info, samples
|
|
|
|
|
|
def main() -> int:
|
|
if not DATA.is_file() or not BINARY.is_file():
|
|
raise SystemExit(f"missing input: {DATA} or {BINARY}")
|
|
results: list[dict] = []
|
|
samples: list[dict] = []
|
|
schedule = [(policy, speed) for speed in ("walk", "fast")
|
|
for policy in (0, 1, 2)]
|
|
for policy, speed in schedule:
|
|
result, rows = run(policy, speed)
|
|
results.append(result)
|
|
samples.extend(rows)
|
|
(OUT / "runs-partial.json").write_text(
|
|
json.dumps(results, indent=2) + "\n", encoding="utf-8")
|
|
summary = []
|
|
for speed_name, speed in SPEEDS.items():
|
|
for policy in POLICIES:
|
|
rows = [row for row in samples
|
|
if row["speed_mps"] == speed and row["policy"] == policy]
|
|
moving = [row for row in rows if row.get("phase") == "move"]
|
|
dwell = [row for row in rows if row.get("phase") == "dwell"]
|
|
summary.append({
|
|
"speed": speed_name, "speed_mps": speed, "policy": POLICIES[policy],
|
|
"moving_samples": len(moving), "dwell_samples": len(dwell),
|
|
"far_missing_moving_mean_pct": round(
|
|
sum(row["far_missing_pct"] for row in moving) / max(1, len(moving)), 3),
|
|
"far_missing_moving_max_pct": max(
|
|
(row["far_missing_pct"] for row in moving), default=None),
|
|
"far_missing_dwell_last_pct": dwell[-1]["far_missing_pct"] if dwell else None,
|
|
"far_hole_moving_mean_pct": round(
|
|
sum(row["far_hole_pct"] for row in moving) / max(1, len(moving)), 3),
|
|
"far_hole_moving_max_pct": max(
|
|
(row["far_hole_pct"] for row in moving), default=None),
|
|
"far_hole_dwell_last_pct": dwell[-1]["far_hole_pct"] if dwell else None,
|
|
"far_stale_moving_max_s": max(
|
|
(row["far_stale_max_s"] for row in moving), default=None),
|
|
"far_stale_dwell_max_s": max(
|
|
(row["far_stale_max_s"] for row in dwell), default=None),
|
|
"near_ready_moving_mean_pct": round(
|
|
sum(row["near_ready_pct"] for row in moving) / max(1, len(moving)), 3),
|
|
"near_ready_moving_min_pct": min(
|
|
(row["near_ready_pct"] for row in moving), default=None),
|
|
"near_ready_dwell_last_pct": dwell[-1]["near_ready_pct"] if dwell else None,
|
|
"queue_update_max_ms": max((row["queue_update_ms"] for row in rows), default=None),
|
|
})
|
|
(OUT / "summary.json").write_text(
|
|
json.dumps({"runs": results, "summary": summary}, indent=2) + "\n", encoding="utf-8")
|
|
if samples:
|
|
with (OUT / "samples.csv").open("w", newline="", encoding="utf-8") as stream:
|
|
writer = csv.DictWriter(stream, fieldnames=list(samples[0]))
|
|
writer.writeheader()
|
|
writer.writerows(samples)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|