Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

phase-5 work: R1.1 rebuild phase5 gate fail-closed and prove red (34/42 named failures, manifest-depth/fake-4K/5min holes removed)

Veyra Goal Agent7ec1e0cc3e56
diff --git a/loop/JOURNAL.md b/loop/JOURNAL.md
index 97662b22..47041a16 100644
--- a/loop/JOURNAL.md
+++ b/loop/JOURNAL.md
@@ -944,6 +944,40 @@ C staged teardown 定位崩溃=swapChain_.Release,矩阵证明 NVOF+debug layer+
- 新 blocker:L2 GBV runtime id=938 未初始化描述符(待修,非本任务)。
- 未执行:query-heap GPU timestamp(用户明令禁止);Reviewer/checkpoint(未授权)。
+## Cycle 031 — R1.1 phase5 gate 重建并先红(2026-09-06 Goal)
+
+### Before
+
+- Phase: 5(重开,in_progress)
+- 唯一任务: 重写 `scripts/gates/phase5.ps1` 为 fail-closed 产品级 gate:移除 manifest-only depth 与第二次 1080p 冒充 4K 两个假通过口、恢复 30 分钟门槛、要求产品库(veyra_pipeline/veyra_guidance)真实存在并被 runner 链接、要求本次 run 的 extent/counter/hash/timing/VRAM/reset JSON 契约、主路径纪律(readback=0、逐帧 CPU wait=0、有界队列);并在当前实现上证明 exit 1。
+- 可证伪假设: 当前 CMake 无 veyra_pipeline/veyra_guidance/veyra_quality_probe target、无 src/pipeline、无 corpus manifest → 新 gate 必须以这些具体缺项 exit 1;若 gate 在这些缺失下 exit 0 则它仍是假 gate,必须重写。
+- 预计修改文件: scripts/gates/phase5.ps1(整体重写,ASCII-only)。
+- 快速检查命令: `powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\loop-gate.ps1 -Gate phase5` → 预期 exit 1,失败项命中 product-library/corpus/runner/endurance 缺口。
+- 预期新增证据: 新 gate 脚本 + 负向 exit 1 运行输出(run-id 落 logs/phase5/)。
+
+### After
+
+- 实际修改: scripts/gates/phase5.ps1 整体重写(42 项检查,ASCII-only,AST-CLEAN)。
+- 实际命令与 exit code:
+ - AST 解析 → AST-CLEAN。
+ - `loop-gate.ps1 -Gate phase5` → **exit 1**(外层 1 失败项 = phase-gate:phase5 exitCode=1;phase-gate-no-project-mutation 通过,gate 未改任何非忽略文件)。
+ - 内层直跑 `phase5.ps1 -Root .` → **exit 1,34/42 检查失败**,失败清单精确命中计划缺口(run-id e293aaf83e0d4eb2b2980b5b4305deb4 及第二轮复跑,logs/phase5/<runId>/)。
+- 失败项与本计划逐项对应:
+ - `product:veyra_pipeline-target` / `product:veyra_guidance-target` / `product:quality-runner-target` / `product:player-links-pipeline` / `product:enhance-graph-submits-gpu` — 共享产品库与真实 GPU graph 提交不存在(R3 范围);
+ - `corpus:*` ×4 — 确定性 corpus manifest 不存在(R1.2 范围);
+ - `quality:*` ×12、`depth:provider-from-run` — runner 缺失,全部 fail-closed "not available";**depth 明确不接受 manifest**(旧 gate 假通过口 #1 已删除);
+ - `endurance:*` ×10 — 4K 检查必须来自本次 run JSON 的 extent(旧 gate 假通过口 #2 已删除);duration 门槛 1790s/30min(旧 gate 假通过口 #3 已删除);
+ - `discipline:main-path` — readback/cpu-wait/deviceRemoved 契约;
+ - `quality:hash-binding` — exe/input/config/runtime hash + run-id 绑定(旧 gate 假通过口 #4 已删除)。
+- 通过项: gate:self-control-chars、build:x64-release、git-ignore ×6。
+- 新 gate 关键设计: runner 契约 `veyra_quality_probe --corpus/--input --duration-seconds --guidance {off,zero,motion,motion-depth,auto}`;JSON 必含 extent×3、frames×3、nrEvaluate/nvofExecute、provenance/nonZeroMotionCount、confidence P05/P50/P95、depthMode/fallback/age、resetCountsByReason/sceneCut/crossCut、gpuPass P50/P95、readback/cpuFenceWaitPerFrame/queueHighWater/vramBudgetHeadroom、workingSet S/P/E、deviceRemovedCount、hashes×4+runId;阈值 1790s/97000 帧/1536MiB VRAM headroom/queue≤6/wsGrowth<512MiB;depth manifest 永不放行 provider 检查。
+- 失败 fingerprint: phase5|loop-gate -Gate phase5|1|product-library+corpus+runner missing —— 预期的 fail-closed 证明,非缺陷。
+- 是否有进展,依据: 是——Phase 5 验收从"旧 gate 可被 manifest/假 4K/5 分钟糊弄"变为机器可验证的 fail-closed 契约,且证明当前实现无法通过。
+- STATE/BACKLOG 更新: cycle.completed=31;BACKLOG R1.1 → DONE(gate 重建并先红);nextAction → R1.2。
+- 下一唯一动作: R1.2 — 扩展 veyra_clip_gen 支持 translation/occlusion/cut-flash-duplicate/particles/ui-text 五类场景,生成 1080p60+4K60 corpus 与 SHA256 manifest。
+
+---
+
## Cycle 030 — R0 新 Maker 接管:preflight/指纹/分类/四类窄 probe(2026-09-06 Goal)
### Before
diff --git a/loop/STATE.json b/loop/STATE.json
index 3fca56be..facdb03b 100644
--- a/loop/STATE.json
+++ b/loop/STATE.json
@@ -76,14 +76,14 @@
}
],
"cycle": {
- "completed": 30,
+ "completed": 31,
"maximum": 120,
"sameFailureAttempts": 0,
"maximumSameFailureAttempts": 3,
"noProgressCycles": 0,
"maximumNoProgressCycles": 5
},
- "currentTask": "R0 takeover complete (Cycle 030): preflight 70/70, Release build exit 0, takeover fingerprint 61feb89b38e32f589b5c2fb6750526e5ad90dc3c, 44 worktree entries classified (keep/repair/hold, none obsolete), four narrow probes re-run with fresh run-ids (NVOF PASS, FG 59/59 truth PASS, audio PASS, player FAIL driftP95=2858ms as expected), protective takeover checkpoint committed.",
+ "currentTask": "R1.1 complete (Cycle 031): scripts/gates/phase5.ps1 rewritten as a 42-check fail-closed product gate (manifest-only depth path deleted, second-1080p-as-4K deleted, 30-minute endurance restored, product-library execution proof, extent/hash/timing/VRAM/reset JSON contract). Proven red on current implementation: exit 1, 34/42 failed with named gaps (product library x5, corpus x4, matrix/depth/endurance/discipline fail-closed).",
"lastGate": {
"name": "phase5",
"status": "invalidated_requires_rebuild",
@@ -106,6 +106,6 @@
"A real DirectShow/UVC 4K60 SDR capture device, HDMI audio, and 4K60 source signal are required before P7 capture gate can pass.",
"Public distribution rights for the experimental DLSSNR runtime and all bundled NVIDIA/model/FFmpeg assets are unresolved; a local release candidate is allowed, public launch is blocked."
],
- "nextAction": "Playbook R1.1: rewrite scripts/gates/phase5.ps1 as a fail-closed product-grade gate (no manifest-only depth, no second-1080p-as-4K, 30-minute endurance, product-library execution proof, extent/hash/timing/VRAM/reset JSON contract) and prove it exits 1 on the current metrics-only graph, then execute R1.2 deterministic corpus via veyra_clip_gen.",
- "updatedAt": "2026-09-06T16:20:00+08:00"
+ "nextAction": "Playbook R1.2: extend veyra_clip_gen with five deterministic scenarios (translation, occlusion, cut-flash-duplicate, particles, ui-text) at 1080p60 and 4K60, generate the corpus into loop/local/fixed_clips with recorded commands and SHA256 corpus-manifest.json so the rebuilt phase5 gate corpus checks can pass; then R2.1 FramePacket contract migration.",
+ "updatedAt": "2026-09-06T16:55:00+08:00"
}
diff --git a/scripts/gates/phase5.ps1 b/scripts/gates/phase5.ps1
index 72b4c633..23220660 100644
--- a/scripts/gates/phase5.ps1
+++ b/scripts/gates/phase5.ps1
@@ -1,20 +1,37 @@
[CmdletBinding()]
param([Parameter(Mandatory = $true)][string]$Root)
-# Veyra Phase 5 gate: Unified Guidance and Quality Core (Launch V1).
-# Covers BACKLOG P5.1 requirements:
-# - Unified EnhanceGraph: single graph chains decode→SR→parity→NR→parity
-# - Real SR→NR: 1080p→4K upscale + NR per frame (not bypass)
-# - Scene/cadence analyzer: cut detection, flash rejection, duplicate handling
-# - Non-zero NVOF motion: real optical flow vectors (not all-zero)
-# - Confidence: R8_UNORM confidence map derived from NVOF cost
-# - DAV2 depth or explicit Auto fallback (not silent zero depth)
-# - 1080p60 endurance: 30 minutes at 60fps
-# - native 4K60 endurance: 30 minutes at 60fps
-# - Output non-black, non-constant, varies with input
-# - GPU timestamps recorded; normal-path readback=0
-# - Bounded queues/resources/memory
-# FAIL-CLOSED: every missing implementation or threshold breach fails.
+# Veyra Phase 5 gate (R1.1 rewrite, 2026-09-06): product-grade unified guidance
+# and quality core. This replaces the invalidated gate that (a) accepted a depth
+# manifest as provider completion, (b) ran a second 1080p endurance in the
+# native-4K slot, (c) shortened 30-minute endurance to 5 minutes, and (d) never
+# proved that a product library executed the GPU chain.
+#
+# Runner contract (implemented by Playbook R3/R4):
+# veyra_quality_probe.exe --corpus <manifest.json> --guidance <off|zero|motion|motion-depth|auto>
+# --run-id <id> --log-file <p> --json-file <p>
+# veyra_quality_probe.exe --input <clip> --duration-seconds <n>
+# --run-id <id> --log-file <p> --json-file <p>
+# The runner must link veyra_pipeline/veyra_guidance (shared product graph), not
+# a private copy of the chain. Every run JSON must carry:
+# runId, exeHash, inputHash, configHash, runtimeHash
+# sourceExtent{width,height}, workingExtent{width,height}, outputExtent{width,height}
+# sourceFrames, processedFrames, nrEvaluateCount, nvofExecuteCount
+# guidanceProvenance, nonZeroMotionCount, confidenceP05/P50/P95
+# depthMode, depthFallbackReason, depthAgeP95
+# resetCountsByReason, sceneCutCount, crossCutHistoryCount
+# gpuPassP50Ms, gpuPassP95Ms, normalPathReadbackCount, cpuFenceWaitPerFrame
+# queueHighWater, resourcePoolPeakMiB, vramBudgetHeadroomMiB
+# workingSetStartMiB/PeakMiB/EndMiB, deviceRemovedCount, durationSeconds
+#
+# Thresholds (Product Spec 11, Playbook R1/R5):
+# endurance >= 1790s measured (30-minute bar, 10s startup tolerance)
+# processedFrames >= 97000 (~30min x 60fps with tolerance)
+# vramBudgetHeadroomMiB >= 1536 (1.5 GiB)
+# queueHighWater <= 6, wsGrowth < 512 MiB, deviceRemoved == 0
+# normalPathReadbackCount == 0, cpuFenceWaitPerFrame == 0
+# A depth manifest can NEVER satisfy a provider check in this gate.
+# FAIL-CLOSED: missing artifact, field, hash mismatch, or threshold breach fails.
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
@@ -36,12 +53,28 @@ function Test-GateEnd {
exit 1
}
}
+function Get-Field {
+ param($Object, [string]$Name)
+ if ($null -eq $Object) { return $null }
+ $p = $Object.PSObject.Properties[$Name]
+ if ($null -eq $p) { return $null }
+ return $p.Value
+}
$runId = [guid]::NewGuid().ToString("N")
Write-Host ("Phase 5 gate run-id: {0}" -f $runId)
+$logDir = Join-Path $Root ("logs\phase5\" + $runId)
+New-Item -ItemType Directory -Force -Path $logDir | Out-Null
+
+# ---------------------------------------------------------------------------
+# 0. Gate self-hygiene: no control characters (PowerShell 5.1 codepage safety)
+# ---------------------------------------------------------------------------
+$scriptText = Get-Content -Raw -LiteralPath $PSCommandPath
+$badChars = [regex]::Matches($scriptText, "[\x00-\x08\x0B\x0C\x0E-\x1F]")
+Add-GateCheck "gate:self-control-chars" ($badChars.Count -eq 0) ("count=" + $badChars.Count)
# ---------------------------------------------------------------------------
-# 1. Build
+# 1. Build (required before anything else)
# ---------------------------------------------------------------------------
$buildScript = Join-Path $Root "scripts\build.ps1"
$shell = (Get-Process -Id $PID).Path
@@ -49,158 +82,264 @@ $shell = (Get-Process -Id $PID).Path
Add-GateCheck "build:x64-release" ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
Test-GateEnd
-$harnessExe = Join-Path $Root "out\build\x64-release\veyra_nr_harness.exe"
-Add-GateCheck "harness:exe" (Test-Path -LiteralPath $harnessExe -PathType Leaf) "present"
-Test-GateEnd
-
-$runtimeDir = Join-Path $Root "runtime_local\nvidia"
-$logDir = Join-Path $Root ("logs\phase5\" + $runId)
-New-Item -ItemType Directory -Force -Path $logDir | Out-Null
-
# ---------------------------------------------------------------------------
-# 2. Unified EnhanceGraph: 1080p→4K SR→NR chain (not bypass)
+# 2. Product library wiring (static fail-closed inputs)
# ---------------------------------------------------------------------------
-$srJson = Join-Path $logDir "enhance-1080p.json"
-& $harnessExe --sr-test --runtime-dir $runtimeDir --run-id $runId --log-file (Join-Path $logDir "enhance-1080p.log") --json-file $srJson
-$srExit = $LASTEXITCODE
-Add-GateCheck "enhance:run-1080p" ($srExit -eq 0) "exitCode=$srExit"
-if (Test-Path -LiteralPath $srJson -PathType Leaf) {
- $sr = Get-Content -Raw -Encoding UTF8 -LiteralPath $srJson | ConvertFrom-Json
- Add-GateCheck "enhance:sr-capability" ([bool]$sr.srCapabilityAvailable -eq $true) "available=$($sr.srCapabilityAvailable)"
- Add-GateCheck "enhance:sr-upscales" ([bool]$sr.upscale1080to4K -eq $true) "upscale=$($sr.upscale1080to4K)"
- Add-GateCheck "enhance:sr-evaluates" ([int64]$sr.upscaleEvaluates -ge 30) "evaluates=$($sr.upscaleEvaluates)"
- Add-GateCheck "enhance:sr-resize" ([bool]$sr.resizeRecreate -eq $true) "resize=$($sr.resizeRecreate)"
+$cmakePath = Join-Path $Root "CMakeLists.txt"
+$cmakeText = ""
+if (Test-Path -LiteralPath $cmakePath -PathType Leaf) {
+ $cmakeText = Get-Content -Raw -Encoding UTF8 -LiteralPath $cmakePath
}
-else {
- Add-GateCheck "enhance:json-1080p" $false "missing"
+$hasPipelineTarget = ($cmakeText -match "add_library\s*\(\s*veyra_pipeline\b")
+$hasGuidanceTarget = ($cmakeText -match "add_library\s*\(\s*veyra_guidance\b")
+$hasRunnerTarget = ($cmakeText -match "veyra_quality_probe\b")
+$playerLinksPipeline = ($cmakeText -match "(?s)veyra_player_probe.*?veyra_pipeline") -or ($cmakeText -match "(?s)veyra_pipeline.*?veyra_player_probe")
+Add-GateCheck "product:veyra_pipeline-target" $hasPipelineTarget "CMakeLists add_library(veyra_pipeline ...) present=$hasPipelineTarget"
+Add-GateCheck "product:veyra_guidance-target" $hasGuidanceTarget "CMakeLists add_library(veyra_guidance ...) present=$hasGuidanceTarget"
+Add-GateCheck "product:quality-runner-target" $hasRunnerTarget "CMakeLists references veyra_quality_probe present=$hasRunnerTarget"
+Add-GateCheck "product:player-links-pipeline" $playerLinksPipeline "player_probe links veyra_pipeline present=$playerLinksPipeline"
+
+$enhanceGraphSrc = Join-Path $Root "src\pipeline\EnhanceGraph.cpp"
+$enhanceOk = $false
+if (Test-Path -LiteralPath $enhanceGraphSrc -PathType Leaf) {
+ $eg = Get-Content -Raw -Encoding UTF8 -LiteralPath $enhanceGraphSrc
+ # The graph source must submit real GPU work, not only copy packets and bump counters.
+ $enhanceOk = ($eg -match "ExecuteCommandLists") -and ($eg -match "EvaluateFeature|Evaluate")
}
-Test-GateEnd
+Add-GateCheck "product:enhance-graph-submits-gpu" $enhanceOk "src/pipeline/EnhanceGraph.cpp executes command lists + NGX evaluate present=$enhanceOk"
# ---------------------------------------------------------------------------
-# 3. NR with real input via unified pipeline (parity encode→NR→parity decode)
-# ---------------------------------------------------------------------------
-$nrJson = Join-Path $logDir "pipeline-nr.json"
-& $harnessExe --parity-compare --runtime-dir $runtimeDir --width 1920 --height 1080 --frames 30 --run-id $runId --log-file (Join-Path $logDir "pipeline-nr.log") --json-file $nrJson --capture-dir (Join-Path $logDir "captures")
-$nrExit = $LASTEXITCODE
-Add-GateCheck "pipeline:run-nr" ($nrExit -eq 0) "exitCode=$nrExit"
-if (Test-Path -LiteralPath $nrJson -PathType Leaf) {
- $nr = Get-Content -Raw -Encoding UTF8 -LiteralPath $nrJson | ConvertFrom-Json
- Add-GateCheck "pipeline:nr-count" (([int64]$nr.frames) -ge 30) "frames=$($nr.frames)"
- # Check stage luma values: proxy/raw/final should all be non-zero and distinct.
- $proxyLuma = [double]$nr.stageLuma.proxy
- $rawLuma = [double]$nr.stageLuma.raw
- $finalLuma = [double]$nr.stageLuma.final
- Add-GateCheck "pipeline:non-black" (($proxyLuma -gt 0.001) -and ($rawLuma -gt 0.001) -and ($finalLuma -gt 0.001)) "proxy=$proxyLuma raw=$rawLuma final=$finalLuma"
- # The parity JSON uses decode/encode/output structure; check encode tolerance as proxy.
- $encDelta = [double]$nr.encode.maxCodeDelta
- Add-GateCheck "pipeline:encode-1code" ($encDelta -le 1.0) "maxCodeDelta=$encDelta"
- $decBeyond = [int64]$nr.decode.beyondOneUlpCount
- Add-GateCheck "pipeline:decode-tolerance" ($decBeyond -eq 0) "beyondOneUlp=$decBeyond"
+# 3. Deterministic corpus (veyra_clip_gen; no dependency on deleted tracked MP4)
+# ---------------------------------------------------------------------------
+$corpusManifestPath = Join-Path $Root "loop\local\fixed_clips\corpus-manifest.json"
+$corpus = $null
+Add-GateCheck "corpus:manifest-present" (Test-Path -LiteralPath $corpusManifestPath -PathType Leaf) $corpusManifestPath
+if (Test-Path -LiteralPath $corpusManifestPath -PathType Leaf) {
+ try { $corpus = Get-Content -Raw -Encoding UTF8 -LiteralPath $corpusManifestPath | ConvertFrom-Json } catch { $corpus = $null }
}
-else {
- Add-GateCheck "pipeline:json-nr" $false "missing"
+$corpusEntries = @()
+if ($null -ne $corpus) {
+ $corpusEntries = @(Get-Field $corpus "clips")
+ if ($corpusEntries.Count -eq 1 -and $null -eq $corpusEntries[0]) { $corpusEntries = @() }
}
+$expectedScenarios = @("translation", "occlusion", "cut-flash-duplicate", "particles", "ui-text")
+$corpusComplete = $false
+$corpusFilesOk = $false
+$corpusHashOk = $false
+if ($corpusEntries.Count -ge 10) {
+ $corpusComplete = $true
+ $corpusFilesOk = $true
+ $corpusHashOk = $true
+ foreach ($entry in $corpusEntries) {
+ $scen = [string](Get-Field $entry "scenario")
+ $w = [int](Get-Field $entry "width"); $h = [int](Get-Field $entry "height")
+ $fps = [int](Get-Field $entry "fps")
+ if ($expectedScenarios -notcontains $scen) { $corpusComplete = $false }
+ if ((-not ($w -eq 1920 -and $h -eq 1080)) -and (-not ($w -eq 3840 -and $h -eq 2160))) { $corpusComplete = $false }
+ if ($fps -ne 60) { $corpusComplete = $false }
+ $clipPath = [string](Get-Field $entry "path")
+ $sha = [string](Get-Field $entry "sha256")
+ if ([string]::IsNullOrWhiteSpace($clipPath) -or ($sha -notmatch "^[0-9A-Fa-f]{64}$")) { $corpusComplete = $false; continue }
+ $absClip = if ([System.IO.Path]::IsPathRooted($clipPath)) { $clipPath } else { Join-Path $Root $clipPath }
+ if (-not (Test-Path -LiteralPath $absClip -PathType Leaf)) { $corpusFilesOk = $false; continue }
+ $item = Get-Item -LiteralPath $absClip
+ if ($item.Length -le 0) { $corpusFilesOk = $false; continue }
+ $actual = (Get-FileHash -LiteralPath $absClip -Algorithm SHA256).Hash
+ if ($actual -ne $sha) { $corpusHashOk = $false }
+ }
+ # Both resolutions must be covered per scenario.
+ foreach ($scen in $expectedScenarios) {
+ $hd = @($corpusEntries | Where-Object { [string](Get-Field $_ "scenario") -eq $scen -and [int](Get-Field $_ "width") -eq 1920 })
+ $uhd = @($corpusEntries | Where-Object { [string](Get-Field $_ "scenario") -eq $scen -and [int](Get-Field $_ "width") -eq 3840 })
+ if ($hd.Count -lt 1 -or $uhd.Count -lt 1) { $corpusComplete = $false }
+ }
+}
+Add-GateCheck "corpus:manifest-complete" $corpusComplete ("entries=" + $corpusEntries.Count + " scenarios=5 x {1080p,4K} @60fps with sha256/size")
+Add-GateCheck "corpus:clip-files" $corpusFilesOk "all manifest clip files exist non-empty"
+Add-GateCheck "corpus:clip-sha256" $corpusHashOk "recomputed SHA256 matches manifest"
# ---------------------------------------------------------------------------
-# 4. Scene/cadence analyzer (requires P5.4 implementation)
-$ffmpegBin = "C:\veyra-deps\installed\x64-windows\bin"
-if (Test-Path -LiteralPath $ffmpegBin -PathType Container) {
- $env:PATH = "$ffmpegBin;" + $env:PATH
-}
+# 4. Quality matrix via the shared product runner
# ---------------------------------------------------------------------------
-$sceneTool = Join-Path $Root "out\build\x64-release\veyra_scene_analyzer.exe"
-if (-not (Test-Path -LiteralPath $sceneTool -PathType Leaf)) {
- Add-GateCheck "scene:tool" $false "veyra_scene_analyzer.exe not built (P5.4 not implemented)"
+$runnerExe = Join-Path $Root "out\build\x64-release\veyra_quality_probe.exe"
+$runnerPresent = (Test-Path -LiteralPath $runnerExe -PathType Leaf)
+Add-GateCheck "quality:runner-exe" $runnerPresent $runnerExe
+
+$runtimeDll = Join-Path $Root "runtime_local\nvidia\nvngx_dlssnr.dll"
+$runtimeHashExpected = $null
+if (Test-Path -LiteralPath $runtimeDll -PathType Leaf) {
+ $runtimeHashExpected = (Get-FileHash -LiteralPath $runtimeDll -Algorithm SHA256).Hash
+}
+
+$motionJson = $null
+if ($runnerPresent -and $corpusComplete) {
+ $guidanceModes = @("off", "zero", "motion", "motion-depth", "auto")
+ foreach ($mode in $guidanceModes) {
+ $qj = Join-Path $logDir ("quality-" + $mode + ".json")
+ & $runnerExe --corpus $corpusManifestPath --guidance $mode --run-id ($runId + "-q-" + $mode) --log-file (Join-Path $logDir ("quality-" + $mode + ".log")) --json-file $qj
+ Add-GateCheck ("quality:run-" + $mode) ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
+ if (($mode -eq "motion") -and (Test-Path -LiteralPath $qj -PathType Leaf)) {
+ $motionJson = Get-Content -Raw -Encoding UTF8 -LiteralPath $qj | ConvertFrom-Json
+ }
+ }
}
else {
- & $sceneTool --run-id $runId --json-file (Join-Path $logDir "scene.json")
- Add-GateCheck "scene:run" ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
+ foreach ($mode in @("off", "zero", "motion", "motion-depth", "auto")) {
+ Add-GateCheck ("quality:run-" + $mode) $false ("not run: runner present=$runnerPresent corpus complete=$corpusComplete")
+ }
}
-# ---------------------------------------------------------------------------
-# 5. Non-zero NVOF motion (requires P5.5 implementation)
-# ---------------------------------------------------------------------------
-$nvofJson = Join-Path $logDir "nvof-motion.json"
-$nvofTool = Join-Path $Root "out\build\x64-release\veyra_nvof_probe.exe"
-if (-not (Test-Path -LiteralPath $nvofTool -PathType Leaf)) {
- Add-GateCheck "nvof:tool" $false "veyra_nvof_probe.exe not built (P5.5 not implemented or SDK missing)"
+if ($null -ne $motionJson) {
+ # Extent contract: 1080p corpus in, SR to 4K working/output extent.
+ $srcW = Get-Field (Get-Field $motionJson "sourceExtent") "width"
+ $workW = Get-Field (Get-Field $motionJson "workingExtent") "width"
+ $outH = Get-Field (Get-Field $motionJson "outputExtent") "height"
+ $extentOk = ($srcW -eq 1920) -and ($workW -eq 3840) -and ($outH -eq 2160)
+ Add-GateCheck "quality:extent-matrix" $extentOk ("source=$srcW working=$workW outputH=$outH (expect 1920->3840x2160)")
+
+ $srcFrames = [int64](Get-Field $motionJson "sourceFrames")
+ $procFrames = [int64](Get-Field $motionJson "processedFrames")
+ $nrEval = [int64](Get-Field $motionJson "nrEvaluateCount")
+ Add-GateCheck "quality:nr-per-frame" (($srcFrames -gt 0) -and ($procFrames -eq $srcFrames) -and ($nrEval -eq $procFrames)) "source=$srcFrames processed=$procFrames nr=$nrEval"
+
+ $nvofExec = [int64](Get-Field $motionJson "nvofExecuteCount")
+ $nonZero = [int64](Get-Field $motionJson "nonZeroMotionCount")
+ $prov = [string](Get-Field $motionJson "guidanceProvenance")
+ Add-GateCheck "quality:nvof-nonzero-motion" (($nvofExec -gt 0) -and ($nonZero -gt 0) -and ($prov -eq "nvof")) "exec=$nvofExec nonZero=$nonZero provenance=$prov"
+
+ $c05 = [double](Get-Field $motionJson "confidenceP05")
+ $c50 = [double](Get-Field $motionJson "confidenceP50")
+ $c95 = [double](Get-Field $motionJson "confidenceP95")
+ Add-GateCheck "quality:confidence-stats" (($c05 -ge 0) -and ($c05 -le $c50) -and ($c50 -le $c95) -and ($c95 -le 1) -and ($c95 -gt 0)) "p05=$c05 p50=$c50 p95=$c95"
+
+ $resetCounts = Get-Field $motionJson "resetCountsByReason"
+ $resetOk = ($null -ne $resetCounts)
+ if ($resetOk) { $resetOk = (@($resetCounts.PSObject.Properties).Count -ge 1) }
+ $sceneCut = [int64](Get-Field $motionJson "sceneCutCount")
+ $crossCut = [int64](Get-Field $motionJson "crossCutHistoryCount")
+ Add-GateCheck "quality:reset-contract" ($resetOk -and ($sceneCut -ge 1) -and ($crossCut -eq 0)) "reasons present=$resetOk sceneCut=$sceneCut crossCutHistory=$crossCut (corpus contains cut scenario)"
+
+ $g50 = [double](Get-Field $motionJson "gpuPassP50Ms")
+ $g95 = [double](Get-Field $motionJson "gpuPassP95Ms")
+ Add-GateCheck "quality:gpu-timing" (($g50 -gt 0) -and ($g95 -ge $g50)) "p50=$g50 ms p95=$g95 ms"
+
+ # Hash binding: independent recompute of exe + runtime identity.
+ $exeReported = [string](Get-Field $motionJson "exeHash")
+ $exeActual = (Get-FileHash -LiteralPath $runnerExe -Algorithm SHA256).Hash
+ $rtReported = [string](Get-Field $motionJson "runtimeHash")
+ $rtOk = ($rtReported -eq $runtimeHashExpected)
+ $inHash = [string](Get-Field $motionJson "inputHash")
+ $cfgHash = [string](Get-Field $motionJson "configHash")
+ $runIdReported = [string](Get-Field $motionJson "runId")
+ Add-GateCheck "quality:hash-binding" (($exeReported -eq $exeActual) -and $rtOk -and ($inHash -match "^[0-9A-Fa-f]{64}$") -and ($cfgHash -match "^[0-9A-Fa-f]{64}$") -and ($runIdReported -like ($runId + "*"))) "exe match/runId match/input+config sha256/runtime match=$rtOk"
}
else {
- & $nvofTool --run-id $runId --json-file $nvofJson
- Add-GateCheck "nvof:run" ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
- if (Test-Path -LiteralPath $nvofJson -PathType Leaf) {
- $nv = Get-Content -Raw -Encoding UTF8 -LiteralPath $nvofJson | ConvertFrom-Json
- Add-GateCheck "nvof:non-zero-motion" ([double]$nv.motion.maxMagnitude -gt 0.0) "maxMag=$($nv.motion.maxMagnitude)"
- Add-GateCheck "nvof:confidence" ([bool]$nv.confidence.present -eq $true) "present=$($nv.confidence.present)"
+ foreach ($n in @("quality:extent-matrix", "quality:nr-per-frame", "quality:nvof-nonzero-motion",
+ "quality:confidence-stats", "quality:reset-contract", "quality:gpu-timing", "quality:hash-binding")) {
+ Add-GateCheck $n $false "not available: motion-mode run JSON missing (runner/library/corpus gap)"
}
}
# ---------------------------------------------------------------------------
-# 6. DAV2 depth or explicit Auto fallback (requires P5.7/P5.8 or manifest)
+# 5. Depth provider: current-run JSON only; manifest can never satisfy this.
# ---------------------------------------------------------------------------
-$davJson = Join-Path $logDir "depth-mode.json"
-$davTool = Join-Path $Root "out\build\x64-release\veyra_depth_probe.exe"
-if (-not (Test-Path -LiteralPath $davTool -PathType Leaf)) {
- $davManifest = Join-Path $Root "third_party_local\depth\manifest.json"
- if (Test-Path -LiteralPath $davManifest -PathType Leaf) {
- Add-GateCheck "depth:manifest" $true "manifest present, Auto fallback documented"
- }
- else {
- Add-GateCheck "depth:mode" $false "veyra_depth_probe.exe not built and no depth manifest (P5.7/P5.8 not implemented)"
- }
+$autoJson = $null
+$autoPath = Join-Path $logDir "quality-auto.json"
+if (Test-Path -LiteralPath $autoPath -PathType Leaf) {
+ try { $autoJson = Get-Content -Raw -Encoding UTF8 -LiteralPath $autoPath | ConvertFrom-Json } catch { $autoJson = $null }
+}
+if ($null -ne $autoJson) {
+ $depthMode = [string](Get-Field $autoJson "depthMode")
+ $depthReason = [string](Get-Field $autoJson "depthFallbackReason")
+ $depthAge = Get-Field $autoJson "depthAgeP95"
+ $modeOk = ($depthMode -eq "dav2") -or ($depthMode -eq "motion-only-auto") -or ($depthMode -eq "disabled")
+ $reasonOk = $true
+ if ($depthMode -ne "dav2") { $reasonOk = (-not [string]::IsNullOrWhiteSpace($depthReason)) }
+ $ageOk = $true
+ if ($depthMode -eq "dav2") { $ageOk = (($null -ne $depthAge) -and ([double]$depthAge -le 8)) }
+ Add-GateCheck "depth:provider-from-run" ($modeOk -and $reasonOk -and $ageOk) "mode=$depthMode reason=$depthReason ageP95=$depthAge"
}
else {
- & $davTool --run-id $runId --json-file $davJson
- Add-GateCheck "depth:run" ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
+ Add-GateCheck "depth:provider-from-run" $false "not available: auto-mode run JSON missing (manifest-only depth is not accepted by design)"
}
# ---------------------------------------------------------------------------
-# 7. 1080p60 endurance (user-approved 5-minute duration)
+# 6. Endurance: 1080p60 and native-4K60, 30 minutes each, via shared graph.
+# Extents must come from this run's JSON; never from filename or a 1080p rerun.
# ---------------------------------------------------------------------------
-$mediaProbe = Join-Path $Root "out\build\x64-release\veyra_media_probe.exe"
-$testClip = Join-Path $Root "validation\fixed_clips\test_h264_1080p.mp4"
-$endurance1080Json = Join-Path $logDir "endurance-1080p60.json"
-
-if ((Test-Path -LiteralPath $mediaProbe -PathType Leaf) -and (Test-Path -LiteralPath $testClip -PathType Leaf)) {
- Write-Host "[INFO] endurance:1080p60 running (5 min)..."
- & $mediaProbe --input $testClip --mode d3d12va --frames 54000 --run-id "$runId-end1" --log-file (Join-Path $logDir "endurance-1080p60.log") --json-file $endurance1080Json
- $e1Exit = $LASTEXITCODE
- Add-GateCheck "endurance:1080p60-run" ($e1Exit -eq 0) "exitCode=$e1Exit"
+$translationHd = $null
+$translationUhd = $null
+if ($corpusComplete) {
+ $translationHd = @($corpusEntries | Where-Object { [string](Get-Field $_ "scenario") -eq "translation" -and [int](Get-Field $_ "width") -eq 1920 })[0]
+ $translationUhd = @($corpusEntries | Where-Object { [string](Get-Field $_ "scenario") -eq "translation" -and [int](Get-Field $_ "width") -eq 3840 })[0]
+}
+$enduranceJsons = @{}
+if ($runnerPresent -and ($null -ne $translationHd)) {
+ $hdPath = [string](Get-Field $translationHd "path")
+ if (-not [System.IO.Path]::IsPathRooted($hdPath)) { $hdPath = Join-Path $Root $hdPath }
+ $ej = Join-Path $logDir "endurance-1080p60.json"
+ Write-Host "[INFO] endurance:1080p60 running (30 minutes, shared graph)..."
+ & $runnerExe --input $hdPath --duration-seconds 1800 --run-id ($runId + "-end-1080p60") --log-file (Join-Path $logDir "endurance-1080p60.log") --json-file $ej
+ Add-GateCheck "endurance:1080p60-run" ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
+ if (Test-Path -LiteralPath $ej -PathType Leaf) { $enduranceJsons["hd"] = Get-Content -Raw -Encoding UTF8 -LiteralPath $ej | ConvertFrom-Json }
}
else {
- Add-GateCheck "endurance:1080p60-run" $false "media_probe or test clip missing (fail-closed)"
+ Add-GateCheck "endurance:1080p60-run" $false "not run: runner present=$runnerPresent corpus translation 1080p present=$($null -ne $translationHd)"
}
-if (Test-Path -LiteralPath $endurance1080Json -PathType Leaf) {
- $e1 = Get-Content -Raw -Encoding UTF8 -LiteralPath $endurance1080Json | ConvertFrom-Json
- Add-GateCheck "endurance:1080p60-duration" ([double]$e1.endurance.durationSeconds -ge 290) "duration=$($e1.endurance.durationSeconds)s"
- Add-GateCheck "endurance:1080p60-nr-count" ([int64]$e1.pipeline.nrEvaluateCount -ge 15000) "nr=$($e1.pipeline.nrEvaluateCount)"
- Add-GateCheck "endurance:1080p60-memory" ([double]$e1.endurance.workingSetGrowthMB -lt 256) "wsGrowth=$($e1.endurance.workingSetGrowthMB)MB"
+if ($runnerPresent -and ($null -ne $translationUhd)) {
+ $uhdPath = [string](Get-Field $translationUhd "path")
+ if (-not [System.IO.Path]::IsPathRooted($uhdPath)) { $uhdPath = Join-Path $Root $uhdPath }
+ $ej4 = Join-Path $logDir "endurance-4k60.json"
+ Write-Host "[INFO] endurance:4k60-native running (30 minutes, shared graph)..."
+ & $runnerExe --input $uhdPath --duration-seconds 1800 --run-id ($runId + "-end-4k60") --log-file (Join-Path $logDir "endurance-4k60.log") --json-file $ej4
+ Add-GateCheck "endurance:4k60-run" ($LASTEXITCODE -eq 0) "exitCode=$LASTEXITCODE"
+ if (Test-Path -LiteralPath $ej4 -PathType Leaf) { $enduranceJsons["uhd"] = Get-Content -Raw -Encoding UTF8 -LiteralPath $ej4 | ConvertFrom-Json }
+}
+else {
+ Add-GateCheck "endurance:4k60-run" $false "not run: runner present=$runnerPresent corpus translation 4K present=$($null -ne $translationUhd)"
}
-# ---------------------------------------------------------------------------
-# 8. Second endurance pass (1080p source, same graph; 4K SR integration is Phase 6)
-# ---------------------------------------------------------------------------
-$endurance4kJson = Join-Path $logDir "endurance-second.json"
+foreach ($pair in @(@("hd", "endurance:1080p60", 1920, 1080), @("uhd", "endurance:4k60-native", 3840, 2160))) {
+ $key = $pair[0]; $name = $pair[1]; $expW = $pair[2]; $expH = $pair[3]
+ $j = $enduranceJsons[$key]
+ if ($null -eq $j) {
+ foreach ($n in @(($name + "-duration"), ($name + "-extent"), ($name + "-throughput"), ($name + "-resources"))) {
+ Add-GateCheck $n $false "not available: run JSON missing"
+ }
+ continue
+ }
+ $dur = [double](Get-Field $j "durationSeconds")
+ Add-GateCheck ($name + "-duration") ($dur -ge 1790) "duration=${dur}s (bar: 1800s, tolerance 1790s)"
+ $sw = Get-Field (Get-Field $j "sourceExtent") "width"
+ $sh = Get-Field (Get-Field $j "sourceExtent") "height"
+ $ww = Get-Field (Get-Field $j "workingExtent") "width"
+ $wh = Get-Field (Get-Field $j "workingExtent") "height"
+ Add-GateCheck ($name + "-extent") (($sw -eq $expW) -and ($sh -eq $expH) -and ($ww -eq $expW) -and ($wh -eq $expH)) "source=${sw}x${sh} working=${ww}x${wh} (native pass-through expected)"
+ $proc = [int64](Get-Field $j "processedFrames")
+ $nr = [int64](Get-Field $j "nrEvaluateCount")
+ Add-GateCheck ($name + "-throughput") (($proc -ge 97000) -and ($nr -eq $proc)) "processed=$proc nr=$nr (>=97000 frames in 30min at 60fps)"
+ $wsStart = [double](Get-Field $j "workingSetStartMiB")
+ $wsEnd = [double](Get-Field $j "workingSetEndMiB")
+ $vram = [double](Get-Field $j "vramBudgetHeadroomMiB")
+ $queue = [int64](Get-Field $j "queueHighWater")
+ Add-GateCheck ($name + "-resources") ((($wsEnd - $wsStart) -lt 512) -and ($vram -ge 1536) -and ($queue -le 6)) "wsGrowth=" + [math]::Round($wsEnd - $wsStart, 1) + "MiB vramHeadroom=$vram MiB queueHighWater=$queue"
+}
-if ((Test-Path -LiteralPath $mediaProbe -PathType Leaf) -and (Test-Path -LiteralPath $testClip -PathType Leaf)) {
- Write-Host "[INFO] endurance:second-pass running (5 min, 1080p; 4K SR graph is Phase 6 scope)..."
- & $mediaProbe --input $testClip --mode d3d12va --frames 54000 --run-id "$runId-end2" --log-file (Join-Path $logDir "endurance-second.log") --json-file $endurance4kJson
- $e4Exit = $LASTEXITCODE
- Add-GateCheck "endurance:second-run" ($e4Exit -eq 0) "exitCode=$e4Exit"
+# Main-path discipline (from whichever endurance JSON exists; motion JSON used as fallback).
+$discJson = $enduranceJsons["uhd"]; if ($null -eq $discJson) { $discJson = $enduranceJsons["hd"] }; if ($null -eq $discJson) { $discJson = $motionJson }
+if ($null -ne $discJson) {
+ $readback = [int64](Get-Field $discJson "normalPathReadbackCount")
+ $cpuWaits = [double](Get-Field $discJson "cpuFenceWaitPerFrame")
+ $removed = [int64](Get-Field $discJson "deviceRemovedCount")
+ Add-GateCheck "discipline:main-path" (($readback -eq 0) -and ($cpuWaits -eq 0) -and ($removed -eq 0)) "readback=$readback cpuWaitsPerFrame=$cpuWaits deviceRemoved=$removed"
}
else {
- Add-GateCheck "endurance:second-run" $false "media_probe or test clip missing"
-}
-
-if (Test-Path -LiteralPath $endurance4kJson -PathType Leaf) {
- $e4 = Get-Content -Raw -Encoding UTF8 -LiteralPath $endurance4kJson | ConvertFrom-Json
- Add-GateCheck "endurance:4k60-duration" ([double]$e4.endurance.durationSeconds -ge 290) "duration=$($e4.endurance.durationSeconds)s"
- Add-GateCheck "endurance:4k60-nr-count" ([int64]$e4.pipeline.nrEvaluateCount -ge 15000) "nr=$($e4.pipeline.nrEvaluateCount)"
+ Add-GateCheck "discipline:main-path" $false "not available: no endurance or motion JSON"
}
# ---------------------------------------------------------------------------
-# 9. Proprietary paths remain ignored.
+# 7. Proprietary paths remain ignored.
# ---------------------------------------------------------------------------
$ignoreTargets = @("nvngx_dlssnr.dll", "renodx-dlss5-1.addon64",
"runtime_local/.veyra-ignore-probe", "third_party_local/.veyra-ignore-probe",