fix(perception): isolate vegetation qualification IO

This commit is contained in:
DCCONSTRUCTIONS
2026-08-28 12:30:43 +03:00
parent 14877b6683
commit e1c3e7e90a
4 changed files with 47 additions and 4 deletions
@@ -205,6 +205,10 @@ foreach ($entry in $source.GetEnumerator()) {
if ((Get-Sha256 $source.SourcePack) -cne [string]$releaseDocument.source_pack_sha256) { if ((Get-Sha256 $source.SourcePack) -cne [string]$releaseDocument.source_pack_sha256) {
throw "RAVNOVES00 source pack digest changed" throw "RAVNOVES00 source pack digest changed"
} }
$videoSha256 = [string]$releaseDocument.video_sha256
if ((Get-Sha256 $source.Video) -cne $videoSha256) {
throw "RAVNOVES00 video digest changed"
}
$vegetation = $null $vegetation = $null
if ($VegetationLoadGate) { if ($VegetationLoadGate) {
@@ -405,6 +409,8 @@ try {
--checkpoint /models/candidate.pth ` --checkpoint /models/candidate.pth `
--dataset-root /data/goose ` --dataset-root /data/goose `
--video /source/right.mp4 ` --video /source/right.mp4 `
--video-sha256 $videoSha256 `
--runtime-video-cache /tmp/vegetation-right.mp4 `
--source-rate-hz $rate ` --source-rate-hz $rate `
--minimum-effective-fps 11.209069 ` --minimum-effective-fps 11.209069 `
--maximum-completion-p95-ms 125.0 ` --maximum-completion-p95-ms 125.0 `
@@ -7,6 +7,7 @@ import argparse
import json import json
import math import math
import platform import platform
import shutil
import statistics import statistics
import time import time
from pathlib import Path from pathlib import Path
@@ -53,6 +54,8 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--checkpoint", type=Path, required=True) parser.add_argument("--checkpoint", type=Path, required=True)
parser.add_argument("--dataset-root", type=Path, required=True) parser.add_argument("--dataset-root", type=Path, required=True)
parser.add_argument("--video", type=Path, required=True) parser.add_argument("--video", type=Path, required=True)
parser.add_argument("--video-sha256", required=True)
parser.add_argument("--runtime-video-cache", type=Path, required=True)
parser.add_argument("--source-rate-hz", type=float, required=True) parser.add_argument("--source-rate-hz", type=float, required=True)
parser.add_argument("--minimum-effective-fps", type=float, required=True) parser.add_argument("--minimum-effective-fps", type=float, required=True)
parser.add_argument("--maximum-completion-p95-ms", type=float, required=True) parser.add_argument("--maximum-completion-p95-ms", type=float, required=True)
@@ -110,6 +113,28 @@ def validate_sha256(value: str, label: str) -> None:
raise IntegratedLoadError(f"{label} SHA-256 is invalid") raise IntegratedLoadError(f"{label} SHA-256 is invalid")
def buffer_compressed_video(source: Path, target: Path, expected_sha256: str) -> dict[str, Any]:
if source.is_symlink() or not source.is_file():
raise IntegratedLoadError("RAVNOVES video is unavailable")
if target.exists() or target.is_symlink():
raise IntegratedLoadError("RAVNOVES runtime video cache already exists")
if not target.parent.is_dir():
raise IntegratedLoadError("RAVNOVES runtime video cache parent is unavailable")
started = time.monotonic_ns()
shutil.copyfile(source, target)
copied_bytes = target.stat().st_size
if copied_bytes != source.stat().st_size:
raise IntegratedLoadError("RAVNOVES runtime video cache size changed")
copied_sha256 = sha256(target)
if copied_sha256 != expected_sha256:
raise IntegratedLoadError("RAVNOVES runtime video cache digest changed")
return {
"bytes": copied_bytes,
"sha256": copied_sha256,
"seconds": round((time.monotonic_ns() - started) / 1_000_000_000.0, 6),
}
def run() -> int: def run() -> int:
args = parse_args() args = parse_args()
if not torch.cuda.is_available(): if not torch.cuda.is_available():
@@ -123,6 +148,7 @@ def run() -> int:
): ):
raise IntegratedLoadError("integrated-load thresholds must be positive and finite") raise IntegratedLoadError("integrated-load thresholds must be positive and finite")
validate_sha256(args.release_sha256, "release") validate_sha256(args.release_sha256, "release")
validate_sha256(args.video_sha256, "video")
if args.output.exists() or args.frame_ledger.exists(): if args.output.exists() or args.frame_ledger.exists():
raise IntegratedLoadError("integrated-load output already exists") raise IntegratedLoadError("integrated-load output already exists")
@@ -143,7 +169,10 @@ def run() -> int:
config["ravnoves"]["expected_width"], config["ravnoves"]["expected_width"],
config["ravnoves"]["expected_height"], config["ravnoves"]["expected_height"],
) )
warmup_capture = open_video(args.video) compressed_video_buffer = buffer_compressed_video(
args.video, args.runtime_video_cache, args.video_sha256
)
warmup_capture = open_video(args.runtime_video_cache)
warmup_source = decode_source(warmup_capture, expected_size) warmup_source = decode_source(warmup_capture, expected_size)
warmup_capture.release() warmup_capture.release()
@@ -152,7 +181,7 @@ def run() -> int:
warmup_tensor, _ = preprocess(warmup_source) warmup_tensor, _ = preprocess(warmup_source)
warmup_latencies_ms = [infer(model, warmup_tensor)[1] for _ in range(3)] warmup_latencies_ms = [infer(model, warmup_tensor)[1] for _ in range(3)]
torch.cuda.reset_peak_memory_stats() torch.cuda.reset_peak_memory_stats()
source_capture = open_video(args.video) source_capture = open_video(args.runtime_video_cache)
wait_for_shared_start( wait_for_shared_start(
args.shared_start_ready_file, args.shared_start_ready_file,
args.shared_start_file, args.shared_start_file,
@@ -245,7 +274,9 @@ def run() -> int:
"capacity_drop_count": 0, "capacity_drop_count": 0,
"deadline_miss_count": late_deadline_count, "deadline_miss_count": late_deadline_count,
"source_decode": { "source_decode": {
"mode": "bounded-sequential-h264/v1", "mode": "bounded-compressed-scene-buffer/v1",
"compressed_scene_prefetch": True,
"compressed_scene_buffer": compressed_video_buffer,
"full_route_rgb_prefetch": False, "full_route_rgb_prefetch": False,
"candidate_local_decoder": True, "candidate_local_decoder": True,
"runtime_target": "shared-source-frame", "runtime_target": "shared-source-frame",
@@ -93,6 +93,9 @@ def build_artifact(
"source_pack_sha256": ( "source_pack_sha256": (
"0685d24219d8236caf8b7f1685e93f6d6b59e7fd015a768d88a92bbe8b154944" "0685d24219d8236caf8b7f1685e93f6d6b59e7fd015a768d88a92bbe8b154944"
), ),
"video_sha256": (
"cadd1696ff000904eb78633a0a8418104b8024f178b91f3421789021ccb160e8"
),
"expected_frames": 4489, "expected_frames": 4489,
"requested_source_rate_hz": 12.0, "requested_source_rate_hz": 12.0,
"native_engine_sha256": ( "native_engine_sha256": (
@@ -236,10 +236,13 @@ def test_worker_gate_reuses_shared_barrier_and_keeps_canonical_triton_unchanged(
wrapper = POWERSHELL_PATH.read_text(encoding="utf-8") wrapper = POWERSHELL_PATH.read_text(encoding="utf-8")
assert '"source-paced-integrated-shadow/v1"' in runner assert '"source-paced-integrated-shadow/v1"' in runner
assert "wait_for_shared_start(" in runner assert "wait_for_shared_start(" in runner
assert '"bounded-sequential-h264/v1"' in runner assert '"bounded-compressed-scene-buffer/v1"' in runner
assert "buffer_compressed_video(" in runner
assert '"compressed_scene_prefetch": True' in runner
assert '"full_route_rgb_prefetch": False' in runner assert '"full_route_rgb_prefetch": False' in runner
assert "decode_source(source_capture, expected_size)" in runner assert "decode_source(source_capture, expected_size)" in runner
assert '"camera_semantics_can_clear_rigid_geometry": False' in runner assert '"camera_semantics_can_clear_rigid_geometry": False' in runner
assert "--runtime-video-cache /tmp/vegetation-right.mp4" in wrapper
assert "$VegetationLoadGate" in wrapper assert "$VegetationLoadGate" in wrapper
assert '"vegetation"' in wrapper assert '"vegetation"' in wrapper
assert "if ($canonicalAfter.Id -cne $canonicalId" not in wrapper assert "if ($canonicalAfter.Id -cne $canonicalId" not in wrapper