Validate Windows native M FP8 and reduce operand packing cost

This commit is contained in:
Codex committed 2026-10-01 21:16:28 +03:00
1 parent 74aad12938
commit 0c18df6253
20 files changed
+486 -33

No files matched your search

+9 -3
View File
@@ -3,21 +3,27 @@
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. K also passes 3840x2160 output and M passes 1920x1080.
Further performance work is in progress. This is a local
GPU NaN/Inf checks. Both K and M pass 3840x2160 output on this machine.
The user reports 49-51 FPS for K in the measured scene after the command-hook
fix and locally built output-store optimization. This is a local
development package; no NVIDIA proprietary DLL is included.
Build the shim/diagnostics, corrected ZLUDA, K/M native objects and patched
OptiScaler using the scripts in `scripts/windows`, then run:
```powershell
.\scripts\windows\package-windows-game.ps1
.\scripts\windows\package-windows-game.ps1 -ArchivePath "$PWD\dist\windows-rdna4-game.zip"
```
The package pins TheRock 10.2.0a20260929 because its Windows external-memory
mapping lifetime passes the repeated import/release test. Stable HIP 7.2 has
a reproduced mapped-view leak; see `docs/windows-rdna4-port.md` for the source
fix, exact dependency versions, validation and complete build commands.
The ZIP contains only manifest-listed files, including a snapshot of committed
d4r source. Private NVIDIA-derived objects, caches and diagnostic captures are
excluded. Original FP8 M and the optional hardware-packing variant pass strict
replay/network tests but do not establish a full-network speedup, so the game
package retains its FP16-equivalent M baseline.
Run a D3D12 game without anti-cheat using your locally supplied NVIDIA DLLs:
+55 -3
View File
@@ -69,9 +69,8 @@ memory, LDS and predicted blocks per multiprocessor. Add
`--metadata-directory <directory-of-llvm-readobj-notes>` for native wave sizes
and compiler spill counts. Reports and proprietary workload inputs remain local.
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.
Native FP8 remains a separate optional experiment; the package uses the
validated FP16-equivalent baseline. Its later checks and timings are below.
Further game coverage (HIP kernel profiling disabled, GPU output checks enabled):
M at 1920x1080 completes 4833 frames, all finite. K at 3840x2160 completes
@@ -172,5 +171,58 @@ each physical command-backend test and the software indirect-root regression.
Use `-ProfileCommandHooks -ProfileStages` to collect samples; the sampler is
disabled for ordinary play.
Native M FP8 was subsequently compiled and tested on this gfx1201. ISA confirms
`v_wmma_f32_16x16x16_fp8_fp8`, with packed e4m3 weight images; exact FP16
attention/PV remains. All logical outputs and merges in forty recorded launches
match the previously NumPy-validated FP16 baseline byte-for-byte. Full DLSS RGB
also matches exactly: four 512x288 LDR frames and four 3840x2160 HDR frames,
all RGBA finite. This establishes correctness for those fixtures, not a speedup.
The original software operand packing makes the FP8 network slower in the
four-frame 4K test: sum of five main-kernel event means (tube weighted six times)
is 27.789640 ms versus FP16's 23.550875 ms. A paired in-process replay confirms
the regression without relying solely on separate process timings. Both modules
and prepared weights remain resident, 512 launches warm the GPU, then sixty-four
AB/BA pairs time the same restored input using HIP events. Diagnostic CPU input
restoration is outside the timed event and is unrelated to game VRAM interop.
Added opt-in `D4R_FP8_HW_PACK`: native packed conversion of already quantised
operands replaces software exponent/subnormal reconstruction. It preserves all
254 finite OCP e4m3 encodings, including signed zero, in an exhaustive GPU check.
All forty recorded launches still match exactly. Four complete 4K HDR frames
also match FP16 RGB exactly with finite RGBA. ISA confirms both packed converts
and FP8 WMMA. The baseline build's sixteen objects remain byte-identical.
| Paired replay median, ms | FP16 (software-packing test) | FP8 software packing | FP16 (hardware-packing test) | FP8 hardware packing |
| --- | ---: | ---: | ---: | ---: |
| enc1 | 0.175450 | 0.217050 | 0.175100 | 0.177700 |
| enc2 | 0.141350 | 0.164550 | 0.132550 | 0.131550 |
| enc3 tube | 0.108000 | 0.112000 | 0.107600 | 0.099850 |
| dec2 | 0.129900 | 0.146000 | 0.143250 | 0.140850 |
| dec1 | 0.169650 | 0.194450 | 0.154250 | 0.156550 |
These are two paired tests on the captured 512x288 workload. Medians avoid large
isolated scheduling outliers; raw per-pair ratios are retained. They identify a
substantial cost in software packing but do not establish an overall FPS gain.
The separately run four-frame 4K hardware-packing network mean is 24.603463 ms;
it still does not beat the measured FP16 total. Default packaging retains FP16.
Hardware counters for bandwidth or WMMA utilization were not measured.
Reproduce the isolated build, encoding/replay checks and paired timings using
the existing private validated captures; no source editing is required:
```powershell
.\scripts\windows\build-native-m-fp8.ps1 -DlssDll "$PWD\nvngx_dlss.dll" -HardwarePacking
.\scripts\windows\test-native-m-fp8.ps1 -ModuleDirectory "$PWD\build\native-m-fp8-hardware-pack" -CaptureDirectory "$PWD\test-results\ngx-m-exact-pv-capture\captures" -BaselineValidation "$PWD\test-results\m-native-exact-pv-temporal-reference\summary.json" -Benchmark
```
Omit `-HardwarePacking` to compile the original FP8 experiment. The replay
validator stops at the first mismatch, retains GPU stdout/stderr/exit code and
hashes every compared logical output. `profile_report.py` accepts replay logs
and reports per-pair GPU time and candidate/control ratios. This experiment is
not installed by the game runner or substituted silently for the baseline.
The conversion builtin is listed in the official
[Clang AMDGPU builtin reference](https://clang.llvm.org/docs/AMDGPUBuiltinReference.html#builtin-amdgcn-cvt-pk-fp8-f32).
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).
+47 -8
View File
@@ -2,10 +2,11 @@
Branch: `windows-rdna4`. Target: Windows 11 x64, RX 9070 XT, **gfx1201**.
Priority: correct K, correct M, native Windows, same-frame output, then speed.
This is a work log for an implementation in progress. Standalone DLSS K/M
This file records current results followed by the dated development history. Standalone DLSS K/M
works on the real Windows GPU, including the patched OptiScaler frontend.
Silent Hill 2 now renders through the Windows backend; gameplay and output
validation coverage are recorded below. Performance remains in progress.
validation coverage are recorded below. Performance and game coverage have
explicit limits; the validated package keeps conservative arithmetic.
## Milestone and gates
@@ -16,9 +17,44 @@ 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.
Final ZLUDA source and binary are `2378af72e586e1730d15f75e0322daab674f0862`,
built cleanly into `dist/zluda-windows-final`; nvcuda SHA256 is
`ccc700974fa5d0b9a5f5c39e617c17ca22f34701d40f745f2f96f039a75b22f8`.
All sixteen CTest gates pass on it. Three K/4K HDR frames and four M baseline
frames remain bit-exact to their prior controls, all RGBA finite. Historical
performance runs below used `b0161a4` with the denormal override unset.
Package metadata records the binary build's actual commit.
The final-runtime M game test completes 1940 4K frames and 1940 finite GPU
scans, with 19410 native launches (including a partial final frame), zero
backend failures/CPU image copies/previous-frame outputs. Native M FP8 also
passes all logical output/merge values from forty NumPy-validated captures,
plus four 512x288 and four 4K complete frames. Its original software packing
regresses performance; the opt-in hardware packing preserves all 254 finite
FP8 encodings and all forty captures, with exact RGB in four additional 4K
frames. Paired in-process event tests confirm reduced packing cost, but the
full-network measurement does not establish a win over FP16. Production keeps
the baseline. See [windows-performance.md](windows-performance.md) for timings
and one-command replay/paired profiling.
Current native Windows build, after the pinned tool/source setup described
below (MSVC v143 / Windows SDK 10.0.26100 required for OptiScaler):
```powershell
.\scripts\windows\build-zluda-windows.ps1
.\scripts\windows\build-windows-rdna4.ps1 -RuntimeProfile therock -ZludaRoot "$PWD\dist\zluda-windows-final" -InstallDirectory "$PWD\dist\windows-rdna4-command-list"
.\scripts\windows\stage-native-k.ps1 -DlssDll "$PWD\nvngx_dlss.dll" -PackageRoot "$PWD\dist\windows-rdna4-command-list"
.\scripts\windows\stage-native-m.ps1 -DlssDll "$PWD\nvngx_dlss.dll" -PackageRoot "$PWD\dist\windows-rdna4-command-list"
.\scripts\windows\build-optiscaler-windows.ps1
& .\.tools\python\cmake\data\bin\ctest.exe --test-dir build/windows-rdna4-therock --output-on-failure
.\scripts\windows\package-windows-game.ps1 -ArchivePath "$PWD\dist\windows-rdna4-game.zip"
```
The archive requires committed source. It includes a tracked-source snapshot,
all runtime file hashes/versions, dependency licenses and source patches, and
excludes local NVIDIA DLLs, PTX/weights/captures and private texture objects.
The optional texture optimization is built/validated locally and supplied with
`-LocalTextureKernels`; it is never folded into the public source snapshot.
Additional production-style runs: M at 1920x1080 completes 4833 frames with
4833 finite-output GPU scans and no backend failures. K at 3840x2160 completes
@@ -178,14 +214,17 @@ with `-EarlyIndirectProbe` in the standalone OptiScaler runner. This avoids
the previously documented unknown-signature rejection for observed startup
objects; signatures created before the frontend is loaded remain untracked.
Current milestone: M1/M2/M4/M5 passed; native NGX Create/Evaluate on the simple
Current milestone: M0-M9 functional gates pass on the tested Windows GPU/game.
The package uses FP16-equivalent K/M and conservative denormal handling.
Native NGX Create/Evaluate on the simple
requested E path passes with the user's DLLs. All 11 K layers now pass synthetic
and real-weight NumPy/PTX replay checks; native K Evaluate produces four finite
frames on Windows. M now passes all five synthetic and real-weight layers against
NumPy and independent PTX, and four native CUDA frames. The standalone D3D12
harness now produces four K and four M frames using imported VRAM and shared
fences, with bit-exact RGB agreement against the corresponding CUDA harnesses.
Game integration remains in progress. The ordinary NGX D3D12 Evaluate API now
Silent Hill 2 K/M integration passes, including current-frame 4K VRAM interop.
The ordinary NGX D3D12 Evaluate API now
records a boundary in an open command list; a native queue interception backend
executes prefix, CUDA evaluation, then suffix in the same submitted frame.
A full temporal M scan
@@ -207,7 +246,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 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 |
| M9: OptiScaler integration, profiling, installation | Patched frontend and game K/M PASS at 4K with finite output; native/translated/FP8 profiling, reversible install and manifest-only public archive PASS; K user reports 49-51 FPS |
## Public NGX identity and OptiScaler gate (2026-10-01)