shader: compute both words of 64-bit SALU logic on numeric pairs #3806
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3806
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3804"
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?
@Leyukaka on GitHub · 2026-12-02 00:51 UTC · original
Leyukaka:py-salu64→main· +340 −8 · 4 files · 2 commits · merged 2026-12-02 01:51 UTCProblem
Stage.scalar()intools/startup/gfx2hlsl.pylowered every_b64scalar logic op and move as a lane-mask op: the low word was cut to the lane bit, the high word of the destination was written as 0, and SCC was read from the cut low word only. That is correct for a real lane mask (vcc, exec, a compare result), but not for two SGPR pairs that hold plain 64-bit numbers.A source-built witness shows the defect on
main: with two numeric pairs set bys_mov_b32(low word 0, high word 1),s_and_b64gives0x1_00000000on the guest, so SCC = 1. The translation produced SCC = 0 from the low word and zeroed the high word, so the followings_cbranch_scc0/s_cbranch_scc1ran the wrong arm. The same happens when one pair is first copied withs_mov_b64. Nothing was refused: the output was silently wrong.This is part of making the translator base more solid: a form is either translated exactly or refused.
Change
(lo | hi) != 0.nullor an inline integer (sign-extended to 64 bits). A literal, a float constant, or an operand that is not an even pair is refused with a message that names it.tests/startup_gfx2hlsl_compute_check.pychanges from refused to whole-word: as_mov_b64of plain data (root constants) now copies both words exactly, so the low word can be read as the number it holds, like the 32-bit copy of the same word.Validation
Run on Windows (MSVC) with the dev preset:
startup_gfx2hlsl_salu64_scc_witnessis new. Its three witnesses (s_and_b64of two numeric pairs, the same with one pair copied bys_mov_b64, and a pair with inline-1) failed onmainand pass with this change. Each program is translated and its emitted blocks are run by the integer evaluator of the bit ALU check; the test accepts either the arm that SCC selects on the guest or a refusal.s_and_b32on the high words and on the low words take the right arm (this checks the harness), and a real lane mask (v_cmpinto vcc, thens_and_b64 s[10:11], vcc, exec) still lowers as a mask op.The fixtures are synthetic instruction words built in the test from the field layouts that
tools/disasm_rdna2.pydecodes; the decoded text of every word is checked first.