mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #1012] [MERGED] tests: GPU readback for the binary64 vector compares, v_cmp_*_f64 and v_cmpx_*_f64 (GPU-CMP-F64) #1049
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1049
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1012
Author: @milk4sale
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:gpu-test/cmp-f64📝 Commits (2)
5040782tests: GPU readback for the binary64 vector compares, v_cmp_f64 and v_cmpx_f64 (GPU-CMP-F64)d366ee2Merge main into gpu-test/cmp-f64📊 Changes
7 files changed (+560 additions, -4 deletions)
View changed files
📝
docs/design.md(+1 -1)📝
docs/testing.md(+16 -0)📝
runtime/test/shaders/check.py(+63 -0)➕
runtime/test/shaders/cs_w32_cmp_f64.asm(+270 -0)📝
scripts/run_gpu_tests.py(+5 -0)➕
tests/test_gpu_cmp_f64.py(+194 -0)📝
tests/test_shader_checks.py(+11 -3)📄 Description
Claimed in the coordination issue as: GPU-CMP-F64 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7137637578)
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.