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

Closed
vladbondarenko97 wants to merge 1 commit from upstream-pr/1601 into main
vladbondarenko97 commented 2026-11-24 19:41:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-24T19:41:31Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589939937 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1601). Originally posted by [vladbondarenko97](https://github.com/vladbondarenko97) on 2026-11-24T19:41:31Z. --- 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)
Calvix2k commented 2026-11-24 21:28:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T21:14:13Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7144660685 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1601#issuecomment-7144660685). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-24T21:14:13Z. --- 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.
upstream-sync closed this pull request 2026-11-25 01:06:55 +00:00
vladbondarenko97 commented 2026-11-25 01:08:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-25T00:48:03Z.


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.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148888722 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1601#issuecomment-7148888722). Originally posted by [vladbondarenko97](https://github.com/vladbondarenko97) on 2026-11-25T00:48:03Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1600
No description provided.