tests: GPU readback for the binary64 vector compares, v_cmp_*_f64 and v_cmpx_*_f64 (GPU-CMP-F64) #1012
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1012
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1012/head"
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?
@milk4sale on GitHub · 2026-11-24 16:49 UTC · original
milk4sale:gpu-test/cmp-f64→main· +560 −4 · 7 files · 2 commits · merged 2026-11-24 23:02 UTCClaimed in the coordination issue as: GPU-CMP-F64 (#14)
What and why
The
v_cmp_*_f64,v_cmpx_*_f64row ofdocs/design.mdis CPU-checked and measured on native gfx1100, and said Not GPU-verified: no fixture inruntime/test/shadersused a binary64 compare, so the SPIR-V those 32 ops translate to (an ordering built from 32-bit integer ops, noFloat64) had not run on a driver.This adds
cs_w32_cmp_f64, a memory-fed fixture in the style ofcs_w32_shift64(#590):check.pyseeds 256 operand pairs throughVKC_HEAP_INIT: the product of 16 values (±inf, ±max, the 1-ULP neighbours of ±1, the smallest subnormals, ±0, the smallest normal, a NaN whose payload is only in the low dword, a negative quiet NaN). Each of 128 threads loads two pairs at run time, so neither the translator nor the driver can fold a compare.v_cmp_word (through VCC) and av_cmpx_word (through EXEC): bits 0..15 are the 16 predicates in opcode order, bit 16 istrurun with the odd threads turned off (an inactive lane gets VCC 0 fromv_cmp_and stays off throughv_cmpx_), bits 17 and 18 areltandngewith VOP3abs/neg.cmp_f64_words). Both GPU runners compare all 1536 heap words, the 1024 unchanged input words included.tests/test_gpu_cmp_f64.pyneeds no GPU: it checks the oracle against an independent restatement of the 16 predicates, a few words worked out by hand, that the assembly gives every predicate the oracle's bit, and the readback and runner verdicts against a fake harness.tests/test_shader_checks.pycounts and fakes the new case.docs/testing.mddescribes the fixture and the contract row names it.No translator or runtime change. The SGPR-pair and constant operand forms are not in the fixture; they stay CPU-checked by
tests/semantic/test_cmp_f64.py.Tested
At this head (
50407827conmain82a2aabcc), test programs rebuilt at this head, llvm-mc 23.1.4, SPIRV-Tools v2026.4:python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_cmp_f64 --require-passon the RTX 4070 Ti: PASS natively and withLEONIDA_W64_EMULATE=1("1536 words exact").python -I tests/test_gpu_cmp_f64.py(9 tests),tests/test_shader_checks.py(87),tests/test_run_gpu_tests.py(64),tests/test_gpu_shift64.py,tests/test_docs_design_rows.py,tests/test_docs_links.py,tests/test_docs_repo_paths.py,tests/test_text_write_line_endings.py,tests/test_regen_fixtures.py: OK.python -m compileall -q make_game.py tools testsandscripts/check_no_game_data.pyon the changed files: OK.Before the rebase (the same change on
main42d705c85):-0canonicalization (word 206), a NaN test that ignores the low dword (28), an ordering key without the low dword (70), the raw result written to an inactive lane's VCC (2),v_cmpx_replacing EXEC instead of narrowing it (3),absignored (0),nltlowered as the negation ofle(0).run_gpu_tests.pyon the RTX 4070 Ti: 260 shaders, 260 translated, 260 passspirv-val; native 200/251 passed, 49 skipped, 2 failed;LEONIDA_W64_EMULATE=1232/251 passed, 17 skipped, 2 failed. The two failures arecs_imgload_tfeandcs_imgload_d16_tfe, already recorded for this GPU ingpu-test-results/RTX4070Ti.txt.tests/test_tool_stdout_encoding.py, which fails the same way without this change (tools/native_pso_hashes.py; #883 and #948 are open for it).Not run: llvm-mc 19, which the
linux-gpu-toolsjob assembles with (not installed here); the translator suite (nothing undertools/ortests/semantic/changes); Windows; AMD hardware. The 4070 Ti run checks the translated SPIR-V on a driver against IEEE-754. What ties the predicates to RDNA2 is the row's native gfx1100 measurement, which this does not repeat.GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 620.70.06, Linux (CachyOS, kernel 7.3.3); Mesa llvmpipe 26.2.6 (LLVM 23.1.4), same machine
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No new rule; the existing row now names the fixture.)🤖 Generated with Claude Code
@KernelSmoker on GitHub · 2026-11-24 17:02 UTC · original · approved these changes
Verified on exact head
50407827cd. The focused CPU suites pass: f64 compare oracle 9/9, shader checks 87/87, GPU runner 64/64, design contract rows 5/5, docs links 16/16. Changed-file no-game-data andgit diff --checkpass. The independent runtime GPU execution reported in the PR is on an RTX 4070 Ti and llvmpipe; I did not independently reproduce a GPU run here. The host RTX 3090 is present, but no fixture harness is built locally and only 72 MB disk space was free, so an honest 3090 run was not feasible. No game data used.@veqzo on GitHub · 2026-11-24 17:23 UTC · original
Tested PR head
50407827cd2cb73313c585cdf3d3d40ed7918baeon Windows with an NVIDIA GeForce GTX 1080 and driver 582.78.cs_w32_cmp_f64: PASS, 1,536 words matched.LEONIDA_W64_EMULATE=1: PASS, 1,536 words matched.spirv-valin both runs.tests/test_gpu_cmp_f64.py: 9 tests passed.Tools: LLVM 23.1.6 and SPIR-V Tools 2026.4. The GPU test programs were built from the same PR revision.
AI-assisted testing.
@iFeyz on GitHub · 2026-11-24 19:40 UTC · original
AMD run (the "AMD hardware" gap): RX 9070 XT (RDNA4, GFX1201), AMD proprietary Windows driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 11. Head
50407827c,scripts/run_gpu_tests.py --filter cs_w32_cmp_f64with the test programs of a currentmainbuild.cs_w32_cmp_f64: PASS, 1536 words exact (256 operand pairs and unchanged inputs), native (subgroup 64) and withLEONIDA_W64_EMULATE=1.@milk4sale on GitHub · 2026-11-24 22:30 UTC · original
The two red checks on this pull request come from the base it was tested against, not from the change. The run tested head
50407827cmerged intomainat82a2aabcc, which was itself red on both jobs:gta6rt.exefailed to link, withWaitOnAddress,WakeByAddressSingleandWakeByAddressAllunresolved fromleonida_xma2_decoder.lib. Fixed onmainby #877.cs_imgload_tfeandcs_imgload_d16_tfefailed (r32 sint (sint view): 64 bad). This pull request does not touch them; their expectation was fixed onmainby #892.In the same llvmpipe run this pull request's own fixture passed:
cs_w32_cmp_f64 1536 words exact, and the job ended at 171/253 passed, 80 skipped, with only those two failures.I have not pushed to re-run CI: the Runtime queue is several hours behind, and #1034 and #1047 are stacked on this branch. (Comment written with AI assistance from the job logs.)
@aslan2142 on GitHub · 2026-11-24 23:02 UTC · original
Merged. Checked locally on
main28a32e190+d366ee248:GPU-CMP-F64was posted at 16:25 UTC, before this PR, and is unedited.cmp_f64_wordsagrees with a separate model that orders by integer keys, with 0 mismatches in 512 result words. By hand: −0 against +0 iseq, the smallest subnormal isgt+0, and both NaNs are unordered on every predicate.main's translator:cs_w32_cmp_f64passes with all 1,536 words exact on llvmpipe (Mesa 26.3.1) and on an RDNA2 iGPU (RADV). The neighbouringcs_w32_cases: 13 passed and 8 skipped for subgroup width on llvmpipe, 21 of 21 on the iGPU.test_gpu_cmp_f64,test_run_gpu_tests,test_shader_checkspass; the 13 docs and writer tests pass;check_no_game_data.pyis clean on the 7 changed files.#1039's
cs_w32_vcmp_f64covers the same row; as that PR says itself, it can drop the row now. #1034, #1047 and #1063 build on this one and follow.AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).