GPU: round FP16 rectangle corners to even and keep NaN (#245) #315

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

@⁠towiice on GitHub · 2026-11-24 23:30 UTC · original
towiice:fix/rect-fp16-rounding-nan → main · +27 −3 · 1 files · 1 commits · open

Fixes #245. In the CPU rectangle expansion, f32_to_half rounded exact ties up in the normal range and turned NaN into infinity. Ties now go to the even mantissa, as the subnormal path already does, and NaN becomes a quiet NaN with the same sign (the payload is not kept).

Tested (2119b0e + this change; GTX 1650 SUPER, Windows 11, Rust 1.98.1 gnullvm):

  • The new test goes through expand_rects and covers a tie rounding down, a tie rounding up, NaN and ±infinity. It fails without the fix; the NaN check also fails when only the NaN fix is removed.
  • cargo test --workspace --locked --no-fail-fast: 496 passed, 1 failed, 7 ignored. The failure is load_probe: building its fixture fails to link on gnullvm (/DELAYLOAD); this PR does not touch it.
  • Clippy (--all-targets -D warnings) passes, and rustfmt --check passes on the changed file.

Not tested: MSVC build, the all-features Clippy run, running a game.

AI use: written and tested with Claude Code.

🤖 Generated with Claude Code

**@⁠towiice** on GitHub · 2026-11-24 23:30 UTC · [original](https://github.com/fxceless/victory-fork/pull/315) `towiice:fix/rect-fp16-rounding-nan` → `main` · +27 −3 · 1 files · 1 commits · open Fixes #245. In the CPU rectangle expansion, `f32_to_half` rounded exact ties up in the normal range and turned NaN into infinity. Ties now go to the even mantissa, as the subnormal path already does, and NaN becomes a quiet NaN with the same sign (the payload is not kept). **Tested** (2119b0e + this change; GTX 1650 SUPER, Windows 11, Rust 1.98.1 gnullvm): - The new test goes through `expand_rects` and covers a tie rounding down, a tie rounding up, NaN and ±infinity. It fails without the fix; the NaN check also fails when only the NaN fix is removed. - `cargo test --workspace --locked --no-fail-fast`: 496 passed, 1 failed, 7 ignored. The failure is `load_probe`: building its fixture fails to link on gnullvm (`/DELAYLOAD`); this PR does not touch it. - Clippy (`--all-targets -D warnings`) passes, and `rustfmt --check` passes on the changed file. **Not tested:** MSVC build, the all-features Clippy run, running a game. **AI use:** written and tested with Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The CPU rectangle expansion rounded exact ties up and turned NaN into
infinity.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:32 +00:00
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/315/head:github-bot/gh-315'
git switch 'github-bot/gh-315'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-315'
git switch 'github-bot/gh-315'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-315'
git switch 'github-bot/gh-315'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-315'
git switch 'main'
git merge --squash 'github-bot/gh-315'
git switch 'main'
git merge --ff-only 'github-bot/gh-315'
git switch 'main'
git merge 'github-bot/gh-315'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.