fix(vk): work around Maxwell BC4 pass device loss #2730
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2730
Loading…
Reference in a new issue
No description provided.
Delete branch "russian.engineer/Longshot:fix/maxwell-bc4-pass-device-loss-pr"
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
Nightly
nightly-805-6b928cb4loses the Vulkan device on the title screen on a Quadro M2000M; the kernel reports NVIDIA Xid 31. The failing render sequence reaches program0xdc5db6b9f2ab0da3(the Deku Tree BC4 web draw). On non-Windows systems, this change detects NVIDIA's proprietary driver plus PCI device0x13b0, ends the open render pass before that draw, and still issues the draw. It does not establish the underlying driver or application fault.The policy is in
gpu/vk/device_policy.h; the pass boundary is ingpu/vk/vk_draw.cpp;tests/test_device_policy.pycovers the OS, hardware and driver match and the draw pass boundary. The test-only commit precedes the fix commit and fails on the current main behavior.Testing
Tested: On the current ThinkPad P50 (Quadro M2000M, NVIDIA 580.178.04, Ubuntu 26.04.1), the branch rendered the 3D title screen, loaded the Kokiri Forest scene, and then reached the Deku Tree. The runtime log recorded the pass split before
dc5db6b9f2ab0da3; no new Xid 31 appeared during that run. The user reports that without this workaround the same device loss occurs on two ThinkPad P50 systems under Windows and Linux.The device-policy test passed before the added draw-boundary and Windows coverage; the updated test is pending. The changed test suite completed with 185 passed and 1 failure (
test_pipeline_tour), reproduced on the unmodified main baseline. The full strict suite was not clean in this environment: 568 passed, 310 failed, 10 skipped; most failures require unavailable build/test tools such as clang, CMake, SPIR-V validation/headers, or Unicorn.Still to test:
logs/folders in both runtimes and retry; the baseline is expected to lose the device before reaching the scene on this P50, so do not claim comparative FPS unless both runs complete (by hand on this P50).Measurements
Verdict: No valid main-versus-branch performance comparison yet. The workaround adds one pass boundary for the matching draw only; the only baseline runs on this M2000M lost the Vulkan device before measurement.
Setup: ThinkPad P50, Quadro M2000M, NVIDIA 580.178.04, Ubuntu 26.04.1;
dev.py ab --scene deku-tree --runs 2 --seconds 30 --warmup 5 --headless, default game settings.22d0d200b0c0138fGPCCLIENT_GCC,FAULT_PTE ACCESS_TYPE_READ)dc5db6b9f2ab0da3; no Xid during the run. The benchmark could not write its frame trace.Risks
The extra pass boundary can add a small cost on the matching draw; no paired measurement is available yet. The rule is limited to non-Windows systems with NVIDIA's proprietary driver and device ID
0x13b0. The Xid 31 root cause remains unconfirmed. Reverting the fix commit disables the workaround. No player settings or save files change.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (changed-suite baseline failure and missing strict-suite tools are listed above).main; main loses the GPU before the scene and the attempted runs have no frame trace.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
Tested in game: Agent test: ThinkPad P50, Quadro M2000M (10de:13b0), NVIDIA 580.178.04, Ubuntu 26.04.1: the 3D title background and Kokiri Forest/Deku Tree loaded; the log showed a pass split before dc5db6b9f2ab0da3; no new Xid 31 was recorded before normal exit. User reports the unpatched build loses the Vulkan device on two ThinkPad P50 systems under both Windows and Linux.
Possibly related, for context:
@review
Recommendation: Approve. The workaround has been observed to let the affected Linux machine reach the scene, but its regression test does not cover the pass boundary that provides the fix. Windows behavior and the cost of the extra boundary also remain unmeasured. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change ends the current render pass before a particular BC4 draw on the Quadro M2000M with NVIDIA's proprietary driver. One reported Linux run reached the title screen and Deku Tree without another Xid 31; the cost and the underlying fault are unknown.
Should fix (1): not blocking, but worth doing before merging.
tests/test_device_policy.py:429: The regression test checks only the hardware policy, not whether the matching draw actually ends the pass. (more on the line) Do: Add a game-free behavioral check that exercises an open pass and the matching and nonmatching draws, verifies the boundary before the retained draw, and fails when the boundary is removed.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/device_policy.h:683: The policy also enables the workaround on Windows, where the branch has not been run on the affected GPU. (more on the line) Do: Run the branch on the M2000M under Windows through the title screen and Deku Tree, checking for device loss and correct rendering. (@fixdoes its part first: Limit the rule to the tested OS until the Windows run is available.)gpu/vk/vk_draw.cpp:9166: The extra pass boundary's cost has not been measured on the affected GPU. (more on the line) Do: Measure frame times and draw or pass counts on the affected machine in a reproducible scene, using a viable comparison or instrumentation if main cannot reach that scene.@fixcan do L1 and L2.Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes, for the reported Linux run: main lost the device at frames 350–489, while the branch reached Kokiri Forest and Deku Tree without a new Xid. This is a functional observation, not a valid paired performance comparison.
Other systems: The new policy is false for other device IDs and for NVK, so the new pass boundary is limited to the proprietary NVIDIA driver on device 0x13b0. Windows on that device remains untested; no evidence was provided for the boundary's frame-time cost.
Switches: None added, changed or removed. The automatic policy defaults on for NVIDIA proprietary driver and device 0x13b0, including Windows.
Reviewed:
b0c0138ff5against22d0d20098: Read the repository rules and PR template, the complete diff and commit messages, and the changed draw site with pass end and restart paths. Inspected device-policy and test code around the changes; the large changed code files and test file were not read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No recorded runs, translations or generated files changed.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run, as requested. The author reports the policy test passed and identifies baseline and missing-tool failures; CI is still running.
Overlaps and merge order: Unknown; network access was not used.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -676,6 +680,7 @@ inline DevicePolicy device_policy(const DeviceFacts& f) {p.compute_builds_serial = f.driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS;p.pcache_fetch_lock = f.windows && f.intel();p.split_before_draw = f.intel();p.maxwell_bc4_pass_split = f.driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY && f.device_id == 0x13b0;L2 (should fix): The policy also enables the workaround on Windows, where the branch has not been run on the affected GPU.
When: A Windows player with device 0x13b0 takes this new pass-splitting path, but the reported successful run is on Linux.
Do: Run the branch on the M2000M under Windows through the title screen and Deku Tree, checking for device loss and correct rendering.
@ -9161,0 +9163,4 @@if (!told.exchange(true, std::memory_order_relaxed))logf("vk: Quadro M2000M: ending the pass before Deku Tree BC4 web draw %016llx",(unsigned long long)cp->key);end_pass(cmd);L3 (should fix): The extra pass boundary's cost has not been measured on the affected GPU.
When: Each matching draw can end a pass and cause a later restart, including attachment stores, reloads and barriers; the attempted benchmark produced no frame trace.
Do: Measure frame times and draw or pass counts on the affected machine in a reproducible scene, using a viable comparison or instrumentation if main cannot reach that scene.
@ -425,6 +426,8 @@ ENV = [# The rules at their edges: the fixture's expression, and its value (sizes in whole MB; -1: no limit)MB = "* policy_rule::kMB"RULES = [("([](const auto& f) { const auto p = device_policy(f); if constexpr (requires { p.maxwell_bc4_pass_split; }) return (long long)p.maxwell_bc4_pass_split; else return 0LL; }([] { DeviceFacts f{}; f.vendor_id = 0x10DE; f.device_id = 0x13b0; f.driver_id = VK_DRIVER_ID_NVIDIA_PROPRIETARY; return f; }()))", 1),L1 (should fix): The regression test checks only the hardware policy, not whether the matching draw actually ends the pass. It therefore does not protect the fix's essential behavior.
When: Removing end_pass(cmd), changing the program key, or removing the draw hook leaves both new policy cases passing, while the affected draw again runs without the workaround.
Do: Add a game-free behavioral check that exercises an open pass and the matching and nonmatching draws, verifies the boundary before the retained draw, and fails when the boundary is removed.
@fix
b0c0138ff5489b9891d1Recommendation: Approve. The code is ready: only testing is left. The reported Linux run shows the workaround getting past the device loss, but the cost of the added pass boundary on the affected GPU remains unmeasured. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
489b9891d1. I rebased it ontomain(0a124fb900). 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.
On a Quadro M2000M with NVIDIA's proprietary driver outside Windows, the change ends the current render pass before the matching Deku Tree draw. The reported Linux run reached the scene without a new Xid 31; the boundary's performance cost is unknown.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_draw.cpp:9166: The extra pass boundary's cost has not been measured on the affected GPU. When: Each matching draw can end a pass and cause a later restart, including attachment stores, reloads and barriers; the attempted benchmark produced no frame trace. Do: Measure frame times and draw or pass counts on the affected machine in a reproducible scene, using a viable comparison or instrumentation if main cannot reach that scene.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (5; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported Linux device-loss case: the baseline lost the device at frames 350–489, while the branch reached Kokiri Forest and the Deku Tree. There is no valid paired performance comparison.
Other systems: The policy excludes Windows, other device IDs and other drivers. Windows users with the reported device loss do not receive the workaround; the updated fixture covers the policy and draw hook but has not been reported as run.
Switches: None added, changed or removed.
Reviewed:
489b9891d1against0a124fb900: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the relevant policy and draw changes, the fix diff, and the device-policy fixture and callers. Skimmed the standards and the other changes included in the base diff; the large draw file and other changed files were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The reported Linux game run reached the affected scene; the updated fixture and CI have not yet been reported on this head.
Overlaps and merge order: Unknown; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
WIP: fix(vk): work around Maxwell BC4 pass device lossto fix(vk): work around Maxwell BC4 pass device loss