Repository navigation
fix(shader): test an empty exec mask in s_subvector_loop_begin with one compare - #7623
Conversation
…ne compare Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
|
Another AMD driver, since the description lists other AMD drivers as not tested. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
This driver didn't show the AI-assisted |
|
The Radeon 860M follow-up is useful additional coverage: it passes the six listed tests 3/3 with the AMD exclusion in place, and the forced- |
|
@MarcZX10 Added: @LeandroLP23's Radeon 860M run is under Tested and on the |
jotitadev
left a comment
There was a problem hiding this comment.
An NVIDIA run of agc_driver_subvector_loop, since NVIDIA is listed under "Not tested" and CI's lavapipe skips the test.
Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02; it reports robustBufferAccess2, and only the AMD Windows driver is excluded from it) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host. PR merged onto main 84c1a4d9a (clean). ANYPS5_NO_SHADER_CACHE=1, -j1 --timeout 30.
agc_driver_subvector_loop |
RTX 3070 | lavapipe |
|---|---|---|
head f65b4bbe9 |
Passed, 3 runs | Skipped |
ControlFlowInstructions.cpp from main (two compares) |
Passed | Skipped |
So the single compare gives the same result on NVIDIA, and NVIDIA's compiler handles the two-compare form correctly too. The exec_lo/exec_hi miscompile looks specific to AMD's Windows driver, as described.
Not run: Windows, AMD, Intel, the layered-volume tests from #7351.
GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Checked the diff: |
boykopovar#7351 kept robustBufferAccess2 off on AMD's proprietary driver because enabling it broke agc_driver_layered_volume_draw, agc_driver_layered_volume_vertex and agc_driver_subvector_loop on an RX 6700 XT. With boykopovar#7623 and boykopovar#7828 on main, those tests pass with the feature on, in either library-mode order. This reverts 48b394d and keeps the record of boykopovar#7623's empty-mask test in the s_subvector_loop debt entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
enabling it broke agc_driver_layered_volume_draw, agc_driver_layered_volume_vertex and agc_driver_subvector_loop on an RX 6700 XT. With boykopovar#7623 and boykopovar#7828 on main, those tests pass with the feature on, in either library-mode order. This reverts 48b394d and keeps the record of boykopovar#7623's empty-mask test in the s_subvector_loop debt entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
enabling it broke agc_driver_layered_volume_draw, agc_driver_layered_volume_vertex and agc_driver_subvector_loop on an RX 6700 XT. With boykopovar#7623 and boykopovar#7828 on main, those tests pass with the feature on, in either library-mode order. This reverts 48b394d and keeps the record of boykopovar#7623's empty-mask test in the s_subvector_loop debt entry. Co-Authored-By: Claude <noreply@anthropic.com>
What
s_subvector_loop_beginskips the loop when the whole wave64 exec mask is zero. The recompiler tested that as two 32-bit compares joined by a logical and:exec_lo == 0 && exec_hi == 0. It now tests it as one compare:(exec_lo | exec_hi) == 0. It is the same condition, andenteredand the newexec_histill useexec_lo == 0as before.AMD's Windows driver compiles the two-compare form wrongly once the guest's exec mask comes from a loaded value. This is the
agc_driver_subvector_loopfailure in #7376 (lane 0 exec hi after the loop is 0, expected 4294967295). #7351 hides it by keepingrobustBufferAccess2off on that driver. With the single compare, the test passes on that driver withrobustBufferAccess2on. The exclusion stays: the two layered-volume failures in #7351 are a separate question (#7376), so this PR does not change which devices get the feature. The debt entry for the guest memory load guards now records thatsubvector_loopis no longer one of the failures.The pipeline's ISA, read back with
VK_KHR_pipeline_executable_properties, shows where it goes wrong. Case "initial exec high half": the guestv_cmpxleavesexec_lo0 andexec_hiset.target.robustBufferAccess2 = false(test passes): the low and high halves are tested separately.target.robustBufferAccess2 = true(test fails): the load's lane guard is now ans_and_b64in the same block. Bothexec_lo == 0andexec_hi == 0are taken from that instruction's SCC, which says whether all 64 bits are zero. Soexec_lo == 0comes out false, andexec_hiafter the begin instruction is selected to 0 (s_cselect_b32 s22, 0, s5).robustBufferAccess2on (test passes):exec_lo == 0is a 32-bit compare again, and the empty-mask test iss_or_b32plus a compare.The two SPIR-V modules differ only around the guest load: a selection in one, an
OpSelectover a guarded index in the other, as @Mouad-Scriptz-0 found on #7376. The begin instruction's ops are the same, and both modules passspirv-val --target-env vulkan1.3.Tested
Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,APS5_NO_PIPELINE_JOURNAL=1. Eachsubvector_looprun used a renamed copy of the test executable, so AMD's per-executable pipeline cache started empty:agc_driver_subvector_looponmain218aa8f00, withRobustBufferAccess2Usablechanged locally to returntrue(that change is not part of this PR):lane 0 exec hi after the loop is 0, expected 4294967295;agc_driver_subvector_loopwith this change and the exclusion kept, as merged: passes.The three ISA listings above come from
main3e3e8b905, read back through a local capture hook that is not part of this PR.Full
ctest --parallel 4 --timeout 120onmain3e3e8b905, with an earlier form of this change that also kept the now unusedexec_hi == 0compare, androbustBufferAccess2forced on: 1479 tests. These fail:agc_driver_lds_mixed_width_atomics(fix(shader): release the LDS lock with an exchange and drop fences inside it #6976),agc_driver_lds_lock_budget(AGC: AMD device-backed LDS lock-budget case returns half of expected sum #7344), andhardware_oracle_compare, which times out on this machine's Python startup;agc_driver_layered_volume_drawandagc_driver_layered_volume_vertex, the cache-order failures described on AGC: root cause of the AMD proprietary failures behind therobustBufferAccess2exclusion (#7351) is still open #7376;agc_robust_buffer_access, whose table expects AMD to be excluded.agc_driver_subvector_loopandagc_driver_layered_volume_vertex_no_gplpass.AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001, Windows 11 26300), run by @LeandroLP23 on
mainc3591adf9with this PR and six others merged (comment):agc_driver_subvector_loop,agc_driver_layered_volume_draw,agc_driver_layered_volume_vertex,agc_driver_lds_lock_budget,agc_driver_lds_mixed_width_atomicsandagc_robust_buffer_accesspass 3 of 3;RobustBufferAccess2Usableforced totrue, from renamed copies of the test executables:agc_driver_subvector_loop,agc_driver_layered_volume_draw(with and without--vertex-only) andagc_driver_lds_mixed_width_atomics --lock-budgetpass 2 of 2;agc_driver_layered_volume_vertex_no_gplfails there the same way onmain(agc_* tests: 3 of 483 fail on AMD Radeon RX 6400, pass on NVIDIA RTX 4080 SUPER #5271), so it is not from this PR. That driver did not show thesubvector_loopfailure before this change either (AGC: root cause of the AMD proprietary failures behind therobustBufferAccess2exclusion (#7351) is still open #7376), so this run shows no regression on a second AMD driver, not the fix itself.Not run: the full suite on
218aa8f00.python tools/check_conventions.py --base origin/mainwith this title and body passes.NVIDIA RTX 3070 (595.99.02, Ubuntu 26.04), run by @jotitadev on f65b4bb merged onto
main84c1a4d9a:agc_driver_subvector_looppasses 3 runs, and passes withmain's two-compare form too, so the miscompile is specific to AMD's Windows driver.Not tested: AMD drivers other than these two, and Intel hardware runs of
subvector_loopwith this change. CI's lavapipe skips that test because its subgroup is too small.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)🤖 Generated with Claude Code