Repository navigation
fix(shader): drop masked selects proven unobserved through whole quad mode - #3391
Conversation
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the analysis, the reasoning in MaskedSelectEliminator looks sound and agc_masked_select passes here (and fails without the change). One blocker:
agc_driver_gated_dispatch_capturefails with this PR merged onto currentmain(3 of 3 runs, RADV):radv/amdgpu: The CS has been cancelled because the context is lost. This context is guilty of a hard recovery, thenthe gated submissions did not finish. WithMaskedSelectEliminator.cppreverted tomainthe same test passes (2.7 s). So a select that is observed is being dropped in that shader, or the generated code hangs. The PR text says the whole suite wasn't run; please runctest -R agc_driverand fix.- Possible lead:
withinQuadsOfis used inImplications::Impliesfor every stage, while only the sample exemption (quadMasked) is limited toPixel. Check whether the gated-dispatch compute shader reaches the new path, and add a test for that case.
df63260 to
21c0c3b
Compare
|
Thanks for the review. Rebased onto current
If the hang still shows up on your RADV box with this rebase, the shader logs from |
… mode A lane set contained in X is contained in WQM(X). Containment is proven through BitwiseAnd and through ballots evaluated in the uniform entry blocks, where every invocation is active. Under a whole quad mode mask the masked lanes form whole quads, so implicit-LOD pixel samples, which only read their own quad, do not observe them. This removes the selects that kept the packed pixel ancillary input alive after its fields were extracted in GTA V (PPSA04264) pixel shaders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV
21c0c3b to
db1f3c3
Compare
|
Thanks for the updated IR trace and the compute regression cases. That addresses the specific hypothesis that |
|
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.
|
|
RADV results for @MarcZX100's question. Setup: Debian 12, GCC 14.4, Release,
So I can't reproduce the hard recovery on this RADV. If it came from a newer Mesa or another GPU, the Mesa version from that run would tell. A second title this fixes: Dead Cells (PPSA15552), on a device without AI-assisted: yes (Claude Code). |
|
Thanks a lot @hansjm10, both for the RADV runs and for the Dead Cells shader ( @adriadam10: with these results (13/13 on RADV gfx1036, and the same 10 failures with and without the PR across the full suite), could you rerun on your box at |
adriadam10
left a comment
There was a problem hiding this comment.
Checked on RADV: the PR merged onto current main, scoped build and ctest of libSceAgc/libSceAgcDriver 406/406, including both agc_driver_gated_dispatch_capture variants. The earlier context loss no longer reproduces here, and @hansjm10's 13/13 agrees. agc_masked_select fails without the change and passes with it. The WQM-superset and quad-local-sample proofs fall back to "observed" on any shape they don't recognise, so the elimination is conservative. Merging.
What
GTA V (PPSA04264) stops on current
main(2220eff) at its first pixel shaders. Replaying the captured requests withagc_shader_replay:The
SelectU32writes a copy of the ancillary VGPR under a whole quad mode exec mask,WQM(X), whereXis a ballot of the live lanes taken in the entry block. Its value is read only by lanes insideX, and by implicit-LOD samples. The masked-lane walk could not prove either case, so the select kept the whole ancillary word alive.It also fixes Dead Cells (PPSA15552) pixel shader
0x21a23e700, on devices withoutVK_KHR_fragment_shader_barycentric, as reported by @hansjm10 below. It stopped withthe emulated barycentric inputs exceed 32 locations, because a select under thes_wqmexec kept the I barycentric alive. With the change it takes the host-interpolation path.MaskedSelectEliminatornow proves both:Xis contained inWQM(X). Containment is proven throughBitwiseAndand through ballots evaluated in the uniform entry blocks, where every invocation is active.WQMmask the masked lanes form whole quads. An implicit-LOD pixel sample only reads its own quad, so it does not observe them.With the change, both shaders recompile (4456 and 1840 SPIR-V words).
Tested
Windows 11, MinGW GCC 15.2.
agc_masked_select_tests:main, on the new cases ("an implicit-LOD pixel sample under whole quad mode reads no masked quad and drops the select", "a write under whole quad mode read only by the lanes it was widened from drops the select");agc_shader_replayon the two GTA V requests above: they fail onmainand recompile with the change.python tools/check_conventions.py --base upstream/mainpasses.ctest -R "agc_driver|agc_masked"(298 tests, RTX 4090): 297 pass;agc_driver_emulated_color_comparefails the same way onmain.agc_driver_gated_dispatch_capturepasses 13 of 13 atdb1f3c38e, and the fullagc_driver|agc_maskedrun has the same 10 failures with and without the change.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV