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++
Checkpoint measured DLSS cadence gaps and trace tooling
Veyra Goal Agentdad189ae046e
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 89952055..7e98adc1 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -2,6 +2,8 @@更新:2026-09-20。发布状态与开发状态分别记录,历史计划不代表当前验收。+最新节奏调查:已存档 `b2c3d0e` / `checkpoint/pre-fg-cadence-audit-20260920`,在 `codex/fg-cadence-audit-20260920` 复测相同实卡参数。关闭逐帧文件日志后仍约 194 提交/s,末尾 8.07 秒内 90 次间隔超过 16.667ms,478 批中 233 批只呈现原帧,直接记录到 114 次拒绝后预热。确认提交节奏断续,尚未修复;PresentMon 权限不足,未测物理显示。见 [节奏调查](FG_CADENCE_AUDIT_2026-09-20.md)。+最新 DLSS 恢复修复:`codex/dlss-recovery-20260920` 从 `c8a3828` 隔离,将无有效 A/B 历史时的整组 MFG 重置改为单次完整预热,按实际预热成本判定预算,新增未执行重置候选计数。主程序构建、105 项 CPU 调度检查和 RTX5070 的 1080p NR+DLSS 2X/4X/6X 恢复检查通过,D3D12 错误为 0。用户关闭程序后,实卡 1440p60 NV12、NR+DLSS SR 到 4K+6X 各 120 秒对照:提交率 202.57→204.10/s,预热调用减少但主要吞吐限制未解决;关闭测试预算拒绝反而降到 184.76/s,采集丢帧及生成过期增加。未达到稳定 6X,不能宣称已修好。未覆盖用户便携包、未发布。见 [恢复修复记录](DLSS_RECOVERY_REPAIR_2026-09-20.md)。最新切换修复(09-20 最终回归):`codex/fg-backend-switch-20260919` 修正 XeSS 旧倍率缓存、UI 请求拒绝、失败回退及异步准备帧的 XeLL 标记周期。RTX5070 引擎/真实下拉切换、失败注入、拖动/重置/缩放回归通过。YUY2 50fps 合成输入 2X/4X 有生成输出,1:1 单像素测试未发现额外模糊;用户所述观感及与 PotPlayer 的差异仍缺同条件对照,不能宣称解决。详见 [切换修复记录](FG_BACKEND_SWITCH_REPAIR_2026-09-19.md)。仅本地编译,未更新用户便携包或发布。diff --git a/docs/FG_CADENCE_AUDIT_2026-09-20.md b/docs/FG_CADENCE_AUDIT_2026-09-20.mdnew file mode 100644index 00000000..c2dd9445--- /dev/null+++ b/docs/FG_CADENCE_AUDIT_2026-09-20.md@@ -0,0 +1,56 @@+# DLSS 6X cadence investigation, 2026-09-20++## Checkpoint and scope++User requested a Git checkpoint before continuing investigation of roughly 200 reported FPS feeling like 30-40 FPS. Saved prior work as `b2c3d0e`, tag `checkpoint/pre-fg-cadence-audit-20260920`; investigation branch `codex/fg-cadence-audit-20260920`. No product scheduling change, package replacement, push or release in this investigation.++## Reproduction++RTX5070, physical `capture:0:14:0:0`, NV12 2560x1440 nominal 60 Hz (59.94 actual), DLSS SR to 3840x2160, original NR at realtime 1920x1080, NVOF Performance, DLSS 6X at 4K, SR -> NR -> residual -> FG. Window 1795x816; pacing/HDR/VSync off, tearing on. The `live-1440p` harness disables injected stalls. User's main app was closed. Each test ran 45 seconds sequentially.++Build: `scripts/build-isolated.ps1 -Root <repo> -BuildDirectory E:/项目/Veyra/build/slider-reset-20260919 -DependencyCache E:/项目/Veyra/build/slider-reset-20260919/CMakeCache.txt -TempDirectory E:/项目/Veyra/tmp/dlss-recovery-20260920 -Targets veyra_fg_sustained_tests -DisplayVersion 1.4.3`, succeeded. Log: `E:/项目/Veyra/logs/fg-cadence-audit-build-20260920.log`.++Run through `scripts/run-short-test.ps1`, exe in the build directory above, arguments `capture:0:14:0:0 <output> 6 on 45 on 0 live-1440p`, timeout 100 seconds. Output directories `E:/项目/Veyra/tests/fg-cadence-audit-20260920/{verbose,memory}`, matching `.stdout.log` / `.stderr.log` prefixes. CWD and process TEMP/TMP used existing E-drive dlss-recovery test/tmp directories. Both tests exited 0. Target ratio 0 means no throughput assertion; `throughput=1` is not proof of 360 FPS.++The verbose run enabled `VEYRA_VERBOSE_FRAME_LOGS=1` only in its child shell. The second run disabled verbose file logging and dumped the existing bounded 8192-event memory trace after stopping the engine. Thus disk logging is not necessary to reproduce the uneven submissions.++Analyze using `python scripts/acceptance/analyze-fg-cadence.py <input> --output <json>`, adding `--trace` for `memory/frame-trace.txt`. Inputs and JSON reports are under the test root above; verbose input is `verbose/engine.log`.++## Measurements++All times below describe application submission, not physical scanout or distinct visible images.++| Metric | Verbose, first 10 seconds excluded | Memory trace, retained final window |+| --- | ---: | ---: |+| Window | 35.17 s | 8.068 s |+| Submit FPS | 194.96 | 194.09 |+| Interval P50 | 2.116 ms | 2.169 ms |+| Interval P95 | 16.787 ms | 16.704 ms |+| Interval P99 | 19.324 ms | 19.117 ms |+| Maximum interval | 45.863 ms | 27.797 ms |+| Intervals below 1 ms | 735 | 156 |+| Intervals above 16.667 ms | 418 | 90 |+| Intervals above 25 ms | 46 | 5 |+| Present CPU P95 | 0.345 ms | 0.333 ms |++The memory window contains 478 interior presented batches (boundary batches excluded). 233 contained only the original frame: 114 were budget-rejected batches, 119 were single-call history warmups. Only 156 batches presented all six frames. Consecutive presented-batch transitions include 114 rejected -> warmup, 119 warmup -> steady, 113 steady -> rejected, and five steady -> warmup. The rejected/recovery cycle is directly observed, not inferred solely from an average counter.++## Supported mechanism and limits++1. `EnhanceGraph.cpp`: rejection sets `fgHistorySkipped_`; the next admitted batch resets/warms history. Repeated rejection therefore removes intermediate images from consecutive intervals. The earlier single-call warmup fix reduces wasted calls but does not remove this cycle.+2. `EngineController.cpp` presentation loop allows generated frames up to 10 ms late. With pacing off, already-due frames can be submitted consecutively. A 6X subframe interval is about 2.78 ms here, so this tolerance can contain several missed slots. Short bursts raise average submission FPS without repairing preceding gaps.+3. The graph and DLSS presentation share an owner thread. Verbose long-gap overlap with graph CPU submission is only about 24%; it would be incorrect to blame every gap on graph CPU work or infer GPU idleness from the rest. GPU readiness and scheduled waiting must also be distinguished.++Example in verbose trace: source 625 was skipped; source 626 reset and presented only its original. It was observed ready about 17.42 ms before presentation; the preceding submission gap was 27.73 ms. Source 627 then had a full generated group. This demonstrates a mixed reset/schedule event, not proof that all waiting can safely be removed.++PresentMon 2.5.1 failed to start ETW with access denied (exit 1). No privilege/group changes were made. Actual display cadence, distinct image count and the user's subjective 30-40 FPS remain unmeasured. Present CPU returning quickly does not prove frames appeared on screen. These measurements also do not prove sufficient GPU capacity for sustained 4K 6X.++## Next repair and acceptance++- Make admission and recovery decisions coherent across a complete warmup-plus-valid-pair sequence; inspect deadline phase and whole-batch completion estimates. Do not repeatedly admit warmup then reject useful work because the two have different costs.+- Separate original enhancement, per-subframe readiness and presentation opportunities in diagnostics before changing scheduler ownership. Any decoupling must preserve bounded queues, GPU resource lifetime and monotonic media time.+- Define an explicit late-frame policy that avoids catch-up bursts without silently enabling user-disabled pacing. Compare fewer evenly spaced valid frames against burst submission; do not replace them with repeated images to inflate FPS.+- Keep real resets and deadline protection. Previous same-parameter removal of admission reduced throughput and increased capture loss/expired generated frames; it is not a demonstrated fix.+- Re-run matched settings with verbose logging off. Acceptance must improve long-gap distribution and rejected/warmup cycling, not only mean FPS; also monitor source loss, original-frame latency, PTS ordering, resource lifetime and 2X/4X/6X recovery. Physical display validation remains separate and requires usable display-event capture or external measurement.++Current status: software cadence defect reproduced and narrowed down; not repaired or accepted as smooth playback.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex bea7cceb..387e2472 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,11 @@# Veyra 工作记录+## 2026-09-20 存档与 DLSS 高读数低流畅度调查++按用户要求先提交已有修复与验收文档为 `b2c3d0e`,标签 `checkpoint/pre-fg-cadence-audit-20260920`,创建 `codex/fg-cadence-audit-20260920`。本轮只改持续测试的停机后内存 trace 导出、新增分析脚本及文档,未改变产品调度。完整命令、设置、统计与下一步修复门槛见 `docs/FG_CADENCE_AUDIT_2026-09-20.md`。++测试程序构建成功,同参数 verbose/memory 各45秒均退出0;内存复核约194提交/s,P95间隔16.704ms,114次拒绝后紧跟预热,确认非逐帧磁盘日志独有现象。PresentMon ETW启动被拒绝(exit1),未获得扫描输出证据。产物 `E:/项目/Veyra/tests/fg-cadence-audit-20260920/`;构建日志 `E:/项目/Veyra/logs/fg-cadence-audit-build-20260920.log`,沿用 E盘 dlss-recovery tmp目录。分析脚本两种模式均已实际运行。未打包、推送或发布,未宣称稳定6X或屏幕流畅度验收。+## 2026-09-20 用户关闭程序后的同参数实卡对照用户要求直接测试刚才参数。按原日志 revision18 使用 `capture:0:14:0:0`、1440p60 NV12、NR 实时1080、DLSS SR 到4K、NVOF Performance、DLSS6X、1795x816、帧同步/VSync/HDR关闭;没有误用最终效果全关配置。完整命令、哈希、计数及边界见 `docs/DLSS_RECOVERY_REPAIR_2026-09-20.md` 新增实卡章节。diff --git a/scripts/acceptance/analyze-fg-cadence.py b/scripts/acceptance/analyze-fg-cadence.pynew file mode 100644index 00000000..0c46e175--- /dev/null+++ b/scripts/acceptance/analyze-fg-cadence.py@@ -0,0 +1,126 @@+"""Inspect verbose capture timing; all intervals are software observations."""+import argparse+import json+import math+import pathlib+import re+import statistics+++def distribution(values):+ values = sorted(values)+ if not values:+ return None+ result = {"count": len(values), "mean": statistics.mean(values)}+ for name, q in (("p50", .5), ("p95", .95), ("p99", .99), ("max", 1)):+ result[name] = values[max(0, math.ceil(len(values) * q) - 1)]+ return {k: round(v, 4) for k, v in result.items()}+++def analyze(path):+ groups = {k: [] for k in ("pacing-sample", "capture-graph-sample", "capture-present-sample")}+ for line in path.read_text(encoding="utf-8", errors="replace").splitlines():+ for tag, rows in groups.items():+ marker = "[" + tag + "]"+ if marker in line:+ fields = dict(re.findall(r"(\w+)=([^ ]+)", line.split(marker, 1)[1]))+ rows.append(fields)+ break+ presentations = groups["pacing-sample"]+ if len(presentations) < 2:+ raise ValueError("No per-frame presentation samples")+ threshold = int(presentations[0]["end"]) + 100_000_000+ presentations = [p for p in presentations if int(p["end"]) >= threshold]+ if len(presentations) < 2:+ raise ValueError("Less than 10 seconds of observations")+ graphs = [g for g in groups["capture-graph-sample"] if int(g["start"]) >= threshold]+ captured = [p for p in groups["capture-present-sample"] if int(p["end"]) >= threshold]+ gaps = []+ for a, b in zip(presentations, presentations[1:]):+ start, end = int(a["end"]), int(b["begin"])+ overlaps = [(g, max(0, min(end, int(g["submitted"])) - max(start, int(g["start"])))) for g in graphs]+ matching = [(g, ticks) for g, ticks in overlaps if ticks > 0]+ gaps.append({"intervalMs": (int(b["end"]) - start) / 10000,+ "idleMs": (end - start) / 10000,+ "graphOverlapMs": sum(ticks for _, ticks in matching) / 10000,+ "graphSources": [int(g["source"]) for g, _ in matching],+ "nextPts": int(b["pts"]), "nextGenerated": b["generated"],+ "begin": start, "end": int(b["end"])})+ intervals = [g["intervalMs"] for g in gaps]+ groups_by_batch = {}+ for p in captured:+ groups_by_batch.setdefault(p["batch"], []).append(p)+ long = [g for g in gaps if g["intervalMs"] > 16.667]+ return {+ "scope": "CPU software submission times; no scanout or unique-pixel measurement; first 10s excluded",+ "samples": len(presentations),+ "submitFps": (len(presentations) - 1) * 1e7 / (int(presentations[-1]["end"]) - int(presentations[0]["end"])),+ "intervalMs": distribution(intervals),+ "intervalUnder1ms": sum(x < 1 for x in intervals),+ "intervalOver16_667ms": len(long),+ "intervalOver25ms": sum(x > 25 for x in intervals),+ "intervalOver33_333ms": sum(x > 33.333 for x in intervals),+ "longGapGraphOverlapFraction": sum(g["graphOverlapMs"] for g in long) / sum(g["idleMs"] for g in long) if long else 0,+ "presentCpuMs": distribution([(int(p["end"]) - int(p["begin"])) / 10000 for p in presentations]),+ "lateMs": distribution([float(p["lateMs"]) for p in presentations]),+ "mediaStepMs": distribution([(int(b["pts"]) - int(a["pts"])) / 10000 for a, b in zip(presentations, presentations[1:])]),+ "graphSubmitMs": distribution([(int(g["submitted"]) - int(g["start"])) / 10000 for g in graphs]),+ "graphSlotWaitMs": distribution([float(g["slotWaitMs"]) for g in graphs]),+ "batchPresentCounts": {str(n): sum(len(v) == n for v in groups_by_batch.values()) for n in range(1, 7)},+ "longestGaps": sorted(gaps, key=lambda g: g["intervalMs"], reverse=True)[:12],+ }+++def analyze_trace(path):+ events = [dict(re.findall(r"(\w+)=([^ ]+)", line)) for line in+ path.read_text(encoding="utf-8", errors="replace").splitlines() if line.startswith("event=")]+ presents = [e for e in events if e["event"] == "Present"]+ if len(presents) < 2:+ raise ValueError("No retained presentation events")+ intervals = [(int(b["host"]) - int(a["host"])) / 10000 for a, b in zip(presents, presents[1:])]+ submits = {e["batch"]: e for e in events if e["event"] == "Submitted"}+ batches = {}+ for p in presents:+ batches.setdefault(p["batch"], []).append(p)+ # Discard partial batches at both retained-window boundaries.+ complete = list(batches)[1:-1]+ counts = {str(n): sum(len(batches[b]) == n for b in complete) for n in range(1, 7)}+ only_real = [b for b in complete if len(batches[b]) == 1 and batches[b][0]["detail"] == "0"]+ rejected = sum(b in submits and int(submits[b]["detail"]) > 0 for b in only_real)+ warmup = sum(b in submits and submits[b]["count"] == "1" for b in only_real)+ def state(batch):+ submit = submits.get(batch)+ if submit is None:+ return "unknown"+ if int(submit["detail"]) > 0:+ return "rejected"+ return "warmup" if submit["count"] == "1" else "steady"+ transitions = {}+ for a, b in zip(complete, complete[1:]):+ key = state(a) + "->" + state(b)+ transitions[key] = transitions.get(key, 0) + 1+ span = (int(presents[-1]["host"]) - int(presents[0]["host"])) / 1e7+ return {"scope": "Bounded memory trace, final retained window only; software submission, not scanout",+ "seconds": span, "samples": len(presents), "submitFps": (len(presents) - 1) / span,+ "intervalMs": distribution(intervals),+ "intervalUnder1ms": sum(v < 1 for v in intervals),+ "intervalOver16_667ms": sum(v > 16.667 for v in intervals),+ "intervalOver25ms": sum(v > 25 for v in intervals),+ "intervalOver33_333ms": sum(v > 33.333 for v in intervals),+ "batchPresentCounts": counts, "onlyRealBatches": len(only_real),+ "onlyRealRejectedBatches": rejected, "onlyRealWarmupBatches": warmup,+ "batchTransitions": transitions,+ "presentCpuMs": distribution([float(p["ms"]) for p in presents]),+ "mediaStepMs": distribution([(int(b["pts"]) - int(a["pts"])) / 10000 for a, b in zip(presents, presents[1:])])}+++if __name__ == "__main__":+ parser = argparse.ArgumentParser()+ parser.add_argument("log", type=pathlib.Path)+ parser.add_argument("--output", type=pathlib.Path, required=True)+ parser.add_argument("--trace", action="store_true")+ args = parser.parse_args()+ result = analyze_trace(args.log) if args.trace else analyze(args.log)+ args.output.parent.mkdir(parents=True, exist_ok=True)+ args.output.write_text(json.dumps(result, indent=2), encoding="utf-8")+ print(json.dumps({k: v for k, v in result.items() if k != "longestGaps"}, indent=2))diff --git a/tests/integration/FgSustainedTests.cpp b/tests/integration/FgSustainedTests.cppindex 70a91bb7..cd64a344 100644--- a/tests/integration/FgSustainedTests.cpp+++ b/tests/integration/FgSustainedTests.cpp@@ -3,6 +3,7 @@#include "veyra/Log.h"#include <chrono>#include <filesystem>+#include <fstream>#include <iostream>#include <thread>@@ -87,6 +88,9 @@ int wmain(int argc,wchar_t** argv){while(!engine.idle()&&Clock::now()-stopping<std::chrono::seconds(15))std::this_thread::sleep_for(std::chrono::milliseconds(10));ok=ok&&engine.idle();}+ // Dump the bounded existing trace after stopping, without per-frame disk I/O.+ std::ofstream(std::filesystem::path(argv[2])/L"frame-trace.txt")+ <<veyra::Logger::instance().diagnosticReport();DestroyWindow(window);CoUninitialize();std::cout<<"Submission rates are not scanout rates. Lifecycle recovery does not assert target throughput or image quality.\n";return ok?0:1;