fix(vk): automatically query VK_EXT_device_fault on device lost when NV checkpoints and buffer markers are absent #2117
Open
Cloudiny wants to merge 1 commit from
Cloudiny/vk/auto-device-fault-report into main
pull from: Cloudiny/vk/auto-device-fault-report
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2834
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2117
Loading…
Reference in a new issue
No description provided.
Delete branch "Cloudiny/vk/auto-device-fault-report"
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
In
gpu/vk/vk_draw.cpp(checkpoints_report()), line 3613 logs"vk: device lost: reading the fault info (RX_VK_CHECKPOINTS=1 for markers)"when!dev.checkpoints && !marker_words, yetFaultLastat line 3614 still gateddevice_fault_report()solely onstd::getenv("RX_VK_FAULT_INFO"). That guard exists because on NVIDIA (dev.checkpoints == true),vkGetDeviceFaultInfoEXTcan hang before checkpoint data finishes reporting.When both
dev.checkpointsandmarker_wordsare false (typical on AMD RADV / Intel whenRX_VK_CHECKPOINTS=1is not set), invokingdevice_fault_report()automatically capturesVK_EXT_device_faultaddresses and vendor fault info on the first crash without needing a manual reproduction run withRX_VK_FAULT_INFO=1.NVIDIA & Cross-Platform Compatibility
dev.checkpoints == true) or when buffer markers are active (marker_words != nullptr):device_fault_report()remains gated onRX_VK_FAULT_INFO, preserving the NVIDIA hang guard.Files Changed
gpu/vk/vk_draw.cppTest Plan / Verification
git apply --checkagainstmain(ca082bf).gpu/vk/vk_draw.cpp(clang++ -fsyntax-only -std=gnu++20 -Wall -Wextra -Wno-missing-field-initializers -Wno-c++11-narrowing -DVK_NO_PROTOTYPES): 0 errors, 0 warnings in modified lines.Reading the fault info by default when there is nothing else to read is a good idea: on AMD and Intel a first crash would then log the faulting address without a second run. Two things before it can go in.
should fix
gpu/vk/vk_draw.cpp:3628:!dev.checkpoints && !marker_wordsis not the same as "not NVIDIA".dev.checkpointsis on by default, butRX_VK_CHECKPOINTS=0turns it off (gpu/vk/vk_main.cpp:272, documented indocs/development.mdas the way to run without checkpoints). On NVIDIA with that switch set, this change callsvkGetDeviceFaultInfoEXTautomatically, which is exactly the call the comment four lines above says has not come back after a fault on NVIDIA. That turns a crash report into a hang for someone who is already debugging a lost device. Gating on the vendor, the way the rest of the renderer does, keeps the NVIDIA guard whatever the switches are:should fix (merge conflict): the PR conflicts with main in
gpu/vk/vk_draw.cpp. #2042 replacedstd::getenv("RX_VK_FAULT_INFO")withenv_on(...), and main now also callsdevice_fault_report()early, at the top ofcheckpoints_report(), whenRX_VK_FAULT_INFOis set. After rebasing, please useenv_onas above, soRX_VK_FAULT_INFO=0means off like the other switches.minor: the PR hasn't been tested on a real lost device. One is hard to provoke, so I won't insist, but one line from an AMD or Intel log with the new
vk: device fault: ...output (orVK_EXT_device_fault not availablewhere the driver lacks the extension) would show the path works end to end.The safety claim doesn't hold. With
RX_VK_CHECKPOINTS=0(vk_main.cpp:282-283), NVIDIA has neitherdev.checkpointsnormarker_words, so this would callvkGetDeviceFaultInfoEXTby default on the driver the comment says it hangs on. Keying it on vendorID != 0x10DE would be safer.Also:
dev.device_faultisn't combined withfault.deviceFaultafter the feature query (vk_main.cpp:369-370). That gap predates this PR, but it matters once the call is on by default.env_on("RX_VK_FAULT_INFO")atvk_draw.cpp:3776, andcheckpoints_report()now already callsdevice_fault_report()once at:3767.This now conflicts with main in
gpu/vk/vk_draw.cpp. Could you merge main into the branch (or rebase) when you get a chance? I'll take another look once it's up to date.