engine: Super Resolution presets E and F, the DLSS 3 CNN, on RDNA2
Presets E (5) and F (6) run on d4r's own Vulkan engine without cooperative matrices: the input and reconstruction kernels translated from the user's DLL (engine/compile_sr_e.py, rr/ptx2rr.py), the network engine/sr/e_net.comp with packed v_pk_fma_f16 accumulation (engine/cnn_sr/mma_f16.glsl, the default head; --head-accumulation f32 keeps the f32 head). Runtime runtime_e.inc (EModel/EEngine), game adapter game_e.cpp, replay d4r-e; the shim serves them from engine\e and engine\f (D4R_ENGINE_MODEL_E_DIR / _F_DIR), LDR or HDR, any render size, not with AutoExposure. build-engine-models.sh builds both. Translator fixes that apply to every translated kernel: .relu on f16/f16x2 fma/add/mul was ignored; add.rz was always taken for the roundf idiom (lost the log1pf correction term); formatted image stores expand at the call site (SPIR-V image type fix); f16 mma.sync m16n8k8/k16, .const loads, shared 16-bit stores, aligned 32-bit arena words (D4R_WORD_ARENA), unified arena. Steam Deck gfx1033: 2.55 ms at 640x360 -> 1280x720, 6.20 ms at 1080p output; Rounded Quality sizes take mid_3x3 (reconstruction 2.44 -> 1.23 ms). Ray Reconstruction CNN presets A-C (compile_rr3.py, the packed RR flavor) stay out of this commit; engine/README.md already documents their tuning.
This commit is contained in:
1 parent
0e851b7f90
commit
b9254f7f96
25 files changed
+2406
-36
No files matched your search
@@ -4,9 +4,8 @@
|
||||
#
|
||||
# usage: bash d4r/tools/build-engine-models.sh [--rr-only | --sr-only] [--exact] [D4R_FOLDER]
|
||||
# bash d4r/tools/build-engine-models.sh --find-proton prints the GE-Proton it would use (or nothing)
|
||||
#
|
||||
# Ray Reconstruction engine/rr-d, rr-e, rr-f from d4r/nvngx_dlssd.dll 310.9.1 alone (about half a minute)
|
||||
# Super Resolution engine/k, k-ldr, m, m-ldr, l, l-ldr
|
||||
# Super Resolution engine/k, k-ldr, m, m-ldr, l, l-ldr, e, f
|
||||
# NVIDIA's DLSS keeps these weights packed in nvngx_dlss.dll; they are read where NGX unpacks
|
||||
# them: the bundled D3D12 test app renders one frame per model through this d4r folder under
|
||||
# GE-Proton, and the uploads are saved (a minute or two each; the first run also compiles
|
||||
@@ -121,13 +120,13 @@ if (( DO_SR )); then
|
||||
fail "d4r's d3d12.dll / d3d12core.dll not found next to $RUNTIME"
|
||||
fi
|
||||
winpath() { printf 'Z:%s' "$(printf '%s' "$1" | tr '/' '\\')"; }
|
||||
dump() { # dump NAME PRESET: the uploads of one frame of preset PRESET in WORK/NAME/replay
|
||||
dump() { # dump NAME PRESET PATTERN [FLAGS]: the uploads of one frame of preset PRESET in WORK/NAME/replay
|
||||
local w="$WORK/$1"
|
||||
mkdir -p "$w/replay"
|
||||
printf ' rendering one frame with model %s through d4r (GE-Proton %s)...\n' "$1" "$(basename "$PROTON")"
|
||||
(cd "$APP" && env STEAM_COMPAT_CLIENT_INSTALL_PATH="$STEAM_ROOT" STEAM_COMPAT_DATA_PATH="$WORK/prefix" \
|
||||
PROTON_FORCE_NVAPI=1 DXVK_NVAPI_GPU_ARCH=AD100 WINEDLLOVERRIDES='d3d12=n,b;d3d12core=n,b;d4r12core=n,b' \
|
||||
D4R_ENGINE=0 D4R_DLSS_PRESET="$2" D4R_HARNESS_CREATE_FLAGS=0x4B D4R_SHIM_LOG="$(winpath "$w/shim.log")" \
|
||||
D4R_ENGINE=0 D4R_DLSS_PRESET="$2" D4R_HARNESS_CREATE_FLAGS="${4:-0x4B}" D4R_SHIM_LOG="$(winpath "$w/shim.log")" \
|
||||
D4R_CUDA_REPLAY_DUMP_DIR="$w/replay" D4R_CUDA_REPLAY_DUMP_LIMIT=60 \
|
||||
"$PROTON/proton" run "$APP/d3d12_dlss_harness.exe" "$(winpath "$RUNTIME/nvngx.dll")" "$(winpath "$w/out.raw")" \
|
||||
1 640 360 1280 720) > "$w/run.log" 2>&1 || true
|
||||
@@ -157,5 +156,16 @@ if (( DO_SR )); then
|
||||
done
|
||||
rm -rf -- "${WORK:?}/$1"
|
||||
done
|
||||
# presets E and F (DLSS 3's CNN): one frame each, LDR with render-size motion (the model serves every flag set)
|
||||
echo 'Building the Super Resolution CNN models (E and F)...'
|
||||
PTX="$WORK/ptx"
|
||||
run ptx.log python3 "$KIT/kernels/tools/extract_dlss_ptx.py" "$DLL" "$PTX"
|
||||
for c in "e 5 E" "f 6 F"; do
|
||||
set -- $c
|
||||
dump "$1" "$2" cuda_engine_input_kernel_rel 0xa
|
||||
run "$1.log" python3 "$KIT/engine/compile_sr_e.py" "$WORK/$1/replay" "$DLL" "$WORK/$1-out" --preset "$3" --ptx-dir "$PTX"
|
||||
place "$1" "$WORK/$1-out" $(ls "$WORK/$1-out")
|
||||
rm -rf -- "${WORK:?}/$1"
|
||||
done
|
||||
fi
|
||||
printf 'Engine models are in %s/engine.\n' "$RUNTIME"
|
||||
+4
-1
@@ -11,9 +11,12 @@
|
||||
; K | 4 | DLAA / Quality / Balanced | Default; faster alternative to M/L
|
||||
; M | 4.5 | Performance | More demanding on RDNA3
|
||||
; L | 4.5 | Ultra Performance | Especially 4K; experimental
|
||||
; E | 3 CNN | Quality / Balanced / Performance | Legacy faster fallback
|
||||
; E | 3 CNN | Quality / Balanced / Performance | Legacy faster fallback; the engine's choice on RDNA2
|
||||
; F | 3 CNN | DLAA / Ultra Performance | Deprecated; prefer K or L
|
||||
;
|
||||
; On the engine ([Engine]) E and F run from engine\e and engine\f (build-engine-models.sh) without cooperative
|
||||
; matrices, so they are the models for RDNA2 GPUs (Steam Deck: about 5 ms at 640x360 -> 1280x720).
|
||||
;
|
||||
; Select the upscaling mode separately in game/OptiScaler. These are recommendations;
|
||||
; other modes are allowed. L requires the L texture build.
|
||||
; game = use the game/OptiScaler choice. Benchmarks: D4R_README.txt.
|
||||
|
||||
Reference in new issue
Block a user