fix(vk): a DLSS feature refused for want of video memory is retried, not latched off #2247
No reviewers
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!2247
Loading…
Reference in a new issue
No description provided.
Delete branch "dazemc/Longshot:fix/dlss-oom-retry"
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?
Summary
A DLSS feature creation that fails with NGX's out-of-video-memory result was kept refused for the rest of the run:
prepare()storeds.refused = key, and only a DLSS, resolution or model row (dlss_retry(), #2658) orrelease()cleared it. That failure is often temporary — a menu switch's old feature and its memory may still be waiting to be let go — so the player silently stayed on the game's own upscale after one transient OOM, though the next few seconds had the memory.This keeps the refusal's key, number of attempts and due frame in
dlss_checks::retry. An out-of-video-memory failure is tried again after 600 frames, at most three creations; then the refusal stays and is logged once. Any other result is final at once, as before, and a different key (output size, quality mode, preset or HDR) is tried at once. A feature made,release()anddlss_retry()clear it. The diagnostic switchRX_VK_DLSS_FAIL_CREATE=<result>[:<times>]makes the next creations return a chosen NGX result, so the out-of-video-memory path can be run on any GPU; it is off by default.To see the bug on main, force NGX's creation to return
NVSDK_NGX_Result_FAIL_OutOfGPUMemoryfor the current output, mode and preset (a card at its limit, or the issue's test hook): the log saysNVIDIA DLSS: its feature was not made (...)once and DLSS never comes back. With this change the next line after 600 frames isits feature is tried again (2 of 3), and the feature is made if the memory is back.Read first:
gpu/vk/dlss_checks.h(the rule),gpu/vk/vk_dlss.cppprepare()/release()/dlss_retry(), andtests/dlss_feature_size_test.cpp.Fixes #1612.
Testing
Tested: Linux (Arch, kernel 7.3.4), NVIDIA RTX 4070 Ti, driver 620.70.06. The branch's pack over main
a2dc5385, Kokiri Forest child, DLSS on at 2560x1440 output (1707x960 render), through the PC's queue:feature 1 made (the first; frame 31, 54.4 ms of CPU): 2560x1440 ... mode 2, preset K, then600/600 frames drawn, 0 made; noits feature was not made, no FATAL, crash or device-lost line. The forced out-of-video-memory path is the L3 run below.Tested, in game (L3 forced OOM): head
4639280b, shared game run underabrun(one owner), ticket2247-l3-oom, runl3-2247-oom-20261122-144220, 2560x1440 output / 1707x960 render, DLSS on,RX_VK_DLSS_FAIL_CREATE=0xBAD0000D:1:vk: NVIDIA DLSS: its feature was not made (0xbad0000d) for 2560x1440 -> 2560x1440vk: NVIDIA DLSS: its feature is tried again (2 of 3) after it was refused for want of video memoryvk: NVIDIA DLSS: feature 1 made (the first; frame 5911, 41.9 ms of CPU): 1707x960 (1280x720 to 2560x1440) -> 2560x1440, mode 2, preset KPlayable afterwards:
state play, frame 6125, 55.1 fps,KokiriForest_Child; the 600-frame status has 90 frames drawn and 1 made. Log sha2561f109a98bf91734faffcabe7065e78b09abb0d17f2ecabf1147018855d6f8e7a. The script exited 1 only because itslog --expectcalls lacked--since; the game run and these lines are complete.Tested, game-free:
python -I -B tests/test_dlss_feature_size.pyon the test-only commitdb882519(on main753fb5af) aborts attests/dlss_feature_size_test.cpp:311, the frame-600 retry assertion (creations == 2); at head4639280bit printsDLSS recommended feature sizes, dynamic ranges, native AA, failure handling and the failure hook pass, including separate behavioral cases fordlss_retry()andrelease()and one forRX_VK_DLSS_FAIL_CREATE.tests/test_dlss_checks.py(the pure rule and separate source checks for both reset paths) passes withg++andclang++.tests/run_all.py --changed origin/main --jobs 4: 29 passed, 0 failed, 3 skipped (Vulkan headers not set in that run).vk_dlss.cpppassesclang++ -fsyntax-onlywith the build's real flags and-DLONGSHOT_NGX.Full suite — settled against main. The light2 run at head
4639280b(log headerhead: 4639280bd19551a4155c243702abcc6e19bd9d7e; queue-light,systemd-run -p MemoryMax=12G -p MemorySwapMax=0,mise run test -- --jobs 5, header deps, noabrun) gave 934 passed, 5 failed, 18 skipped in 424 s (exit 1). The clean main753fb5afbaseline gives the same 934 passed, 5 failed, 18 skipped in 416 s, and the same five fail in both:test_cpm_discovery,test_dev_packs,test_mise_build,test_pipeline_state_computes,test_saveload_warm_cache. No DLSS check failed. Earlier4a22570druns were process-suspect or lacked headers; thec3edeba6run was cancelled as 10 behind and a first4639280brun was killed mid-run by the harness parent timeout — light2 is the settled result. Log:head-2247-4639280b-queued-light2.log.Still to test:
4639280b, expecting a feature made and 600/600 frames drawn (by hand or @Beanstalk; the corrected farm request is on the PR and needs a BigBean).Measurements
None: a behaviour fix, not a speed change. The game-free before/after is in Testing, and the in-game run above is a smoke test of the DLSS path, not a timing comparison.
Risks
A permanent out-of-video-memory failure now pays up to two extra creation attempts (tens of milliseconds each, 600 frames apart) before the final log; a transient one recovers instead of losing DLSS for the run. Any other NGX result is unchanged, and so is the setting-change retry. The only switch is
RX_VK_DLSS_FAIL_CREATE, a diagnostic one off by default, with its row inswitches.def; unset it does nothing. No default, save, cache format or translator-stamp change:dlss_checks.handvk_dlss.cppare not in the translator's hashed files, so no player re-prepares shaders. A revert is enough.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). Light2 at4639280b: 934 passed, 5 failed, 18 skipped in 424 s; the clean main753fb5afbaseline is 934 passed, 5 failed, 18 skipped in 416 s, with the same five:test_cpm_discovery,test_dev_packs,test_mise_build,test_pipeline_state_computes,test_saveload_warm_cache. No DLSS check failed. The light2 log is kept athead-2247-4639280b-queued-light2.log; the baseline's raw log is no longer on disk (its shell output was pruned with the reboot), so its numbers stand as recorded in comment 74919.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.gpu/vk/switches.def. (RX_VK_DLSS_FAIL_CREATEis a diagnostic, off by default; its row and a fixture case are in.)tests/that reads changed source is updated, not weakened.-fsyntax-onlycheck above; nohost/file changes.)docs/dev/reference/upscalers.mdnow documents the bounded out-of-video-memory retry and the unchanged other failures.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Linux, RTX 4070 Ti, Kokiri Forest: DLSS feature made, 600/600 frames drawn, no feature-creation failure; the OOM retry path itself is proven game-free
Testing: added the Windows-target syntax check of vk_dlss.cpp (x86_64-w64-mingw32-clang++ -fsyntax-only, pass) and the host-build box. No code change; head
4a22570d.@Beanstalk two runs for this WIP: (1) Windows 11, any NVIDIA RTX, DLSS on in Kokiri Forest, expecting the feature made and 600/600 frames drawn with no 'its feature was not made' line; (2) if a 6-8 GB card is free, hold video memory with another program before the game starts, turn DLSS on, and expect either the feature made or the lines 'its feature is tried again (2 of 3)' after 600 frames and a feature made when the memory returns, with no crash.
@dazemc only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was for4a22570, and the PR has changed since (c3edeba), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.Full suite rerun at head
4a22570d: 911 passed, 23 failed, 18 skipped in 543 s; log head-2247-4a22570d.log, the same 23 pre-existing maina2dc5385names and no DLSS check failed. The description now names the head. No code change.Suite result marked SUSPECT: the first --jobs 4 run at
4a22570dwas outside abrun/the queue and without the 12G cap, overlapping fs-orphan-kill (04:48:43-05:01:34) and 2207-unc-suite (04:42:44-05:04:42). The suite box is unticked. fs-orphan-kill's own failure was its script's 'FAIL: kill-run launch', not this suite. A clean abrun + MemoryMax=12G + --jobs 5 rerun is queued behind the current owner.Suite status: the queued abrun + 12G + jobs 5 rerun at
4a22570dcompleted process-clean but without the test header deps: 825 passed, 109 failed, 18 skipped; all 109 are --strict 'not found: spirv_headers/vulkan_headers', not code. The suite box stays unticked. A header-deps rerun under the same abrun/12G/jobs 5 rule is queued (head-2247-4a22570d-queued-headers.log). No code change.@review
Recommendation: Approve. The game-free test demonstrates the retry, but the actual NGX out-of-video-memory recovery has not been exercised in game, and the Windows DLSS run remains outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
A DLSS feature refused for insufficient video memory is retried twice at 600-frame intervals instead of remaining disabled immediately. This can restore DLSS after temporary memory pressure, at the cost of up to two additional feature-creation stalls when memory remains unavailable.
Should fix (2): not blocking, but worth doing before merging.
docs/dev/reference/upscalers.md:207: The upscaler reference still says every failed DLSS feature creation waits for a setting change before retrying. When: After an out-of-video-memory failure, prepare now retries after 600 frames, contrary to the documented rule. Do: Document the bounded out-of-video-memory retries and the unchanged behavior for other failures.tests/test_dlss_checks.py:55: The source check claims to cover both reset paths but accepts a reset in either one alone. (more on the line) Do: Check release and dlss_retry separately, preferably with a behavioral test that exercises each reset.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlss.cpp:449: The actual NGX out-of-video-memory recovery and retry cost remain untested in game. (more on the line) Do: Run the failure and recovery scenario on an NVIDIA GPU, record the retry and successful creation, and observe the frame stalls during failed attempts.gpu/vk/vk_dlss.cpp:408: The changed DLSS path has not been run on Windows. (more on the line) Do: Run the requested Windows NVIDIA DLSS smoke test and record feature creation and sustained drawing.@fixcan do L1 and L2.Checks: Still running: 9 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven in game for the reported failure: the fixture fails on main at the frame-600 retry and passes at head, but the Linux RTX 4070 Ti smoke run did not produce an out-of-video-memory result.
Other systems: The changed path is NVIDIA NGX DLSS on Linux and Windows, including DLAA and the temporal chain's prewarm and gameplay calls. The recorded Linux smoke run covers ordinary creation; Windows and actual memory-pressure recovery remain untested. Non-NGX builds retain their existing stubs; AMD and Intel upscaler implementations are unchanged.
Switches: None added, changed or removed.
Reviewed:
4a22570d6aagainsta2dc538590: Read AGENTS.md, CONTRIBUTING.md, the pull request template, docs/dev/standards.md, the complete diff and commit messages, and all six changed files. Traced prepare, release, retry, temporal-chain callers and frame numbering; skimmed the surrounding DLSS frame-generation code and upscaler reference. docs/review-checklist.md and ../Tooling/AGENTS.md were absent from the checkout.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project, builds or tests were run. The reported full-suite rerun with header dependencies and several CI checks remain pending.
Overlaps and merge order: Not established from the supplied checkout and review context.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -405,2 +406,3 @@(hdr ? 1 : 0) ^ 1ull << 63;if (s.refused == key) return *fail = "its feature was not made", 0;// (a refusal for this key: kept, unless it was out of video memory and its retry is due)const dlss_checks::retry::Verdict refused = dlss_checks::retry::verdict(s.refusal, key, texture_frame_no());L4 (should fix): The changed DLSS path has not been run on Windows.
When: The Windows-target syntax check cannot show that NGX creates and draws a feature successfully with this change on Windows.
Do: Run the requested Windows NVIDIA DLSS smoke test and record feature creation and sustained drawing.
@ -441,0 +446,4 @@// again after a bounded interval. Any other failure, or the last of them, keeps the game's upscale until a DLSS// setting changes)const bool out_of_memory = r == NVSDK_NGX_Result_FAIL_OutOfGPUMemory;if (dlss_checks::retry::failed(s.refusal, key, out_of_memory, texture_frame_no()) && out_of_memory)L3 (should fix): The actual NGX out-of-video-memory recovery and retry cost remain untested in game.
When: When NGX refuses creation under video-memory pressure, the fixture supplies a simulated result, but no recorded game run shows that the real failure is retried and DLSS returns after memory is freed.
Do: Run the failure and recovery scenario on an NVIDIA GPU, record the retry and successful creation, and observe the frame stalls during failed attempts.
@ -49,0 +52,4 @@"NVSDK_NGX_Result_FAIL_OutOfGPUMemory" in prepare, \"prepare: an out-of-video-memory creation is recorded for a retry"assert "dlss_checks::retry::made(s.refusal)" in prepare, "prepare: a made feature clears the refusal"assert "s.refusal = {}" in dlss, "release() and dlss_retry() clear the refusal"L2 (should fix): The source check claims to cover both reset paths but accepts a reset in either one alone.
When: Removing the reset from dlss_retry leaves the release reset matching this assertion, so the check passes even though changing a DLSS setting no longer clears a final refusal.
Do: Check release and dlss_retry separately, preferably with a behavioral test that exercises each reset.
Review answers (head
c3edeba6): L1 fixed in docs/dev/reference/upscalers.md (the OOM retry and the unchanged other results); L2 fixed with separate source checks and behavioral tests for release() and dlss_retry(); L3 added RX_VK_DLSS_FAIL_CREATE and the forced OOM/recovery run is queued; L4 still needs the Windows/Test Farm run. The header-deps suite atc3edeba6is queued under abrun + MemoryMax=12G + --jobs 5; the suite box stays unticked until it finishes. No ready flip.Checklist: added the Docs updated box (upscalers.md) and named the forced OOM run as by hand on this RTX 4070 Ti. The suite box stays unticked pending the abrun/12G/jobs 5 header-deps run at
c3edeba6. No code change.Suite wrapper fixed: the old light ticket that retried abrun inside the queue-light slot was cancelled (it could deadlock a timing runner that holds abrun and waits for a queued timing job). The new ticket 2247-suite-c3edeba6-light is queue-light + systemd-run -p MemoryMax=12G -p MemorySwapMax=0 + mise run test --jobs 5 with header deps, no abrun inside. Log head-2247-c3edeba6-queued-light.log. The suite box stays unticked and the PR stays WIP.
c3edeba6f94639280bd1Rebased onto current main
753fb5af: new head4639280b(testdb882519, fix2901d54b). Thec3edeba6suite was cancelled because it was 10 commits behind and could not settle the box. The test commit still fails on753fb5afat the frame-600 retry, and the rebased head passes the DLSS checks. The clean suite will be queued as 2247-suite-4639280b only when the queue is empty, as one queue-light ticket with systemd-run MemoryMax=12G and no abrun. Suite box unticked; PR WIP.The first
4639280bqueue-light run was killed mid-run by the harness parent timeout (partial head-2247-4639280b-queued-light.log, no result). Replacement ticket 2247-suite-4639280b-light2 is queued only when the queue is empty: queue-light + systemd-run MemoryMax=12G + jobs 5, no abrun, longer parent timeout, log head-2247-4639280b-queued-light2.log. The direct-abrun alternative was evaluated and blocked by the safety gate, so it is not used. Suite box unticked; PR WIP.Suite box settled from the light2 run at
4639280b: 934 passed, 5 failed, 18 skipped in 424 s; the clean main753fb5afbaseline is the same 934/5/18 in 416 s with the same five failures (test_cpm_discovery, test_dev_packs, test_mise_build, test_pipeline_state_computes, test_saveload_warm_cache). No DLSS check failed. The box is ticked; L3 forced-OOM and L4 Windows remain Still to test. The PR state will be checked before any ready flip.WIP: fix(vk): a DLSS feature refused for want of video memory is retried, not latched offto fix(vk): a DLSS feature refused for want of video memory is retried, not latched off@Beanstalk Windows 11, any NVIDIA RTX, PR head
4639280b(rebased since the earlier request): DLSS on in Kokiri Forest, expecting feature 1 made and 600/600 frames drawn, no its feature was not made line, no crash. This is the L4 Windows check only; the forced out-of-video-memory recovery (L3) is being run on the author Linux RTX 4070 Ti. No game files, keys or derived data.@dazemc only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.L3 forced OOM/recovery, head
4639280b, shared game run under abrun, ticket 2247-l3-oom, run l3-2247-oom-20261122-144220, 2560x1440 output / 1707x960 render, DLSS on, RX_VK_DLSS_FAIL_CREATE=0xBAD0000D:1.vk: NVIDIA DLSS: its feature was not made (0xbad0000d) for 2560x1440 -> 2560x1440
vk: NVIDIA DLSS: its feature is tried again (2 of 3) after it was refused for want of video memory
vk: NVIDIA DLSS: feature 1 made (the first; frame 5911, 41.9 ms of CPU): 1707x960 (1280x720 to 2560x1440) -> 2560x1440, mode 2, preset K
Playable afterwards: state play, frame 6125, 55.1 fps, KokiriForest_Child; the 600-frame status has 90 frames drawn and 1 made. Log sha256 1f109a98bf91734faffcabe7065e78b09abb0d17f2ecabf1147018855d6f8e7a. The script exited 1 only because its log --expect calls lacked --since; the game run and these lines are complete.
L3 evidence added to Tested: head
4639280b, ticket 2247-l3-oom, run l3-2247-oom-20261122-144220; forced create failure (0xbad0000d), retry (2 of 3), feature 1 made, then state play at frame 6125, 55.1 fps, KokiriForest_Child. Log sha256 1f109a98... The L3 Still-to-test line is removed; only the Windows L4/farm run remains. Suite box stays ticked; Ready-to-merge remains 0/4. No code change.Head
4639280bis still ready and waits only on fork CI: itspull_requestjobs are "Blocked by required conditions" and the PR has noci: approvedlabel. No earlier fork-CI ask names this head.@HumanBean: please approve this head's fork CI runs (the Actions jobs, and the
ci: approvedlabel for the fork project) and review #2247 — a DLSS feature refused for want of video memory retried rather than latched off.Evidence is in the thread: the suite at
4639280b(934/5/18, equal to the main baseline) and the forced-OOM recovery run at4639280b(feature made, then play).