mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #833] [MERGED] OLD-7450: restore old upstream PR 7450 - wave64 emulate: a cross-lane read of a missing lane in a partial wave gives 0 #871
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#871
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/833
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:wave64-partial-wave-zero📝 Commits (4)
5668f16wave64 emulate: a cross-lane read of a missing lane in a partial wave gives 0721a3b8Merge main into wave64-partial-wave-zero485e38ftest_w64x_partial_swizzle: poison the prologue's OpAtomicStore zeroes0bae6f5Merge main into wave64-partial-wave-zero📊 Changes
8 files changed (+272 additions, -12 deletions)
View changed files
📝
docs/design.md(+1 -0)📝
runtime/test/shaders/check.py(+2 -1)➕
runtime/test/shaders/cs_w64x_partial_swizzle.asm(+78 -0)📝
scripts/run_gpu_tests.py(+9 -6)➕
tests/semantic/fixtures/disasm/cs_w64x_partial_swizzle.s(+59 -0)➕
tests/semantic/fixtures/w64x_partial_swizzle.asm(+20 -0)➕
tests/semantic/test_w64x_partial_swizzle.py(+77 -0)📝
tools/rdna2spirv.py(+26 -5)📄 Description
Claimed in the coordination issue as: OLD-7450 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133918227
Restoration of my original pull request, old upstream PR 7450 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Ported onto main atd0da7dade; the translator change applied unchanged, and the port adds the subgroup-32 pin inscripts/run_gpu_tests.py(below) and the RX 7900 XTX measurements to the contract row.Depends on: #793 (line-level, docs/design.md), #364, #366, #373 (line-level, scripts/run_gpu_tests.py)
What and why
--wave64-emulate, a cross-lane read of another lane's exchange slot gives 0 when the source lane doesn't exist in a partial last wave. This coversds_swizzle_b32,ds_bpermute_b32,ds_permute_b32,v_readlane_b32,v_readfirstlane_b32, DPP and the other reads behindGen.x_round. A source lane that isn't running reads 0 on the hardware.Gen.x_lane_word:x_wbase + lane < threads, else 0. It is used by the five slot reads inx_round.masked_swizzle_amdwithfetch_inactive. In a 40-thread group, lanes 32-39 ofds_swizzle_b32 offset:swizzle(SWAP,8)then read the missing lanes' registers: garbage that changes between runs.cs_w64x_partial_swizzle(40 threads: SWAP 8, BROADCAST 16,15 andds_bpermute_b32from lanes 40-47). Its 8 words were measured natively on gfx1036 throughtools/hw_oracle.tests/semantic/test_w64x_partial_swizzle.pywith a hand-written fixture. It covers 40 and 104 threads, with the prologue's zero stores replaced by a poison word in the workgroup interpreter.scripts/run_gpu_tests.pynow runs the partial-wave fixtures emulated at subgroup 32, ascheck.py'spartial_wave_testalready does.check.pyshows it wrong.docs/design.mdcontract table: "Wave64 emulation: cross-lane reads of missing lanes", with how it was confirmed.Tested
Mesa 26.3.1 RADV on Linux. "Before" is main
d0da7dadewith only this PR's tests and runner change added.test_w64x_partial_swizzle.py: before 2 fail and 1 error; after 3/3 OK.run_semantic_tests.py): before 465 files and 6,108 tests, after 466 files and 6,111 tests; 0 files fail on either.cs_w64x_partial_swizzle, emulated at subgroup 32, 20 runs ofvk_compute_testper device:run_gpu_tests.py --filter cs_w64x_partial:cs_w64x_partial_swizzlefails);check.py, emulated:cs_w64x_partial_swizzlefails on both GPUs before and isokafter.run_gpu_tests.py, the same on both GPUs, native andLEONIDA_W64_EMULATE=1:cs_imgload_tfeandcs_imgload_d16_tfe. They fail on main too and this change doesn't touch them.crosslane_fuzz.py --wave 64 --ext --dpp --no-maskdata --programs 1000 --seed 48315 --modes emulate:--limit 2000slice, native and--wave64-emulate: 2000 translated and 2000 passspirv-val, before and after, with identical modules. That slice has no compute shaders.--wave64-emulate: 40 translated and 40 passspirv-val, before and after. 25 of the 40 modules change (the ones that read across lanes).python -m compileall -q tools tests scriptsis clean;git diff --checkis clean;check_no_game_data.pypasses on every changed file;tests/test_shader_checks.py,tests/test_partial_wave_subgroup.py,tests/test_run_gpu_*.pyandtests/test_text_write_line_endings.pypass.GPUs tested: AMD Radeon RX 7900 XTX (RDNA3, RADV, Mesa 26.3.1, Linux); AMD Radeon Graphics iGPU of the Ryzen 9 7950X3D (gfx1036, RDNA2, RADV, Mesa 26.3.1, Linux)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.AI-assisted (Claude Code, Claude Opus 5.5).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.