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++
test: add bounded real-player NR baseline measurement
Veyra Goal Agent63e43e756ac7
diff --git a/docs/PERF_EXECUTION_NR_2026-10-04.md b/docs/PERF_EXECUTION_NR_2026-10-04.mdindex 12fcfc7f..c38a022c 100644--- a/docs/PERF_EXECUTION_NR_2026-10-04.md+++ b/docs/PERF_EXECUTION_NR_2026-10-04.md@@ -9,7 +9,7 @@## 执行与保留规则- 所有新增 build/tests/logs/tmp/archives/test-packages 均放 `E:/项目/Veyra/` 对应 `perf-nr-20261004` 子目录;固定素材放 `tests/perf-matrix/media`,只创建本轮拥有的文件。-- 先完成文档对齐提交和 `checkpoint/perf-nr-docs-20261004`,归档 Git bundle/提交身份/原桌面状态,再开始产品改动。基线产品源码为起点;测试工具改动独立记录。+- 文档对齐已提交 `37bc0c090918566f7ebebc9f5edb24ba60c5f5a3`,标签 `checkpoint/perf-nr-initial-docs-20261004`,完整 bundle 已验证。基线产品源码为起点;测试工具改动独立记录。- 每个实验/节点使用 before/candidate/accepted 或 rejected 标签、独立增量 bundle、patch、构建身份、设置、环境、原始日志、结果 JSON 和结论文档。负优化用明确的 revert 提交;不重写历史,不删失败证据。未达到收益或正确性门槛的候选不进保留实现。- A 为当前源码的全新生产构建和独立 staging;B 为节点候选;B-off 在同一候选关闭该节点。固定驱动/运行库/素材/尺寸/设置,三次运行报告中位数与范围。GPU任务串行,构建与计时测试不重叠,其他用户应用不强行关闭;记录负载干扰并排除受干扰样本。- 软件 Present/提交时间、GPU timestamp、CPU Timer、物理显示事件分别报告。没有 ETW/高速相机证据时不宣称实屏帧率或端到端延迟。@@ -23,8 +23,8 @@| 节点 | 内容 | 状态 | 证据 / 下一步 ||---|---|---|---|-| D0 | 项目文档对齐与存档 | in-progress | 新分支已创建,准备文档提交/存档 |-| A0 | 当前版本基线及矩阵驱动 | pending | 全新构建、独立数据目录、固定素材/运行库 |+| D0 | 项目文档对齐与存档 | accepted | 37bc0c0 / initial-docs完整bundle verify,桌面/main保持 |+| A0 | 当前版本基线及矩阵驱动 | in-progress | A全新476步构建通过;M1五种现有设置各三轮真实播放器计时中 || E1 | Feature18动态输入尺寸 | pending | 原版/Lecram分别测返回值、画面、历史 || E2 | 并行Evaluate/CreateFeature | pending | 独立command list、压力/反复切换 || E3 | 真实来源精确重复比例 | pending | 屏幕/实卡可用性与合成节奏分开 |@@ -48,4 +48,6 @@## 当前可续接状态-已完成只读核对和新工作树创建;尚未开始产品性能改动、尚无本轮前后性能结果。下一步:保存文档对齐,创建可验证存档,然后构建并测量A。+已完成项目文档对齐、独立分支和开工存档。`py -3.11 -B scripts/perf/nr-build.py A build-A-v1 veyra_qml_ui veyra_nr_video_quality_probe veyra_export_probe` 全新构建476步、exit0;日志 `E:/项目/Veyra/logs/perf-nr-20261004/build-A-v1.log`。运行库沿用已验收完整NVIDIA包原字节,EXE/QML和各profile独立。++基线驱动 `nr-series.py A` 串行运行M1/S1、S2-720、S3、S4、S5-existing各三轮、稳态50秒;每个产品进程和驱动有270/280/299秒上限。1280×800窗口、真实GPU timestamp及CPU提交统计,不将16ms UI Timer当渲染FPS。现有UI没有精确50%档位,S2明确为1280×720(1080p输入维度66.7%、像素44.4%)。多层先粗后细已有逐层尺寸参数,S5核对现有行为,不计为新收益。当前尚无产品性能改动或本轮前后收益。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex c5019b80..8f9d7144 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,12 @@# Veyra 工作记录+## 2026-10-04 NR优化:文档归档与优化前真实GPU基线进行中++- 文档对齐commit37bc0c090918566f7ebebc9f5edb24ba60c5f5a3,checkpoint/perf-nr-initial-docs-20261004;initial-docs/source.bundle verify成功,SHA34d888b290e094b4f3b9d7dd3aa01d6b34c5a568fe722ef3e18327f3e207e0fd,patch/commit/parent receipt在本轮archives。起点8cdc产品不变,原桌面/main保护guard持续通过。+- `py -3.11 -B scripts/perf/nr-build.py A build-A-v1 veyra_qml_ui veyra_nr_video_quality_probe veyra_export_probe` 全新476步、exit0。build/perf-nr-20261004/A,日志logs/perf-nr-20261004/build-A-v1.log;Qt/SDK/patched FFmpeg沿用已发布配置,TEMP/TMP仅E盘子进程。没有与GPU计时重叠编译。+- `nr-matrix.py`/`nr-probe.qml`/`nr-series.py`用于自身staging实际产品播放,M1/S1..S5各三轮,270s产品退出/280s driver/299s子测试上限;配置、生效状态、素材/EXE/NR SHA、GPU频率/显存/CPU、滚动player-timing原始CSV/JSON均独立。硬链接仅不可变依赖,EXE/QML/配置独立,不修改用户包或配置。+- 目前只完成部分A基线,不能把现有720p比1080p快写成新优化。无精确50%原选项,记录720p实际维度;SAOG多层总残差与Veyra每层独立控制并不等价,需按合同验收。尚无产品改动;三轮完整数据和节点实验结论待追加。+## 2026-10-04 NR性能优化目标:进度对齐、分支与开工存档- 用户指定 `docs/PERF_PLAN_NR_2026-10-03.md`,要求文档/存档/当前基线先行,逐节点留档与实测,负优化回退,目标模式直至整份方案处理完毕。已创建active goal,没有预算上限。独立E盘worktree `perf-nr-20261004` / `codex/perf-nr-20261004` 从刚验收tip `8cdc612120cbf23ba116a33c3cb0a53e2043f718` 开出;旧修复分支、main354b1c6、Claude工作区、原桌面64项dirty和已发布/本地候选保持。diff --git a/scripts/perf/nr-matrix.py b/scripts/perf/nr-matrix.pynew file mode 100644index 00000000..70be4220--- /dev/null+++ b/scripts/perf/nr-matrix.py@@ -0,0 +1,158 @@+"""Run one serial real-player baseline/candidate experiment and preserve raw evidence."""+from pathlib import Path+import csv+import hashlib+import json+import os+import re+import shutil+import statistics+import subprocess+import sys+import time+import psutil++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+TASK = 'perf-nr-20261004'+PACKAGE = BASE / 'test-packages/playback-smoothness-20261004/Veyra-2.0.3-smoothfix-NVIDIA-win64-portable'+BUILD = BASE / 'build' / TASK+SOURCES = {'M1': BASE / 'tests/hotfix-2.0.0-20261002/media/gta6-1080p30-60s.mp4'}+CONFIGS = {+ 'S1': {'layers': 1, 'policies': [1], 'temporal': False},+ # The current UI has fixed sizes, not 50%; label this actual 720p policy.+ 'S2-720': {'layers': 1, 'policies': [3], 'temporal': False},+ 'S3': {'layers': 1, 'policies': [0], 'temporal': False, 'sr': True},+ 'S4': {'layers': 2, 'policies': [0, 0], 'temporal': False, 'sr': True, 'fg': True},+ 'S5-existing': {'layers': 3, 'policies': [2, 3, 1], 'temporal': False},+}++def digest(path):+ with Path(path).open('rb') as f:+ return hashlib.file_digest(f, 'sha256').hexdigest()++def copy_dependency(src, dst):+ if Path(src).suffix.lower() in {'.dll', '.hsaco', '.ptx', '.onnx', '.f16', '.bin', '.cubin'}:+ os.link(src, dst)+ else:+ shutil.copy2(src, dst)+ return dst++def gpu_query():+ cmd = ['nvidia-smi', '--query-gpu=name,driver_version,utilization.gpu,memory.used,memory.total,clocks.current.graphics,clocks.current.memory,power.draw', '--format=csv,noheader,nounits']+ p = subprocess.run(cmd, capture_output=True, text=True, timeout=8)+ if p.returncode:+ return {'queryError': p.returncode}+ values = [v.strip() for v in p.stdout.strip().split(',')]+ return dict(zip(('name','driver','gpuPercent','memoryMiB','memoryTotalMiB','graphicsMHz','memoryMHz','powerW'), values))++def stage(variant):+ path = BASE / 'tests' / TASK / ('app-' + variant)+ if path.exists():+ return path+ shutil.copytree(PACKAGE, path, copy_function=copy_dependency,+ ignore=shutil.ignore_patterns('*.log', 'logs', 'user-data-2.0.0', '*.dmp'))+ assert digest(BUILD / variant / 'veyra_qml_ui.exe')+ shutil.copy2(BUILD / variant / 'veyra_qml_ui.exe', path / 'veyra_qml_ui.exe')+ if variant != 'A':+ shutil.copytree(ROOT / 'qml', path / 'qml', dirs_exist_ok=True)+ shutil.copy2(ROOT / 'scripts/perf/nr-probe.qml', path / 'qml/Veyra/NrPerfProbe.qml')+ main = path / 'qml/Veyra/Main.qml'+ text = main.read_text(encoding='utf-8'); at = text.rfind('}')+ text = text[:at] + '\n Loader { source: "NrPerfProbe.qml"; onLoaded: { item.media=veyra.testOptions.perfMedia; item.config=JSON.parse(veyra.testOptions.perfConfig); item.seconds=veyra.testOptions.perfSeconds } }\n' + text[at:]+ # testOptions has no arbitrary CLI arguments; make only this owned loader+ # read a fixed per-run JSON via Qt's supported XMLHttpRequest API instead.+ text = text.replace('item.media=veyra.testOptions.perfMedia; item.config=JSON.parse(veyra.testOptions.perfConfig); item.seconds=veyra.testOptions.perfSeconds',+ 'const r=new XMLHttpRequest(); r.open("GET", "' + (path / 'perf-run.json').as_uri() + '", false); r.send(); const c=JSON.parse(r.responseText); item.media=c.media; item.config=c.config; item.seconds=c.seconds')+ main.write_text(text, encoding='utf-8')+ return path++def run(variant, material, setting, label, seconds):+ subprocess.run([sys.executable, '-B', str(ROOT / 'scripts/perf/nr-control.py'), 'guard'], check=True)+ app = stage(variant)+ media = SOURCES.get(material, BASE / 'tests/perf-matrix/media' / (material + '.mkv'))+ assert media.is_file(), media+ logs = BASE / 'logs' / TASK / label+ profile = BASE / 'tests' / TASK / label / 'profile'+ tmp = BASE / 'tmp' / TASK / label+ for path in (logs, profile, tmp):+ path.mkdir(parents=True, exist_ok=False)+ config = CONFIGS[setting]+ (app / 'perf-run.json').write_text(json.dumps({'media': str(media).replace('\\', '/'), 'config': config,+ 'seconds': seconds}), encoding='utf-8')+ (profile / 'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat': 'off'}), encoding='utf-8')+ env = os.environ.copy()+ for key in tuple(env):+ if key.upper().startswith(('VEYRA_', 'QT_QUICK_BACKEND', 'QSG_RHI_BACKEND')):+ env.pop(key)+ env.update(TEMP=str(tmp), TMP=str(tmp), VEYRA_LOG_FILE=str(logs / 'player.log'),+ QML_DISABLE_DISK_CACHE='1', QT_FORCE_STDERR_LOGGING='1', QML_XHR_ALLOW_FILE_READ='1',+ VEYRA_VERBOSE_FRAME_LOGS='1')+ before = gpu_query()+ receipt = {'variant': variant, 'material': material, 'setting': setting, 'config': config,+ 'sourceSha256': digest(media), 'exeSha256': digest(app / 'veyra_qml_ui.exe'),+ 'runtimeSha256': digest(app / 'runtime/experimental/nvngx_dlssnr.dll'),+ 'beforeGpu': before, 'secondsRequested': seconds, 'measurement': 'GPU timestamps and CPU submission, not display scanout',+ 'sourceCommit': subprocess.check_output(['git', '-C', str(ROOT), 'rev-parse', 'HEAD']).decode().strip()}+ start = time.monotonic()+ with (logs / 'console.log').open('xb') as out:+ proc = subprocess.Popen([str(app / 'veyra_qml_ui.exe'), '--data-dir', str(profile),+ '--page', 'pro', '--size', '1280x800', '--exit-after', '270000'],+ cwd=app, env=env, stdout=out, stderr=subprocess.STDOUT)+ receipt['pid'] = proc.pid+ meter = psutil.Process(proc.pid); meter.cpu_percent(None)+ samples = []+ try:+ while proc.poll() is None and time.monotonic()-start < 280:+ try:+ cpu, rss = meter.cpu_percent(None), meter.memory_info().rss+ except psutil.Error:+ break+ samples.append({'elapsed': time.monotonic()-start, 'cpuPercentOneCoreScale': cpu, 'rssBytes': rss,+ 'gpu': gpu_query()})+ time.sleep(1)+ if proc.poll() is None:+ proc.kill(); proc.wait(timeout=8); rc = 124+ else:+ rc = proc.returncode+ finally:+ if proc.poll() is None:+ proc.kill(); proc.wait(timeout=8)+ receipt.update(exitCode=rc, wallSeconds=time.monotonic()-start, afterGpu=gpu_query())+ text = (logs / 'player.log').read_text(encoding='utf-8', errors='replace')+ receipt['passed'] = rc == 0 and 'NR_PERF_PASS' in text and 'NR_PERF_FAIL' not in text and not any(s in text for s in ('ReferenceError:', 'TypeError:', '[ERROR]', '[FATAL]'))+ # Each line contains rolling statistics. Summarise their steady observations,+ # never call their median an aggregate percentile of all individual frames.+ rows = []+ steady = False+ for line in text.splitlines():+ if 'NR_PERF_SAMPLE ' in line:+ try:+ sample = json.loads(line.split('NR_PERF_SAMPLE ',1)[1])+ steady = sample['ready'] and 10 <= sample['position'] <= 48+ except (ValueError, KeyError):+ pass+ if '[player-timing]' in line and steady:+ row = {k: float(v) for k,v in re.findall(r'(\w+)=(-?\d+(?:\.\d+)?)',line)}+ rows.append(row)+ keys = sorted(set(k for row in rows for k in row))+ summary = {key: {'medianOfRollingObservations': statistics.median(row[key] for row in rows if key in row),+ 'min': min(row[key] for row in rows if key in row),+ 'max': max(row[key] for row in rows if key in row)} for key in keys}+ receipt['steadyObservationCount'] = len(rows)+ receipt['summary'] = summary+ receipt['passed'] = receipt['passed'] and len(rows) >= 10+ (logs / 'meters.json').write_text(json.dumps(samples, ensure_ascii=False, indent=2), encoding='utf-8')+ (logs / 'result.json').write_text(json.dumps(receipt, ensure_ascii=False, indent=2), encoding='utf-8')+ with (logs / 'timing.csv').open('x', encoding='utf-8', newline='') as f:+ writer = csv.DictWriter(f, fieldnames=keys); writer.writeheader(); writer.writerows(rows)+ print(json.dumps({key: receipt[key] for key in ('variant','material','setting','exitCode','passed','steadyObservationCount','summary')}, ensure_ascii=False), flush=True)+ if not receipt['passed']:+ print('\n'.join(text.splitlines()[-30:]), flush=True)+ raise SystemExit(1)++if __name__ == '__main__':+ variant, material, setting, label = sys.argv[1:5]+ assert variant.replace('-', '').isalnum() and label.replace('-', '').isalnum()+ assert setting in CONFIGS+ run(variant, material, setting, label, int(sys.argv[5]) if len(sys.argv)>5 else 50)diff --git a/scripts/perf/nr-probe.qml b/scripts/perf/nr-probe.qmlnew file mode 100644index 00000000..4377fc48--- /dev/null+++ b/scripts/perf/nr-probe.qml@@ -0,0 +1,91 @@+import QtQuick++// Isolated test-only loader; never distributed with the product.+Item {+ id: probe+ property var appWindow: Window.window+ property var config: ({})+ property string media: ""+ property int seconds: 50+ property int ticks: 0+ property double readyAt: 0+ property double previous: 0+ property var intervals: []+ property bool configured: false+ property bool expectSr: false+ property bool expectFg: false+ property int expectNr: 1+ property var expectedPolicies: []++ function require(value, why) {+ if (!value) { console.log("NR_PERF_FAIL", why); Qt.exit(3) }+ }+ Connections {+ target: veyra+ function onNotice(text, error) { console.log("NR_PERF_NOTICE", text, error) }+ }+ Timer {+ interval: 16; running: true; repeat: true+ onTriggered: {+ const now = Date.now()+ if (probe.previous) probe.intervals.push(now - probe.previous)+ probe.previous = now+ }+ }+ Timer {+ interval: 1000; running: true; repeat: true+ onTriggered: {+ ++probe.ticks+ if (!probe.configured) {+ probe.appWindow.width = 1280; probe.appWindow.height = 800+ veyra.muted = true; veyra.lowLatency = false+ veyra.nrEnabled = true; veyra.srEnabled = false; veyra.fgEnabled = false+ veyra.videoHdr = false; veyra.colorEnabled = false+ probe.expectNr = probe.config.layers || 1+ const policies = probe.config.policies || [1]+ probe.expectedPolicies = policies+ while (veyra.nrLayers.length < probe.expectNr)+ probe.require(veyra.duplicateNrLayer(veyra.nrLayers[0].index) >= 0, "duplicate layer")+ for (let i = 0; i < probe.expectNr; ++i) {+ const idx = veyra.nrLayers[i].index+ probe.require(veyra.setNrLayerParameter(idx, "sizePolicy", policies[Math.min(i, policies.length-1)]), "size policy")+ probe.require(veyra.setNrLayerParameter(idx, "runtime", 0), "Lecram runtime")+ probe.require(veyra.setNrLayerParameter(idx, "temporal", probe.config.temporal ? 1 : 0), "temporal")+ }+ probe.expectSr = Boolean(probe.config.sr)+ if (probe.expectSr) {+ veyra.videoSrQuality = 0 // actual DLSS SR, not RTX Video SR+ veyra.srTargetIndex = 2; veyra.srEnabled = true+ }+ probe.expectFg = Boolean(probe.config.fg)+ if (probe.expectFg) {+ veyra.fgBackendName = "dlss"; veyra.fgMultiplier = 2; veyra.fgEnabled = true+ }+ console.log("NR_PERF_CONFIG", JSON.stringify({config:probe.config, layers:veyra.nrLayers,+ sr:veyra.srEnabled, srQuality:veyra.videoSrQuality, srTarget:veyra.srTargetIndex,+ fg:veyra.fgEnabled, multiplier:veyra.fgMultiplier, backend:veyra.fgBackendName}))+ veyra.openPath(probe.media)+ probe.configured = true+ }+ probe.require(!veyra.failed, "engine failure")+ if (!probe.readyAt && veyra.running && veyra.position > 0 && veyra.nrActive &&+ veyra.srActive === probe.expectSr && veyra.fgActive === probe.expectFg) {+ probe.readyAt = Date.now()+ console.log("NR_PERF_READY", probe.readyAt)+ }+ const a = probe.intervals.sort((a,b) => a-b)+ const p = value => a.length ? a[Math.min(a.length-1,Math.floor(a.length*value))] : 0+ console.log("NR_PERF_SAMPLE", JSON.stringify({tick:probe.ticks, ready:probe.readyAt > 0,+ active:probe.appWindow.active, width:probe.appWindow.width, height:probe.appWindow.height,+ position:veyra.position, fps:veyra.submitFps, nr:veyra.nrActive, sr:veyra.srActive,+ fg:veyra.fgActive, uiTimerP50Ms:p(.5), uiTimerP95Ms:p(.95), uiTimerMaxMs:p(1),+ uiTimerSamples:a.length, detail:veyra.runStatusDetail}))+ probe.intervals = []+ if (probe.readyAt && Date.now() - probe.readyAt >= probe.seconds * 1000) {+ probe.require(veyra.nrLayers.length === probe.expectNr, "layer count changed")+ console.log("NR_PERF_PASS"); Qt.quit()+ }+ if (probe.ticks >= 250) { console.log("NR_PERF_FAIL", "timeout"); Qt.exit(4) }+ }+ }+}diff --git a/scripts/perf/nr-series.py b/scripts/perf/nr-series.pynew file mode 100644index 00000000..dc4d6e20--- /dev/null+++ b/scripts/perf/nr-series.py@@ -0,0 +1,31 @@+"""Serial comparison orchestration; individual player tests remain <=300s."""+from pathlib import Path+import json+import subprocess+import sys++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+variant = sys.argv[1]+settings = sys.argv[2:] or ['S1', 'S2-720', 'S3', 'S4', 'S5-existing']+logs = BASE / 'logs/perf-nr-20261004'+for setting in settings:+ for repeat in range(1, 4):+ label = f'{variant}-M1-{setting}-r{repeat}'+ result = logs / label / 'result.json'+ if result.exists():+ assert json.loads(result.read_text(encoding='utf-8'))['passed'], f'failed receipt: {result}'+ print('ALREADY_PASS', label, flush=True)+ continue+ print('START', label, flush=True)+ out = logs / (label + '-driver.log')+ with out.open('x', encoding='utf-8') as f:+ p = subprocess.run([sys.executable, '-B', str(ROOT / 'scripts/perf/nr-matrix.py'),+ variant, 'M1', setting, label], cwd=ROOT, stdout=f,+ stderr=subprocess.STDOUT, timeout=299)+ if p.returncode:+ print('FAILED', label, p.returncode, out, flush=True)+ raise SystemExit(p.returncode)+ data = json.loads(result.read_text(encoding='utf-8'))+ print('PASS', label, 'processingMs=', data['summary']['enhancementProcessingMs']['medianOfRollingObservations'],+ 'nrP95Ms=', data['summary']['gpuNrP95Ms']['medianOfRollingObservations'], flush=True)