mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #1803] lane_masks, rdna2spirv: wrap parked v_writelane/v_readlane slots mod 32 in wave32 (LANE-MASKS-WAVE32-SLOT) #1817
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1817
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1803
Author: @ShotTechOp
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/lane-masks-wave32-slot📝 Commits (1)
87fde5clane_masks, rdna2spirv: wrap parked v_writelane/v_readlane slots mod 32 in wave32 (LANE-MASKS-WAVE32-SLOT)📊 Changes
4 files changed (+87 additions, -17 deletions)
View changed files
📝
tests/semantic/test_lane_masks_edge_cases.py(+29 -0)📝
tests/test_lane_masks.py(+37 -0)📝
tools/lane_masks.py(+18 -14)📝
tools/rdna2spirv.py(+3 -3)📄 Description
Summary
Claimed in #1608 as
LANE-MASKS-WAVE32-SLOT: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162135689In wave32 (
wave64=False), RDNA2v_writelane_b32andv_readlane_b32mask the lane selector byS1[4:0](& 31, mod 32) — whichtools/rdna2spirv.pyalready emits at lines 8818 and 8837 (self.cu(63 if self.wave64 else 31)). However,lane_masks.lane_slot()always masked by& 63andlane_masks.parked()/rdna2spirv.pydid not passwave64:32(32 & 31 == 0) with plain data in wave32 failed to invalidate a mask parked in lane0, so a subsequentv_readlane_b32returned the stale parked mask ([0xffffffff, 0xffffffff, 0, 0]) instead of the written scalar ([0x55aa] * 4).32in wave32 and reading it back from lane0missed the parked slot and broadcast lane 0's bit across all lanes instead of restoring each lane's bit.Changes
tools/lane_masks.py:lane_slot(vgpr, lane, wave64=True): mask lane index by63 if wave64 else 31, and reject multi-dword VGPRs (n != 1) orabs/neg-modified operands.step()andparked(blocks, masks, wave64=True): threadwave64intolane_slot()(defaultTruepreserves existing callers).tools/rdna2spirv.py:wave64=self.wave64tolane_masks.parked()(park_masks) andlane_masks.lane_slot()(v_readlane_b32/v_writelane_b32).tests/test_lane_masks.py&tests/semantic/test_lane_masks_edge_cases.py:spirv_mini_interp.run_workgroup.Testing
Environment: Windows 11 x64, Python 3.12.10, CPU-only (no GPU or game files; based on
0d80bc5).main(0d80bc5):python -I tests/test_lane_masks.py->AssertionErrorintest_wave32_parked_lane_wraps_mod_32python -m unittest discover -s tests/semantic -p test_lane_masks_edge_cases.py->FAIL([0xffffffff, 0xffffffff, 0, 0]!=[0x55aa] * 4)python -I tests/test_lane_masks.py->okpython -m unittest discover -s tests/semantic -p "test_*lane_mask*.py"-> all OKpython -m compileall -q/scripts/check_no_game_data.py/git diff --check-> all cleanAI-assisted: yes (Antigravity). Synthetic inputs only; no game data.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.