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++

fix(vfg): retain severe group estimates with bounded recovery probes

Veyra Goal Agentba38f7e4c677
diff --git a/docs/VFG_NEXT_PLAN_2026-10-07.md b/docs/VFG_NEXT_PLAN_2026-10-07.md
index 60076b1f..d5d4e23d 100644
--- a/docs/VFG_NEXT_PLAN_2026-10-07.md
+++ b/docs/VFG_NEXT_PLAN_2026-10-07.md
@@ -8,7 +8,7 @@
4. 必须与原2.0.6及同EXE旧模式相邻对照,8/10-bit全部质量/2X–8X像素逐位核对,重复输入地址更新、反向parity/reset、中途起始subframe、失败回退、退出/seek/切换和完整导出计数。实测无收益或画面变化则撤回产品改动并保留报告。
5. 只有证据支持才处理额外VFG专属瓶颈;禁止靠放宽过期门槛、丢更多帧、降低画质或放慢时钟伪造收益。所有产物E:/项目/Veyra下同名任务目录,测试每进程≤300秒、构建≤900秒。正常GPU串行;已有SDK/DLL/模型原字节保持且不进源码Git。
-当前:开工保护完成,优化尚未实现,收益待测。NVIDIA显存增长及其它硬件长稳不由本轮短测视为解决。
+开工时:保护完成,优化尚未实现。后续进度按下列节点及本轮报告记录;NVIDIA显存增长及其它硬件长稳不由本轮短测视为解决。
## 第二节点:VFG排队预算修正
@@ -16,3 +16,12 @@
同步减量实验已测:同EXE High3 68/68.5fps、Medium8 210/210fps、Medium6 180/180fps,未证明收益,撤回VfgBackend.cpp;实验ff8fdf4及独立EXE保留在tests/vfg-next-20261007/bin/producer-v1。SDK1.3官方CudaGraph selector实查get/set均-5,不实施CUDA图假说。能力探针首次未建CUDA context创建失败,补齐产品相同初始化后成功,原失败记录不作SDK不支持证据。
具体发现:EngineController文件来源pendingCompletions的GPU成本,对fgReduced=true且fgEvaluated=1的VFG组仍用fgBudget.predicted的请求倍率完整成本。只在VFG这一分支按baseCost + Fg1 GPU P95核算一张插帧,并以完整成本为上界;无测量/非1次/历史恢复沿用原估计。其它补帧、admitFile、截止时间/宽限/倍率/reset/画质不改。必要接点扩展到src/engine/EngineController.cpp、独立include/veyra/engine/VfgQueueBudget.h和tests/unit/VfgSettingsTests.cpp,guard独立范围同步扩展,不改start或旧保护。环境VEYRA_TEST_VFG_FULL_REDUCED_QUEUE_COST仅作旧估计对照。先相邻High3、Medium8/7,若无收益或增加过期/跳源帧则撤回;已有全像素合同和生命周期/导出在保留候选后验收。
+
+
+## 第三节点:严重超预算时避免成本过期触发盲目全倍率重试
+
+adb1c8b矩阵中High8旧估计42.5fps/103张过期/17跳源,排队修正44fps/92张过期/14跳源;均20秒观察,软件偏差约32ms,仍不理想。日志显示整组FG可达115ms,完整成本两秒过期后predicted退回base,反复尝试无法实时完成的整组。
+
+仅在VFG、非历史预热、完整FG成本已经过期且最近整组实际成本超过两个源帧间隔时,独立保留该整组与其第一张的实际GPU耗时比例。当前Fg1 P95较参考下降20%以上则允许重新试探;有新完整测量、源/history/settings reset同步更新或清空。只把保留值当估计,用原输出宽限和lastDeadline再作保守否决,继续既有2X回退;不冒充新GPU测量、不放宽截止、不增队列、不降模型或分辨率。High3等轻度超预算不受这一保护。新增VfgOverloadEstimate.h、CompletionWatch单张GPU时间记录与VFG专用否决;shared FgRecoveryBudget不改。以旧估计/仅排队修正/双修正同EXE对照验证High8和High3,正常长一点片段检查周期性迟到。若反复确认过期/跳源增加或恢复被锁住则撤回该节点。质量/倍率/seek/reset/缺测保护由339项设置测试扩展。
+
+首次保留估计版High8=60fps,20/40秒观察段过期与跳源均0;同EXE关闭保护=44fps/101过期/20跳源,双关闭43fps/90过期/16跳源。对抗式复查发现:若整组后续插帧偶遇异常,第一张没变快,永久保留比例会锁住恢复。最终增加30秒最多一组、仍须原admitFile接受的完整重测;提交前预约,防止异步多组同时探测。新完整测量更新定时器;单张变快20%仍立即放开。低频重测本身可能带来一次迟到,必须按最终版本重新测量并如实报告,首版0过期结果不代表最终版。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 9c272a4b..083cf6a5 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,13 @@
# WORKLOG
+## 2026-10-07 VFG第三节点:严重过载及恢复边界
+
+- 第二节点矩阵11例完成:High4旧68→72,Medium8旧208.5→216、Medium7旧201→204.5;High8仍42.5→44fps/过期103→92/跳源17→14。Medium7另一对210→200、过期2→16,不能宣称该档无回归,最终版加长并反向顺序复测。全程GTA4K30/原版1080NR/普通GPU/原模型,提交FPS只表示软件Present。
+- 找到完整FG成本2秒过期后退回base而盲目重试完整High8组。VFG专用保留整组/首张实测比例,仅严重超两源间隔且完整成本缺失时保守否决,期限和共享FgRecoveryBudget不改。overload-v1编译通过,设置349项0失败(首次unit命令预建输出目录触发argv契约exit2,改新目录成功)。首版同EXEHigh8双关闭43、仅排队44、双修正60fps;20/40秒双修正观察过期与跳源0,但首版无低频重新评估,未交付。
+- 对抗式复查:后续插帧一次性变慢而首张没有变化,保留比例可能长期锁住恢复。最终overload-v2加30秒最多一次完整重新测量,仍须原admitFile接受、预约后禁止并发探测;更快首张/历史或设置reset仍立即放开。设置353检查0失败,构建exit0,GUI SHA256 c007c7fc9072a6114eb2479b1880b65f5386a5fd445e6c58513faf3c1328a2b2。结果以后续final-matrix为准。
+- 首版矩阵未完整结束:重编v2时与首版Low8测量重叠(构建14:59:00–14:59:33 UTC,Low8观察14:59:15–14:59:34),该例不作性能证据;下一个Medium4载入v2后因预期首版SHA断言停止。原进程回执均保留,不混算为同EXE矩阵通过。最终13例串行矩阵重新测量期间禁止构建/GPU并行。
+- 产物仍全部E:/项目/Veyra下vfg-next-20261007任务目录。最终像素/切换/失败/导出及本地包检查尚待完成,未合入main或发布。
+
## 2026-10-07 VFG第二节点:排队预算实验
- 同EXE同步减量High3 68/68.5、Medium8 210/210、Medium6 180/180fps:无明确收益,已将VfgBackend.cpp恢复96a7c8de原字节;ff8fdf4及EXE在tests/vfg-next-20261007/bin/producer-v1存档。SDK1.3 CudaGraph selector get/set=-5,未实施;能力探针首次未建CUDA context创建失败,补齐产品初始化后成功,sdk-capabilities.json保留正确返回码。
diff --git a/include/veyra/engine/VfgOverloadEstimate.h b/include/veyra/engine/VfgOverloadEstimate.h
new file mode 100644
index 00000000..dd1190fe
--- /dev/null
+++ b/include/veyra/engine/VfgOverloadEstimate.h
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-3.0-only
+#pragma once
+#include <algorithm>
+#include <cmath>
+#include <cstdint>
+#include <optional>
+
+namespace veyra::engine {
+// Retained estimates are NOT fresh GPU samples. A severely overloaded full
+// group must not become free merely because only affordable 2X groups ran
+// during the measurement window. A faster measured first interpolation opens
+// the probe again. A bounded, low-frequency full probe also permits recovery
+// from a later-subframe outlier that did not affect the first interpolation.
+// Source/history/settings resets discard this relationship.
+class VfgOverloadEstimate {
+ std::optional<double> full_,first_;
+ int64_t nextProbe_=0;
+ static constexpr int64_t probeInterval=300000000; // 30 s, in 100 ns units.
+ static bool positive(std::optional<double> x){return x&&std::isfinite(*x)&&*x>0;}
+public:
+ void reset(){full_.reset();first_.reset();nextProbe_=0;}
+ void observe(std::optional<double> full,std::optional<double> first,int64_t now){
+ if(positive(full)&&positive(first)&&*full>=*first){full_=full;first_=first;nextProbe_=now+probeInterval;}
+ }
+ // Call only if the original admission accepts this pair. Reserve one
+ // probe before submission so several in-flight pairs cannot all retry.
+ bool allowProbe(int64_t now){
+ if(!positive(full_)||now<nextProbe_)return false;
+ nextProbe_=now+probeInterval;return true;
+ }
+ std::optional<double> severeTotal(std::optional<double> base,std::optional<double> currentFirst,double sourceIntervalMs)const{
+ if(!positive(full_)||!positive(first_)||!positive(currentFirst)||!base||!std::isfinite(*base)||*base<0||
+ !std::isfinite(sourceIntervalMs)||sourceIntervalMs<=0||*currentFirst<*first_*0.8)return {};
+ const double total=*base+*full_*(*currentFirst / *first_);
+ if(!std::isfinite(total)||total<=2*sourceIntervalMs)return {};
+ return total;
+ }
+ static bool fits(double total,double base,double deadlineMs,double graceMs,double elapsed,double queued,double blit){
+ const double queue=std::isfinite(queued)?std::max(0.0,queued):0.0;
+ const double progress=std::clamp(elapsed,0.0,queue+base);
+ return deadlineMs+std::max(0.0,graceMs)>=std::max(0.0,queue+total-progress)+std::max(0.0,blit);
+ }
+};
+}
diff --git a/scripts/acceptance/vfg-next-audit.py b/scripts/acceptance/vfg-next-audit.py
new file mode 100644
index 00000000..bd879ec8
--- /dev/null
+++ b/scripts/acceptance/vfg-next-audit.py
@@ -0,0 +1,52 @@
+"""Independent complete payload hashes, vendor boundaries and PE import closure."""
+import hashlib, json, os, sys
+from pathlib import Path
+import pefile
+
+BASE=Path('E:/项目/Veyra'); TASK='vfg-next-20261007'
+app=Path(sys.argv[1]).resolve(); flavor=sys.argv[2]; label=sys.argv[3]
+assert app.is_relative_to(BASE.resolve()) and flavor in ('NVIDIA','AMD')
+out=BASE/'logs'/TASK/(label+'.json'); assert not out.exists()
+manifest=json.loads((app/'package-manifest.json').read_text(encoding='utf8'))
+names={f.relative_to(app).as_posix():f for f in app.rglob('*') if f.is_file()}
+expected={r['path'] for r in manifest['files']}|{'package-manifest.json'}
+assert set(names)==expected, {'unexpected':list(set(names)-expected),'missing':list(expected-set(names))}
+for row in manifest['files']:
+ f=names[row['path']]
+ with f.open('rb') as stream: sha=hashlib.file_digest(stream,'sha256').hexdigest()
+ assert f.stat().st_size==row['size'] and sha==row['sha256'],row['path']
+assert not any(f.suffix.lower() in ('.pdb','.lib','.pyd','.whl','.addon64') for f in names.values())
+drivers={'nvcuda.dll','nvopticalflow64.dll','amdhip64.dll','amdhip64_6.dll','amdhip64_7.dll'}
+assert not drivers & {f.name.lower() for f in names.values()}
+if flavor=='NVIDIA':
+ assert not any(n.startswith('runtime/amd-nr/') for n in names)
+ vfg={f.name for n,f in names.items() if n.startswith('runtime/nvidia-vfg/')}
+ assert vfg=={'NVVideoEffects.dll','nvVFXVideoFrameGeneration.dll','NVCVImage.dll','cudart64_12.dll','nvngxruntime.dll'},vfg
+else:
+ assert not any(f.name.lower().startswith(('nvngx','nvvideoeffects','cudart','npp','nvcv')) for f in names.values())
+ assert 'runtime/amd-nr/LmxxfNrRuntime.dll' in names
+fsr={f.name for n,f in names.items() if n.startswith('runtime_local/amd/fidelityfx/')}
+assert fsr=={'amd_fidelityfx_loader_dx12.dll','amd_fidelityfx_upscaler_dx12.dll','amd_fidelityfx_framegeneration_dx12.dll'}
+runtime=json.loads((app/'release-runtime-manifest.json').read_text(encoding='utf8'))
+assert runtime==json.loads((app/'runtime/experimental/release-runtime-manifest.json').read_text(encoding='utf8'))
+assert {n for n,f in names.items() if n.startswith(('runtime/','runtime_local/')) and f.suffix.lower() not in ('.json','.md','.txt')} <= {r['path'] for r in runtime['files']}
+packaged={f.name.lower() for f in names.values() if f.suffix.lower()=='.dll'}
+system=Path(os.environ['WINDIR'])/'System32'; imports=[]; missing=[]
+for name,f in names.items():
+ if f.suffix.lower() not in ('.dll','.exe'):continue
+ pe=pefile.PE(str(f),fast_load=True)
+ pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_IMPORT'],pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT']])
+ direct=[i.dll.decode().lower() for i in getattr(pe,'DIRECTORY_ENTRY_IMPORT',[])]
+ delay=[i.dll.decode().lower() for i in getattr(pe,'DIRECTORY_ENTRY_DELAY_IMPORT',[])]
+ pe.close()
+ assert not any(n.startswith('npp') for n in direct+delay),(name,direct,delay)
+ for dll in direct+delay:
+ if dll in packaged or dll.startswith(('api-ms-','ext-ms-')) or (system/dll).is_file():continue
+ missing.append({'file':name,'dependency':dll,'delay':dll in delay})
+ imports.append({'file':name,'direct':direct,'delay':delay})
+assert not missing,missing
+result=dict(flavor=flavor,app=str(app),payloadFiles=len(manifest['files']),payloadBytes=sum(r['size'] for r in manifest['files']),
+ sourceCommit=manifest.get('baseCommit'),releaseReady=manifest.get('releaseReady'),runtimeFiles=len(runtime['files']),
+ peFiles=len(imports),imports=imports,missing=missing,fsrException=True)
+out.write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')
+print('PACKAGE AUDIT PASS',flavor,result['payloadFiles'],result['payloadBytes'],out,flush=True)
diff --git a/scripts/acceptance/vfg-next-build.py b/scripts/acceptance/vfg-next-build.py
index 7dbc2b72..ca3175ea 100644
--- a/scripts/acceptance/vfg-next-build.py
+++ b/scripts/acceptance/vfg-next-build.py
@@ -1,4 +1,4 @@
-"""Build the isolated routing fix with the accepted 2.0.5 dependencies."""
+"""Build the isolated VFG continuation with the accepted dependency cache."""
from pathlib import Path
import hashlib,json,os,subprocess,sys,time
ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
@@ -13,9 +13,9 @@ for line in cache.read_text(encoding='utf8').splitlines():
if kind in ('INTERNAL','STATIC') or key in ('VEYRA_DISPLAY_VERSION','VEYRA_AMD_NR_TEST_GRAPH_SOURCE'):continue
if key.startswith('VEYRA_') or key in ('CMAKE_PREFIX_PATH','CMAKE_MAKE_PROGRAM','PROTOC','PKG_CONFIG_EXECUTABLE'):
settings.append(f'set({key} [[{value}]] CACHE {kind} "Accepted dependencies" FORCE)')
-settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.6-vfg-next]] CACHE STRING "Local AMD NR/FSR repair" FORCE)')
+settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.6-vfg-next]] CACHE STRING "Local VFG continuation" FORCE)')
(TMP/'dependencies.cmake').write_text('\n'.join(settings),encoding='utf8')
-targets=sys.argv[2:] or ['veyra_qml_ui','veyra_amd_nr_graph_tests','veyra_lmxxf_nr_tests','veyra_effect_chain_tests']
+targets=sys.argv[2:] or ['veyra_qml_ui','veyra_vfg_gpu_tests','veyra_vfg_export_probe','veyra_vfg_settings_tests']
assert all(t.replace('_','').isalnum() for t in targets)
cmd=TMP/'build.cmd';cmd.write_text('@echo off\nchcp 65001 >nul\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\n"%TASK_CMAKE%" --preset x64-release -S "%TASK_ROOT%" -B "%TASK_BUILD%" -C "%TASK_TMP%\\dependencies.cmake"\nif errorlevel 1 exit /b 5\n"%TASK_CMAKE%" --build "%TASK_BUILD%" --parallel 6 --target '+' '.join(targets)+'\nexit /b %errorlevel%\n',encoding='ascii')
env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP),VSLANG='1033',TASK_ROOT=str(ROOT),TASK_BUILD=str(BUILD),TASK_TMP=str(TMP),TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')
diff --git a/scripts/acceptance/vfg-next-cold.py b/scripts/acceptance/vfg-next-cold.py
new file mode 100644
index 00000000..3dca8331
--- /dev/null
+++ b/scripts/acceptance/vfg-next-cold.py
@@ -0,0 +1,69 @@
+"""Verify the final ZIP and cold-start its unmodified GUI with private settings."""
+from pathlib import Path,PurePosixPath
+import ctypes,hashlib,json,os,re,shutil,stat,subprocess,sys,time,zipfile,psutil
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
+VERIFY=BASE/'verify'/TASK;receipt=json.loads((VERIFY/'candidate-package.json').read_text(encoding='utf8'))
+def sha(p):
+ with Path(p).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)
+assert not any(p.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for p in psutil.process_iter(['name']))
+archive=Path(receipt['archive']);assert sha(archive)==receipt['archiveSha256']
+destination=VERIFY/'candidate-extracted';assert not destination.exists()
+with zipfile.ZipFile(archive) as z:
+ assert len(z.infolist())<5000 and sum(i.file_size for i in z.infolist())<5*1024**3
+ assert z.testzip() is None
+ for entry in z.infolist():
+ path=PurePosixPath(entry.filename)
+ assert not path.is_absolute() and '..' not in path.parts and ':' not in entry.filename
+ assert not stat.S_ISLNK(entry.external_attr>>16)
+ assert (destination/entry.filename).resolve().is_relative_to(destination.resolve())
+ z.extractall(destination)
+APP=destination/Path(receipt['app']).name
+manifest=json.loads((APP/'package-manifest.json').read_text(encoding='utf8'))
+def verify_payload():
+ for row in manifest['files']:assert sha(APP/row['path'])==row['sha256'],row['path']
+ assert {p.relative_to(APP).as_posix() for p in APP.rglob('*') if p.is_file()}=={r['path'] for r in manifest['files']}|{'package-manifest.json'}
+verify_payload();assert sha(APP/'veyra_qml_ui.exe')==receipt['exeSha256']
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-audit.py'),str(APP),'NVIDIA','candidate-zip-audit'],cwd=ROOT,check=True,timeout=90)
+out,logs,tmp=(BASE/k/TASK/'candidate-cold' for k in ('tests','logs','tmp'))
+for p in (out,logs,tmp):p.mkdir(parents=True,exist_ok=False)
+profile=out/'profile';shutil.copytree(BASE/'tests'/TASK/'overload-medium4/profile',profile)
+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}
+windows=Path(env['WINDIR']);engine=logs/'engine.log';console=logs/'console.log'
+env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_LOG_FILE=str(engine),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',PATH=os.pathsep.join(map(str,(windows/'System32',windows,windows/'System32/Wbem'))))
+cmd=[str(APP/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','28000','E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4']
+start=time.monotonic();modules=[]
+with console.open('xb') as stream:
+ process=subprocess.Popen(cmd,cwd=APP,env=env,stdout=stream,stderr=subprocess.STDOUT)
+ try:
+ time.sleep(12)
+ kernel=ctypes.WinDLL('kernel32',use_last_error=True);psapi=ctypes.WinDLL('psapi',use_last_error=True)
+ kernel.OpenProcess.argtypes=[ctypes.c_ulong,ctypes.c_int,ctypes.c_ulong];kernel.OpenProcess.restype=ctypes.c_void_p
+ kernel.CloseHandle.argtypes=[ctypes.c_void_p]
+ psapi.EnumProcessModulesEx.argtypes=[ctypes.c_void_p,ctypes.POINTER(ctypes.c_void_p),ctypes.c_ulong,ctypes.POINTER(ctypes.c_ulong),ctypes.c_ulong]
+ psapi.GetModuleFileNameExW.argtypes=[ctypes.c_void_p,ctypes.c_void_p,ctypes.c_wchar_p,ctypes.c_ulong]
+ handle=kernel.OpenProcess(0x0410,False,process.pid);assert handle
+ try:
+ items=(ctypes.c_void_p*1024)();needed=ctypes.c_ulong()
+ assert psapi.EnumProcessModulesEx(handle,items,ctypes.sizeof(items),ctypes.byref(needed),3)
+ for i in range(min(1024,needed.value//ctypes.sizeof(ctypes.c_void_p))):
+ buffer=ctypes.create_unicode_buffer(32768)
+ if psapi.GetModuleFileNameExW(handle,items[i],buffer,len(buffer)):
+ path=Path(buffer.value)
+ if path.name.startswith(('Qt6','avcodec-','avformat-','avutil-','swscale-','swresample-')):
+ assert path.resolve().is_relative_to(APP.resolve()),str(path);modules.append(str(path))
+ finally:kernel.CloseHandle(handle)
+ rc=process.wait(timeout=65)
+ except BaseException:
+ if process.poll() is None:process.kill();process.wait(timeout=10)
+ raise
+text=engine.read_text(encoding='utf8',errors='replace')+'\n'+console.read_text(encoding='utf8',errors='replace')
+bad=[line for line in text.splitlines() if re.search(r'\[ERROR\s*\]|\[FATAL\s*\]|ReferenceError:|TypeError:|no root object',line)]
+vfg4=bool(re.search(r'\[vfg\] SDK version=.* multiplier=4 quality=1 async=1',text)) and bool(re.search(r'\[fg-validity\].* valid=[1-9][0-9]* invalid=0.*backend=NVIDIA-VFG',text))
+result={'exit':rc,'seconds':time.monotonic()-start,'command':cmd,'exeSha256':receipt['exeSha256'],'archiveSha256':receipt['archiveSha256'],'ownQtAndCodecModulePaths':modules,'boundedWorker':'SDK submission=bounded worker' in text,'nr1080':'internal=1920x1080 composite=3840x2160' in text,'vfg4':vfg4,'normalGpuPriority':'requested=2 actual=2' in text,'errors':bad,'engine':str(engine),'console':str(console),'extractedApp':str(APP)}
+result['passed']=rc==0 and len(modules)>10 and all(result[k] for k in ('boundedWorker','nr1080','vfg4','normalGpuPriority')) and not bad
+(VERIFY/'candidate-cold.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')
+assert result['passed'],result
+verify_payload()
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)
+print('VFG CANDIDATE ZIP COLD START PASS',len(modules),'own Qt/codec modules',result['seconds'],flush=True)
diff --git a/scripts/acceptance/vfg-next-control.py b/scripts/acceptance/vfg-next-control.py
index 4cd43fca..5ea95d56 100644
--- a/scripts/acceptance/vfg-next-control.py
+++ b/scripts/acceptance/vfg-next-control.py
@@ -3,7 +3,7 @@ from pathlib import Path
import hashlib,json,subprocess
ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
START=BASE/'archives'/TASK/'start.json'
-ALLOWED={'AGENTS.md','docs/WORKLOG.md','src/pipeline/VfgBackend.cpp','tests/integration/VfgGpuTests.cpp','src/engine/EngineController.cpp','include/veyra/engine/VfgQueueBudget.h','tests/unit/VfgSettingsTests.cpp'}
+ALLOWED={'AGENTS.md','docs/WORKLOG.md','src/pipeline/VfgBackend.cpp','tests/integration/VfgGpuTests.cpp','src/engine/EngineController.cpp','include/veyra/engine/VfgQueueBudget.h','include/veyra/engine/VfgOverloadEstimate.h','tests/unit/VfgSettingsTests.cpp'}
def sha(p):
with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
def git(*args,cwd=ROOT):return subprocess.check_output(['git',*args],cwd=cwd)
diff --git a/scripts/acceptance/vfg-next-final-matrix.py b/scripts/acceptance/vfg-next-final-matrix.py
new file mode 100644
index 00000000..a8180007
--- /dev/null
+++ b/scripts/acceptance/vfg-next-final-matrix.py
@@ -0,0 +1,24 @@
+"""Final serial same-binary checks, including bounded recovery and a noisy tier."""
+from pathlib import Path
+import json,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
+EXPECTED='c007c7fc9072a6114eb2479b1880b65f5386a5fd445e6c58513faf3c1328a2b2'
+OLD=['--no-overload-estimate','--full-reduced-queue-cost']
+cases=[('final-control-high8',2,8,40,OLD),('final-high8',2,8,40,[]),
+ ('final-control-high3',2,3,20,OLD),('final-high3',2,3,20,[]),
+ ('final-control-medium7-a',1,7,40,OLD),('final-medium7-a',1,7,40,[]),
+ ('final-medium7-b',1,7,40,[]),('final-control-medium7-b',1,7,40,OLD),
+ ('final-control-medium8',1,8,20,OLD),('final-medium8',1,8,20,[]),
+ ('final-low8',0,8,20,[]),('final-medium4',1,4,20,[]),('final-high2',2,2,20,[])]
+results=[]
+for label,quality,multiplier,seconds,flags in cases:
+ log=BASE/'logs'/TASK/(label+'-driver.log')
+ cmd=[sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-preview.py'),'case',label,'--quality',str(quality),'--multiplier',str(multiplier),'--seconds',str(seconds),'--no-verbose',*flags]
+ with log.open('xb') as stream:rc=subprocess.run(cmd,cwd=ROOT,stdout=stream,stderr=subprocess.STDOUT,timeout=280).returncode
+ assert rc==0,(label,rc,str(log))
+ data=json.loads((BASE/'logs'/TASK/label/'result.json').read_text(encoding='utf8'))
+ assert data['passed'] and not data['errors'] and data['exeSha256']==EXPECTED
+ assert any('requested=2 actual=2' in line for line in data['normalSchedulingClass'])
+ results.append({'label':label,'quality':quality,'multiplier':multiplier,'seconds':seconds,'flags':flags,'fps':data['fps'],'timing':data.get('observationTiming')})
+ (BASE/'logs'/TASK/'final-matrix.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8')
+ print(json.dumps(results[-1],ensure_ascii=False),flush=True)
diff --git a/scripts/acceptance/vfg-next-matrix.py b/scripts/acceptance/vfg-next-matrix.py
new file mode 100644
index 00000000..b215b8ab
--- /dev/null
+++ b/scripts/acceptance/vfg-next-matrix.py
@@ -0,0 +1,22 @@
+"""Serial normal-playback A/B cases, with a separate bounded process per case."""
+from pathlib import Path
+import json,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
+cases=[('queue-control-medium8-b',1,8,True),('queue-medium8-b',1,8,False),
+ ('queue-control-medium7',1,7,True),('queue-medium7',1,7,False),
+ ('queue-control-high4',2,4,True),('queue-high4',2,4,False),
+ ('queue-control-high8',2,8,True),('queue-high8',2,8,False),
+ ('queue-low8',0,8,False),('queue-medium4',1,4,False),('queue-high2',2,2,False)]
+results=[]
+for label,quality,multiplier,control in cases:
+ log=BASE/'logs'/TASK/(label+'-driver.log')
+ cmd=[sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-preview.py'),'case',label,'--quality',str(quality),'--multiplier',str(multiplier),'--no-verbose']
+ if control:cmd.append('--full-reduced-queue-cost')
+ with log.open('xb') as stream:rc=subprocess.run(cmd,cwd=ROOT,stdout=stream,stderr=subprocess.STDOUT,timeout=280).returncode
+ assert rc==0,(label,rc,str(log))
+ data=json.loads((BASE/'logs'/TASK/label/'result.json').read_text(encoding='utf8'))
+ assert data['passed'] and not data['errors'] and data['exeSha256']=='93e8b2703c1316d6978f35c884e644d98af0682da1026b9f31de4995c8cc9e0c'
+ assert any('requested=2 actual=2' in line for line in data['normalSchedulingClass'])
+ results.append({'label':label,'quality':quality,'multiplier':multiplier,'control':control,'fps':data['fps'],'timing':data.get('observationTiming')})
+ (BASE/'logs'/TASK/'matrix.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8')
+ print(json.dumps(results[-1],ensure_ascii=False),flush=True)
diff --git a/scripts/acceptance/vfg-next-overload-matrix.py b/scripts/acceptance/vfg-next-overload-matrix.py
new file mode 100644
index 00000000..ab320abc
--- /dev/null
+++ b/scripts/acceptance/vfg-next-overload-matrix.py
@@ -0,0 +1,25 @@
+"""Same-binary normal-playback controls for retained severe-overload estimates."""
+from pathlib import Path
+import json,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
+EXPECTED='daf3b27b5ea904ac1483c61610d07b3a3fd14ef41b472c69ebcf8ae2f89fb018'
+cases=[('overload-queue-only-high8',2,8,20,['--no-overload-estimate']),
+ ('overload-control-high8',2,8,20,['--no-overload-estimate','--full-reduced-queue-cost']),
+ ('overload-high8-b',2,8,40,[]),
+ ('overload-control-high3',2,3,20,['--no-overload-estimate','--full-reduced-queue-cost']),
+ ('overload-high3',2,3,20,[]),
+ ('overload-control-medium7',1,7,20,['--no-overload-estimate','--full-reduced-queue-cost']),
+ ('overload-medium7',1,7,20,[]),
+ ('overload-low8',0,8,20,[]),('overload-medium4',1,4,20,[]),('overload-high2',2,2,20,[])]
+results=[]
+for label,quality,multiplier,seconds,flags in cases:
+ log=BASE/'logs'/TASK/(label+'-driver.log')
+ cmd=[sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-preview.py'),'case',label,'--quality',str(quality),'--multiplier',str(multiplier),'--seconds',str(seconds),'--no-verbose',*flags]
+ with log.open('xb') as stream:rc=subprocess.run(cmd,cwd=ROOT,stdout=stream,stderr=subprocess.STDOUT,timeout=280).returncode
+ assert rc==0,(label,rc,str(log))
+ data=json.loads((BASE/'logs'/TASK/label/'result.json').read_text(encoding='utf8'))
+ assert data['passed'] and not data['errors'] and data['exeSha256']==EXPECTED
+ assert any('requested=2 actual=2' in line for line in data['normalSchedulingClass'])
+ results.append({'label':label,'quality':quality,'multiplier':multiplier,'seconds':seconds,'flags':flags,'fps':data['fps'],'timing':data.get('observationTiming')})
+ (BASE/'logs'/TASK/'overload-matrix.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8')
+ print(json.dumps(results[-1],ensure_ascii=False),flush=True)
diff --git a/scripts/acceptance/vfg-next-preview.py b/scripts/acceptance/vfg-next-preview.py
index 33283210..9b05ca16 100644
--- a/scripts/acceptance/vfg-next-preview.py
+++ b/scripts/acceptance/vfg-next-preview.py
@@ -59,11 +59,12 @@ def run(args):
if not args.no_verbose:env['VEYRA_VERBOSE_FRAME_LOGS']='1'
if args.cpu_profile:env['VEYRA_TEST_VFG_CPU_PROFILE']='1'
if args.sync_submit:env['VEYRA_TEST_VFG_SYNC_SUBMIT']='1'
+ if args.no_overload_estimate:env['VEYRA_TEST_VFG_NO_OVERLOAD_ESTIMATE']='1'
if args.full_reduced_queue_cost:env['VEYRA_TEST_VFG_FULL_REDUCED_QUEUE_COST']='1'
if args.per_frame_producer:env['VEYRA_TEST_VFG_PER_FRAME_PRODUCER']='1'
if args.no_reduced:env['VEYRA_TEST_FG_NO_REDUCED']='1'
if args.software:env['QT_QUICK_BACKEND']='software'
- receipt={'config':config,'exeSha256':EXPECTED_EXE,'gpuBefore':gpu(),'noReduced':args.no_reduced,'softwareUi':args.software,'verboseFrameLogs':not args.no_verbose,'cpuProfile':args.cpu_profile,'syncSubmit':args.sync_submit,'perFrameProducer':args.per_frame_producer,'fullReducedQueueCost':args.full_reduced_queue_cost,'selectedBinary':str(selected)}
+ receipt={'config':config,'exeSha256':EXPECTED_EXE,'gpuBefore':gpu(),'noReduced':args.no_reduced,'softwareUi':args.software,'verboseFrameLogs':not args.no_verbose,'cpuProfile':args.cpu_profile,'syncSubmit':args.sync_submit,'perFrameProducer':args.per_frame_producer,'fullReducedQueueCost':args.full_reduced_queue_cost,'noOverloadEstimate':args.no_overload_estimate,'selectedBinary':str(selected)}
save(out/'launch.json',receipt)
started=time.monotonic();meters=[]
with (out/'console.log').open('xb') as stream:
@@ -115,6 +116,7 @@ parser.add_argument('--no-nr',action='store_true');parser.add_argument('--strict
parser.add_argument('--original',action='store_true');parser.add_argument('--cpu-profile',action='store_true')
parser.add_argument('--sync-submit',action='store_true');parser.add_argument('--per-frame-producer',action='store_true')
parser.add_argument('--full-reduced-queue-cost',action='store_true');parser.add_argument('--producer-experiment',action='store_true')
+parser.add_argument('--no-overload-estimate',action='store_true')
args=parser.parse_args()
subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],check=True)
diff --git a/scripts/acceptance/vfg-next-stage.py b/scripts/acceptance/vfg-next-stage.py
new file mode 100644
index 00000000..fa9ef169
--- /dev/null
+++ b/scripts/acceptance/vfg-next-stage.py
@@ -0,0 +1,51 @@
+"""Stage a complete local VFG candidate, preserving approved 2.0.6 payloads."""
+from pathlib import Path
+import hashlib,json,os,shutil,subprocess,sys,zipfile
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'
+PACKAGE=BASE/'releases/release-2.0.6-20261007/packages/Veyra-2.0.6-NVIDIA-win64-portable'
+OUT=BASE/'test-packages'/TASK;APP=OUT/'Veyra-2.0.6-VFG-next-NVIDIA-win64-portable'
+VERIFY=BASE/'verify'/TASK
+def sha(p):
+ with Path(p).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
+def git(*args):return subprocess.check_output(['git',*args],cwd=ROOT,encoding='utf8').strip()
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)
+assert not git('status','--porcelain=v1'),'Commit the reviewed source and test helpers first'
+build=json.loads((BASE/'logs'/TASK/'candidate-final.json').read_text(encoding='utf8'));assert build['exit']==0
+head=build['sourceHead'];assert head==git('rev-parse','HEAD')
+for path,digest in build['sourceFiles'].items():assert sha(ROOT/path)==digest,path
+measure=json.loads((VERIFY/'measurements.json').read_text(encoding='utf8'))
+assert measure['passed'] and measure['exeSha256']==sha(BASE/'build'/TASK/'veyra_qml_ui.exe')
+old=json.loads((PACKAGE/'package-manifest.json').read_text(encoding='utf-8-sig'))
+for item in old['files']:assert sha(PACKAGE/item['path'])==item['sha256'].lower(),item['path']
+assert not APP.exists();OUT.mkdir(parents=True,exist_ok=True);VERIFY.mkdir(parents=True,exist_ok=True)
+shutil.copytree(PACKAGE,APP,copy_function=shutil.copy2)
+shutil.copy2(BASE/'build'/TASK/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')
+notes=ROOT/'docs/VFG_NEXT_REPORT_2026-10-07.md';assert notes.is_file()
+assert '状态:本机VFG定向验收通过' in notes.read_text(encoding='utf8')
+shutil.copy2(notes,APP/'VFG-NEXT-NOTES.zh-CN.md')
+source=OUT/'Veyra-2.0.6-VFG-next-source.zip';assert not source.exists()
+subprocess.run(['git','archive','--format=zip','--prefix=Veyra-vfg-next/','--output='+str(source),head],cwd=ROOT,check=True,timeout=90)
+manifest={'schema':3,'version':'2.0.6','candidate':'2.0.6-vfg-next','displayVersion':'2.0.6-vfg-next','releaseReady':False,'localOnly':True,'gpuPackage':'NVIDIA',
+ 'baseCommit':head,'sourceArchiveCommit':head,'publishedBaseVersion':'2.0.6','publishedBaseExeSha256':sha(PACKAGE/'veyra_qml_ui.exe'),
+ 'correspondingSource':{'application':'../'+source.name,'applicationSha256':sha(source),'dependencies':old['correspondingSource']['dependencies'],'dependencySha256':old['correspondingSource']['dependencySha256'],'instructions':'docs/BUILD_2.0.6.md','displayVersionOverride':'-DVEYRA_DISPLAY_VERSION=2.0.6-vfg-next'},
+ 'validationRecord':'docs/VFG_NEXT_REPORT_2026-10-07.md',
+ 'knownIssues':['Native 4K High quality above 2X remains over budget on RTX5070; requested 8X can deliberately fall back to stable 2X','Submission FPS is not physical scanout or measured end-to-end latency','NVIDIA VRAM growth remains unresolved; only normal bounded VFG checks were run'],
+ 'files':[]}
+for file in sorted(APP.rglob('*')):
+ if not file.is_file() or file.name=='package-manifest.json':continue
+ rel=file.relative_to(APP).as_posix();original=PACKAGE/rel
+ if original.is_file():
+ assert not os.path.samefile(file,original),'Candidate must not share writable hardlinks'
+ if rel!='veyra_qml_ui.exe':assert sha(file)==sha(original),rel
+ manifest['files'].append({'path':rel,'size':file.stat().st_size,'sha256':sha(file)})
+(APP/'package-manifest.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf8')
+archive=OUT/(APP.name+'.zip');assert not archive.exists()
+with zipfile.ZipFile(archive,'x',compression=zipfile.ZIP_DEFLATED,compresslevel=6) as z:
+ for file in sorted(APP.rglob('*')):
+ if file.is_file():z.write(file,file.relative_to(OUT).as_posix())
+with zipfile.ZipFile(archive) as z:assert z.testzip() is None
+receipt={'app':str(APP),'exeSha256':sha(APP/'veyra_qml_ui.exe'),'source':str(source),'sourceSha256':sha(source),'files':len(manifest['files']),'runtimeAndQmlUnchanged':True,'independentCopies':True,'buildSource':head,'archive':str(archive),'archiveSha256':sha(archive),'archiveBytes':archive.stat().st_size,'packageManifestSha256':sha(APP/'package-manifest.json')}
+(VERIFY/'candidate-package.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')
+(OUT/'SHA256SUMS.txt').write_text(sha(archive)+' '+archive.name+'\n'+sha(source)+' '+source.name+'\n',encoding='ascii')
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)
+print(json.dumps(receipt,ensure_ascii=False),flush=True)
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 293f1f33..f0dc8670 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -17,6 +17,7 @@
#include "veyra/engine/LiveFgAdmission.h"
#include "veyra/engine/FgRecoveryBudget.h"
#include "veyra/engine/VfgQueueBudget.h"
+#include "veyra/engine/VfgOverloadEstimate.h"
#include "veyra/engine/LivePairLatency.h"
#include "veyra/engine/RealtimePreviewScheduling.h"
#include "veyra/engine/CaptureHalfRate.h"
@@ -908,6 +909,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
FgRecoveryBudget fgBudget;uint64_t fgBudgetRevision=options.settings.revision;
const bool vfgMeasuredReducedQueue=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_FULL_REDUCED_QUEUE_COST",nullptr,0)==0;
int64_t nextVfgQueueLog=0;
+ VfgOverloadEstimate vfgOverload;
+ const bool vfgRetainOverload=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_NO_OVERLOAD_ESTIMATE",nullptr,0)==0;
+ int64_t nextVfgOverloadLog=0;
unsigned previewFgMultiplier=options.fgMultiplier;
LivePairLatency pairLatency;
const bool adaptiveCapturePhase=physicalCapture&&GetEnvironmentVariableW(L"VEYRA_TEST_LEGACY_CAPTURE_PHASE",nullptr,0)==0;
@@ -924,7 +928,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
std::shared_ptr<FrameFlowWindow> flow;
Clock::time_point processStart;
int64_t predictedGpuStart100ns=0;
- std::optional<double> gpuExecutionMs,fgExecutionMs;
+ std::optional<double> gpuExecutionMs,fgExecutionMs,firstFgExecutionMs;
bool real=false;
std::atomic<bool> ready=false;
Clock::time_point readyObserved{};
@@ -973,6 +977,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(id.epoch==sample.identity.epoch&&id.settingsRevision==sample.identity.settingsRevision&&id.sourceFrameId==sample.identity.sourceFrameId){
if(const auto span=diagnostics::graphExecutionSpanMs(sample))watch->gpuExecutionMs=span;
if(fgCost.state==diagnostics::SampleState::Measured)watch->fgExecutionMs=fgCost.milliseconds;
+ const auto& first=sample.gpu[size_t(diagnostics::GpuStage::Fg1)];
+ if(first.state==diagnostics::SampleState::Measured)watch->firstFgExecutionMs=first.milliseconds;
}
}
const auto& blit=sample.gpu[size_t(diagnostics::GpuStage::Blit)];
@@ -1023,6 +1029,11 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// see FgRecoveryBudget::complete. Only a history reset or
// an FG recovery is a warmup sample.
if(batch.batch.identity.settingsRevision==fgBudgetRevision)fgBudget.complete(watch.gpuExecutionMs,batch.fgEvaluated>0,batch.historyReset||batch.fgRecovery,host100ns(),watch.fgExecutionMs,!batch.fgReduced);
+ if(options.settings.frameGenerationBackend==FrameGenerationBackend::Vfg&&batch.batch.identity.settingsRevision==fgBudgetRevision){
+ if(batch.historyReset)vfgOverload.reset();
+ if(!batch.historyReset&&!batch.fgRecovery&&!batch.fgReduced&&batch.fgEvaluated+1==options.fgMultiplier)
+ vfgOverload.observe(watch.fgExecutionMs,watch.firstFgExecutionMs,host100ns());
+ }
if(adaptiveCapturePhase&&watch.captureArrival>0&&valid==batch.fgCandidates&&
batch.hasGenerated&&!batch.historyReset&&!batch.fgRecovery&&
batch.batch.identity.settingsRevision==fgBudgetRevision&&watch.presentationGeneration==presentationGeneration.load()){
@@ -1734,7 +1745,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
nextFgAdmissionLog=now+10000000;if(!admitted)nextFgRejectionLog=now+10000000;
veyra::log::info("live-fg-admission",std::format("timeline={} revision={} source={} multiplier={} requestedMultiplier={} admitted={} admittedPairs={} rejectedPairs={} remainingDeadlineMs={:.3f} firstDeadlineMs={:.3f} queuedGpuMs={:.3f} predictedMs={:.3f} elapsedMs={:.3f} blitGpuP95Ms={:.3f} presentCpuP95Ms={:.3f} warmingHistory={} (CPU Present is backpressure, not added GPU cost; firstDeadlineMs=-1 when unused)",timeline,batch.identity.settingsRevision,batch.identity.sourceFrameId,previewFgMultiplier,options.fgMultiplier,admitted,fgAdmittedPairs,fgRejectedPairs,double(deadline-now)/10000,firstDeadline?double(firstDeadline-now)/10000:-1,queuedMs,fgBudget.predicted(now,warmingHistory).value_or(-1),elapsed,blit,livePresent.p95(),warmingHistory));
};
- if(fgBudgetRevision!=options.settings.revision){fgBudget.reset();pairLatency.reset();fgBudgetRevision=options.settings.revision;}
+ if(fgBudgetRevision!=options.settings.revision){fgBudget.reset();vfgOverload.reset();pairLatency.reset();fgBudgetRevision=options.settings.revision;}
previewFgMultiplier=options.fgMultiplier;
// An output cap used to only drop candidates at present time, so
// the GPU still generated frames that were thrown away: at 6X on
@@ -1824,7 +1835,25 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
const auto firstDeadline=now+int64_t((firstPts-media)/playbackRate),deadline=now+int64_t((lastGenerated-media)/playbackRate);
const auto first=frameFlow->snapshot(now).gpuTiming[size_t(diagnostics::GpuStage::Fg1)].p95;
const auto elapsed=elapsedMs(processStart),blit=livePresentGpu.p95();
- const auto admitted=fgBudget.admitFile(now,firstDeadline,deadline,int64_t(interval/playbackRate)/previewFgMultiplier,elapsed,blit,first,warmingHistory,queuedGpuMs,options.settings.fgStrictAdmission);
+ const auto outputInterval=int64_t(interval/playbackRate)/previewFgMultiplier;
+ bool retainedFits=true;
+ if(vfgRetainOverload&&options.settings.frameGenerationBackend==FrameGenerationBackend::Vfg&&!warmingHistory){
+ const auto base=fgBudget.baseCost(now),whole=fgBudget.predicted(now,false);
+ // Only replace the missing FG component; a fresh full
+ // sample still uses the original shared admission.
+ if(base&&whole&&*whole<=*base+0.000001){
+ const auto retained=vfgOverload.severeTotal(base,first,double(interval)/10000/playbackRate);
+ if(retained){
+ retainedFits=VfgOverloadEstimate::fits(*retained,*base,double(deadline-now)/10000,double(outputInterval)/10000,elapsed,queuedGpuMs,blit);
+ if(!retainedFits&&now>=nextVfgOverloadLog){nextVfgOverloadLog=now+10000000;
+ veyra::log::info("vfg-overload-budget",std::format("source={} requested={} fullCostExpired=1 retainedTotalEstimateMs={:.3f} currentFirstGpuP95Ms={:.3f} (retained estimate, not new GPU sample; deadlines unchanged)",batch.identity.sourceFrameId,options.fgMultiplier,*retained,*first));}
+ }
+ }
+ }
+ const auto originalAdmission=fgBudget.admitFile(now,firstDeadline,deadline,outputInterval,elapsed,blit,first,warmingHistory,queuedGpuMs,options.settings.fgStrictAdmission);
+ const bool overloadProbe=originalAdmission&&!retainedFits&&vfgOverload.allowProbe(now);
+ if(overloadProbe)veyra::log::info("vfg-overload-probe",std::format("source={} requested={} probeIntervalMs=30000 (one full group using original admission; no deadline extension)",batch.identity.sourceFrameId,options.fgMultiplier));
+ const auto admitted=originalAdmission&&(retainedFits||overloadProbe);
logAdmission(batch,now,deadline,elapsed,blit,admitted,warmingHistory,"file-audio",firstDeadline,queuedGpuMs);
if(admitted)return pipeline::EnhanceGraph::FgDecision::Evaluate;
// Over budget for the full group: emit a presentable 2X
diff --git a/tests/unit/VfgSettingsTests.cpp b/tests/unit/VfgSettingsTests.cpp
index e53b3f3b..b2d06c6b 100644
--- a/tests/unit/VfgSettingsTests.cpp
+++ b/tests/unit/VfgSettingsTests.cpp
@@ -1,6 +1,7 @@
#include "veyra/engine/PresetStore.h"
#include "veyra/engine/PresetLibrary.h"
#include "veyra/engine/VfgQueueBudget.h"
+#include "veyra/engine/VfgOverloadEstimate.h"
#include "veyra/pipeline/FrameBatch.h"
#include <filesystem>
#include <fstream>
@@ -21,6 +22,22 @@ int wmain(int argc,wchar_t** argv){
check(vfgQueuedGroupCost(38.,7.,12.,true,2,false)==38.,"unexpected multi-evaluation reduced group is not undercharged");
check(vfgQueuedGroupCost(38.,7.,std::numeric_limits<double>::quiet_NaN(),true,1,false)==38.&&vfgQueuedGroupCost(38.,7.,-1.,true,1,false)==38.,"invalid first timing cannot lower queue budget");
check(vfgQueuedGroupCost(15.,7.,12.,true,1,false)==15.,"reduced estimate never exceeds existing full cost");
+ VfgOverloadEstimate overload;
+ check(!overload.severeTotal(7.,20.,33.),"unknown full group is not invented");
+ check(!overload.allowProbe(300000000),"unknown work does not invent a probe");
+ overload.observe(114.,20.,0);
+ check(overload.severeTotal(7.,20.,33.)==121.,"expired severe cost remains an estimate instead of free work");
+ check(!overload.severeTotal(7.,15.,33.),"a meaningfully faster first interpolation reopens full probing");
+ check(overload.severeTotal(7.,25.,33.)==149.5,"slower current work cannot lower retained full estimate");
+ check(!overload.severeTotal({},20.,33.)&&!overload.severeTotal(7.,{},33.)&&!overload.severeTotal(7.,20.,0.),"missing measurements or cadence preserve legacy admission");
+ overload.observe(0.,0.,0);check(overload.severeTotal(7.,20.,33.)==121.,"invalid observation does not erase known severe work");
+ check(!overload.allowProbe(299999999)&&overload.allowProbe(300000000),"unchanged first cost still permits eventual full recovery probing");
+ check(!overload.allowProbe(300000000)&&!overload.allowProbe(599999999),"pending probes do not form a burst of full groups");
+ overload.observe(114.,20.,400000000);check(!overload.allowProbe(699999999)&&overload.allowProbe(700000000),"a fresh full measurement restarts the low-frequency probe interval");
+ overload.reset();check(!overload.severeTotal(7.,20.,33.),"source and revision reset discard retained relationship");
+ overload.observe(38.,20.,0);check(!overload.severeTotal(7.,20.,33.),"mildly overloaded 3X groups retain existing recovery");
+ check(VfgOverloadEstimate::fits(100.,7.,96.,4.,0.,0.,0.)&&!VfgOverloadEstimate::fits(100.,7.,95.9,4.,0.,0.,0.),"retained admission uses the original deadline and grace boundary");
+ check(!VfgOverloadEstimate::fits(121.,7.,113.,0.,1000.,0.,0.),"elapsed CPU time cannot erase unsubmitted interpolation cost");
check(!motionUsesFlow(MotionSource::OpticalFlow,FrameGenerationBackend::Vfg)&&
!motionUsesFlow(MotionSource::Automatic,FrameGenerationBackend::Vfg),"VFG uses its own motion even after a DLSS flow preset");
check(motionUsesFlow(MotionSource::OpticalFlow)&&motionUsesFlow(MotionSource::Automatic),"SR/NR external motion remains enabled");