d3d12/shader: fix clippy warnings in valu_tests IEEE-754 comparisons #3360

Open
github-bot wants to merge 1 commit from github-bot/gh-3360 into main AGit
Owner

@⁠wagney on GitHub · 2026-12-03 16:21 UTC · original
wagney:fix/d3d12-shader-valu-tests-clippy → main · +6 −6 · 1 files · 1 commits · open

Claim: D3D12-SHADER-VALU-TESTS-CLIPPY (#3312)

Summary

Clears the 6 remaining cargo clippy --workspace --all-targets --locked -- -D warnings warnings on main in d3d12/crates/leonida-shader/src/emit/valu_tests.rs (float_compares_with_nan_on_the_device) without altering IEEE-754 NaN semantics:

  • 0x5 (v_cmp_lg_f32): a < b || a > b -> !nan && a != b (avoids clippy::double_comparisons, while keeping false when either operand is NaN)
  • 0x9 (v_cmp_nge_f32): !(a >= b) -> nan || a < b
  • 0xa (v_cmp_nlg_f32): !(a < b || a > b) -> nan || a == b
  • 0xb (v_cmp_ngt_f32): !(a > b) -> nan || a <= b
  • 0xc (v_cmp_nle_f32): !(a <= b) -> nan || a > b
  • 0xe (v_cmp_nlt_f32): !(a < b) -> nan || a >= b

Verification

  • cargo clippy --offline --workspace --all-targets --locked -- -D warnings in d3d12/: exited 0 (0 warnings across all workspace crates and targets).
  • cargo test --offline --locked -p leonida-shader --lib float_compares_with_nan_on_the_device: 1 passed, 0 failed.

AI Disclosure

  • AI-assisted using Gemini 4 Hydrogen (Medium) for implementation and an independent read-only reviewer subagent (Gemini Pro) for diff/IEEE-754/clean-room audit (Verdict: APPROVED).
**@⁠wagney** on GitHub · 2026-12-03 16:21 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3360) `wagney:fix/d3d12-shader-valu-tests-clippy` → `main` · +6 −6 · 1 files · 1 commits · open Claim: `D3D12-SHADER-VALU-TESTS-CLIPPY` (#3312) ### Summary Clears the 6 remaining `cargo clippy --workspace --all-targets --locked -- -D warnings` warnings on `main` in `d3d12/crates/leonida-shader/src/emit/valu_tests.rs` (`float_compares_with_nan_on_the_device`) without altering IEEE-754 `NaN` semantics: - `0x5` (`v_cmp_lg_f32`): `a < b || a > b` -> `!nan && a != b` (avoids `clippy::double_comparisons`, while keeping `false` when either operand is `NaN`) - `0x9` (`v_cmp_nge_f32`): `!(a >= b)` -> `nan || a < b` - `0xa` (`v_cmp_nlg_f32`): `!(a < b || a > b)` -> `nan || a == b` - `0xb` (`v_cmp_ngt_f32`): `!(a > b)` -> `nan || a <= b` - `0xc` (`v_cmp_nle_f32`): `!(a <= b)` -> `nan || a > b` - `0xe` (`v_cmp_nlt_f32`): `!(a < b)` -> `nan || a >= b` ### Verification - `cargo clippy --offline --workspace --all-targets --locked -- -D warnings` in `d3d12/`: exited 0 (0 warnings across all workspace crates and targets). - `cargo test --offline --locked -p leonida-shader --lib float_compares_with_nan_on_the_device`: 1 passed, 0 failed. ### AI Disclosure - AI-assisted using Gemini 4 Hydrogen (Medium) for implementation and an independent read-only reviewer subagent (Gemini Pro) for diff/IEEE-754/clean-room audit (**Verdict: APPROVED**).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 16:31:53 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-03 17:14 UTC · original

Ran natively on Windows 11, head 5f98ad6f8 merged into current main (717b90233, clean merge).

No findings.

check main merge
cargo clippy -p leonida-shader --all-targets -- -D warnings 6 errors, all in valu_tests.rs lines 1065-1074 clean
cargo clippy --workspace --all-targets -- -D warnings (in d3d12/) (not run) clean
float_compares_with_nan_on_the_device pass pass

The test ran on both the hardware D3D12 device and WARP (no "skipped" line with --nocapture). Each rewritten arm is the same predicate for NaN and non-NaN inputs, including 0.0 vs -0.0 for 0xa (read).

Not checked: the rest of the leonida-shader tests.

GPUs tested: one NVIDIA desktop card.
AI-assisted: yes (Claude Code).

**@⁠Kal0s-design** on GitHub · 2026-12-03 17:14 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3360#issuecomment-7386195779) Ran natively on Windows 11, head `5f98ad6f8` merged into current `main` (`717b90233`, clean merge). No findings. | check | `main` | merge | |---|---|---| | `cargo clippy -p leonida-shader --all-targets -- -D warnings` | 6 errors, all in `valu_tests.rs` lines 1065-1074 | clean | | `cargo clippy --workspace --all-targets -- -D warnings` (in `d3d12/`) | (not run) | clean | | `float_compares_with_nan_on_the_device` | pass | pass | The test ran on both the hardware D3D12 device and WARP (no "skipped" line with `--nocapture`). Each rewritten arm is the same predicate for NaN and non-NaN inputs, including `0.0` vs `-0.0` for `0xa` (read). Not checked: the rest of the `leonida-shader` tests. GPUs tested: one NVIDIA desktop card. AI-assisted: yes (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3360/head:github-bot/gh-3360'
git switch 'github-bot/gh-3360'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3360'
git switch 'github-bot/gh-3360'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3360'
git switch 'github-bot/gh-3360'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3360'
git switch 'main'
git merge --squash 'github-bot/gh-3360'
git switch 'main'
git merge --ff-only 'github-bot/gh-3360'
git switch 'main'
git merge 'github-bot/gh-3360'
git push origin 'main'
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/ubiquitarianism--leonida!3360
No description provided.