Repository navigation
tests: GPU readback for the binary64 vector compares, v_cmp_*_f64 and v_cmpx_*_f64 (GPU-CMP-F64) - #1012
Conversation
… v_cmpx_*_f64 (GPU-CMP-F64) The v_cmp_*_f64 / v_cmpx_*_f64 row of docs/design.md was CPU-checked and measured on native gfx1100, and no fixture in runtime/test/shaders used a binary64 compare, so the SPIR-V those 32 ops translate to had not run on a driver. cs_w32_cmp_f64 is memory-fed, like cs_w32_shift64: check.py seeds 256 operand pairs, 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), and each of 128 threads loads two of them at run time. Per pair it stores a v_cmp_ word (through VCC) and a v_cmpx_ word (through EXEC): one bit per predicate in opcode order, a bit for tru run with the odd threads turned off (an inactive lane gets VCC 0 and stays off through v_cmpx_), and two bits for lt and nge with VOP3 abs/neg. The expected words come from Python floats. Both GPU runners compare all 1536 heap words, the unchanged inputs included. tests/test_gpu_cmp_f64.py checks, without a GPU, 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. docs/testing.md describes the fixture and the row names it. No translator or runtime change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
KernelSmoker
left a comment
There was a problem hiding this comment.
Verified on exact head 5040782. 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 and git diff --check pass. 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.
|
Tested PR head
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. |
|
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
|
|
The two red checks on this pull request come from the base it was tested against, not from the change. The run tested head
In the same llvmpipe run this pull request's own fixture passed: 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.) |
Brings the branch up to date with main 68d1331. No conflicts; the merged tree was tested before the push (every standalone test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since ProjectLeonida#930). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Merged. Checked locally on
#1039's AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5). |
… with ProjectLeonida#1012 merged Takes the updated head of ProjectLeonida#1034's branch, which holds main 6558d53 (ProjectLeonida#1012, GPU-CMP-F64, is merged there). Git merged it without conflicts (git merge-tree, exit 0), and the tree is the one a direct merge of main gives. GitHub had reported a conflict since ProjectLeonida#1012 merged, with the branch and main on two merge bases (68d1331 and 5040782). Merging ProjectLeonida#1034's head instead of main leaves this branch with one merge base with main when ProjectLeonida#1034 merges. The merged tree was tested before the push: every standalone test file under tests/ passes except tests/test_ci_registration.py, which fails on main 6558d53 alone (ProjectLeonida#1365 fixes it). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ProjectLeonida#1012 merged Takes the updated head of ProjectLeonida#1034's branch, which holds main 6558d53 (ProjectLeonida#1012, GPU-CMP-F64, is merged there). Git merged it without conflicts (git merge-tree, exit 0), and the tree is the one a direct merge of main gives. GitHub had reported a conflict since ProjectLeonida#1012 merged, with the branch and main on two merge bases (68d1331 and 5040782). Merging ProjectLeonida#1034's head instead of main leaves this branch with one merge base with main when ProjectLeonida#1034 merges. The merged tree was tested before the push: every standalone test file under tests/ passes except tests/test_ci_registration.py, which fails on main 6558d53 alone (ProjectLeonida#1365 fixes it). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings the branch up to date with main 6558d53, which now holds #1012 (GPU-CMP-F64), the pull request this one was stacked on. Git merged it without conflicts (git merge-tree, exit 0). GitHub had reported a conflict since #1012 merged, with the branch and main on two merge bases (68d1331 and 5040782); main is an ancestor of this commit. The merged tree was tested before the push: every standalone test file under tests/ passes except tests/test_ci_registration.py, which fails on main 6558d53 alone (#1365 fixes it). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claimed in the coordination issue as: GPU-CMP-F64 (#14 (comment))
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; native_pso_hashes: stdout gets the errors=replace guard (NATIVE-PSO-HASHES-HELP) #883 and native_pso_hashes: guard stdout like every other tool #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