Repository navigation
fix(shader): load a BDA span in place from its own function - #5022
Merged
oneandonlydean merged 1 commit intoOct 13, 2026
Merged
Conversation
read_bda_span chooses between the span's in-place dword loads and its per-dword byte fallback, which calls read_bda_dword_bytes. Each shape of that choice so far hangs a group of NVIDIA drivers: a dispatch never finishes and the device is lost. As the two arms of one selection, with the loads emitted in the arm, it hung drivers 591.86 and 590.48.01 when lanes took both arms (boykopovar#3291). As two selections, the loads under the span's condition and the fallback under its negation (boykopovar#4759), it hangs 595.97, 596.36, 610.62, 610.74 and 610.57.04 (boykopovar#4975). The loads now live in load_bda_span, a DontInline function that calls nothing, and read_bda_span is one selection again: one arm calls load_bda_span, the other is the fallback as before. Probe, loads, lookups, faults and stops are unchanged for every lane. On an RTX 4090 (Linux, driver 610.57.04) the two-selection shape hangs agc_driver_scalar_wide_loads and agc_driver_flat_apertures_0..13 in a build with SPIRV-Tools, and agc_driver_bda_span_reads and agc_driver_pixel_interlock in a build without. All pass with this change in both builds. Drivers 591.86, 590.48.01, 595.97, 596.36, 610.62 and 610.74 are not tested; a shape with the loads in their own DontInline function was reported passing on 591.86 in boykopovar#3291. agc_shader_memory now requires that a span read function holds no load and calls its load function once, and that the load function holds the four loads and no call. Refs boykopovar#4975
9 tasks done
10 tasks done
Contributor
|
Driver 595.97, which the commit message lists as not tested, passes with this change, in a default build and in one with SPIRV-Tools. Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU (NVIDIA 595.97) and an Intel Raptor Lake-S iGPU (32.0.101.6790),
Written with AI assistance. |
This was referenced Oct 13, 2026
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
read_bda_spanchooses between a span's in-place dword loads and its per-dword byte fallback, which callsread_bda_dword_bytes. Both shapes of that choice so far hang a group of NVIDIA drivers (a dispatch never finishes and the device is lost), and #4975 shows that reverting #4759 only moves the hang:The loads now live in
load_bda_span, aDontInlinefunction that calls nothing, andread_bda_spanis one selection again: one arm callsload_bda_span, the other is the fallback as before. Neither earlier shape is emitted: the selection is single, and no function holds both the in-place loads and the nested calls. The probe, the loads, the lookups, the fault records and the invocation stops are unchanged for every lane. A read site inmainis unchanged, so its size is too.This is the shape described in a comment on #3291 as passing on 591.86 (RTX 4060 Laptop) with no pipeline creation cost over
main(1.95 s and 7.2 s for 256 and 512 read sites). That was another implementation of it, not this commit.docs/dev/debt/shader.md: the BDA span reads entry now lists both hanging shapes with their drivers and says where the current one is measured.Tested
Linux (CachyOS, kernel 7.2, GCC 16.2), RTX 4090, NVIDIA 610.57.04, Release,
BUILD_TESTING=ON, built with-DANYPS5_ENABLE_SPIRV_TOOLS=ONandOFF.mainwas measured at c2565f0 and the branch is on cac4e96; nothing undercore/shaderorlibSceAgcDriverdiffers between the two.The 23 tests of #4759 plus
agc_driver_scalar_wide_loads, run one at a time withANYPS5_NO_SHADER_CACHE=1:main(1 run)agc_driver_scalar_wide_loadsandagc_driver_flat_apertures_0to_13hangagc_driver_bda_span_readsandagc_driver_pixel_interlockhangmainwithSpirvBdaRead.cppfrom e51428b^1 (4 of the tests)agc_driver_bda_device)[gpu] recorded batch still running on the GPU after 5 s, logs one NVIDIA Xid 109 in the kernel log and ends inguest allocation ... is still pinned by GPU work or an import. No Xid with the branch.vkQueueSubmit recorder: Vulkan result -4, Xid 109), in a build without SPIRV-Tools. Bisected to e51428b: its parent doesn't, andmainwith only fix(shader): split a BDA span read's in-place loads from its fallback #4759 reverted ran 5 times without it. This branch was not run in that title.agc_driver_scalar_wide_loadspassesspirv-val --target-env vulkan1.3in all three shapes; nothing invalid was found in the hanging one.agc_shader_memory, "BDA read functions": a span read function must hold no load and call its load function once, and the load function must hold the four loads and no call. Onmainit fails withthe span load function does not hold the four in-place loads and nothing else. It needs no GPU, so it runs on lavapipe CI.ctest -R "agc|shader"with SPIRV-Tools on: 476 of 476 pass, no Xid. Onmainthe 15 hangs above are the failures.python3 tools/check_conventions.py --base origin/mainandgit diff --checkpass.Not tested: drivers 591.86, 590.48.01, 595.97, 596.36, 610.62 and 610.74, any Windows build, AMD, Intel, and any title. A run on one driver of each group would settle it; the #4759 comment above offers one on 595.97 and a #4975 comment one on 610.74.
#4976 and #3655 change the same function, so whichever merges later needs a rebase.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)