Measure Windows submission costs and validate faster private K output stores

This commit is contained in:
Codex committed 2026-10-01 19:54:41 +03:00
1 parent d556747bad
commit 73ee2e5ecc
14 files changed
+453 -24

No files matched your search

+20 -5
View File
@@ -3,8 +3,8 @@
Validated hardware: Windows 11 x64 / Radeon RX 9070 XT / gfx1201. Native K and
M transformer kernels pass standalone D3D12 + OptiScaler checks. Silent Hill 2
K now renders real menu frames and M renders a saved gameplay level with
GPU NaN/Inf checks. Resolution coverage and performance are still being
validated. This is a local
GPU NaN/Inf checks. K also passes 3840x2160 output and M passes 1920x1080.
Further performance work is in progress. This is a local
development package; no NVIDIA proprietary DLL is included.
Build the shim/diagnostics, corrected ZLUDA, K/M native objects and patched
@@ -29,8 +29,10 @@ Use `-Preset 13` for M. The validated manifest requires DLSS 310.9.1 with the
recorded SHA256; other feature DLLs require regenerating and validating the
native manifest. Select an upscaler supported by OptiScaler in the game.
The script installs `dxgi.dll`, an explicit DLSS configuration and a private
`d4r` runtime directory, and captures stdout/stderr, an external debugger log,
crash dump, loaded DLL paths, driver information and OptiScaler logs. A local
`d4r` runtime directory, and captures stdout/stderr, exit code, loaded DLL paths,
driver information and OptiScaler logs. Ordinary runs use a process job without
an attached debugger. Add `-CaptureExceptions` to capture exception events and
minidumps when reproducing a crash. A local
ZIP bundle is printed at exit. `-RunSeconds 120` bounds a diagnostic run;
the normal default allows you to play until you close the game.
@@ -46,7 +48,11 @@ the GPU before returning it to D3D12. Only two diagnostic counters (8 bytes)
are read by the CPU; image data remains in VRAM. Validation failures are
reported explicitly. Disable this diagnostic when measuring production speed.
`-ProfileStages` records CPU completion time for seven interop/NGX stages.
`-ProfileStages` records CPU completion time for seven interop/NGX stages,
command-list split/replay, submitted state publication and suffix completion.
The recording interval measures NGX calls on the recording thread, not Present.
`-ProfileKernels` enables synchronizing HIP-event kernel profiling and changes
frame scheduling; use it separately from a production FPS measurement.
The runner drains stdout/stderr concurrently as raw bytes; the earlier
line-oriented PowerShell collector imposed large per-frame delays. The optional
ZLUDA kernel profiler is for diagnostics only. Measurements and reproduction
@@ -58,6 +64,15 @@ kernel launches remain logged. `-VerboseRuntime` enables all API and frontend
trace messages when investigating a failure. Numerical relaxation flags are
cleared in the child process; FP16 rounding and subnormals stay enabled.
The optional K output-store optimization is built locally from your NVIDIA DLL
with `build-native-texture.ps1` and checked by `test-native-texture.ps1`;
commands and measurements are in [windows-performance.md](windows-performance.md).
Add `-LocalTextureKernels "C:\Users\Administrator\d4r\build\private-textures-gfx1201"`
to the game command to install it. The object/manifest hashes and DLSS identity
must match validation. These generated objects contain NVIDIA code, remain
private, and are excluded from the distributable package. Ordinary launches
inherit the game's resolution/window settings; the default argument is `-dx12`.
Original files are backed up before replacement. Restore with:
```powershell
+65
View File
@@ -73,5 +73,70 @@ Native FP8 is not the validated baseline and has no performance claim here.
Replacing the exact per-MMA f16 rounding with f32 FP8 accumulation requires a
new layer/reference validation; it is not justified by the observed CPU stalls.
Further game coverage (HIP kernel profiling disabled, GPU output checks enabled):
M at 1920x1080 completes 4833 frames, all finite. K at 3840x2160 completes
4685 frames, all finite. Neither has a backend failure, CPU image copy or an
aged-frame fallback. Their mean interop/NGX CPU stages total about 13.6 and
10.1 ms respectively; these are different scenes, not a K/M comparison.
The no-debugger K/4K run completes 5774 frames, with 5774 finite output scans
and 63514 native transformer launches. The user reports 38-42 FPS. Additional
CPU measurements exclude replay/publication as the main cause of low FPS:
| CPU measurement | Mean, ms | Median, ms |
| --- | ---: | ---: |
| Command split setup | 0.284 | 0.275 |
| State replay within split setup | 0.025 | 0.023 |
| Submitted texture state publication | 0.029 | 0.029 |
| Consumer suffix completion | 0.405 | 0.409 |
| NGX recording interval | 27.474 | 28.466 |
Recording intervals are between NGX recording calls on the same thread, not
DXGI Present times. The interval includes rendering and application scheduling.
A second K/4K run with the attached debugger completes 3567 frames without
failure, with median recording interval 30.091 ms. The runs include different
menu/game states; this does not establish a precise debugger FPS speedup.
Its sparse debugger events also rule out a per-kernel OutputDebugString storm.
An earlier control that stayed on the startup screen completed zero DLSS frames
and is excluded. Normal game launches now omit the attached debugger; crash
diagnostics remain available with `-CaptureExceptions`.
The 2961-frame 4K K profile identifies the translated output tail as its largest
kernel: 4.401670 ms mean GPU time, versus about 2.875 ms for all eleven native
transformer layers combined. Ported upstream's texture-store recipe to native
Windows. It retains accuracy mode, wave32, FP16 subnormals and f16 reference
accumulation; native FP8 remains disabled.
Both output variants execute on every checked frame and match the previous
RGB output bit-exactly: eight consecutive 512x288 frames per variant, then
three consecutive 3840x2160 frames per variant. All RGBA components are finite.
Identical synthetic inputs and public NGX flags give these 4K event times
(three samples each; host initialization and readback are outside the event):
| K output variant | Translated mean, ms | Native stores mean, ms |
| --- | ---: | ---: |
| LDR, regular depth, high-resolution MV | 2.907823 | 1.803233 |
| HDR, inverted depth, low-resolution MV | 2.978547 | 2.088347 |
A subsequent game run executes 6221 frames with the native HDR output tail,
zero backend failures and mean tail GPU time 1.801918 ms. The earlier game
profile's 4.401670 ms is from a different scene/scheduling state; use the
identical-input table for the controlled comparison, not an inferred FPS
multiplier. This profiled game run did not enable the NaN scan.
Reproduce the private texture build and full-frame comparisons:
```powershell
.\scripts\windows\build-native-texture.ps1 -DlssDll "$PWD\nvngx_dlss.dll"
.\scripts\windows\build-native-texture.ps1 -DlssDll "$PWD\nvngx_dlss.dll" -Kernel hiluma_engine_output_depthreg_mvhi_ldr_max_v2_rel
.\scripts\windows\test-native-texture.ps1 -OutputResolution 3840x2160 -Iterations 3
```
These objects contain code derived from the locally supplied NVIDIA PTX. They
stay in ignored local directories and are excluded from the public package.
The installer accepts them with `-LocalTextureKernels` only after validation,
checking the exact DLL identity, object and manifest hashes. M retains its
independently validated FP16-equivalent baseline.
References: [HIP events](https://rocmdocs.amd.com/projects/HIP/en/develop/doxygen/html/group___event.html),
[HIP occupancy API](https://rocm.docs.amd.com/projects/HIP/en/latest/doxygen/html/group___occupancy.html).
+46 -1
View File
@@ -9,6 +9,51 @@ validation coverage are recorded below. Performance remains in progress.
## Milestone and gates
Upstream refreshed and merged on 2026-10-01 through
[`f0d1a65`](https://github.com/countervolts/d4r/commit/f0d1a65e27aff6cbe7eeaa13227c80facb9056ab)
and artifact fix `65dfc9f`. Windows retains strict f16 rounding and the exact
M attention baseline. Upstream's optional denormal override now drops only
FP32 requirements, preserving FP16/FP64. All sixteen rebuilt native K/M
objects have the same SHA256 as the previously validated objects. All thirteen
ZLUDA patches apply to the pinned fresh base; all sixteen CTest gates pass.
The local ZLUDA source includes that denormal correction at `2378af7`; the
measured runtime remains the separately recorded `b0161a4` binary, with the
override unset. Package metadata records the binary build's actual commit.
Additional production-style runs: M at 1920x1080 completes 4833 frames with
4833 finite-output GPU scans and no backend failures. K at 3840x2160 completes
4685 frames, 51535 native launches and 4685 finite-output GPU scans. Both use
current-frame VRAM interop, no CPU image copy and no previous-frame fallback.
The user confirms visible imagery at 4K but reports low FPS and about 25% GPU
usage. This percentage is not an isolated DLSS/WMMA hardware measurement.
The game runner now launches without an attached debugger by default, while
retaining a kill-on-close process job, raw stdout/stderr, exit code, loaded
module inventory and frontend/driver logs. `-CaptureExceptions` enables the
original attached debugger and minidumps. A K/4K run without it completes
5774 frames / 63514 native launches / 5774 finite-output scans, zero failures.
The user reports 38-42 FPS. Recording/replay measurements: average split setup
0.284 ms, replay 0.025 ms, submitted texture-state publication 0.029 ms,
suffix completion 0.405 ms. These do not explain tens of milliseconds of
missing performance. NGX recording intervals average 27.474 ms, median
28.466 ms; they are not a DXGI Present measurement. The first debugger control
never left the startup screen and is explicitly not a valid FPS comparison.
K output bottleneck: the 2961-frame 4K profile measures its translated output
tail at 4.401670 ms, larger than all eleven native transformer layers combined.
The Windows texture build preserves upstream Accuracy mode and creates private
NVIDIA-derived output objects. Both LDR and the game's HDR/inverted-depth/low-MV
variants pass strict full-frame comparisons: eight 512x288 frames each, then
three 3840x2160 frames each, max absolute/relative RGB error 0 and all RGBA
components finite. Controlled 4K tail GPU means: LDR 2.907823 -> 1.803233 ms;
HDR 2.978547 -> 2.088347 ms. The 6221-frame game profile executes the native tail
every frame, with zero backend failures and mean tail time 1.801918 ms. Scene
differences preclude an exact game FPS speedup claim. `-LocalTextureKernels`
requires matching source DLL, object and manifest hashes after validation;
public ZIPs exclude these objects. Install/restore with private overrides
restores sentinel DLL/config byte-exactly, without duplicate slash/backslash
manifest paths.
Performance diagnostics (2026-10-01): the separate ZLUDA `b0161a4` runtime
passes 32 PTX launches in each context and all four native K/M frames with
bit-exact RGB against their controls. All thirteen exported patches (0002
@@ -141,7 +186,7 @@ Do not integrate NGX until the integer PTX workload is stable on the real GPU.
| M6: K layers, full transformer and image validation | PASS: 11 real-weight layers, 44 native launches, four D3D12 frames bit-exact against native CUDA, 81.85–92.91 dB versus translated K |
| M7: M FP16-equivalent baseline and full transformer | PASS: all blocks of 40 native launches exactly match NumPy; targeted independent PTX regression matches; four D3D12 frames bit-exact against corrected translated M |
| M8: standalone Windows D3D12 NGX harness | PASS for ordinary recorded EvaluateFeature and explicit boundaries: K/M, four frames each, no shim CPU image copies; both bit-exact against explicit boundary baselines |
| M9: OptiScaler integration, profiling, installation | Patched frontend K/M PASS; K game menu and M saved level PASS; profiling and final package pending |
| M9: OptiScaler integration, profiling, installation | Patched frontend and game K/M PASS, including K 4K and M 1080p finite output; native/translated GPU profiling and reversible install PASS; remaining FPS investigation and final archive in progress |
## Public NGX identity and OptiScaler gate (2026-10-01)