rdna2spirv, lane_masks, wave64_halves: fix 3-operand short-form v_*_co_ci_u32 operand classification (SHADER-SHORT-CO-CI-MASK-OPERANDS) #2357
Closed
ShotTechOp wants to merge 1 commit from
upstream-pr/2357 into main
pull from: upstream-pr/2357
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2357
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2357"
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?
Imported from ubiquitarianism/leonida. Originally posted by ShotTechOp on 2026-11-26T15:12:19Z.
Item:
SHADER-SHORT-CO-CI-MASK-OPERANDSProblem
Gen._insn(tools/rdna2spirv.py) explicitly accepts the 3-operand short VOP2 assembler spellingv_add_co_ci_u32 vD, src0, src1(andv_sub_co_ci_u32/v_subrev_co_ci_u32), where carry-out and carry-in are both implicitvccand operand 1 is the 32-bit sourcesrc0. However, four analysis helpers treated operand 1 as the VOP3b carry-out destination:tools/lane_masks.py(step): Calledput(state, a[1], MASK, wave64), falsely markingsrc0(e.g. an SGPR holding plain scalar data) as a lane mask and failing to mark implicitvccasMASK. Downstream scalar ops readingsrc0(e.g.s_bcnt1_i32_b32) then read the wave ballot (32instead ofpopcnt(src0)).tools/rdna2spirv.py(widen_wave64_masks): Always usedat = (1, 4)for_co_ci_, widening a 32-bitsrc0SGPR (a[1]) ton=2in wave64 shaders, which crashed translation withUnsupported("64-bit operand").tools/rdna2spirv.py(writes_exec): Treateda[1]as a destination on allVOP3_TWO_DESTSops, sov_add_co_ci_u32 v1, exec_lo, v0was falsely flagged as writing EXEC.tools/wave64_halves.py(operands): Splitdests, srcs = [a[0], a[1]], list(a[2:])whena[1]was an SGPR/special, droppingsrc0fromsrcs, falsely claimingsrc0was overwritten, and omitting implicit"vcc"from bothdefsanduses.Fix
tools/lane_masks.py: For 3-operandv_*_co_ci_u32, putMASKon implicitvccinstead ofa[1].tools/rdna2spirv.py: Inwiden_wave64_masks, only widen(1, 4)whenlen(a) > 3; inwrites_exec, skip thea[1]destination check for 3-operand*_ci_u32.tools/wave64_halves.py: For 3-operandv_*_co_ci_u32, keepdests = [a[0]]andsrcs = [a[1], a[2]], and append"vcc"todefs(len(srcs) == 2then also adds"vcc"touses).tests/semantic/test_short_co_ci_masks.py: Unit + wave32/wave64 execution regression tests covering all four sites.Verification
AI-assisted: yes.
Environment: Windows 11, Python 3.12.10, CPU-only (no game files, no
spirv-val, not GPU-verified).python -I tests/semantic/test_short_co_ci_masks.py -v-> 6/6 OKpython -I tests/test_lane_masks.py-> OKpython -I tests/semantic/test_wave64_halves.py-> 127/127 OKpython -I tests/test_text_write_line_endings.py-> 3/3 OKpython -m compileall -q tools/rdna2spirv.py tools/lane_masks.py tools/wave64_halves.py tests/semantic/test_short_co_ci_masks.py-> 0python -I scripts/check_no_game_data.py ...-> 0git diff --check-> 0origin/mainfbf100b1):tests/semantic/test_short_co_ci_masks.pyagainstorigin/main'stools/fails all 6 tests (14 assertion failures + 1Unsupported("64-bit operand")crash on wave64).Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T15:20:10Z.
On an RTX 4090, all 30 short-form carry/borrow dispatches at
e1ca6cceamatched both an independent integer reference and the byte-for-byte GPU readback from the 30 corresponding explicit-form controls.fbf100b1be1ca6ccea64-bit operandEach case read back the per-lane arithmetic result, the population count of the original scalar source, and the population count of the outgoing carry or borrow mask. For example, with scalar source
1and carry-in set on lanes 0–2, the parent’s short-form addition reported a source population count of32in lane 0. The PR returned1. The matrix covered add, subtract and reverse subtract. All 12 PR modules passedspirv-val --target-env vulkan1.2, and the six committed CPU tests passed.I also tested how this composes with #2355’s bit-set fix. On the clean local merge of the two heads (tree
3b8e75816), each shader changed selected VCC bits immediately before the short-form arithmetic consumed them. All 30 additional dispatches matched the integer reference, including emulated high-half carry-in.Windows 11, NVIDIA 616.64, Vulkan validation enabled, synthetic shader listings. AI-assisted verification by OpenAI Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T15:37:18Z.
Review: COMMENTED
Windows 11: 6/6 short-form carry-in/carry-out semantic tests passed, covering the three-operand form, wave32 and wave64. No findings from these checks.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:24:08Z.
Review: COMMENTED
macOS arm64 check of #2357 (SHADER-SHORT-CO-CI-MASK-OPERANDS). Analysis-only translator change plus one semantic test; the GPU part is MoltenVK/Kosmickrisp.
Tested head
e1ca6cceamerged ontomainbdbc7e923as merge540bafef8(clean; branch 21 commits behind,git merge-treeclean).Environment: Apple M3 Pro, arm64 (subgroups 4..32), macOS 27.2.1, CPython 3.15.2, SPIRV-Tools v2026.4, llvm-mc 23.1.5, MoltenVK 1.4.0; KosmicKrisp and lavapipe = Mesa 26.3.0.
The new test passes, and the control shows the bug
python -I tests/semantic/test_short_co_ci_masks.py:Ran 6 tests ... OKat the head and after merging ontobdbc7e923.tools/rdna2spirv.py,tools/lane_masks.pyandtools/wave64_halves.pyput back tomain's):FAILED (failures=8, errors=1).test_wave64_short_co_ci_translates_and_runsaborts withrdna2spirv.Unsupported: 64-bit operandonmain, becausewiden_wave64_maskswidenssrc0(an SGPR used as a value) to a pair for the 3-operand spelling.AssertionError: 10 unexpectedly found in {10: 'mask'}(lane masks markss10, the source, as a mask destination) forv_add_co_ci_u32,v_sub_co_ci_u32andv_subrev_co_ci_u32in wave32 and wave64, and thewave64_halvestest fails too.No regressions
mainbdbc7e923; 501 files / 6,373 tests / 0 failed at the merge (+1 file, +6 tests).mainand the merge after normalising the per-run temp directory; same pre-existing failures (cs_fma_fused,cs_imgatomic_ext,ps_ssharpon MV;cs_bvh,cs_bvh32,cs_imgatomic_ext,ps_cndmask_sign_mods,ps_valu16_mad_selon KK).cs_w64_mask_imm.asmandps_ops2.asmusev_*_co_ci_u32, so the 5-operand path is covered there, and its results are unchanged.Findings
scripts/audit_shader4_regs.py:216-221(is_dual_dston any_co_op, thendsts = args[:2]) andscripts/vs_input_survey.py:86-88(samelen(args) >= 2test). Given the 3-operand spelling, both treatsrc0as the carry-out destination, exactly what this PR fixes elsewhere. It does not affect corpus reports today because llvm-mc/the disassembler print the_e32form with five operands (vD, vcc_lo, src0, src1, vcc_lo), astests/semantic/test_carry_exec_mask.pyshows; but the translator and its tests accept the short spelling, so an audit run on hand-written.sinput would be wrong. Adding the samelen(args) == 3exclusion plus a line intests/test_audit_shader4_regs.py/tests/test_vs_input_survey.pycloses it.runtime/test/shadersuses the 3-operand form, so the GPU runs above only show the 5-operand path is unchanged. That is expected for an analysis fix (no SPIR-V text changes for correct inputs), but worth saying in the description so nobody reads the green suite as hardware confirmation of the short form.python -I scripts/check_no_game_data.pyon the changed files: clean.git diff --check: clean.No game files. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:46:34Z.
Review: APPROVED
Approving
e1ca6ccea.The three-operand short form of
v_add/sub/subrev_co_ci_u32carries in and out through an implicit VCC, and the change teaches that to all three analyses consistently:lane_masks.stepandwave64_halves.operandsrecord VCC as its mask definition,writes_execno longer reads its second operand as a VOP3 carry-out destination, andwiden_wave64_masksleaves its operands alone.test_short_co_ci_masks.py6 passed (12 subtests). Merged ontomaind1dff7949together with #2397, #2416 and the other three of this series below (no conflicts), on Linux with Python 3.13. The full translator suite (run_semantic_tests.py tests/semantic) on that tree has only the 8 failuresmainhas here (7 intest_fspx_dot4_op_sel_disasm,test_int32_to_f64), andtests/test_translate.pyonlymain's ownps_sdwa_f16_const.asm(an llvm-mc version difference in this environment). AI-assisted (Claude Code, Claude Opus 5.5).Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T15:37:04Z.
Tested
e1ca6cceamerged ontomainec91d695con a Mac (profile S), where wave64 is always emulated on 32-wide subgroups: Apple M3, macOS 26.5.1, MoltenVK 1.4.2, KosmicKrisp and llvmpipe (Mesa 26.3.1). No game files.scripts/run_gpu_tests.py, auto mode, test programs frommain:mainmain+ this PRLEONIDA_W64_EMULATE=1The failures are the same on both sides (the known ones: #1724, #1518 and #1774 on MoltenVK, #2229's on KosmicKrisp). The translator suite passes with no failures.
Evidence: MEASURED, 1 run each. This only shows that nothing changes on Apple drivers. It says nothing about the game.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-27T19:15:52Z.
CPU check on Linux, merged with main
c0201a80:test_short_co_ci_masks.py6/6 on the merge; copied onto main it fails (writes_execsubtests, wave32 data/VCC, andUnsupported: 64-bit operandfor wave64), as you describe. Merged together with #2438, #2447, #2355 and #2360 the full translator suite passes (506 files, 6,415 tests).Heads-up: #2447 fixes the same short form one level earlier. Its
explicit_carry_vccrewritesv_add_co_ci_u32 vD, src0, src1(and sub/subrev) to the explicit form when the listing is read, so in_translatethelen(a) == 3branches here are no longer reached once both are in. They still cover direct callers oflane_masks/wave64_halves. Not a blocker, just so whoever lands second knows about the duplicate.AI-assisted (Claude Code); I ran the tests and checked the results.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T03:20:59Z.
Review: APPROVED
Verified head
e1ca6ccea(vs parentfbf100b1b, and merged onto testedmainsnapshot1a441d336) on Windows 11 across AMD Radeongfx1036(32.0.21030.2001) and RTX 5080 (616.64) with Vulkan SDK1.4.363.0Core + SyncVal.Semantic & dual-GPU hardware checks (Vulkan SDK
1.4.363.0Core + SyncVal):tests/semantic/test_short_co_ci_masks.py— 6/6 OK;tests/test_lane_masks.py— OK;tests/semantic/test_wave64_halves.py— 127/127 OK.cs_w64_mask_imm,ps_ops2): PASS (exit 0 under Core + SyncVal) on both GPUs.v_add_co_ci_u32_e32,v_sub_co_ci_u32_e32,v_subrev_co_ci_u32_e32withs4 = 0xffffffff, lane-varyingv1, and carry-in on lanes{0, 2, 31, 32, 37, 63}(448 checked words):fbf100b1b: failed translation (Unsupported: 64-bit operand).e1ca6ccea: 0/448 mismatches on both Radeon native wave64 and RTX 5080 emulated wave64 (0 VUIDs).Minor note (non-blocking on tested
mainsnapshot1a441d336): On standalonee1ca6ccea,tools/wave64_emulate_opt.py's_scalar_rw_with_meta(L528-L534,L569-L576) still treats operand 1 of 3-operandv_*_co_ci_u32as a destination rather than a read. A guarded-execztest (s10=1-> narrowexecto lanes 0..15 ->s10=2-> restoreexec->v_add_co_ci_u32_e32 v5, s10, v4) passes on standalone Radeon native wave64 (0/64), but folds incorrectly on standalone emulated wave64 (48/64 wrong lanes:lane0=12, lane32=11on both RTX 5080 and Radeon). Merging onto testedmainsnapshot1a441d336(which includes#2447's pre-expansion) resolves both emulated failures (0/64 wrong lanes:12across all 64 lanes on RTX 5080 emulated, Radeon emulated, and Radeon native, 0 VUIDs). Updating_scalar_rw_with_metais only needed if standalone/unexpanded analysis is kept consistent.No game data used. AI-assisted review (Codex static audit + Gemini dual-GPU verification).
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T09:15:44Z.
#2357 | head
e1ca6cceac0c76d2ea9de8245d200a83efea2855|python3 -I tests/semantic/test_short_co_ci_masks.py -v| red: 6 tests, 13 assertion failures | green: 6 passed | Red → greenThe baseline failures include parameterized subtests covering operand classification. Failure and error counts include subtest events.
Pinned main
4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:42:05Z.
I tested
e1ca6cceamerged with maind48a957bbon physical gfx906, native subgroup 64 (RADV Mesa 26.0.8), with synchronization validation enabled. On this baseline the public translator already expands the three-operand spelling withexplicit_carry_vccbefore widening. All 12 modules translated on both trees. Short and explicit spellings had identical instruction bytes, SPIR-V and GPU output; I did not reproduce a public translation refusal or a GPU improvement.The analysis fix is observable:
wave32_pixel_scan.scan_shaderfalsely counted a mask-word operation after short add/sub/subrev followed by a population count of the unchanged scalar source. Main counted one for each short listing and none for its explicit equivalent; the merge counted none for either.Both GPU matrices matched 28/36 readbacks. SGPR, VGPR, literal and M0 sources passed. The eight failures were the same on both trees: with sparse EXEC and
exec_loorexec_hias numeric source 0, both spellings returned incorrect arithmetic (596 wrong words per tree). The results are consistent withGen.src_usupplying the active-lane value instead of the scalar EXEC word. All guards held, with no shader-run validation errors or synchronization hazards. This is a separate pre-existing failure, not a regression from this PR.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T20:00:57Z.
Could a maintainer reopen #2357, or point to a replacement for its raw-operand analysis fix? GitHub’s closure event points to the commit from #2494. That commit changed the register audit scripts. The pixel-shader scanner still gives different results for two spellings of the same instructions on the resulting main revision.
I ran the public
tools/wave32_pixel_scan.pycommand against three synthetic pixel shaders, one each for add, subtract and reverse subtract. Each reads a numeric scalar source and then counts its bits. I ran the same files again with the carry operands written explicitly.5cb45921e)3d7ce5904merge tree)For example, the short-form fixture uses
s_mov_b32 s10, 0x12345678,v_add_co_ci_u32_e32 v1, s10, v0, thens_bcnt1_i32_b32 s11, s10. The last instruction counts the unchanged numeric value ins10. On main, the scanner counts it as a lane-mask operation.I also copied this PR’s six tests unchanged onto main. Both translation/execution tests pass there. The four analysis tests produced 13 assertion failures across their cases. All six pass on the clean local merge of PR head
e1ca6ccea, and the 52 existing audit, input-survey and scanner tests pass on both trees.Windows, CPU-only synthetic tests. AI-assisted verification with OpenAI Codex (GPT-6).
Pull request closed