Repository navigation
Conversation
RDNA reads and writes the same physical lane for selectors 8 and 40 in a wave32. Mask provenance must follow that alias so a read recovers each lane predicate and a data overwrite clears it.
Keep the targeted regression and the intervening upstream changes together for review.
Keep the targeted regression and the intervening upstream changes together for review.
Count lanes that restore an odd-lane predicate through the other selector and lanes that see the predicate cleared after an ordinary aliased write. Keep the existing four integer controls and check all six results in both GPU runners and the CPU interpreter. TEST-1044. Depends on ItsNotRexed#2956 for the translator fix.
Kam471
left a comment
There was a problem hiding this comment.
Blocking: the new expected words do not match either implementation.
tests/semantic/test_wave32_lane_select.pyata0c5a1759on Windows 11 -> 1 failed, 1 passed:
test_lane_select_uses_bits_4_0:[25, 16, 777, 777, 16, 16] != [25, 16, 777, 777, 32, 32].- GPU, RTX 5070 Ti,
run_gpu_tests.py --filter lane_wrap-> FAIL:cs_w32_lane_wrap 25 16 777 777 16 16(expected the new... 32 32).
So the interpreter and the hardware agree (16, 16) while check.py/the runner expect 32, 32 for the two new aliased-selector cases. Either the fixture's selector/alias setup does not do what the PR expects, or the expected words are wrong; as it stands the PR fails its own semantic test and the GPU test. Please fix the fixture or the expectations and re-run both before merge.
Keep the changes from Vonsek in ItsNotRexed#2956 and make the regression runnable from this PR head. The resulting tree is the tested main baseline with the ItsNotRexed#2956 diff and the TEST-1044 patch applied in order.
|
@Kam471 Thanks for running this on the 5070 Ti. I reproduced the I re-ran both checks from that exact revision on Windows:
The last two words count lanes with the expected result. A correct odd/even pattern matches on all 32 lanes (16 true and 16 false). After writing zero, all 32 lanes must read false. That is why both expected counts remain 32. The PR still depends on #2956 for merge order; the fix keeps its original authorship. |
|
Tested The checked-in wave32 fixture I also changed the predicate save/read/clear selectors in a temporary copy from 8/40 to 31/63, the last lane and its alias. All six words still matched. As a negative control I changed only the clearing write from selector 63 to 62. That left the saved odd-lane predicate intact at lane 31. The first five words matched, the final match count fell from 32 to 16, and the filtered runner failed as expected. All three shaders passed spirv-val. AI-assisted verification. |
|
Checked the regression on Windows 11 Pro x64 (26200), RTX 4070 Ti, NVIDIA 616.56, subgroup 32..32.
The passing integrated checkout matches all 1,876 expected checkout files of head Commands: Full passing-tree GPU results: default 170 PASS / 0 FAIL / 47 SKIP; Focused CPU lane-select tests: before dependency 2 tests / 1 failure; with dependency 3/3 pass. Adjacent wave64 subgroup, wave64 halves and lane-mask edge-case suites: 113/113 pass. Native Python 3.13.1, LLVM MC 23.1.6, SPIRV-Tools v2026.4; reused locally built Vulkan harnesses from Runner accounting caveat (inherited from main; fixed separately by #4784): the full-run totals above count reported rows. In these logs |
kacper-serewis
left a comment
There was a problem hiding this comment.
Independent AI-assisted static census at c4f5740 including #2956. Across 26,503 cached listings, 23 contain an ordered write then read on the same VGPR with immediate selectors aliasing in wave32 but distinct in wave64. 6,258 lane instructions lacked a parsed immediate selector. Wave mode, reachability, predicate provenance and intervening writes were not established, so the actual retail regression count remains unknown. CPU only.
|
Tested
Both totals are exactly
Both are natively 32-wide devices, so this is the predicate spill through lane aliases on hardware where the wave32 path is the only path — the 32/32 counts are the ordinary case here, not an emulated one. Built with AppleClang 21.0.0, CMake 4.4.4 + Ninja, Homebrew llvm-mc 23.1.4 (AMDGPU), SPIRV-Tools 1.4.363.0. AI-assisted. |
Kam471
left a comment
There was a problem hiding this comment.
Blocker resolved at c4f57408f (the update at 06:11): the fixture and expectations now agree.
tests/semantic/test_wave32_lane_select.py-> 3 tests, OK (previously 1 failed:[25,16,777,777,16,16]vs[...,32,32]).tests/test_lane_masks.py-> 9 passed.- GPU, RTX 5070 Ti:
run_gpu_tests.py --filter lane_wrap-> 1/1 passed,cs_w32_lane_wrap->25 16 777 777 32 32(the values match the updatedcheck.py/runner expectations). git diff --checkclean.
The branch now also carries the SHADER-540 lane_masks dependency (the merge commit), which is why the head moved. With that, the aliased-selector spill cases are exact on hardware and the earlier hold is cleared.
|
Tested c4f5740 on Intel UHD 630 (Coffee Lake GT2), Mesa 25.2.8 ANV, Ubuntu 24.04, at the stack head (c311e08 from #2956 is an ancestor): cs_w32_lane_wrap passes 1/1 with LEONIDA_VK_DEVICE=Intel (output 25 16 777 777 32 32). The same command with a nonexistent device name fails with "no Vulkan physical device matches", so the filter applied. tests/semantic test_wave32_lane_select (3 tests) and tests/test_lane_masks.py (9) pass, and test_translate.py -k "lane or mask or wave32" gives 51 passed. The shader fixture check on this GPU shows 141 of 188 pass, 45 skipped, with only cs_signed_zero_nan and cs_fmt_int_narrow failing, the same two that fail in the recorded main 3faac55 run on this GPU. AI-assisted. |
|
Verified merged with main: the GPU-side test of predicate spills through aliased lane selectors works on the CPU — test_wave32_lane_select.py runs 3/3 (including the new wave32_mask_spill fixture: lane-40 write / lane-8 read of a saved EXEC restore identically), test_lane_masks' new wave-size check passes, and test_translate (596) plus the fixture check are green. Landing-order heads-up, verified on the graph: this branch carries the SHADER-540 translator work of still-open #2956 (commit bb75831, merged in for standalone review and not on main) — merge #2956 first, or treat this as the superset and fold the two. The GPU run of the extended cs_w32_lane_wrap was not possible on this host. No CI checks were reported. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Tested
|
Retain the lane-selector semantics from ItsNotRexed#2956 alongside the updated wave64 documentation.
|
Tested The stock I changed only the selector on the final zero write from 40 (lane 8) to 41 (lane 9), keeping the read on lane 8. That left the odd-lane predicate in place: exactly 16 lanes then compared equal to zero. The runner flagged the control as a failure against the stock expectation. A comparison of the full GPU readbacks showed only word 5 changed, from 32 to 16. The earlier predicate-restore count stayed at 32. AI-assisted verification. |
|
Tested |
|
Tested
Xbox 1.0.2.1 coverage: 3,050 of 26,503 local |
Depends on: #2956
Review checkout
gh pr checkout 4769includes the TEST-1044 commita0c5a175, Vonsek's #2956 atc311e089, and upstreammainat561b65a8. Please land #2956 first. Its commits remain in this branch's history. After resolving the dependency's documentation conflict the only differences frommainplus #2956 are the five TEST-1044 fixture and runner files.TEST-1044 claim
Hardware verification at
6ec7931fOn the RTX 5090 D v2 (617.42) and Ryzen 7 9800X3D Radeon iGPU (32.0.21036.18), the filtered GPU runner passed 1/1 per adapter. I also ran the same hand-written fixture through the
561b65a8translator and this PR's translator. Both devices reported a native 32-lane compute subgroup. Each row below was reproduced in three fresh dispatches per device.mainat561b65a825 16 777 777 16 166ec7931fwith #295625 16 777 777 32 32The untouched buffer words retained their fill value in every dispatch. Focused lane, subgroup and runner tests passed (74 tests plus 130 subtests), as did 13 additional lane-related translator tests. The earlier measurements below remain available for comparison.
cs_w32_lane_wrapalready checked that selectors 8 and 40 address the same lane for an ordinary integer. This extends that fixture to the predicate spill in SHADER-540. The last two output words count how many of the 32 lanes recover the original even/odd pattern and how many see zero after an ordinary write through the alias. Both GPU runners and the CPU interpreter check the results. The first four integer controls keep their original expectations.98fa503f(main), restore / clearc311e089(#2956), restore / clearThree dispatches per device and revision, all identical. Each run selected the device by name and pinned a 32-lane subgroup. On unpatched main, changing just the save selector to 8 gave
32 / 16. Changing just the clear selector gave16 / 32. Keeping both at 8 gave32 / 32on both devices.Also tested the dependency applied to
98fa503f. The filteredscripts/run_gpu_tests.pyrun and the fixture check fromruntime/test/shaders/check.pyboth failed on baseline and passed with #2956 on both GPUs. Fixture regeneration, the focused semantic tests, both runner unit suites and the two matchingtest_translate.pycases passed with the dependency. At the stacked headc4f57408,python -m pytest -q tests/semantic/test_wave32_lane_select.pypassed (3 tests, 32 subtests).scripts/run_gpu_tests.py --filter lane_wrap --require-passpassed on each card with25 16 777 777 32 32.The complete CPU semantic suite ran 6,246 tests. It reported three failed subtests and two errors in the wave64 emulation cases in
test_loop_ballot_barrier.py, one skip and one expected failure. Running that module separately on a clean98fa503fcheckout reproduced all three failed subtests and both errors with the same assertions and unsupportedOpFunctionCallmessages.Windows 11 x64 build 26300. NVIDIA 617.42, AMD 32.0.21036.18, LLVM 22.1.8, SPIRV-Tools v2026.4. AI-assisted with Codex, using only the hand-written test shader.