feat(dlss): DLSS 5 on RTX 20, 30 and 40 with the community FP16 file (Windows) #2513
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2513
Loading…
Reference in a new issue
No description provided.
Delete branch "pmwork-personal/Longshot:feat/dlss5-fp16"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Built on #2503 (DLSS 5 through NGX), which is merged (
348ecdd8).mainis merged in (4a5e9424), so the diff hereshows only this PR's own change.
Summary
DLSS 5 (#2503) runs only on RTX 50 cards: NVIDIA's own
nvngx_dlssnr.dllis its FP8 model. The community FP16conversion of that file runs on RTX 20, 30, 40 and 50 (the Bloodborne PC port uses it). It is a modified NVIDIA file, so
NGX refuses it. This PR adds a second path for that one file, Windows only, as the Bloodborne port runs it. NVIDIA's
signed file uses #2503's NGX path. Both paths now release the old feature before creating its replacement.
What a player does: put the FP16 file, named
nvngx_dlssnr.dll, in anfp16folder inside one of #2503's folders(
<game>\ngx\fp16,%LOCALAPPDATA%\Longshot\ngx\fp16, orRX_VK_DLSS_DIR's). Longshot does not include or downloadit. Which file runs:
gpu/vk/vk_dlss.cpp,NrDirect,nr_direct_load): the FP16 file loaded and started with itsown
NVSDK_NGX_VULKAN_Init_Ext; its feature made, evaluated and let go with its ownCreateFeature,EvaluateFeatureandReleaseFeature; the sameDLSSNR.*parameters in a block NGX allocates.nr_create_feature,nr_evaluate_feature,nr_release_feature,nr_new_paramsandnr_set_intchoose the back end. Inputs, proxy,composite, settle and rows stay shared. On replacement, the old feature is released after its last GPU use before the
new one is created; if creation fails, Longshot attempts to restore the last working settings.
longshot_nvngx.dll_nr.dll(gpu/vk/dlss_nr_forwarder.c, 4 calls): the model refuses a callerwhose module name lacks
nvngx.dll, so each call goes through it. No tail call (a volatile result anddisable_tail_calls). The Rust builder links it after the renderer on Windows with the NGX SDK(
builder/crates/build-compilelink_forwarder, throughlink::run,/Brepro) and puts it besidelongshot_vk.dll(
build-driverfinished_files, so the installed note holds it); a pack carries it as a generated file.gpu/vk/dlss_nr_model.h): the FP16 file is used only when its size and SHA-256 are on the allow-list(the Bloodborne port's known file, 276,162,560 bytes,
CDFA6C1E…3ED). Hashed once a run on its own thread (about0.6 s on a Ryzen 7 9800X3D; the recording thread does not wait for it, and the DLSS 5 rows appear after the file check
finishes), through a handle that keeps others from
writing, moving or deleting the file while the game runs. The model is loaded by that handle's final path and checked
to be that file, so the file loaded is the file checked. NGX's signature check is not turned off, nothing is patched in
memory, no Windows setting changes.
DLSS 5 model(gpu/vk/menu/dlss5.cpp, saved asdlss5_model, in FROZEN;RX_VK_DLSS_NR_MODELover it).Its help starts with
[EXPERIMENTAL], as every DLSS 5 row's does since #2503's7492ea7a; the DLSS 5 row's help alsonames the FP16 file.
vk_dlss.cppfromstruct NrDirect,nr_direct_load,nr_check_locked;dlss_nr_model.h;dlss_nr_forwarder.c.Credit: the direct path and the forwarder are ported from the Bloodborne PC port's DLSS bridge (PMWork fork,
gpu/dlss_bridge, GPL-3.0-or-later), which follows theOptiScaler DLSS-NR fork by Dagherbou (GPL-3.0); that fork found the
model's exports, the caller check and the tail-call trap. #2503's credits (HypeZ85/Valerio85, TheDevil, RenoDX) still
apply to the shared parts.
Testing
Tested: Head
c627ccbdis76252ff9withmain3072dda4(the Rust builder) merged in and the forwarder'sbuild ported to that builder. Built with
dev.py packon the shared base of3072dda4: the builder linkedlongshot_nvngx.dll_nr.dll(42 KB) after the renderer, and the pack put it besidelongshot_vk.dll.cargo test -p build-compile -p build-driver: the same 13 failures as onmain3072dda4on this PC (paths, the PATH'sclang, time stamps), and one test that is flaky on both;
cargo fmt --checkand clippy clean. No game run onc627ccbd:the DLSS 5 code was the same as at
76252ff9, where the runs below ran. The later changes to file checking and featurereplacement still need testing. Three CI checks fail on
main3072dda4itself, notby this PR: "Guide screenshots" (20 UI sources changed by #2286 since the settings-graphics.png review; this PR's own
sources are in the review) and both website builds (
docs/user/common-issues.md, the same asmain's, stopsformat-common-issues.ts: "Help page group list changed: it must link each group in order").At
76252ff9: Windows 11, RTX 5090, NVIDIA 621.24, the branch as a pack on main9046a8d7+ #2503 (7492ea7a), headless (the controlbridge, no window), Kokiri Forest from the repository's
kokiri-startsave, DLAA, 2560x1440, my stable settings. Eachcase in its own folder given as
RX_VK_DLSS_DIR(the files copied in for the test only, never into the repository). Ineach run: DLSS 5 On, Model resolution 65% then 50% (the feature made again), Off for 3 s (let go), On again (made
again); 1,900+ frames evaluated, no Vulkan error:
dlss5_model=2savedRX_VK_DLSS_NR_MODEL=nvidialongshot_nvngx.dll_nr.dlltaken awayB and D ran at
76252ff9; A, C, E and F on it before the rebase onto #2503's7492ea7a, which changed only menu helptexts (the
[EXPERIMENTAL]tag). The FP16 file's log:found in …\fp16 (SHA-256 cdfa6c1ec7848671..., the known file),DLSS 5 (FP16): the community FP16 model started, through longshot_nvngx.dll_nr.dll,feature created at 2224x936 … (the community FP16 file, direct).A screenshot of run A's picture showed the Default preset's DLSS 5 look, nothing broken (not attached: it is the game's
picture). Prathyush also played it on his own screen (5120x2160, his save and settings, DLSS 5 On with the FP16 file
from the DLSS 5 model row): 2,400 frames evaluated at 3328x1408, "looks good". Checks:
tests/run_all.pyat76252ff9: 914 passed, 23 failed, 55 skipped. 22 of them fail onmain9046a8d7onthis PC too (auto_handheld, cmpflags, crash_dialog, dev_ab, dev_build, dev_migrate, fastfp_fma, float_add_subgroup,
fma_soft, fpx_sticky, fpxkeep, game_menu_mouse_buttons, input_movie, linux_preflight, pads_after_menu, perf_report,
portable_builder_startup, sdiv_overflow, spawn_emit, vbytes, vecfp, vfpx_elem);
test_job_queueran beside a GPU runand passes alone.
test_sampler_admissionis timing-flaky here (it failed once onmain9046a8d7too, and passed 6 of6 alone both there and here). New checks:
test_dlss_nr_model(the choice table for every GPU, file pairand choice; SHA-256 against FIPS 180-4's examples; the allow-list),
test_dlss_nr_fp16_files(the search, its order,the size and hash check, the held file),
test_dlss_nr_forwarder(each of the forwarder's four calls reaches the modelfrom a module named for its check; a forwarder built with a tail call fails it; both back ends' calls), and
test_dev_packs'renderer_beside. The guide image's source review:source-review-6d4a63a1.md(
check_guide_screenshots.py --review-sourcespasses). The site's settings check and its test pass (run with Node 24without the markdown package: the one test that needs it fails here on #2503 too).
Still to test:
ngx\fp16and DLAA or DLSS: turn DLSS 5 On, expecting thelog line
DLSS 5 (FP16): the community FP16 model startedand frames evaluated, no DLSS 5 model row (by hand, atester, or
@Beanstalkonce the farm has such a card).each time and no "out of memory" line. The old feature is released after its last GPU use before the replacement is made (by hand or the Test Farm).
_WIN32).Measurements
Measurements against
mainare pending for the changed feature replacement. With the FP16 file, the model uses the same inputs; the file's check at the start is about 0.6 s on its own thread, which the frames do not wait for.Risks
fp16folder reaches the direct path. Feature replacement also changesfor NVIDIA's NGX path: the old feature is released before its replacement is made.
named in the log and not loaded.
the upscaler's picture; it is not tried again until the next start. To turn it off: take the file out of
fp16.dlss5_model(Auto by default). Nothing else inlongshot_options.ini, saves or caches.Checklist
Ready for review
main; the title is a Conventional Commit. (Onmain348ecdd8, after #2503 merged: thediff is this change alone.)
mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
gpu/vk/switches.def.(
RX_VK_DLSS_NR_MODEL: unset, the row's Auto.)tests/that reads changed source is updated, not weakened. (test_dlss5_menu,test_menu_ini_keys,test_menu_env_overrides,test_dlss_nr_support;test_recorder_syncnow also holds the direct path's create andevaluate to their
boundary(B_DIRECT).)Assisted-by:/Co-Authored-By:trailers.Ready to merge
mainis merged into this branch after it. (#2503:348ecdd8;mainmerged in:4a5e9424.)main, measured again or a comment says why the numbers still hold.Co-Authored-By: Claude Opus 5.5 [email protected]
🤖 Generated with Claude Code
- website/src/repo-docs/graphics-settings.ts: badges for DLSS 5's conditions ("shown only with NVIDIA's `nvngx_dlssnr.dll`", "shown while DLSS 5 is On"); the DLSS 5 preset (a view of the page's rows) and the DLSS 5 settings page row registered as Dynamic resolution's and Simulated turf's are. The site's build stopped at "The table names no condition for DLSS 5". A site test for both. - docs/user/graphics-and-controls.md: the DLSS 5 preset's line names its condition. - scripts/screenshots/menu.cpp: stand-ins for the menu's six new DLSS 5 calls (no DLL: no DLSS 5 row). - docs/user/images/guide: settings-graphics.png kept after reviewing the six changed UI sources and five new ones (source-review-2c4516b8.md); the manifest's review record and fixture hash follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>Tested in game: Windows 11, RTX 5090, NVIDIA 621.24, Kokiri Forest: DLSS 5 with the community FP16 file through the new direct path and with NVIDIA's file through NGX, in every file and model-row case of the Testing table (headless, 1,900+ frames each, no Vulkan error), and the forwarder missing (DLSS 5 off with its reason, the game runs on). Prathyush also played it on his own screen at 5120x2160 with the FP16 file: 2,400 frames, looks good.
@review
Recommendation: Request changes. It conflicts with its base branch: bring it up to date (
@fixor@rebasetry first). (L4) The FP16 path works in the reported RTX 5090 runs, but its intended RTX 20, 30 and 40 hardware and its low-memory behavior have not been tested. This branch also depends on #2503 merging first.Adds DLSS 5 after the temporal upscaler and a Windows direct-loading path for a user-supplied, allow-listed FP16 model. It extends support to older RTX cards at the cost of model loading, GPU time and memory, and a first menu wait while the file is checked.
Blocking (1): must change before merging.
@fixor@rebasetry first). (for the author)Should fix (1): not blocking, but worth doing before merging.
gpu/vk/vk_dlss.cpp:1460: The first menu visibility check waits for the FP16 hash to finish. (more on the line) Do: Check whether the future is ready before reading it, and let the rows become visible when the result arrives.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlss.cpp:950: The direct path has not been exercised on the older RTX cards it is intended to enable. (more on the line) Do: Run the FP16 path on Windows with an RTX 20, 30 or 40 card, inspect the picture, and exercise creation and evaluation.gpu/vk/vk_dlss.cpp:511: Peak memory during model replacement is not measured on an 8 GB card. (more on the line) Do: Measure peak VRAM and exercise style, resolution and window-size changes with the FP16 model on an 8 GB card. (@fixdoes its part first: Reduce peak memory by releasing the old feature before creating its replacement, with an appropriate fallback if creation fails.)@fixcan do L1 and L3.More: does it help, other systems, switches, what was read
Does it help: Unproven on the intended RTX 20, 30 and 40 cards. The author reports over 1,900 evaluated frames per tested file-selection case on an RTX 5090 and a separate 2,400-frame on-screen run; the recorded DLSS 5 Off comparison on an earlier shared commit was within its run-to-run spread.
Other systems: The shared DLSS 5 chain also affects NVIDIA's signed model, DLSS, DLAA, FSR, HDR and pre-bloom paths. The reported runs cover Windows and an RTX 5090; Linux and the older RTX and 8 GB cases remain untested. With the feature off, an earlier shared-branch comparison on the 5090 showed no cost beyond the spread.
Switches: RX_VK_DLSS_NR defaults to the saved row, initially Off; RX_VK_DLSS_NR_DEBUG defaults to 0; RX_VK_DLSS_NR_LINUX defaults off; RX_VK_DLSS_NR_MODEL defaults to the saved Auto choice; RX_VK_NR_TEST_REJECT_INTENSITY is unset and effective only in test builds. The defaults are conservative, but the model choice and feature costs need the outstanding hardware runs. All have switch-table entries.
Reviewed:
76252ff947against9046a8d750: Read the repository rules, PR template, commit log, rendering and loader changes, model and settings headers, shaders, menu module, packaging diffs, and the reported runs. Skimmed generated SPIR-V headers, screenshot review records, website changes, and test fixtures; the full contents of every changed file and all surrounding callers were not read.; nothing run (a code review).Checked and fine:
Testing: No code, tests, builds or scripts were run, as requested. The supplied CI lists no failures or running checks; the author's reported runs are described above.
Overlaps and merge order: #2503 contains the shared DLSS 5 implementation and must merge first; this branch then needs rebasing onto main.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -120,0 +508,4 @@NVSDK_NGX_Result r = nr_new_params(&candidate_params);const dlss_nr::Settings controls = s.nr_edits.pending;const auto t0 = std::chrono::steady_clock::now();if (NVSDK_NGX_SUCCEED(r) && candidate_params) {L3 (should fix): Peak memory during model replacement is not measured on an 8 GB card.
When: Changing a model setting or its resolution creates a candidate while the previous feature remains live; on an 8 GB GPU the combined allocations may prevent the new feature from being created.
Do: Measure peak VRAM and exercise style, resolution and window-size changes with the FP16 model on an 8 GB card.
@ -306,0 +947,4 @@// (with State::mu held, NGX started) The direct path for the FP16 file, once a run: the forwarder beside this module, the// model, its four exports, then the model's own start on this device. Issue::none when it runs; what failed is in the log,// and the model is not tried again until the next start. What was loaded before the model's start is let go on a failuredlss_nr::Issue nr_direct_load(const NrFiles& files) {L2 (should fix): The direct path has not been exercised on the older RTX cards it is intended to enable.
When: An RTX 20, 30 or 40 player selects the FP16 file, but the only reported direct-model runs use an RTX 5090; whether feature creation, evaluation and the resulting picture work on the target cards remains unknown.
Do: Run the FP16 path on Windows with an RTX 20, 30 or 40 card, inspect the picture, and exercise creation and evaluation.
@ -562,0 +1457,4 @@bool dlss_nr_offered() {#ifdef _WIN32static const bool found = [] { // (once a run: the menu asks at each drawing)const NrFiles& f = nr_files();L1 (should fix): The first menu visibility check waits for the FP16 hash to finish.
When: When the Graphics rows are evaluated before the background check has finished, dlss_nr_offered calls nr_files().get(), so the menu thread stalls for the remainder of the 276 MB read and hash, even when DLSS 5 is off.
Do: Check whether the future is ready before reading it, and let the rows become visible when the result arrives.
3072dda4, the Rust builder) into feat/dlss5-fp16 439a891d81fb724339into feat/dlss5-drop-in 68b15b72f8fb724339) into feat/dlss5-fp16@rebase
This pull request has merge commits, so I brought it up to date by merging
main(348ecdd811) into it rather than rebasing (its history stays as it is): the new head is4a5e942497.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Approve. The FP16 path has been demonstrated on an RTX 5090, but its intended older RTX cards and peak memory use on an 8 GB card remain untested. The pull request also still reports a conflict with its base and depends on #2503. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change lets Windows players with the known community FP16 model use DLSS 5 through a direct path and adds a model choice when both files are available. It adds a forwarder, file verification, a saved menu setting and builder integration.
Should fix (1): not blocking, but worth doing before merging.
gpu/vk/vk_dlss.cpp:1460: The first menu visibility check waits for the FP16 hash to finish. When: When the Graphics rows are evaluated before the background check has finished, dlss_nr_offered calls nr_files().get(), so the menu thread stalls for the remainder of the 276 MB read and hash, even when DLSS 5 is off. Do: Check whether the future is ready before reading it, and let the rows become visible when the result arrives.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlss.cpp:950: The direct path has not been exercised on the older RTX cards it is intended to enable. When: An RTX 20, 30 or 40 player selects the FP16 file, but the only reported direct-model runs use an RTX 5090; whether feature creation, evaluation and the resulting picture work on the target cards remains unknown. Do: Run the FP16 path on Windows with an RTX 20, 30 or 40 card, inspect the picture, and exercise creation and evaluation.gpu/vk/vk_dlss.cpp:511: Peak memory during model replacement is not measured on an 8 GB card. When: Changing a model setting or its resolution creates a candidate while the previous feature remains live; on an 8 GB GPU the combined allocations may prevent the new feature from being created. Do: Measure peak VRAM and exercise style, resolution and window-size changes with the FP16 model on an 8 GB card. (@fixdoes its part first: Reduce peak memory by releasing the old feature before creating its replacement, with an appropriate fallback if creation fails.)@fixcan do L1 and L3.Since the last review (on
76252ff947)Resolved: L4 (It conflicts with its base branch: bring it up to date (
@fixor@rebasetry first).)Still open: L1 (The first menu visibility check waits for the FP16 hash to finish.); L2 (The direct path has not been exercised on the older RTX cards it is intended to enable.); L3 (Peak memory during model replacement is not measured on an 8 GB card.)
Checks: Still running:
PR description / Description follows the template (pull_request_target).More: does it help, other systems, switches, what was read
Does it help: Unproven for the intended RTX 20, 30 and 40 cards. The reported RTX 5090 runs evaluated at least 1,900 frames per case, and an on-screen FP16 run evaluated 2,400 frames.
Other systems: The direct path and forwarder are Windows-only; Linux retains the NGX path. The older NVIDIA cards targeted by the feature and an 8 GB card still need game runs; no Linux result is reported for this head.
Switches: RX_VK_DLSS_NR_MODEL defaults to unset, leaving the saved dlss5_model choice at Auto; Auto selects NVIDIA's model when both are available on RTX 50. The default is consistent with the described behavior.
Reviewed:
4a5e942497against348ecdd811: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the ledger paths and the builder integration around the changed lines. Skimmed the changed forwarder test and the supplied run reports. The full pull request diff and every changed code file were not read in full; docs/review-checklist.md is absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The supplied reports cover the direct and NGX paths on Windows with an RTX 5090; older RTX hardware, 8 GB replacement behavior and Linux remain to be tested.
Overlaps and merge order: #2503 is the required parent pull request and must merge first.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.
@fix
Recommendation: Approve. The code is ready: only testing is left. The FP16 path has run on an RTX 5090, but its intended RTX 20, 30 and 40 support remains unverified. Peak memory during replacement also needs an 8 GB card run. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
47df2d82d6. It was already up to date withmain. I edited its description to match the change.Changed
Changed in part (the rest is for the author)
Nothing was built or run: the checks run again on the new head.
The change lets Windows players supply a known community FP16 model for DLSS 5 on older RTX cards. It adds a direct model path and a model choice, while feature replacement now releases the old feature before creating its successor.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlss.cpp:950: The direct path has not been exercised on the older RTX cards it is intended to enable. When: An RTX 20, 30 or 40 player selects the FP16 file, but the only reported direct-model runs use an RTX 5090; whether feature creation, evaluation and the resulting picture work on the target cards remains unknown. Do: Run the FP16 path on Windows with an RTX 20, 30 or 40 card, inspect the picture, and exercise creation and evaluation.gpu/vk/vk_dlss.cpp:511: Peak memory during model replacement is not measured on an 8 GB card. When: Changing a model setting or its resolution creates a candidate while the previous feature remains live; on an 8 GB GPU the combined allocations may prevent the new feature from being created. Do: Measure peak VRAM and exercise style, resolution and window-size changes with the FP16 model on an 8 GB card.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (3; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven on the target cards: the reported RTX 5090 runs evaluated more than 1,900 frames per case, but no RTX 20, 30 or 40 run is reported. The 8 GB replacement peak has not been measured.
Other systems: The direct path is Windows-only; replacement also changes for NVIDIA's NGX path and Linux. The later replacement and file-check changes have no reported game run, and a Linux build and run remain pending.
Switches: RX_VK_DLSS_NR_MODEL is unset by default, selecting Auto; the saved dlss5_model row also defaults to Auto. Auto chooses NVIDIA's model when both are present on RTX 50, which matches the stated preference.
Reviewed:
47df2d82d6against348ecdd811: Read AGENTS.md, CONTRIBUTING.md, the fix diff and the replacement and support code around the changed lines. Skimmed the overall diff and recorded runs; the remaining changed files were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The description reports RTX 5090 game runs on an earlier revision; CI has not run on this head.
Overlaps and merge order: None identified in the supplied context; the prerequisite #2503 is merged.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
WIP: feat(dlss): DLSS 5 on RTX 20, 30 and 40 with the community FP16 file (Windows)to feat(dlss): DLSS 5 on RTX 20, 30 and 40 with the community FP16 file (Windows)