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: record dynamic NR output differences and add concurrent creation experiment
Veyra Goal Agent5fb12fdaa400
diff --git a/CMakeLists.txt b/CMakeLists.txtindex b5c1eb2c..d740bafe 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1005,6 +1005,10 @@ add_executable(veyra_sr_reconstruction_tests tests/integration/SrReconstructionTtarget_compile_features(veyra_nr_dynamic_size_experiment PRIVATE cxx_std_20)target_compile_options(veyra_nr_dynamic_size_experiment PRIVATE /utf-8)target_link_libraries(veyra_nr_dynamic_size_experiment PRIVATE veyra_ngx)+ add_executable(veyra_nr_concurrent_create_experiment tests/perf/NrConcurrentCreateExperiment.cpp)+ target_compile_features(veyra_nr_concurrent_create_experiment PRIVATE cxx_std_20)+ target_compile_options(veyra_nr_concurrent_create_experiment PRIVATE /utf-8)+ target_link_libraries(veyra_nr_concurrent_create_experiment PRIVATE veyra_ngx)target_compile_features(veyra_nr_temporal_gpu_tests PRIVATE cxx_std_20)target_link_libraries(veyra_nr_temporal_gpu_tests PRIVATE veyra_pipeline)add_executable(veyra_gpu_timing_tests tests/integration/GpuTimingTests.cpp)diff --git a/docs/PERF_E1_DYNAMIC_SIZE_2026-10-04.md b/docs/PERF_E1_DYNAMIC_SIZE_2026-10-04.mdnew file mode 100644index 00000000..029b1545--- /dev/null+++ b/docs/PERF_E1_DYNAMIC_SIZE_2026-10-04.md@@ -0,0 +1,38 @@+# E1 Feature18 动态输入尺寸实验++## 实测结论与实现决定++本机RTX5070/616.56上,NVIDIA原版310.8.0.0与Lecram310.8.3.0都接受最大1920×1080创建后更小的Evaluate子区域。85/70/55/40%尺寸均实际写出图像,区域外写入0、D3D12 debugErrors0、GetDeviceRemovedReason=S_OK,恢复1920×1080后与独立原生尺寸实例输出相同。++**但缩小后并不与按相同小尺寸Create的实例像素等价。** 两个运行库、四种组合结果一致;修改Create尺寸参数字段也不能消除差异。3b优先使用按实际尺寸创建的有界实例,而不把最大实例动态子区域当作现有固定尺寸档位的等价替代。这个选择保证后续可以对照现有尺寸合同;E1仅证明本机接口/资源行为,未证明自然素材/HDR/其他GPU的动态画质或长稳。++## 试验设计++测试程序`tests/perf/NrDynamicSizeExperiment.cpp`仅调用产品NgxCoreHost、DlssNrRuntimeAdapter和类型化参数定义;没有修改运行库。作者生成RGB渐变/棋盘RGBA8代理输入,零运动/深度,输出先写哨兵色。每档5次Evaluate、切档Reset;尺寸顺序1920→1632→1344→1056→768→1920,16:9高度取偶数。每档独立创建同尺寸参照、相同输入/参数/5次Evaluate。++四组合:只改subrect/同时改尺寸字段 × 最大尺寸纹理/实际尺寸纹理。两个运行库共8个独立进程;每个≤180s。最大尺寸起点及恢复两处不同字节0,为参照确定性检验。精确参照验收失败的进程保留exit1,**不把这些日志改成PASS**。++每组像素读取/CPU fence等待只存在于本测试程序,不是产品播放性能。v1先查返回值/像素,v2补充Evaluate本身前后GPU timestamp;v2每档仅报告最后一次Evaluate诊断样本,不当稳态P95或正式收益。++## 观测++| 输入维度 | 子区域尺寸 | 与同尺寸独立实例不同字节数 | RGBA平均绝对差(0–255) | 子区域外写入 |+|---|---|---:|---:|---:|+| 100% | 1920×1080 | 0 | 0 | 0 |+| 85% | 1632×918 | 2,057,215 | 0.388186 | 0 |+| 70% | 1344×756 | 1,406,047 | 0.397265 | 0 |+| 55% | 1056×594 | 879,524 | 0.398506 | 0 |+| 40% | 768×432 | 446,270 | 0.376668 | 0 |+| 恢复100% | 1920×1080 | 0 | 0 | 0 |++Lecram subrect/full的v2 GPU诊断样本:100%6.31024ms、85%5.09088、70%3.75014、55%3.17386、40%2.43677、恢复100%6.11018;小尺寸独立实例分别5.89414/4.79578/3.46461/3.03728/2.76026/6.05152。其他组合原始值在CSV。频率自动变化、样本短,不用这些数计算发布性能百分比。++## 身份、命令和证据++- Lecram SHA256 `F95FEB54137EA11979F9B4EC4F00AFD84B5C98A5624D3388FBF6A87714A39FCC`,现有已授权社区原字节。+- 原版 SHA256 `E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E`。+- `nr-build.py E1 build-E1-v1/v2/v3 veyra_nr_dynamic_size_experiment` 均exit0;v2加拒绝录制discard,v3加GPU timestamp,不是修饰模型输出。+- `nr-e1.py E1-v1`及`E1-v2`顺序完成,两个summary JSON在`E:/项目/Veyra/logs/perf-nr-20261004/`。+- 各`E1-v2-{Lecram|original}-{subrect|dimensions}-{full|small}`目录含原始console/engine/observations.csv/result.json及逐档dynamic/reference RGBA。EXE SHA/命令/运行库身份由driver记录。++未测低于768×432、4K/8K/HDR与其他显卡。不能由“40%成功”外推任何小源的40%都安全,也不能由debugErrors0宣称画质通过。diff --git a/docs/PERF_EXECUTION_NR_2026-10-04.md b/docs/PERF_EXECUTION_NR_2026-10-04.mdindex 464bb3bd..be33a06b 100644--- a/docs/PERF_EXECUTION_NR_2026-10-04.md+++ b/docs/PERF_EXECUTION_NR_2026-10-04.md@@ -25,7 +25,7 @@|---|---|---|---|| D0 | 项目文档对齐与存档 | accepted | 37bc0c0 / initial-docs完整bundle verify,桌面/main保持 || A0 | 当前版本基线及矩阵驱动 | in-progress | A完整包封存;M1五组各三轮15/15通过,PERF_BASELINE_NR;其余素材/切换基线在各节点前补齐 |-| E1 | Feature18动态输入尺寸 | pending | 原版/Lecram分别测返回值、画面、历史 |+| E1 | Feature18动态输入尺寸 | completed-conditional | 两运行库8组合API/区域/恢复正常,但缩小后与独立小实例不同;PERF_E1_DYNAMIC_SIZE,3b优先实际尺寸实例 || E2 | 并行Evaluate/CreateFeature | pending | 独立command list、压力/反复切换 || E3 | 真实来源精确重复比例 | pending | 屏幕/实卡可用性与合成节奏分开 || 1a | 精确重复帧整链复用 | pending | 先验证时域模型重复Evaluate结果是否相同 |diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 94cf6ebb..ed24abed 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,12 @@# Veyra 工作记录+## 2026-10-04 NR优化:M1基线封存及E1实验结论++- M1五组各三轮共15/15实际产品PASS,nr-series.py A退出0;处理耗时三轮中位S1 7.7145ms、S2-720 4.6975、S3 NR+DLSS4K 11.3565、S4两NR+DLSS4K+FG2X 21.192、S5已有480/720/原生三层14.372。S5范围13.59–14.377,保留波动;这不是新优化。驱动616.56、NRLecram F95FEB原字节、EXE b7081f…0eb4。统计为滚动观测的三轮中位/范围,非总体P95,未测实屏。+- nr-baseline-report.py exit0,完整A封存于test-packages/perf-nr-20261004/Veyra-2.0.3-perf-baseline-A-NVIDIA-win64-portable,1542载荷/QML逐文件匹配8cdc/无测试Loader;manifest与baseline-M1-summary.json含逐SHA。A0baseline标签eb47ed6/增量bundle验证;其余素材/切换暂停基线仍待补齐。+- E1 before/candidate-v2/timing各存档,独立实验build-E1-v1/v2/v3均exit0。nr-e1.py E1-v1、E1-v2各8进程顺序完成;原版E16BCF与Lecram F95FEB,最大1920×1080实例Evaluate 85/70/55/40%:接口成功/全部活跃像素写出/区域外写入0/debug0/设备正常,回100%像素与独立实例相同。缩小后MAE0.376668–0.398506(0–255)且不同约45%RGBA字节,8组合相同,精确参照失败的exit1如实保留。v2 GPUtimestamp实际随尺寸降低,但短样本不当稳态收益。+- 结论PERF_E1_DYNAMIC_SIZE_2026-10-04.md:单实例子区域可用≠现有小尺寸档位像素等价,3b优先实际尺寸创建的有界实例;未经4K/HDR/自然素材/其他GPU验收不外推。无产品路径改动,所有像素读回/同步仅实验。接续E2并发Create/Evaluate,独立fence/ring避免共享timeline重号。+## 2026-10-04 NR优化1c:盲预测重复帧拒绝存档- 节点before标签checkpoint/perf-nr-1c-before-20261004,产品源码仍8cdc。`py -3.11 -B tests/perf/CadencePredictionCounterexample.py E:/项目/Veyra/logs/perf-nr-20261004/1c-counterexample-v1/result.json` exit0:准确已知30-in-60/24-in-60整帧2:3/40-in-120节奏,第49未抽查的重复位只改一个像素,候选三组都替换错这一帧,后续检测错误0;精确比较输出均0不同帧。diff --git a/tests/perf/NrConcurrentCreateExperiment.cpp b/tests/perf/NrConcurrentCreateExperiment.cppnew file mode 100644index 00000000..c757660e--- /dev/null+++ b/tests/perf/NrConcurrentCreateExperiment.cpp@@ -0,0 +1,90 @@+#include "NrExperimentalFixture.h"+#include "veyra/Log.h"+#include <atomic>+#include <thread>+#include <dxgi1_4.h>+#include <d3d12sdklayers.h>++// E2. Foreground Feature18 Evaluate and background independent Feature18+// Create/Evaluate/Release share one device, one queue and one snippet session.+// Each command ring owns a separate fence/event and allocator/list set.+// CLI: runtime-dir output-dir duration-seconds create-count concurrent|serial+int wmain(int argc,wchar_t** argv) {+ using namespace nrperf;+ if(argc!=6)return 2;+ const unsigned seconds=unsigned(_wtoi(argv[3])),count=unsigned(_wtoi(argv[4]));+ const bool concurrent=std::wstring_view(argv[5])==L"concurrent";+ if(!seconds||seconds>240||!count||count>50)return 2;+ const std::filesystem::path out=argv[2];std::filesystem::create_directories(out);+ Logger::instance().openFile((out/L"engine.log").wstring());+ Session s;if(!s.init(argv[1]))return 2;+ ComPtr<IDXGIFactory4> factory;ComPtr<IDXGIAdapter3> adapter;+ if(!hrOK(CreateDXGIFactory1(IID_PPV_ARGS(&factory)),"DXGI.Factory")||+ !hrOK(factory->EnumAdapterByLuid(s.device.device()->GetAdapterLuid(),IID_PPV_ARGS(&adapter)),"DXGI.Adapter"))return 2;+ auto usage=[&](){DXGI_QUERY_VIDEO_MEMORY_INFO info{};return hrOK(adapter->QueryVideoMemoryInfo(0,DXGI_MEMORY_SEGMENT_GROUP_LOCAL,&info),"DXGI.Memory")?info.CurrentUsage:UINT64_MAX;};+ const auto before=usage();std::atomic<bool> failed=false;+ unsigned created=0,released=0,evaluated=0,foregroundEvaluated=0;+ double maxForegroundGap=0;uint64_t after=0;+ std::ofstream csv(out/L"background.csv");csv<<"cycle,w,h,createMs,evaluateOK,releaseOK,vramLive,vramReleased\n";+ {+ Feature foreground(s),background(s); // Parameter tracking is mutated only on this thread.+ if(!foreground.create(s.ring,1920,1080)||!foreground.textures(s.ring,1920,1080,1920,1080))return 2;+ for(unsigned i=0;i<30;++i)if(!foreground.evaluate(s.ring,1920,1080,i==0))return 2;+ const auto reference=foreground.read(s.ring);+ ComPtr<ID3D12Fence> fence;+ if(!hrOK(s.device.device()->CreateFence(0,D3D12_FENCE_FLAG_NONE,IID_PPV_ARGS(&fence)),"Background.Fence"))return 2;+ HANDLE event=CreateEventW(nullptr,FALSE,FALSE,nullptr);if(!event)return 2;+ gfx::CommandSlotRing backgroundRing;Status status;+ if(!backgroundRing.initialize(s.device.device(),s.device.directQueue(),fence.Get(),event,4,status)){CloseHandle(event);return 2;}+ const double start=nowMs();+ auto worker=[&](){+ for(unsigned i=0;i<count&&!failed.load();++i){+ const auto due=start+double(i)*double(seconds)*1000.0/count;+ if(concurrent)std::this_thread::sleep_until(std::chrono::steady_clock::time_point(std::chrono::duration_cast<std::chrono::steady_clock::duration>(std::chrono::duration<double,std::milli>(due))));+ if(failed.load())break;+ const unsigned widths[]={1280,1920,960};const auto w=widths[i%3],h=(w*9/16)&~1u;+ const auto at=nowMs();const bool ok=background.create(backgroundRing,w,h);const auto ms=nowMs()-at;+ if(!ok){failed=true;break;}++created;+ const bool textures=background.textures(backgroundRing,w,h,w,h);+ const bool run=textures&&background.evaluate(backgroundRing,w,h,true);+ evaluated+=run;const auto live=usage();const bool release=background.release();released+=release;+ // Release probe-owned textures after completed work too.+ background.color.Reset();background.output.Reset();background.motion.Reset();background.depth.Reset();+ const auto freed=usage();csv<<i<<','<<w<<','<<h<<','<<ms<<','<<run<<','<<release<<','<<live<<','<<freed<<'\n';csv.flush();+ if(!run||!release){failed=true;break;}+ }+ };+ std::thread thread;+ if(concurrent)thread=std::thread(worker);else worker();+ auto next=nowMs(),previous=next;+ while(!failed.load()&&nowMs()-start<double(seconds)*1000.0){+ if(!foreground.evaluate(s.ring,1920,1080,false)){failed=true;break;}+ ++foregroundEvaluated;const auto current=nowMs();maxForegroundGap=std::max(maxForegroundGap,current-previous);previous=current;+ next+=1000.0/60.0;+ if(next>nowMs())std::this_thread::sleep_for(std::chrono::duration<double,std::milli>(next-nowMs()));+ else next=nowMs();+ }+ if(thread.joinable())thread.join();+ const auto actual=foreground.read(s.ring);+ // Static input history is warmed for 30 frames before the worker.+ // Save actual and reference pixels even if the model keeps changing.+ for(const auto& pair:{std::pair{L"foreground-before.rgba",&reference},std::pair{L"foreground-after.rgba",&actual}}){+ std::ofstream f(out/pair.first,std::ios::binary);f.write(reinterpret_cast<const char*>(pair.second->data()),std::streamsize(pair.second->size()));}+ uint64_t different=0;for(size_t i=0;i<std::min(reference.size(),actual.size());++i)different+=reference[i]!=actual[i];+ std::printf("PIXELS sameSize=%d differentBytes=%llu referenceBytes=%zu\n",reference.size()==actual.size(),different,reference.size());+ if(!foreground.release()||!background.release())failed=true;+ backgroundRing.drainQueue();backgroundRing.shutdown();CloseHandle(event);+ }+ s.ring.drainQueue();after=usage();+ ComPtr<ID3D12InfoQueue> debug;unsigned errors=0;+ if(!hrOK(s.device.device()->QueryInterface(IID_PPV_ARGS(&debug)),"Debug.Query"))return 2;+ for(UINT64 i=0;i<debug->GetNumStoredMessages();++i){SIZE_T n=0;debug->GetMessage(i,nullptr,&n);+ std::vector<uint8_t> data(n);auto* m=reinterpret_cast<D3D12_MESSAGE*>(data.data());+ if(!hrOK(debug->GetMessage(i,m,&n),"Debug.Read"))return 2;+ if(m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;std::printf("DEBUG_ERROR %s\n",m->pDescription);}}+ const HRESULT removed=s.device.device()->GetDeviceRemovedReason();+ const bool pass=!failed&&created==count&&released==count&&evaluated==count&&foregroundEvaluated>0&&errors==0&&SUCCEEDED(removed);+ std::printf("RESULT pass=%d requested=%u created=%u released=%u backgroundEvaluated=%u foregroundEvaluated=%u seconds=%u concurrent=%d maxForegroundGapMs=%.6f vramBefore=%llu vramAfter=%llu debugErrors=%u deviceRemoved=0x%08X\n",+ pass,count,created,released,evaluated,foregroundEvaluated,seconds,concurrent,maxForegroundGap,before,after,errors,unsigned(removed));+ return pass?0:1;+}