Tests: f32 and f16 transcendentals on the GPU against f64 references #643
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!643
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-643"
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?
@acaracargo on GitHub · 2026-11-24 02:49 UTC · original
acaracargo:fork/transcendental-gpu-tests→main· +130 −0 · 1 files · 2 commits · openAdds GPU tests for
v_rcp,v_rsq,v_sqrt,v_log,v_exp,v_sinandv_cos, in both f32 and f16, against f64 references.Special results such as zeros, infinities, NaN and overflow are checked exactly. Other results are checked within the following tolerances:
The worst measured f32 errors were 0 for rcp, 8.4e-8 for rsq, 7.4e-8 for sqrt, 1.2e-7 for log, 1.1e-7 for exp, 6.8e-5 for sin and 9.6e-5 for cos. The f16 error was about 1.6 ulp at most.
The sin / cos results also show that converting turns to radians before range reduction increases the error with larger arguments. This is worth investigating separately rather than changing the translation in a test-only PR.
#530 covers the f64 forms of rcp and rsq, which these tests do not touch.
What is in it
crates/xcl/src/gpu/recomp/tests.rs:gpu_transcendental_f32andgpu_transcendental_f16.Tested
x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug.cargo test --workspace -- --test-threads=4on232ee73: 686 passed, 0 failed, 41 ignored (main9ce2070: 684 / 0 / 41).gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).log2()withlog(), replacingexp2()withexp()and removing the 2pi factor from the f16 cosine translation all cause the tests to fail (checked locally, reverted).Regression run
Not tested
rsq(-0)because console behavior is unverified.AI use
@MesshM on GitHub · 2026-11-24 03:18 UTC · original
Test run of
232ee73f36c7b8fa0c4e9fe30c96e29a4b3063f0on AMD RDNA4 (native wave64). I merged it onto currentmain63cdc25locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 694 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 654 passed, 0 failed, 21 ignoredSKIPPED;gpu_transcendental_f32andgpu_transcendental_f16pass.Review:
v_sin/v_costake their input in turns (turn(x, f64::sin)), as the hardware does, and inputs past |x| > 256 are left out where the hardware's own reduction differs; the special values are compared exactly and the rest within a relative tolerance (absolute for sin / cos). This is the first AMD run.Not tested: no retail title (not needed for a test-only change), release build; the PR's head on its old base was not run, only its merge onto
main.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@NAbobo101 on GitHub · 2026-11-24 03:21 UTC · original
Test run of
232ee73f36c7b8fa0c4e9fe30c96e29a4b3063f0on NVIDIA Blackwell with an older DXC than the PR's run (1.8 instead of 1.9), tested as is (it also merges cleanly onto currentmaindd2ae9a).Tested
x86_64-pc-windows-msvc; DXC 1.8.2502.11 (Windows SDK 10.0.26100); debug.cargo test --workspace --no-fail-fast -- --test-threads=4: 686 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.gpu_transcendental_f32andgpu_transcendental_f16pass, and three more runs of both (--nocapture) printed the same worst errors each time:Not tested
AI use
@lordon1a on GitHub · 2026-11-24 03:38 UTC · original
Independent GPU test report on
232ee73:Tested
616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200),rustc 1.100.0(x86_64-pc-windows-gnullvm), debug build, DXC1.9.2609.5(01b62ad4)cargo test -p xcl --lib gpu_transcendental_ -- --nocapture0.97s(gpu_transcendental_f32max err: rcp0.0, rsq8.43e-8, sqrt7.45e-8, log1.19e-7, exp1.09e-7, sin6.77e-5, cos9.57e-5;gpu_transcendental_f16max err: rcp8.24e-4, rsq4.29e-4, sqrt4.88e-4, log6.51e-4, exp6.93e-4, sin/cos4.88e-4)Not tested
AI use
232ee73in a detached worktree, audited the diff, ran the GPU test, and posted this report.@acaracargo on GitHub · 2026-11-24 03:47 UTC · original
@lordon1a Eline sağlık.
@upipibi on GitHub · 2026-11-24 05:53 UTC · original
For when this lands: #818 (fix for #796) reduces
v_sin/v_cosin turns before scaling. With this PR'sgpu_transcendental_f32/_f16applied locally, both pass onmainand with #818 (RTX 3070, driver 616.56). The worst sin/cos errors drop from 6.8e-5 / 9.6e-5 (f32) to 1.2e-7 / 6.0e-8, and f16 sin from 4.9e-4 to 2.6e-4. So after #818 the f32 sin/cos tolerance could tighten well below 2^-10, and the skip of inputs above 256 turns could go: the RDNA2 ISA's own examples includesin(-MaxFloat) = 0andcos(-MaxFloat) = 1.AI-assisted (Claude Code).
@JJAutoCompare on GitHub · 2026-11-25 05:42 UTC · original
Tested
PR #643 was open at
232ee73f36c7b8fa0c4e9fe30c96e29a4b3063f0before and after the run. The checkout was clean and detached at that commit. The PR discussion and issue #42 contained no equivalent Arc result at either check.STOR-WINLAB, native Windows 11 Enterprise Evaluation 25H2 x64 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust/Cargo 1.100.0
x86_64-pc-windows-msvc, DXC/DXIL 1.9.2609.5, debug test profile with debuginfo disabled.cargo test --locked -p xcl --lib --no-run --message-format=jsonfinished in 39.90 s outside the Arc lock, with two build jobs, incremental compilation disabled, dev/test debuginfo set to 0, andTEMP/TMPunderL:/XclTooling/pr643/temp.With
XCL_ADAPTER=A770,XCL_DIRECT_DXIL=0, andXCL_DXC_DIR=%LOCALAPPDATA%/XclTooling/dxc-1.9.2609/bin/x64, the lock wrapper ran the two prebuilt fixtures.$fixtureBinarycame from Cargo's artifact output.2 passed, 0 failed, 0 ignored, 0 capability skips. Both fixtures reached their final assertions after GPU dispatch and readback. From the fixture loops, f32 evaluated 175 result comparisons (0.60 s) and f16 evaluated 159 (0.21 s) across reciprocal, reciprocal square root, square root, log2, exp2, sine and cosine. They exercised signed-zero inputs, infinities, NaN and turn-based angles where the fixtures include those cases. Both used split logical wave64 on 32-lane Arc hardware, as selected by the checked-in runner.
The Cargo build, both native fixture processes, and the Arc wrapper each returned
0. The wrapper logged release of the GPU lock.Not tested
Native wave64, standalone logical wave32, direct DXIL,
rsq(-0), f16 results filtered by the fixture's overflow guard, angles outside the fixture's domain, console parity, other fixtures, the workspace suite, and retail smoke runs.AI use
T3 Code / Codex (
gpt-6.2-sol) ran the verification and wrote this report. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts againstpr643/{f32,f16}.stdout.logand published.@DavidM1911 on GitHub · 2026-11-25 12:31 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.