Repository navigation
fix(shader): call load_bda_span outside read_bda_span's per-lane selection - #22774
Conversation
…ction read_bda_span calls the DontInline load_bda_span from one arm of a per-lane selection and runs the dword fallback, which calls read_bda_dword_bytes in a loop, in the other. On NVIDIA's Blackwell driver (RTX 5090, 621.01) the lanes that take the fallback then get the results of other lanes: agc_driver_bda_device fails on every run with values read at another lane's address, and the lanes that differ change from run to run. read_bda_span now calls load_bda_span once before the selection, with the mask of used dwords for lanes that take the in-place loads and 0 for the others, so load_bda_span loads nothing for them; the selection keeps its result or runs the fallback. load_bda_span stays DontInline, holds the four loads and calls nothing, as 8c04efc requires for the drivers that hang when the loads are inlined into the selection. Probe, loads, lookups, faults and stops are unchanged for every lane. The contract test checks that read_bda_span calls load_bda_span outside every selection and loop, since CI runs on lavapipe, which does not show the fault. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ran the BDA suites on NVIDIA's proprietary Linux driver with the Khronos validation layer, since the description's layer run is on Windows. Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
No new AI-assisted: yes (Claude Code) |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
I am reviewing 1f9ddd3. The change reads right to me: load_bda_span now runs for every lane, and lanes that are unmapped or unaligned pass mask 0, so they load nothing. The open question is the driver. Main passes agc_driver_bda_device on a 5080 with 610.88 but fails it on a 5090 with 621.01, so the fault may follow the 621.x driver rather than Blackwell. @zarmstrong, or anyone from #22773 with a Blackwell card: could you run this at exactly 1f9ddd3 and post the driver version? Ideally on a 621.x driver: On our side I am running the same tests and the flat and global load suites on an RTX 4090, plus a Windows run on an RTX 4050 laptop. |
milescoviello
left a comment
There was a problem hiding this comment.
Reviewed head 1f9ddd3783 by reading, and ran agc_driver_bda_device on an older NVIDIA generation.
Run: Windows 11 VM, GeForce GT 1030 (Pascal), NVIDIA 582.78, WinLibs GCC 16.2.0 POSIX UCRT, Ninja, Release, ANYPS5_REQUIRE_VULKAN=1.
main8ba52d0287and this PR merged onto it both passagc_driver_bda_device3 of 3 runs, so the uniform-call shape doesn't regress on Pascal.- Pascal doesn't show the Blackwell fault, so this only covers the no-regression side.
Reading SpirvBdaRead.cpp:
- Lanes that fall back load nothing. The single
load_bda_spancall passesSelect(wide, used, 0). With a used mask of 0, each of the four loads is inside its ownEmitValueOrZeroIfCondition, so those lanes never form or dereference a pointer. - Inputs are unchanged.
physicalandfirstBytesreaching the call for those lanes is harmless, since they're only used under the per-dword condition. - The result is the same as before. The
widelanes takeloadedand the others run the unchanged dword fallback. The coherent variant goes through the sameDefineBdaSpanReadFunction, so it gets the same shape. - The new contract in
BdaContracts.cpppins that shape (the call outside every selection and loop) on lavapipe CI, where the fault can't be observed.
No changes needed from my side.
AI-assisted: yes
|
Older-driver regression check on an RTX 4090, NVIDIA Linux driver On each revision, All 30 executions per revision used the 4090 with Khronos validation 1.4.341 loaded and the AnyPS5 shader cache disabled. No skips, device losses, or AI-assisted testing and reporting. |
|
Ran at exactly
The layer was inserted in every run, there were no On driver versus architecture, the reports so far:
So it appears to need both Blackwell and a 621.x driver: 610.88 on Blackwell passes, and 621.01 on Ada passes. AI-assisted: yes (Claude Code) |
|
Paired Windows/Blackwell validation on an NVIDIA GeForce RTX 5060 with driver 616.64. Windows 11 Home 25H2 (26200.9711), WinLibs GCC 15.2.0 r7, Release. I compared
The suite covered The baseline already passes on this setup, so these results give regression coverage for driver 616.64. The original reproduction in #22773 used an RTX 5090 with 621.01. The two additional AI-assisted: yes |
|
A data point from another Blackwell card on a newer driver: on an RTX 5060 Ti with 621.24,
The failure message and anchor are the same as in #22773, so 621.24 still has the problem, at least on this card. It adds a row to the driver table above: RTX 5060 Ti (Blackwell), 621.24, System: Windows 11 Pro for Workstations 10.0.26300, Intel Core i9-14900K, NVIDIA GeForce RTX 5060 Ti ( Steps, for each of the two commits, built in a separate checkout with Run 10 times in a row per build, on 2026-11-18. AI-assisted: yes (Claude Code) |
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
|
Verified on a third Blackwell card, under Linux, with a driver older than the one in the issue. NVIDIA GeForce RTX 5060 Ti (
This also puts the driver boundary below 621: 610.88 passes on an RTX 5080 (#22773), 620.70.06 fails on Linux on this card, 621.01 fails on the RTX 5090. The fault is not specific to the 621 series, and not to Windows.
Not tested: Windows, an AMD GPU, and driver 621.01. AI-assisted: yes. |
|
RTX 5080 on driver 617.14, head Setup: base AI-assisted: yes (Claude Code) |
|
Confirmed on a second Blackwell card. Windows 11 Pro (build 26300), WinLibs GCC 15.2.0 r7, Release,
No |
|
Ran on an Ada Lovelace card, a generation the results above don't cover yet. Setup: NVIDIA GeForce RTX 4070 Ti (AD104, Code:
The only validation output in either full run is the same 65 I also read the diff before building: it changes only the SPIR-V emission in AI-assisted: yes (Claude Code). The builds and tests ran on my machine. |
|
I checked whether the anchored read failure also occurs with validation off on an RTX 5090 Laptop (0x2c58, 621.01), using Intel Graphics (0x7d67, 101.8860) as a control on the same Windows 11 build 26200 machine. Base 34bd032 and the merge-base diff for head 1f9ddd3 were compiled and relinked using the same procedure. Vulkan was required, shader cache disabled, and the ICD pinned per adapter. On NVIDIA, base failed the anchored 32-bit, four-dword read at 0x7fff12340101 in 3/3 ordinary runs and 3/3 validation runs. The PR passed all six. On Intel both revisions passed all six runs each. With only the new contract test on the unfixed backend, the call-nesting assertion failed before device creation, as expected. This isolates the regression check from driver execution. The attachment contains the build recipe, hashes and 36 logs, including the contract controls. These comparisons establish that enabling validation is unnecessary to reproduce this failure on this laptop driver. AI-assisted (Claude and Codex). |
|
Tested on an NVIDIA Blackwell laptop GPU. This PR fixes The failing test, 3 runs each
On
Graphics tests, one run each (
The three remaining failures are the ones tracked in #22930, #22427 and #23708. Validation (
Both logs show
The builds and runs were driven with an AI assistant; the tables are measured output. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The source change moves the span loader call outside the lane selection and guards its loads with the selected mask; I found no verified blocking defect.
What I ran
Reviewed head 1f9ddd378332b86aaace2a12056025d515b6a4d1 using the prepared review bundle and repo_read.py. I did not run build or test commands; no merged-preview check was performed.
Results
| Check | Result | Note |
|---|---|---|
| Changed-line review | passed | Both changed files reviewed |
| Build and tests | not run | Author-reported results only |
| Negative control | not run | Not run in this review |
Findings
Blocking
None.
Non-blocking
- The new SPIR-V contract check covers coherent and non-coherent span reads without the stop-invocation variant. Consider adding that variant if it can be generated by
MakeBdaDwordReadTestShader.
Not verified
I did not independently verify the described GPU results, the unsupported NVIDIA driver behavior, or the author's CI and local test results. No changed files were excluded: core/libs/prx/libSceAgcDriver/tests/BdaContracts.cpp and core/shader/recompiler/SpirvBackend/src/SpirvBdaRead.cpp were read; files.json was not present in the prepared bundle.
To get this to a good state
Nothing is required. Optional: extend the SPIR-V contract coverage to the stop-invocation variant.
|
Tested on another machine: Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7 (Release,
With All four of #22774, #22508, #22950 and #23751 applied together: every AI-assisted: yes (Claude Code ran the builds and tests and wrote this comment). |
|
An Ampere row on an NVIDIA driver older than every one in "Not tested": RTX 3060 on Windows 572.16. This is the card #3291 hung on (with 591.86). No regression and no validation messages. Setup: Windows 11 Pro 10.0.26200, Ryzen 9 5900X, NVIDIA GeForce RTX 3060 ( That selects 30 tests:
All ten tests that hung in #3291 are in this set. Each side ran 5 times. The validation layer is
* The 30th,
What this does not show: I did not build the shape from before 8c04efc, so I don't know whether 572.16 hangs the way 591.86 did. This shows no regression on an older driver; it does not show that the PR avoids a hang this driver has. AI-assisted: yes (Claude Code) |
|
Tested on a second Blackwell card. This fixes Setup: NVIDIA GeForce RTX 5060 Ti, driver 621.01 (32.0.16.2101), Windows 11 build 26300, WinLibs GCC 15.2.0 (
Each column has 1 run with validation and the rest without. On Validation run: Rest of the suite: I ran the full suite ( The timeout was |
|
This PR now conflicts with AgcDriver::Graphics::Require(lookups == 2u && loops == 1u, "the dword-by-dword fallback of a " + std::to_string(dwords) + "-dword write has " + std::to_string(lookups) + " write lookups and " + std::to_string(loops) + " byte-loop calls, not one dword store looped over its dwords");
+ }
for (const bool coherent : {false, true}) {With that resolution, the fix still holds on current Setup: NVIDIA GeForce RTX 5060 Ti, driver 621.01, Windows 11 build 26300, Ryzen 5 9600X, WinLibs GCC 15.2.0 r7, Release. That pattern selects 13 tests. I ran it 3 times per build, and then ran
Every validated log shows AI-assisted: yes (Claude Code) |
# Conflicts: # core/libs/prx/libSceAgcDriver/tests/BdaContracts.cpp
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing in the inspected changes blocks merging; approval is justified by the code and author-reported GPU results, although those results were not run by me.
What I ran
Head: 27456456f4fe00394a2db86ecda85e3d70f52d10. No commands or tests were run. I read the prepared diff and both changed files at the pinned head through repo_read.py.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed files | passed | Both changed files read |
| Tests in this review | not run | GPU runs reported by author |
| Prepared-file inventory | not run | files.json was unavailable |
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently run tests or validate the reported NVIDIA/Intel GPU results. I did not inspect repository files outside the two changed files. The review folder’s files.json inventory was unavailable; manifest.json lists both changed files as included, and I read both.
To get this to a good state
Nothing is required.
|
Thanks @oneandonlydean for merging Retested the merged head I'll send the stop-variant contract check @MarcZX10 suggested as a separate follow-up once this merges. AI-assisted: yes (Claude Code) |
What
read_bda_spanchooses per lane between the span's in-place loads, a call to theDontInlineload_bda_span, and the dword fallback, which callsread_bda_dword_bytesin a loop. On NVIDIA's Blackwell driver (RTX 5090, 621.01) the lanes that take the fallback then get other lanes' results, soagc_driver_bda_devicefails on every run (#22773). The diagnosis is in the issue.read_bda_spannow callsload_bda_spanonce before the selection, passing the used-dword mask for lanes whose span is mapped and aligned and 0 for the others, soload_bda_spanloads nothing for them. The selection keeps that result for the in-place lanes and runs the fallback for the rest.load_bda_spanitself is unchanged:DontInline, the four loads, no call, as 8c04efc requires for the drivers that hung with the loads in the selection (#3291, #4975). Probe, loads, lookups, faults, stops and theAPS5_BDA_BYTE_READSpath are unchanged for every lane.BdaContracts.cppchecks thatread_bda_spanandread_bda_span_coherentcall their load function outside every selection and loop. CI runs on lavapipe, which does not show the fault, so without the check a later change could restore the shape unnoticed. Withmain'sSpirvBdaRead.cppthe check fails (run on the Intel GPU; it reads only the generated SPIR-V).Tested
Windows 11 Pro 10.0.26200, i9-13900K, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, every execution test built.main72cf170a25and this branch on it.ctest --test-dir build -R "agc|shader|video_out" -V -j 8withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_GPU=RTX 5090,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer(validation layer 1.4.363, Vulkan SDK 1.4.363.0), on the RTX 5090. The OBS, Overwolf and Twitch implicit layers are disabled withVK_LOADER_LAYERS_DISABLEon both sides (see #20011).mainagc_driver_bda_device,agc_driver_msaa_dcc_unwatch,agc_driver_stencil_plane_memory,agc_driver_store_over_untrackedagc_driver_msaa_dcc_unwatch,agc_driver_stencil_plane_memoryInsert instance layer "VK_LAYER_KHRONOS_validation"was not found but was requestedVUID-,SYNC-HAZARD-,UNASSIGNED-agc_driver_bda_deviceon the RTX 5090:mainfails 10 of 10 (an anchored BDA read differs from the same read through the lookups at anchor 0x7fff12340101 + 0 + (0), 32 bits, 4 dwords); this branch passes 10 of 10, with the validation layer and noVUID-lines.main.agc_shader_memoryandagc_shader_memory_coherent_atomic_loads, which check thatload_bda_spanstaysDontInlinewith its four loads and is called once from the span read function: pass.agc_driver_store_over_untrackedfails intermittently on both sides on this machine (4 of 10 runs without the layer on9b60c84343), so its pass here is not from this change.agc_driver_stencil_plane_memoryis agc_driver_stencil_plane_memory fails on Windows hardware GPUs: "a consumed stencil clear was lost on a read-only rebind" #22427.agc_driver_msaa_dcc_unwatchfails on both sides.agc_driver_upload_cache_read_only_flushdoes not build on Windows (setenv, fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899).Not tested: the NVIDIA drivers that hung in #3291 and #4975 (591.86, 590.48.01, 595.97, 596.36, 610.x). The loads stay in their own
DontInlinefunction, but its call now runs for every lane, so a run ofagc_driver_bda_span_reads,agc_driver_scalar_wide_loadsandagc_driver_flat_apertures_*on one of those drivers would confirm they still pass.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)agc_driver_bda_deviceonly)🤖 Generated with Claude Code