Skip to content

tests: GPU fixture cs_w32_vcmp64_null for 64-bit integer v_cmp/v_cmpx null sources - #302

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/10034
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/10034

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

Carried over from old PR 10034 by ramon-victor in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10034, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
ramon-victor: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Summary

Adds a wave32 compute GPU fixture runtime/test/shaders/cs_w32_vcmp64_null.asm verifying the docs/design.md contract row "Null sources in 64-bit integer VALU compares" (v_cmp / v_cmpx relations eq, ne, lt, le, gt, ge on u64/i64, e32/e64, null in src0, src1, or both, partial EXEC masking, v_cmpx narrowing EXEC while leaving VCC untouched) on an NVIDIA GeForce RTX 3070, wires it into runtime/test/shaders/check.py and scripts/run_gpu_tests.py, and updates the corresponding docs/design.md contract row (keeping no corpus count).

Claim: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116958170

What cs_w32_vcmp64_null.asm checks

Wave32 group (32,1,1) assigns each lane i a 64-bit value by i & 3: 0, +1, 2^32, and 2^63 (-2^63 signed). Each lane ORs 1 << lane into LDS for each active mask bit and lane 0 stores eight 32-bit words:

  • out[0] (0x11111111): v_cmp_eq_u64_e32 vcc_lo, null, v[2:3]
  • out[1] (0x77777777): v_cmp_ge_i64_e64 s8, v[2:3], null
  • out[2] (0x66666666): v_cmp_lt_i64_e32 vcc_lo, null, v[2:3]
  • out[3] (0x88888888): v_cmp_gt_i64_e64 s10, null, v[2:3]
  • out[4] (0x00EE00EE): v_cmp_gt_u64_e64 s11, v[2:3], null under EXEC = 0x00FF00FF
  • out[5] (0x5555AAAA): v_cmp_le_u64_e64 null, null | v_cmp_ne_i64_e64 null, null under EXEC = 0x5555AAAA
  • out[6] (0x08888888): EXEC after v_cmpx_lt_i64_e64 v[2:3], null under EXEC = 0x0FFFFFFF
  • out[7] (0x96A53C69): VCC preserved untouched after v_cmpx_lt_i64_e64

Hardware & Environment

  • OS: Windows 11 Pro 64-bit (10.0.26300)
  • GPU: NVIDIA GeForce RTX 3070 (Ampere, 8 GiB, subgroup 32..32)
  • Driver / Vulkan: NVIDIA 621.24, Vulkan 1.4.357
  • Toolchain: llvm-mc 23.1.6, spirv-as / spirv-val 2026.4, vk_compute_test.exe built with MSVC 19.51

Testing

  • python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_vcmp64_null --require-pass → 1/1 passed (PASS cs_w32_vcmp64_null 286331153 2004318071 1717986918 2290649224 15597806 1431677610 143165576 2527411305)
  • LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_vcmp64_null --require-pass → 1/1 passed (identical output)
  • python -I runtime/test/shaders/build.py <scratch> cs_w32_vcmp64_null + check.py → cs_w32_vcmp64_null ok
  • python -m unittest discover -s tests/semantic -p test_vcmp64_null_src.py → 6/6 OK
  • python -I tests/test_run_gpu_tests.py (62/62 OK), tests/test_gpu_build_dir.py (18/18 OK), tests/test_design_contract_rows.py (5/5 OK), tests/test_docs_encoding.py (1/1 OK), tests/test_docs_table_rows.py (2/2 OK)
  • python -m compileall -q runtime/test/shaders/check.py scripts/run_gpu_tests.py → clean
  • python -I scripts/check_no_game_data.py runtime/test/shaders/cs_w32_vcmp64_null.asm runtime/test/shaders/check.py scripts/run_gpu_tests.py docs/design.md → clean, LF-only verified

Checklist

  • No game data, keys, decryption, or online services included
  • AI-assisted: yes
  • Claimed in the coordination issue (#9677)

@moffington

Copy link
Copy Markdown
Contributor

I ran cs_w32_vcmp64_null at 1f82097 on Linux with an RTX 3060 (NVIDIA 615.78.08). It passed with all eight expected words.

One coverage gap: the fixture ORs the expected-true null <= null mask with the expected-false null != null mask. I changed ne to eq in a scratch copy and still got all eight expected words. Could you check the two masks separately so the fixture catches that regression?

I’d also narrow the GPU verification note in docs/design.md to the cases this fixture exercises. It’s a wave32 shader, and building with LEONIDA_W64_EMULATE=1 produced byte-identical SPIR-V here, so I’d drop the wave64-emulation claim for this fixture.

@GeorgiyDemo

Copy link
Copy Markdown
Contributor

Tested 1f82097c on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main d42773d07:

  • MoltenVK 1.4.2 (subgroup 4..32): cs_w32_vcmp64_null PASS, words 286331153 2004318071 1717986918 2290649224 15597806 1431677610 143165576 2527411305.
  • KosmicKrisp (Mesa 26.3.1, subgroup 32..32): the same words, PASS.
  • 1 shader translated, 1 pass spirv-val.

Binaries from main (only check.py, run_gpu_tests.py and the fixture changed). llvm-mc 23.1.6. Synthetic fixtures only, no game data. AI-assisted.

@ImLele69

Copy link
Copy Markdown
Contributor

Tested on Linux, merged onto main 21625bca8 (PR head 1f82097ce, merges cleanly).

GPU: NVIDIA GeForce RTX 2070 SUPER (Turing, subgroup 32), proprietary driver 620.70.06, Fedora 44, llvm-mc 22.1.8, SPIRV-Tools 2026.1.

Run This PR main alone
run_gpu_tests.py native 198/249 passed, 49 skipped 197/248 passed, 49 skipped
LEONIDA_W64_EMULATE=1 230/249 passed, 17 skipped 229/248 passed, 17 skipped
run_semantic_tests.py tests/semantic 465 files, 6108 tests, 0 files failed in 120 s with 16 jobs 465 files, 6108 tests, 0 files failed

New fixture cs_w32_vcmp64_null: PASS in both modes.

The only failures in both runs are the known cs_imgload_tfe / cs_imgload_d16_tfe pair (#31), as on main. No regressions.

AI-assisted: yes (Claude Code ran the build and tests on my machine; numbers are the runners' own output).

@aslan2142

Copy link
Copy Markdown
Collaborator

This carry-over of old upstream PR 10034 has been taken over in #1031, so I'm closing this draft as #17 describes. The branch old-pr/10034 stays.

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142 aslan2142 closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants