rdna2spirv: a lane mask read as a number is the wave's mask word (SHADER-MASK-AS-DATA) #1043
Closed
thesubtleties wants to merge 3 commits from
upstream-pr/1043 into main
pull from: upstream-pr/1043
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!1043
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1043"
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 thesubtleties on 2026-11-24T17:08:09Z.
Claimed in the coordination issue as: SHADER-MASK-AS-DATA
What and why
A lane mask is one word for the wave on hardware; the translator keeps each lane's own 0 / ~0. An op that read the mask as a number therefore got a different wrong value per lane, with no error: with mask
0x3ff,s_add_u32 d, mask, 1was 0 or 1 andv_mov_b32 v, maskwas 0 or ~0 (crosslane_fuzz.py"maskdata", the old #293).s_bcnt/s_ff/s_flbitalready rebuild the word. This does the same for:lane_masks.NUMBER_READERS);v_mov_b32of a mask, when nov_readfirstlane_b32or vector bitwise op reads that value as a mask. Each copy is followed forward, through VGPR-to-VGPR copies (second commit).The emulation planner counts such an op as an exchange, it never joins an active run, and
wave32_pixel_scan.pycounts it asmask_word.Partial on purpose. Not covered: the values excluded above (the v_mov / v_or3 / v_readfirstlane idiom needs each lane's own bit), compares, SDWA and DPP, and 16-bit, float and 64-bit ops.
Three existing tests changed:
test_salu_movrels_lane_mask,test_scselect_b64_dataandtest_salu64_bitwise_dataread a mask back withv_mov_b32and expected the lane's own 0 / ~0; they now expect the mask word.Tested
Measured on base
82a2aabc, then rebased; the semantic suite and the touched tests were rerun after the rebase.tests/semantic/test_mask_as_data.py(wave32, native wave64, partial EXEC, the through-a-VGPR idiom, emulated translation): fails onmain, passes here.run_semantic_tests.py: 0 files failed.crosslane_fuzz.py, hard mismatches, main -> this PR; no program fails here that passed on main:--ext, seed 880606 (300), 3080 and gfx1036--ext, seed 880707 (300), gfx1036The 880xxx main rows were run on
98a977b4. With--no-maskdatathere are no hard mismatches there on main. Correction: the first version of this text said the remaining mismatches werev_readfirstlanereads. Minimizing them showed most came from a plain VGPR-to-VGPR copy that the first commit counted as a mask read; the second commit fixes that. What is left on wave32 seeds 991201, 991202 and 993301 (11 mismatches, plus 4 programs with a hypothesis op) is now minimized on the 3080: every reduction contains av_mov_b32of a mask into a VGPR that av_readfirstlane_b32or a vector bitwise op then reads, the idiom this PR leaves alone. The shortest isv_cmp_ne_u32_e32 vcc_lo, 9, v6/v_mov_b32_e32 v2, vcc_lo/v_readfirstlane_b32 s8, v2. The wave64 leftovers (seed 880606 emulated on the 3080, seed 880707 native on gfx1036) minimize to the same idiom. Caveat: two hard reductions stayed at 14 and 17 lines, where the pattern is present but not shown to be the cause, and the six programs with a hypothesis op (4 wave32, 2 wave64 native) are not explained.cf_diff.py: 2,000 programs on the second commit (wave32 and wave64), 0 mismatches.run_gpu_tests.py: per-test results identical to main: 3080 201/252, 3080 emulated 233/252, gfx1036 234/252, gfx1036 emulated 234/252; only the two known tfe fixtures fail (#31). Rerun on the second commit.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.Imported from ubiquitarianism/leonida. Originally posted by morodirule on 2026-11-24T17:10:34Z.
Independent Linux check (stdlib only, no game/GPU): all four files pass on head
02d62939f— test_mask_as_data 9/9, test_salu64_bitwise_data 11/11, test_salu_movrels_lane_mask 3/3, test_scselect_b64_data 12/12. Same files against the unmodified tools fail 172+9+32+2 respectively, so the tests fully exercise the change. Not claiming; review evidence.Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T17:24:58Z.
Review: APPROVED
Verified on exact head
02d62939f6(base96e1e22261). Focused tests pass: new mask-as-data 9/9; updated SALU64, MOVRELS and SCSELECT regressions 11/11, 3/3 and 12/12; lane-mask, planner and pixel-scan unit suites also pass (including wave64 emulation 31/31). One additional SPIR-V validation test skipped becausespirv-as/spirv-valare absent. The full semantic run covered 471 files / 6,174 tests; onlytest_sopc_validationandtest_unary_f16_validationfailed, both because those executables are missing, so I do not report the full suite as green. Changed-file no-game-data/diff checks and merge-tree pass. The addeddocs/design.mdcontract entry is present. CPU semantic validation only; no local GPU or game-data run.Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T17:28:12Z.
Thanks @morodirule and @KernelSmoker. I pushed a second commit, so your checks cover
02d62939fand not the new head. It changes only howlane_masks.number_movesdecides whichv_mov_b32copies are read as numbers: a VGPR-to-VGPR copy no longer counts as a mask read. Wave32 fuzz mismatches go from 10 to 0 (seed 880505). My earlier explanation of those 10 was wrong, and the description is corrected. AI-assisted (Claude Code).Imported from ubiquitarianism/leonida. Originally posted by Sangonapou on 2026-11-24T18:24:53Z.
Tested
68b964e4on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, and a GPU before/after withcrosslane_fuzzRuntime built with
scripts\build_runtime.ps1(MSVC 19.51; this PR changes no runtime file);llvm-mc23.1.6, SPIRV-Tools 2026.4. No game files.crosslane_fuzz.py --wave both --modes both --programs 300 --seed 20261123(the samevk_compute_test), on this PR's based4de3a7dand at this head. "Flagged" = programs reported asmismatch, including the hypothesis-op ones; every flagged program in both columns containsmaskdata:--dpp--extThe base counts are identical to a run of the same seed on
main867d922fthe day before, so the drop is this change. 0 rejected and 0 harness errors in all runs. Still flagged at this head (seed 20261123, reproducible with--show):cs_xl32_2026173083373,cs_xl64_2026173083374,…396,…450,…524,…564,…632,…660--dpp:cs_xl32_2026173083409,…425,…639,cs_xl64_2026173083512,…528,…580,…642--ext:cs_xl32_2026173083373,cs_xl64_2026173083562Also at this head:
test_mask_as_data.py13 OK,test_salu64_bitwise_data.py11 OK,test_salu_movrels_lane_mask.py3 OK,test_scselect_b64_data.py12 OK (unittest discover). GPU suite: 261 shaders, 261 translated, 261 pass spirv-val; native 201/252, emulated 233/252; the only failures arecs_imgload_tfe/cs_imgload_d16_tfe, as onmainon this card (#892).Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T18:54:00Z.
More evidence on head
68b964e42; no code change.tools/wave_diff.py --masks-as-data(CPU only, seed 551117, 2,000 programs per wave size), main3aa97542against this branch:The first remaining failure in each is a
v_mov_b32of a mask followed by av_readfirstlane_b32of that VGPR, the idiom this PR leaves alone. I did not check the other 26 one by one (that tool has no minimizer).The wave64
crosslane_fuzz.pyleftovers from the description are minimized now (seed 880606 emulated on the 3080, seed 880707 native on gfx1036): all 4 contain the same idiom, the shortest beingv_cmp_ge_u32_e64 vcc, v6, v1/v_mov_b32_e32 v5, vcc_hi/v_readfirstlane_b32 s8, v5. The description is updated to say so.Not tested: the game corpus and RDNA2 console hardware. AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by MynFriend on 2026-11-24T19:53:58Z.
Tested
68b964e42on an RTX 3080 with--wave64-emulate. A synthetic loop counting four set bits should return 4 in every lane. GPU readback returned 32 in four lanes and 2 in the other 60. A local change that converts the lane mask to a scalar word before entering the loop returned 4 in all 64 lanes. Both modules passed Vulkan 1.2 validation. AI-assisted test, no game files used.Local translator change. On entry to the scalar bit-scan loop,
s8represents the low half of a per-lane mask. On the back edge,s_mov_b32 s8, s14carries an ordinary scalar after clearing one bit. The analysis drops the mask classification at the join. The firsts_ff1_i32_b32then sees a different value across lanes. The local fix gathers the low 32 predicate bits into one uniform word at the entry zero-test, while the source is still known to be a mask (Gen.lane_mask_word). It stores that word in the SGPR and treats the register as scalar on both outgoing paths and at the loop header. The fix was tested on an experimental translator branch with single-wave, 64-thread compute groups.Reproduce on the PR head with Python only
From the repo root at
68b964e42, run the following Python. Each of the 64 output words should be 4. The interpreter printsCounter({2: 60, 32: 4}), matching the RTX 3080 readback.For the GPU check, the same
asmwas assembled withspirv-as --target-env vulkan1.2and validated withspirv-val --target-env vulkan1.2. The module was run withvk_compute_test scan.spv 1 inspectandVKC_DUMPset to an output file. All 64 little-endian uint32 values in the dump were counted.Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T22:35:23Z.
Thanks @MynFriend, I reproduced this in the CPU interpreters at
68b964e42: wave64 native and emulated, and a wave32 version. Main82a2aabcgives the same wrong values, so it isn't a regression, but this PR doesn't fix it. It's a mask meeting plain data at a join, where the analysis drops the mask.While checking I found a straight-line relative:
s_xor_b32of a mask and plain data reads one lane's bit. I have a local prototype for that second case only (semantic suite clean, no GPU run yet). If you'd like to send your entry-test fix as its own PR, please do; I won't start on the loop case.CPU only. AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-24T23:50:14Z.
Native RDNA2 (gfx1036,
tools/hw_oracle): all 21 programs left over in the description (15 hard, 6 with a hypothesis op) match the fuzzer's model, so those are translator bugs, not model errors. Four short versions of the idiom also match. The cause is still shown only for the short reductions.GPU suite on this head: the only failures are the two
tfefixtures fixed by #892. AI-assisted (Claude Code)Imported from ubiquitarianism/leonida. Originally posted by thesubtleties on 2026-11-25T04:03:06Z.
Rebased by merging main
bfef489c; two conflicts, both independent additions.test_slot67_operand_formsloses anexpectedFailurethat this fixes.Semantic suite: 488 files / 6,292 tests, 0 failed. GPU suite on the 3080 and gfx1036, native and emulated: per-test identical to main. Earlier approvals cover older heads. #1397 overlaps; I commented there. AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-26T01:56:05Z.
RTX 3090 / 621.40, crosslane fuzz with maskdata, seed 309700: mismatches go 56+29 -> 12+9 (w32+w64) with this PR. Remaining are still mask-as-data, e.g. cs_xl32_30970929176 (native, group 50):
minimized repro
s14: expected 0x00000000; threads 0-31 got 0xfffeef3a, threads 32-49 got 0x0002ef3a.
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-26T08:15:31Z.
Fix for the remaining mismatches: https://github.com/ubiquitarianism/leonida/compare/thesubtleties:mask-as-data...ammonium231:fix-1043-number-moves (on top of this PR, 4 files, +123/-10). number_moves dropped a plain v_mov of a mask when a later v_readfirstlane / v_and read the copy, so inactive lanes leaked into the mask. RTX 3090 fuzz, 2000 programs/seed, --dpp --ext: 309700 984/12/4 + 989/9/2 -> 1000/1000 both waves; held-out 309900 (36 failing) and 310100 (29 failing) -> 0, no new failures. Semantic suite 6296/0.
Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-27T11:01:32Z.
Checked
4d58a05dmerged into main2859d0c9(merges cleanly), by Claude Code (AI-assisted) on my behalf. Linux,Mesa lavapipe,
--wave64-emulate.tests/semantic: 501 files, 6,387 tests, 0 failed.crosslane_fuzz.py --wave 64 --modes emulate --dpp --ext: seed 205, 150 programs: 150 match (main: 5 mismatch,2 hyp_only); seed 311, 300 programs: 299 match, 1 hyp_only,
cs_xl64_31101202(main: 10 mismatch, 4 hyp_only).That one is on main too, and #1397's head (
e3e119a) matches it, so it is one place where the two differ.Not run: a hardware GPU, native wave32.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-28T04:51:03Z.
RTX 3090 / 621.40, crosslane_fuzz 2000 programs on main
431ceba4f: this PR takes mismatches from 59/26 (native/emulated) to 13/2. The rest are a plain v_mov of a mask feeding a vector bitwise op (v_cmp_ne_u32_e64 s16 / v_mov_b32 v4, s16 / v_xor_b32 v7, v5, v4).Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:33:21Z.
Review: CHANGES_REQUESTED
Reviewed against current
main: this branch has merge conflicts and failing CI, and it is a competing variant with#1397for the same lane-mask-as-data issue (SHADER-MASK-AS-DATA;#1397is currently rebased and CI-green). Please rebase ontomainif you intend to keep this variant in contention for maintainer selection, or coordinate with#1397.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:49:15Z.
Closing this competing variant in favor of #1397 for
SHADER-MASK-AS-DATA(lane-mask operands read as numeric values).Side-by-side comparison:
#1043'snumber_movesforward-lookahead heuristic still leaves remainingcrosslane_fuzzmismatches on RTX 3090 (13 native / 2 emulated out of 2,000 programs measured by@ammonium231, e.g.v_cmp→v_mov_b32→v_readfirstlane_b32andv_cmp→v_mov_b32→v_xor_b32) as well ascs_xl64_31101202(measured by@kawaii-shakal).#1397avoids lookahead fragility by maintaining a single invariant: VALU data reads (src_u) always materialize the wave's 32-bit mask word, while mask consumers (mask_srcandv_readfirstlane_b32into mask-tracked destinations) extract this lane's bit back via_vgpr_mask_lane_bit(half-aware in wave64) and broadcast from the first active lane.#1397also incorporates the scalarMASK_NUMBER_READERSset from#1043.#1043currently conflicts withmainand has failing CI.#1397is cleanly rebased ontomain(MERGEABLE/CLEAN), has all 7 CI checks green, adds thecs_exec_copy.asmGPU fixture plus 280 lines of semantic tests, and passed independent RTX 4090 hardware verification (50/50 native wave32 and 50/50 emulated wave64 programs, 0/103,180 word mismatches vs. 422/103,180 onmain).Thanks
@thesubtleties— yourNUMBER_READERSanalysis directly contributed to the landed solution in#1397.(AI-assisted review.)
Pull request closed