rdna2spirv: v_writelane_b32 reads its destination (SHADER-768) #175

Closed
github-bot wants to merge 4 commits from gh-pr/175/head into gh-pr/175/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:35 UTC · original
ubiquitarianism:old-pr/9910 → main · +112 −12 · 2 files · 4 commits · closed without merging

Carried over from old PR 9910 by LouisRiverstone in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9910, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
LouisRiverstone: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

SHADER-768, from the "Up for grabs" table in #4257: read_before_write_vgprs counted v_writelane_b32 as a full write of its destination.

v_writelane_b32 vD, sSRC, sLANE writes one lane of vD and keeps every other lane's value. The translator's own emission loads the old vD and selects per lane. So the value vD held before is read, and a shader whose first touch of a VGPR is a writelane should report that VGPR as read before written.

Re-submission of #4297. #4297 was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current main.

Checked on #4297 by: theswiss24 (RTX 4070), JRamos1993 (RTX 5090), kapitche (Linux), javdc (Steam Deck LCD), mrloic (RTX 4060), wavehs (Apple M3 Pro), TG0000 (RX 6800), matheusfermiano-source (main 867d922f0)).

No game files.

AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with main.

**@⁠Andretuta** on GitHub · 2026-11-24 02:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/175) `ubiquitarianism:old-pr/9910` → `main` · +112 −12 · 2 files · 4 commits · closed without merging > Carried over from **old PR 9910** by `LouisRiverstone` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9910`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `LouisRiverstone`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): SHADER-768, from the "Up for grabs" table in `#4257`: `read_before_write_vgprs` counted `v_writelane_b32` as a full write of its destination. `v_writelane_b32 vD, sSRC, sLANE` writes one lane of `vD` and keeps every other lane's value. The translator's own emission loads the old `vD` and selects per lane. So the value `vD` held before is read, and a shader whose first touch of a VGPR is a writelane should report that VGPR as read before written. Re-submission of `#4297`. `#4297` was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current `main`. Checked on `#4297` by: theswiss24 (RTX 4070), JRamos1993 (RTX 5090), kapitche (Linux), javdc (Steam Deck LCD), mrloic (RTX 4060), wavehs (Apple M3 Pro), TG0000 (RX 6800), matheusfermiano-source (main 867d922f0)). No game files. AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with `main`.
v_writelane_b32 writes one lane and keeps the others. read_before_write_vgprs
counted it as a full write. Counting every writelane destination as a read is
too much the other way (@shdann on #4297: a VS spilling an SGPR into one lane
of v40 around the fetch call was rejected with 'fetch mapping'). The kept
lanes are now carried: they become a read when something other than
v_readlane_b32 reads the register before a full write. reg_reads_writes (per
slice) counts the destination as read. DST_ALSO_READ names the accumulating
ops both functions list.

tests/semantic/test_writelane_read_before_write.py: carried and used lanes,
the readlane spill, a full write ending the carry, shdann's VS spill and PS
cases end to end.
# Conflicts:
#	tools/rdna2spirv.py
# Conflicts:
#	tools/rdna2spirv.py
# Conflicts:
#	tools/rdna2spirv.py
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:47:28 +00:00
github-bot closed this pull request 2026-11-26 08:47:28 +00:00
Author
Owner

@⁠LouisRiverstone on GitHub · 2026-11-24 11:10 UTC · original

Taken over by its author in #658 (rebased on main). This draft can be closed.

**@⁠LouisRiverstone** on GitHub · 2026-11-24 11:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/175#issuecomment-7129746430) Taken over by its author in #658 (rebased on main). This draft can be closed.
Author
Owner

@⁠ubiquitarianism on GitHub · 2026-11-24 16:17 UTC · original

Closing: replaced by #658, which is merged.

**@⁠ubiquitarianism** on GitHub · 2026-11-24 16:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/175#issuecomment-7137432670) Closing: replaced by #658, which is merged.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.