fix(shader): v_writelane_b32 ignores EXEC #411
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/411"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-02T21:56:37Z.
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