[PR #265] [MERGED] rdna2spirv: fix Wave64 halves partial destination read-modify-write #315

Closed
opened 2026-11-26 20:17:29 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/265
Author: @kotekompotek
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: contribution/wave64-halves-partial-dst-rmw


📝 Commits (1)

  • ad1e53e wave64_halves: preserve destination taint on partial writes and reject asymmetric DPP row_mask

📊 Changes

2 files changed (+443 additions, -3 deletions)

View changed files

➕ tests/semantic/test_wave64_halves_partial_dst.py (+372 -0)
📝 tools/wave64_halves.py (+71 -3)

📄 Description

…t asymmetric DPP row_mask

Fixes partial-destination writes in tools/wave64_halves.py that dropped prior taint and falsely marked divergent VGPRs uniform (miscompiling v_readlane_b32 in rdna2spirv.py):

  • Track destination read in operands() for SDWA dst_unused:UNUSED_PRESERVE with sub-dword dst_sel, single-half 16-bit VALU ops (including 8-byte VOP3 / _nc_16 / v_interp_p2_f16), partial-lane DPP (row_mask/bank_mask != 0xf or bound_ctrl:0), v_fmac_legacy_f32, and partial d16 loads.
  • Flag half-asymmetric DPP row_mask ((row_mask & 3) != (row_mask >> 2)) and dpp8 in transfer().

Verified locally (CPU-only):

  • tests/semantic/test_wave64_halves_partial_dst.py (13 OK)
  • tests/semantic/test_wave64_halves_soundness.py (30 OK)
  • tests/semantic/test_wave64_halves.py (73 OK)
  • tests/semantic/test_wave64_cross_half.py (9 OK)
  • tests/semantic/test_wave64_subgroup_ops.py (6 OK)
  • pytest tests/test_wave64_halves_fixtures.py tests/test_wave64_graphics_scan.py (25 passed, 1 skipped)
  • docs, line-ending, resource hygiene, tool startup, compileall, git diff --check

Conflicts:

docs/design.md

Conflicts:

tools/wave64_halves.py

Claimed in the coordination issue as:

Depends on:

What and why

Tested

AI-assisted:

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/265 **Author:** [@kotekompotek](https://github.com/kotekompotek) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `contribution/wave64-halves-partial-dst-rmw` --- ### 📝 Commits (1) - [`ad1e53e`](https://github.com/ubiquitarianism/leonida/commit/ad1e53e42b8c1a40af44b2f1bd7261716dca243e) wave64_halves: preserve destination taint on partial writes and reject asymmetric DPP row_mask ### 📊 Changes **2 files changed** (+443 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `tests/semantic/test_wave64_halves_partial_dst.py` (+372 -0) 📝 `tools/wave64_halves.py` (+71 -3) </details> ### 📄 Description …t asymmetric DPP row_mask Fixes partial-destination writes in tools/wave64_halves.py that dropped prior taint and falsely marked divergent VGPRs uniform (miscompiling v_readlane_b32 in rdna2spirv.py): - Track destination read in operands() for SDWA dst_unused:UNUSED_PRESERVE with sub-dword dst_sel, single-half 16-bit VALU ops (including 8-byte VOP3 / _nc_16 / v_interp_p2_f16), partial-lane DPP (row_mask/bank_mask != 0xf or bound_ctrl:0), v_fmac_legacy_f32, and partial d16 loads. - Flag half-asymmetric DPP row_mask ((row_mask & 3) != (row_mask >> 2)) and dpp8 in transfer(). Verified locally (CPU-only): - tests/semantic/test_wave64_halves_partial_dst.py (13 OK) - tests/semantic/test_wave64_halves_soundness.py (30 OK) - tests/semantic/test_wave64_halves.py (73 OK) - tests/semantic/test_wave64_cross_half.py (9 OK) - tests/semantic/test_wave64_subgroup_ops.py (6 OK) - pytest tests/test_wave64_halves_fixtures.py tests/test_wave64_graphics_scan.py (25 passed, 1 skipped) - docs, line-ending, resource hygiene, tool startup, compileall, git diff --check # Conflicts: # docs/design.md # Conflicts: # tools/wave64_halves.py Claimed in the coordination issue as: <!-- the item ID from the open "Coordinating who works on what" issue, for example TEST-17, or a link to your claim --> Depends on: <!-- #N for every pull request this one builds on or conflicts with (the coordination issue's Commands section, AGENTS.md); delete the line if it builds on none and conflicts with none --> ### What and why <!-- What this changes and the problem it solves. --> ### Tested <!-- What you ran and on which GPU and driver (CONTRIBUTING.md). For the shader translator: how many shaders translate and pass spirv-val, before and after. --> AI-assisted: <!-- yes or no (AGENTS.md asks a coding agent to say so) --> ### Checklist - [ ] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:29 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#315
No description provided.