rdna2spirv: SDWA selects of v_{add,sub,subrev}_co_ci_u32 go to the sources, not the carry-out (SHADER-SDWA-CARRY-SEL) #1004
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1004
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1004/head"
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?
@thesubtleties on GitHub · 2026-11-24 16:43 UTC · original
thesubtleties:sdwa-carry-sel→main· +113 −1 · 3 files · 1 commits · merged 2026-11-24 22:19 UTCClaimed in the coordination issue as: SHADER-SDWA-CARRY-SEL
What and why
v_add_co_ci_u32_sdwa,v_sub_co_ci_u32_sdwaandv_subrev_co_ci_u32_sdwaprint the carry-out between the destination and the sources (v4, vcc_lo, v2, v3, vcc_lo). The SDWA setup assumed the sources start at operand 1, sosrc0_selwent to the carry-out (and was lost) andsrc1_selwent to src0. Any non-DWORD source selector gave a wrong value with no error. The selects now go to operands 2 and 3 for the printed form.Tested
tests/semantic/test_sdwa_carry.py(all 49 selector pairs per op in wave32, a sample in wave64,sext(),dst_sel): 164 failures without the fix, all pass with it.scripts/run_semantic_tests.pyon base3ed8e50b: 470 files / 6165 tests, 0 failed; with the fix 471 / 6170, 0 failed. Rebased since; the SDWA and carry tests were rerun after the rebase.run_gpu_tests.pyon3ed8e50b, per-test results identical with and without the fix: 201/252 (3080 native), 233/252 (3080,LEONIDA_W64_EMULATE=1), 234/252 (gfx1036 RADV); the only failures are the two known tfe fixtures (#31). No GPU fixture uses the new path, so these are regression checks.GPUs tested: NVIDIA RTX 3080 (620.73.04) and AMD RDNA2 iGPU gfx1036 (RADV, Mesa 26.3.1), CachyOS Linux 7.3.5
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.@KernelSmoker on GitHub · 2026-11-24 16:55 UTC · original · approved these changes
Reviewed exact head
073b8bb3a8on current main82a2aabcc. The newtest_sdwa_carry.pypassed 5/5, covering all 49 selector pairs per opcode in wave32, wave64 samples, sign extension, destination selection and the short form. The full semantic suite passed 471 files / 6,170 tests / 0 failures in Fedora 45 with SPIRV-Tools. The mutation runner caught all five relevant mutants, including removal offirst = 2(164 test failures). Docs rows 5/5, docs links 16/16, no-game-data scan and diff check passed. Synthetic CPU validation only; the PR notes no GPU fixture exercises these opcodes. Hosted label check was queued.@QemmHD on GitHub · 2026-11-24 22:19 UTC · original
Merging.
Why merged: SHADER-SDWA-CARRY-SEL: SDWA src selects on v_{add,sub,subrev}_co_ci_u32 skip the carry-out operand, so the select lands on the right source. KernelSmoker checked it.
Why it's good: Its test plus the sdwa_hw, sdwa_broadcast and sdwa_dst_mask tests: 47 passed, 2323 subtests.
Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main
4a50cafc7. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 573 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new subprocesses, new env vars or CI changes.AI-assisted (Claude Code, Claude Opus 5.5).