rdna2spirv: keep plain-data VCC sources on the 64-bit data path in is_mask_op and src64_data (SHADER-SALU64-VCC-DATA-SRC) #1990
Closed
leonida/mandy
ShotTechOp wants to merge 0 commits from
fix/salu64-vcc-data-src into main
pull from: fix/salu64-vcc-data-src
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!1990
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/salu64-vcc-data-src"
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 closed
This pull request cannot be reopened because the branch was deleted.
Claimed in #1608 as
SHADER-SALU64-VCC-DATA-SRC.What and why
Gen.is_mask_opintools/rdna2spirv.pypreviously returnedTrueunconditionally whenever an operand wasvcc,vcc_lo, orvcc_hi, even whenlane_masks.pyprovedvccholds plain scalar data (for example afters_mov_b32 vcc_lo, .../s_mov_b32 vcc_hi, ...).Gen.holds_lane_maskalready returnsTrueunconditionally forexec/exec_lo/exec_hiand returnsTrueforvcc/vcc_lo/vcc_hionly whenvccactually holds a lane mask ("vcc" in self.cur_masks).vccbranch inis_mask_op:s_not_b64,s_{and,or,xor,andn2,orn2,nand,nor,xnor}_b64, ands_cselect_b64with a plain-datavccsource took the per-lane mask path, dropping%vcc_hiand the high dword of the paired SGPR, duplicating the low 32-bit word into both destination dwords, and votingSCCacross the wave instead of testing(D.lo | D.hi) != 0.s_cmov_b64,s_quadmask_b32/s_quadmask_b64, ands_bitreplicate_b64_b32falsely rejected plain-datavcc/vcc_looperands as lane masks.Gen.src64_dataalso rejected plain-datavccoperands withUnsupported("<op> source"). Adding anot self.holds_lane_mask(s)branch to load(%vcc, %vcc_hi)fixes allsrc64_dataconsumers while keeping lane-maskvccsources rejected asUnsupported.64-bit scalar bitwise opscontract row indocs/design.md.Testing
tests/semantic/test_salu64_vcc_data_src.py— covers all 9 64-bit bitwise ops in both operand orders (s_and_b64..s_xnor_b64,s_not_b64) with high-word-only non-zero SCC checks,s_cselect_b64,s_cmov_b64,s_quadmask_b64,s_bitreplicate_b64_b32, mask-to-data VCC overwrite, and lane-mask VCC preservation/rejection controls.origin/main(fe15534):tests/semantic/test_salu64_vcc_data_src.pyfails onorigin/main(proving both silent miscompilation of the high dword / SCC in the bitwise +s_cselect_b64ops and falseUnsupportederrors ins_cmov_b64/s_quadmask_b64/s_bitreplicate_b64_b32).python -I tests/semantic/test_salu64_vcc_data_src.py -vpython -m unittest discover -s tests/semantic -p test_salu64_bitwise_data.pypython -m unittest discover -s tests/semantic -p test_scselect_b64_data.pypython -m unittest discover -s tests/semantic -p test_salu_cmov_b64.pypython -m unittest discover -s tests/semantic -p test_salu_quadmask_bitreplicate.pypython -m unittest discover -s tests/semantic -p test_lane_mask_bitreplicate_flbit.pypython -m unittest discover -s tests -p "test_docs_*.py"python -I tests/test_text_write_line_endings.pypython -m compileall -q tools/rdna2spirv.py tests/semantic/test_salu64_vcc_data_src.pypython -I scripts/check_no_game_data.py tools/rdna2spirv.py docs/design.md tests/semantic/test_salu64_vcc_data_src.py#1990 | head 74031f03cfa39a3755a3f6b9eff731be685dbeee | python -I -m unittest discover -s tests/semantic -p test_salu64_vcc_data_src.py | red: FAILED (failures=48, errors=3; AssertionError + rdna2spirv.Unsupported) | green: 4/4 OK (8.034s) | full suite: FAILED — semantic 506 files / 6401 tests / 1 failed (test_wave64_emulate_opt) vs main 8994000b08 | Windows 11, Python 3.14.7, no game files | AI-assisted: yes, Antigravity (Gemini)Details:
tests/semantic/test_salu64_vcc_data_src.pyonupstream/main8994000b08):Ran 4 tests in 8.400s — FAILED (failures=48, errors=3)(rdna2spirv.Unsupported: s_cmov_b64 lane-mask sourcex2,rdna2spirv.Unsupported: s_quadmask_b64 on a lane maskx1, plus 48AssertionErrorsubtests where plain-datavcctook the lane-mask path).upstream/main8994000b08):Ran 4 tests in 8.034s — OK.rc=1):506 files, 6401 tests, 1 files failed in 419 s with 16 jobs: test_wave64_emulate_opt.6.988s,rc=1) vs cleanupstream/main8994000b08(34/34 OKin7.311s,rc=0):LocalExecFoldTests.test_negative_live_in_pair_and_unmasked_vcc_scc_not_foldedfails attests/semantic/test_wave64_emulate_opt.py:1158(self.assertGreaterEqual(vote_calls, 2) # branch vote + scc_from_mask vote->AssertionError: 1 not greater than or equal to 2).test_wave64_emulate_opt.py:1139-1158buildss_mov_b64 vcc, s[12:13]+s_and_b64 s[10:11], vcc, s[12:13]assuming the previousGen.is_mask_op(vcc) -> scc_from_masksubgroup vote, whereas this PR changesGen.is_mask_optoreturn self.holds_lane_mask(x)so plain-datavccstays on the scalar 64-bit data path (noscc_from_maskvote,vote_calls == 1). Needs reconciliation withtest_wave64_emulate_opt.pybefore merge.scripts/check_no_game_data.py->0;python -m compileall -q tools scripts tests->0;node --test tests/test_viewer_streaming.cjs->0; standalone stdlibtests/test_*.pyinitially hit 2 parallel 90s worker timeouts (tests/test_build_runtime_cmake.py,tests/test_merge_check.py), both passed standalone on the merged PR tree (1/1 OKin19.251sand24/24 OKin40.342s), yielding513/521 passed(33skipped pytest/helper files;0new stdlib failures vs8994000b08, same 8 pre-existing failures).#1990 | head
74031f03cfa39a3755a3f6b9eff731be685dbeee(merged cleanly ontomaind48a957bb9988afce424552a3c0c8d01ef12320f, and cleanly alongside#1983) | Windows 11 (10.0.26200), CPython3.12.10,llvm-mc(gfx1013),spirv-val(1.4.363.1), NVIDIA GeForce RTX 3090 (Vulkan1.4.341, driver610.88,subgroup 32..32,LEONIDA_VK_VALIDATION=1)main(d48a957bb9988afce424552a3c0c8d01ef12320f):tests/semantic/test_salu64_vcc_data_src.py:FAILED (failures=48, errors=3)(64-bit bitwise/select ops route plain-datavcconto the per-lane mask path ands_cmov_b64/s_quadmask_b64/src64_datareject plain-datavcc).vk_compute_test(--wave64-emulate,LEONIDA_VK_VALIDATION=1) ons_and_b64 s[8:9], s[6:7], vccwiths[6:7] = 0x0F0F0F0F_00000000andvcc = 0x55667788_11223344: dumps0x11223344 0x11223344 1instead of0x00000000 0x05060708 1.PR + main:python -I tests/semantic/test_salu64_vcc_data_src.py -vandpython -I tests/semantic/test_salu64_bitwise_data.py -v: pass (OK).vk_compute_test(--wave64-emulate,LEONIDA_VK_VALIDATION=1,spirv-valclean) exercisings_and_b64,s_quadmask_b64, ands_cmov_b64on plain-datavcc = 0x55667788_11223344ands[6:7] = 0x0F0F0F0F_00000000:1 groups x 64: 0 mismatches,out[0..5] = 0x00000000 0x05060708 1 0x0000FFFF 0x11223344 0x55667788(0Khronos validation errors).scripts/check_no_game_data.py,test_docs_encoding.py, andtest_text_write_line_endings.py: pass (0CRLF).s_mov_b64 vcc, nullinteraction noted on#1983(lane_masks.pyclassifiesvccas non-mask afters_mov_b64 vcc, nullwhile%vcc_hiis not cleared), and in wave32Gen.holds_lane_mask({"k": "special", "t": "vcc"})checks"vcc"without"vcc_hi".AI-assisted.
The previously reported vote-count test failure is also a wrong GPU result on native wave64, not just a brittle
OpAtomicOrcount. On physical gfx906 (RADV Mesa 26.0.8), start withs[4:5] = (1, 0)and run:This scalar AND is nonzero. Main
d48a957bbstored 7 on all 64 lanes. With74031f03cmerged, only lane 0 stored 7; the other 63 stored 3. Splitting the first instruction into separate low/high VCC writes restored 64 sevens; zero input returned 64 threes on both builds. On a second physical device, the upper-half branch fromLocalExecFoldTests.test_negative_live_in_pair_and_unmasked_vcc_scc_not_foldedlikewise changed from 32 sevens to 32 threes. I would assert the stored values before changing the vote-count expectation.The broader matrix improved from 15/72 to 75/90 matching readbacks. The merge fixes the tested split-write bitwise cases; it also ran the conditional-move and quadmask modules main refused. The minimal straight-line control above is separate from those counts. All guards held; no shader-run validation errors or synchronization hazards.
AI-assisted.
Tested
74031f03cmerged (no commit) withmainaa918e5d9. Python 3.12.4, Windows 11 10.0.26300, CPU only, withLLVM_MC(conda-forge llvm-tools) and SPIRV-Tools from the Vulkan SDK 1.4.363.1.check_no_game_data.pyis clean.tests/semantic/test_salu64_vcc_data_src.py, 4 tests pass.tools/rdna2spirv.pyback tomain, 48 failures and 3 errors (lane 32 diverged).Blocker: it breaks an existing test. With this PR merged on
main,tests/semantic/test_wave64_emulate_opt.pyfailsLocalExecFoldTests.test_negative_live_in_pair_and_unmasked_vcc_scc_not_folded(line 1180,vote_calls:1 not greater than or equal to 2). That test passes on plainmainand with each of the other six PRs. The likely cause is thatis_mask_opno longer treats everyvcc/execspecial as a mask, so the wave64-emulate fold sees one vote fewer. Either the fold test needs updating with a reason, oris_mask_opneeds to keep that case.Overlap check across #1973, #1977, #1990, #1943, #1994, #1996 and #1803 (same translator area):
s_wqm, #1990 forsrc64_data/is_mask_op;s_movintoexec_hi, #1996 form0/scc;docs/design.md, between #1990, #1943 and #1994.main(docs/design.mdtaken frommain), each PR's own test file passes. The full semantic suite (scripts/run_semantic_tests.py tests/semantic -j 4, 528 files, 6513 tests) fails in 2 files:test_valu_cvt_f16_int16_mods, which fails on plainmaintoo;test_wave64_emulate_opt, which comes from #1990 alone (see #1990).AI-assisted (Claude Code).
The scalar-pair write patch for #2598 fixes the wrong GPU output in the earlier SCC reproduction. I applied only this PR's translator diff at
74031f03cto mainaa52446f7d, then compared it with the same code plus the #2598 patch. Physical RTX 4090, Windows 11, driver 616.64, wave64 emulation over 32-lane subgroups.For
s[4:5] = (1, 0), the shader moves the pair to VCC, ANDs the same pair with VCC, then selects 7 on nonzero SCC. When all lanes executed, 1/64 lanes selected 7 with this PR alone and 64/64 with both changes. When only lanes 32–63 executed the AND, the result went from 0/32 to 32/32. All 32 lower output words stayed zero in the guarded shader.Across four input pairs, both single-move shaders went from 1/4 correct dispatches to 4/4. Both split-write controls stayed at 4/4. All 32 dispatches preserved the guard words and completed with Vulkan validation enabled and zero validation errors.
The existing CPU assertion in
LocalExecFoldTests.test_negative_live_in_pair_and_unmasked_vcc_scc_not_foldedstill counts one vote and expects at least two with both changes applied. The upper-half readback above gives an output assertion for this specific case while leaving the other case in that test intact. The comparison trees wereb102395b783d5354883ef69ec200f0fa97691603andfa2a62e42cc9dc41a754c3e0ed525143ffa1032c. AI-assisted with OpenAI Codex (GPT-6).Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.