streaming: one supplemental far apply per frame when the budget is half unused (L121)
After the normal visible-apply count is reached and <50% of the 2 ms budget is spent, apply one horizon result (off during startup boost; voxel.StreamingFarApplySupplement=0 disables). 30 m/s UE, 5 pairs: far holes 4.38% -> 2.70%, far finish-to-apply p50 1.105 -> 0.114 s, worst tick 14.74 ms (<15.43), near coverage +0.3 pt, arrival whole-view -313 ms. Geometry unchanged (24/24 hashes), fast tier green. Adds trace-only RMC proxy publication timing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
1 parent
161565936c
commit
5c519f5206
8 files changed
+1115
-5
No files matched your search
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Five interleaved FI arrival pairs, comparing normal applies with one supplemental far apply."""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[4]
|
||||
RUNNER_PATH = Path(__file__).with_name("RunL121Arrival.py")
|
||||
SPEC = importlib.util.spec_from_file_location("l121_arrival", RUNNER_PATH)
|
||||
assert SPEC and SPEC.loader
|
||||
ARRIVAL = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(ARRIVAL)
|
||||
|
||||
|
||||
def add_view_metrics(row: dict) -> dict:
|
||||
trace_path = ROOT / row["trace"]
|
||||
events = ARRIVAL.read_events(trace_path)
|
||||
config = next((e for e in events if e.get("type") == "worker_backend_config"), {})
|
||||
row["effective_tile_slots"] = config.get("effective_tile_slots")
|
||||
row["near_priority"] = config.get("near_priority")
|
||||
row["horizon_priority"] = config.get("horizon_priority")
|
||||
samples = [e for e in events if e.get("type") == "streaming_sample"
|
||||
and float(e.get("t_s", 0.0)) < ARRIVAL.MOVE_START_S
|
||||
and float(e.get("speed_cm_s", 0.0)) < 50.0]
|
||||
|
||||
def total(values: list[int]) -> int:
|
||||
return sum(values)
|
||||
|
||||
def near_complete(event: dict) -> bool:
|
||||
desired = event.get("desired_by_lod", [0] * 9)
|
||||
settled = event.get("settled_by_lod", [0] * 9)
|
||||
return total(desired[:3]) > 0 and total(settled[:3]) >= total(desired[:3])
|
||||
|
||||
def whole_complete(event: dict) -> bool:
|
||||
desired = event.get("desired_by_lod", [0] * 9)
|
||||
settled = event.get("settled_by_lod", [0] * 9)
|
||||
return total(desired) > 0 and total(settled) >= total(desired)
|
||||
|
||||
def far_holes(event: dict) -> float | None:
|
||||
desired = event.get("desired_by_lod", [0] * 9)[3:]
|
||||
covered = event.get("covered_by_lod", [0] * 9)[3:]
|
||||
denominator = total(desired)
|
||||
return (100.0 * (denominator - total(covered)) / denominator
|
||||
if denominator else None)
|
||||
|
||||
first_near = next((e for e in samples if near_complete(e)), None)
|
||||
first_whole = next((e for e in samples if whole_complete(e)), None)
|
||||
first_far_clear = next((e for e in samples if total(e.get("desired_by_lod", [0] * 9)[3:])
|
||||
and far_holes(e) == 0.0), None)
|
||||
last_sample = samples[-1] if samples else None
|
||||
row["lod02_settled_t_s"] = float(first_near["t_s"]) if first_near else None
|
||||
row["whole_view_settled_t_s"] = float(first_whole["t_s"]) if first_whole else None
|
||||
row["far_clear_t_s"] = float(first_far_clear["t_s"]) if first_far_clear else None
|
||||
row["far_holes_at_20s_pct"] = far_holes(last_sample) if last_sample else None
|
||||
row["arrival_sample_count"] = len(samples)
|
||||
return row
|
||||
|
||||
|
||||
def run_condition(condition: str, repetition: int, ready_depth: int) -> dict:
|
||||
cap = 1
|
||||
expected_slots = 8
|
||||
row = ARRIVAL.run(
|
||||
"FI", repetition, condition, ready_depth, cap, 0, 1, 1, 0, 1, False, False,
|
||||
0 if condition == "baseline" else 1)
|
||||
row = add_view_metrics(row)
|
||||
if row["effective_tile_slots"] != expected_slots:
|
||||
raise RuntimeError(f"worker slot readback mismatch: {row}")
|
||||
if row["streaming_far_apply_supplement"] != (0 if condition == "baseline" else 1):
|
||||
raise RuntimeError(f"far apply supplement CVar mismatch: {row}")
|
||||
return row
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--ready-depth", type=int, choices=(8, 64), default=8)
|
||||
ready_depth = parser.parse_args().ready_depth
|
||||
OUT = ROOT / "Saved/Linux/l121/arrival"
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
results = []
|
||||
for condition in ("baseline", "far_supplement"):
|
||||
warmup = run_condition(condition, 0, ready_depth)
|
||||
warmup["warmup"] = True
|
||||
results.append(warmup)
|
||||
|
||||
for repetition in range(1, 6):
|
||||
order = ("baseline", "far_supplement") if repetition % 2 else ("far_supplement", "baseline")
|
||||
for condition in order:
|
||||
row = run_condition(condition, repetition, ready_depth)
|
||||
row["warmup"] = False
|
||||
results.append(row)
|
||||
print("[L121ArrivalPair] " + json.dumps(row, sort_keys=True), flush=True)
|
||||
|
||||
(OUT / f"pairs-rd{ready_depth}.json").write_text(json.dumps({
|
||||
"design": f"FI arrival, normal four applies versus one supplemental far apply, ready depth {ready_depth}",
|
||||
"runs": results,
|
||||
}, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user