mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1116] [CLOSED] rdna2spirv: SDWA selects on the long-form carry ops land on their sources (SHADER-SDWA-CO-CI-SELECT) #1152
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#1152
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/1116
Author: @tiguan26
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:fix/sdwa-co-ci-select📝 Commits (1)
b4288ecrdna2spirv: SDWA selects on the long-form carry ops land on their sources (SHADER-SDWA-CO-CI-SELECT)📊 Changes
3 files changed (+111 additions, -1 deletions)
View changed files
📝
docs/design.md(+1 -1)➕
tests/semantic/test_sdwa_carry_select.py(+103 -0)📝
tools/rdna2spirv.py(+7 -0)📄 Description
Claimed in the coordination issue as: SHADER-SDWA-CO-CI-SELECT
What and why
Gen.insn()attaches the SDWAsrc0_sel/src1_selfromargs[1]on (first = 1). In the long form ofv_add_co_ci_u32,v_sub_co_ci_u32andv_subrev_co_ci_u32(vD, carry out, src0, src1, carry in)args[1]is the carry out, sosrc0_sellanded on it,src1_selnarrowed src0 and src1 was read whole: a silent wrong result, not a refusal.With v1 = v4 =
0x00050003,src0_sel:WORD_1 src1_sel:WORD_0and no carry in,maingives:v_sub_co_ci_u32_sdwa0xfffb0000, borrow 12, borrow 0v_add_co_ci_u32_sdwa0x50006, carry 08, carry 0v_subrev_co_ci_u32_sdwa0x50000, borrow 00xfffffffe, borrow 1The fix starts the selects at src0 for these three ops when the long form is printed (
SDWA_CARRY_OPS). The short formvD, src0, src1already gave the expected words and is unchanged; so is every other op.Impact: the SDWA row's hardware measurement over the 172 SDWA forms in the corpus lists no mismatch for these ops, so the current corpus most likely has no long-form carry op with a narrowing select. This is a correctness fix for the rule, not a known game bug. Found while reviewing #1093.
Tested
Linux, Python 3.13.18, on
main6293c1c:tests/semantic/test_sdwa_carry_select.py(4 tests): the reported words, both forms of all three ops with carry in 0 and 1 over byte/word/dword selects, and 24 seeded cases, against a plain-Python reference of the ISA semantics. Onmainthe three long-form tests fail and the short-form control passes; with the fix all four pass.python -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6172 tests, 0 files failed.tests/test_docs_design_rows.py,test_docs_table_rows.py,test_docs_links.py,test_text_write_line_endings.py,python -m compileall -q tools tests,scripts/check_no_game_data.pyon the three files,git diff --check: clean.docs/design.mdgains one sentence on the long-form carry ops and how it was checked.GPUs tested: n/a (CPU interpreter only; not GPU-checked)
AI-assisted: yes (Claude)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).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.