Repository navigation
fix(shader): v_writelane_b32 ignores EXEC - #411
Merged
oneandonlydean merged 1 commit intoOct 4, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
V_WRITELANE_B32 writes the selected lane regardless of EXEC, but the translation routed it through the exec-masked VGPR write, so a spill to an inactive lane was dropped. The WriteLane test now writes lane 5 while only lane 0 is active. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
9 tasks done
This was referenced Oct 2, 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
v_writelane_b32writes one lane of a VGPR and ignores EXEC (RDNA2 ISA,V_WRITELANE_B32). The translation wrote its result through the exec-masked VGPR write, so it becameSelect(exec bit of LaneId, WriteLane(...), old). A write to a lane that is inactive at that point was dropped.Compilers use
v_writelane/v_readlaneto spill SGPRs into VGPR lanes inside divergent control flow, where the spill lane is often inactive. Besides the wrong value at run time, the exec select hid the WriteLane fromReadLaneEliminator, so descriptors reloaded withv_readlanestayed lane-dependent. Draws then failed withGetSamplerResource dword 0 is not a valid runtime value; chain: ReadLane(SelectU32(INotEqual32(... LaneId ...), WriteLane(...), ...)).The WriteLane result now goes straight to the destination VGPR. The SPIR-V lowering already selects per invocation on
SubgroupLocalInvocationId == lane.Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
ctest: all tests pass.agc_driver_write_lanenow setsexec_lo = 1around the write to lane 5. Without the fix it fails (lane 5 keeps its old value); with it, it passes.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 repositorytests/execution/WriteLane.cpp(and the WriteLane lane wrap); whichever merges second keeps both changes🤖 Generated with Claude Code