Shader tests: special values of v_rcp/v_rsq/v_sqrt/v_log/v_exp_f32 #1601

Closed
github-bot wants to merge 1 commit from gh-pr/1601/head into gh-pr/1601/base
Owner

@⁠vladbondarenko97 on GitHub · 2026-11-24 19:41 UTC · original
vladbondarenko97:shader-tests/transcendental-specials-v2 → main · +123 −0 · 1 files · 1 commits · closed without merging

Adds a synthetic GPU test in crates/victory-shader/src/emit/valu_tests.rs for v_rcp_f32, v_rcp_iflag_f32, v_rsq_f32, v_sqrt_f32, v_log_f32 and v_exp_f32. ±0, ±inf, NaN, negative inputs and overflow/underflow are checked bit for bit against RDNA2 (e.g. sqrt(−0) = −0, rsq(−0) = −inf, log(−0) = −inf, exp(−inf) = +0, exp(128) = +inf, exp(−200) = +0); finite results must be within the 1 ULP the ISA allows, against f64 references. These ops lower to fdiv and the DXIL Rsqrt / Sqrt / Log / Exp intrinsics, whose edge cases are up to the host driver, and nothing tested them before. Tests only.

Tested

  • NVIDIA GeForce RTX 3080 Ti (32-lane waves) and WARP, Windows 11, on main ffe310e: the new test rcp_rsq_sqrt_log_exp_f32_special_values_match_rdna2 passes on both.
  • cargo test --workspace --locked (idle GPU): 343 passed, 0 failed, 6 ignored.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: clean. rustfmt --edition 2024 --check on the file: clean.

Not tested

  • AMD and Intel hardware (the expected values come from the RDNA2 ISA, not from an AMD run).

AI use

  • Claude Code with Claude Opus 5.5 wrote the test and this description and ran the tests on the hardware named above.

🤖 Generated with Claude Code

**@⁠vladbondarenko97** on GitHub · 2026-11-24 19:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/1601) `vladbondarenko97:shader-tests/transcendental-specials-v2` → `main` · +123 −0 · 1 files · 1 commits · closed without merging Adds a synthetic GPU test in `crates/victory-shader/src/emit/valu_tests.rs` for `v_rcp_f32`, `v_rcp_iflag_f32`, `v_rsq_f32`, `v_sqrt_f32`, `v_log_f32` and `v_exp_f32`. ±0, ±inf, NaN, negative inputs and overflow/underflow are checked bit for bit against RDNA2 (e.g. sqrt(−0) = −0, rsq(−0) = −inf, log(−0) = −inf, exp(−inf) = +0, exp(128) = +inf, exp(−200) = +0); finite results must be within the 1 ULP the ISA allows, against f64 references. These ops lower to `fdiv` and the DXIL Rsqrt / Sqrt / Log / Exp intrinsics, whose edge cases are up to the host driver, and nothing tested them before. Tests only. **Tested** - NVIDIA GeForce RTX 3080 Ti (32-lane waves) and WARP, Windows 11, on `main` `ffe310e`: the new test `rcp_rsq_sqrt_log_exp_f32_special_values_match_rdna2` passes on both. - `cargo test --workspace --locked` (idle GPU): 343 passed, 0 failed, 6 ignored. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: clean. `rustfmt --edition 2024 --check` on the file: clean. **Not tested** - AMD and Intel hardware (the expected values come from the RDNA2 ISA, not from an AMD run). **AI use** - Claude Code with Claude Opus 5.5 wrote the test and this description and ran the tests on the hardware named above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Runs v_rcp_f32, v_rcp_iflag_f32, v_rsq_f32, v_sqrt_f32, v_log_f32 and
v_exp_f32 on the host GPU and WARP and checks the RDNA2 results for
signed zeros, infinities, NaN, negative inputs and overflow / underflow
exactly, and finite results within the 1 ULP the ISA gives them.

These ops lower to fdiv and the DXIL Rsqrt / Sqrt / Log / Exp intrinsics,
whose edge cases (sqrt(-0) = -0, rsq(-0) = -inf, log(-0) = -inf) are up to
the host driver; nothing tested them before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:56 +00:00
github-bot closed this pull request 2026-11-26 04:37:56 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 21:14 UTC · original

Hardware run of rcp_rsq_sqrt_log_exp_f32_special_values_match_rdna2 on head 8a55155:

  • Machine: Windows 10 x64, Radeon RX 7800 XT (RDNA3, driver 32.0.32029.2010), Rust 1.98.1 MSVC.
  • The system runtime reports SM 6.5, so the test binary was opted into the Agility SDK runtime 1.616 locally (D3D12Core.dll + exports, not part of the repo).
  • cargo test -p victory-shader --locked rcp_rsq_sqrt_log_exp_f32_special_values_match_rdna2 -- --test-threads=1 --nocapture — 1 passed, 0 failed on the hardware backend.
  • WARP was skipped (it stays at SM 6.2 here), so the special-value expectations are confirmed against RDNA3 hardware only.
**@⁠Calvix2k** on GitHub · 2026-11-24 21:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1601#issuecomment-7144660685) Hardware run of `rcp_rsq_sqrt_log_exp_f32_special_values_match_rdna2` on head 8a55155: - **Machine:** Windows 10 x64, Radeon RX 7800 XT (RDNA3, driver 32.0.32029.2010), Rust 1.98.1 MSVC. - The system runtime reports SM 6.5, so the test binary was opted into the Agility SDK runtime 1.616 locally (`D3D12Core.dll` + exports, not part of the repo). - `cargo test -p victory-shader --locked rcp_rsq_sqrt_log_exp_f32_special_values_match_rdna2 -- --test-threads=1 --nocapture` — **1 passed, 0 failed** on the hardware backend. - WARP was skipped (it stays at SM 6.2 here), so the special-value expectations are confirmed against RDNA3 hardware only.
Author
Owner

@⁠vladbondarenko97 on GitHub · 2026-11-25 00:48 UTC · original

Closing: semantics_tests.rs's transcendental_specials_match_the_hardware (on main since this was opened) covers the same ops and special inputs, including the omod/clamp/abs variants. This test still passes on the merged tree (RTX 3080 Ti + WARP), so nothing is lost. Thanks! (Checked with Claude Code, Claude Sonnet 5.5.)

**@⁠vladbondarenko97** on GitHub · 2026-11-25 00:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1601#issuecomment-7148888722) Closing: `semantics_tests.rs`'s `transcendental_specials_match_the_hardware` (on main since this was opened) covers the same ops and special inputs, including the omod/clamp/abs variants. This test still passes on the merged tree (RTX 3080 Ti + WARP), so nothing is lost. Thanks! (Checked with Claude Code, Claude Sonnet 5.5.)

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1601
No description provided.