GPU: preserve NaN in reconstructed FP16 rectangle vertices #2262

Closed
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2264 into main
andrewpozdnakov7-jpg commented 2026-11-25 09:21:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T09:21:26Z.


The CPU rectangle fallback reconstructs the fourth vertex in float32 and encodes it back to the vertex format. Its FP16 converter sent NaN through the overflow path, turning a NaN input or a NaN from infinity minus infinity into a signed infinity. Emit a quiet FP16 NaN before checking finite overflow.

The regression expands synthetic R16G16B16A16_FLOAT vertices and checks the generated fourth vertex. It covers a NaN input, a NaN from the arithmetic, and both signs of infinity.

On Windows x64 / WARP, the regression failed on 940d32f and passed on c7d145a. A separate synthetic point draw bound the generated vertex as FP16 and read the pixel back from a float render target. It classified the four channels as [+inf, +inf, -inf, -inf] before the patch and [NaN, +inf, -inf, NaN] after it.

The victory-gpu diagnostics suite went from 145 passed, 2 failed, 2 ignored to 146 passed, 1 failed, 2 ignored. The existing placed-view format test (#1999) fails on this runtime in both runs. Strict Clippy with and without diagnostics and the staged asset policy passed. The patch merges cleanly alongside #2243.

Coordination claim

AI-assisted with Codex. Synthetic data only.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6601223477 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2264). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T09:21:26Z. --- The CPU rectangle fallback reconstructs the fourth vertex in float32 and encodes it back to the vertex format. Its FP16 converter sent NaN through the overflow path, turning a NaN input or a NaN from infinity minus infinity into a signed infinity. Emit a quiet FP16 NaN before checking finite overflow. The regression expands synthetic `R16G16B16A16_FLOAT` vertices and checks the generated fourth vertex. It covers a NaN input, a NaN from the arithmetic, and both signs of infinity. On Windows x64 / WARP, the regression failed on `940d32f` and passed on `c7d145a`. A separate synthetic point draw bound the generated vertex as FP16 and read the pixel back from a float render target. It classified the four channels as `[+inf, +inf, -inf, -inf]` before the patch and `[NaN, +inf, -inf, NaN]` after it. The `victory-gpu` diagnostics suite went from 145 passed, 2 failed, 2 ignored to 146 passed, 1 failed, 2 ignored. The existing placed-view format test (#1999) fails on this runtime in both runs. Strict Clippy with and without diagnostics and the staged asset policy passed. The patch merges cleanly alongside #2243. [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7158128449) AI-assisted with Codex. Synthetic data only.
upstream-sync closed this pull request 2026-11-25 10:07:13 +00:00
catminou4 commented 2026-11-25 10:07:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T09:35:35Z.

Review: COMMENTED


f32_to_half returns quiet NaN for NaN inputs instead of falling through the exponent path. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Small correctness fix; ties to the earlier f32_to_half NaN/RNE static review — this is the NaN half.

<!-- greyfinch-sync:Marvisak/VIctory:review:6055073405 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2264#pullrequestreview-6055073405). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T09:35:35Z. **Review:** COMMENTED --- f32_to_half returns quiet NaN for NaN inputs instead of falling through the exponent path. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Small correctness fix; ties to the earlier f32_to_half NaN/RNE static review — this is the NaN half.
andrewpozdnakov7-jpg commented 2026-11-25 10:07:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T09:54:45Z.


Thanks for the review. I missed the earlier #1732 when I opened this. Its current head fixes the NaN case and the rounding case from #843. I verified the same Windows/WARP point draw against it, including the NaN produced by the fourth-corner subtraction.

I am closing this duplicate. The rectangle-expansion regression is available as a separate test-only commit on #1732, with the results in the follow-up.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158968304 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2264#issuecomment-7158968304). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T09:54:45Z. --- Thanks for the review. I missed the earlier #1732 when I opened this. Its current head fixes the NaN case and the rounding case from #843. I verified the same Windows/WARP point draw against it, including the NaN produced by the fourth-corner subtraction. I am closing this duplicate. The rectangle-expansion regression is available as a separate test-only commit on #1732, with the results in the [follow-up](https://github.com/Marvisak/VIctory/pull/1732#issuecomment-7158955135).

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!2262
No description provided.