Shaders: honor explicit half input flush in normalized conversions #3166

Open
github-bot wants to merge 2 commits from github-bot/gh-3166 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 10:48 UTC · original
andrewpozdnakov7-jpg:fix/normalized-f16-input-denorms → main · +206 −76 · 3 files · 2 commits · open

V_CVT_NORM_I16_F16 and V_CVT_NORM_U16_F16 must read half subnormals as zero when MODE[6] disables input denormals. Lyrnc's RDNA2 sweep in #376 measured the distinction for both instructions.

Reuse the existing MODE dataflow for statically known S_DENORM_MODE and literal MODE writes. The analysis runs lazily for shaders that use either conversion. Known flush sites zero the source magnitude below the smallest normal half before scaling. Entry and runtime-unknown modes retain the current behavior.

On main, signed conversion of 0x0101 in flush mode returns 0x0001. On WARP the patch gives 0x0000, and all 274 synthetic readbacks passed across both conversions, the four denormal modes, explicit MODE bit writes and agreeing branch paths. All 36 VALU tests, strict shader Clippy and the asset policy passed.

AI-assisted with Codex. Please retain the Git author when cherry-picking or rebasing. If folded into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 10:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/3166) `andrewpozdnakov7-jpg:fix/normalized-f16-input-denorms` → `main` · +206 −76 · 3 files · 2 commits · open `V_CVT_NORM_I16_F16` and `V_CVT_NORM_U16_F16` must read half subnormals as zero when MODE[6] disables input denormals. [Lyrnc's RDNA2 sweep in #376](https://git.gtahub.st/github/Marvisak--VIctory/pulls/376) measured the distinction for both instructions. Reuse the existing MODE dataflow for statically known `S_DENORM_MODE` and literal MODE writes. The analysis runs lazily for shaders that use either conversion. Known flush sites zero the source magnitude below the smallest normal half before scaling. Entry and runtime-unknown modes retain the current behavior. On main, signed conversion of `0x0101` in flush mode returns `0x0001`. On WARP the patch gives `0x0000`, and all 274 synthetic readbacks passed across both conversions, the four denormal modes, explicit MODE bit writes and agreeing branch paths. All 36 VALU tests, strict shader Clippy and the asset policy passed. AI-assisted with Codex. Please retain the Git author when cherry-picking or rebasing. If folded into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:09:12 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 11:03 UTC · original

Updated to b5a1678 to keep the normalized-half code and its MODE analysis in one module. The initial tree exceeded the repository's source-size limit when combined with #2623 and the independent shader fixes. The composed tree now passes the asset policy with lower.rs at 521,358 bytes. All 36 WARP VALU tests passed on the new PR head and all 44 passed with #2623 and the other shader changes. Strict shader Clippy passed.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 11:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3166#issuecomment-7190202258) Updated to `b5a1678` to keep the normalized-half code and its MODE analysis in one module. The initial tree exceeded the repository's source-size limit when combined with #2623 and the independent shader fixes. The composed tree now passes the asset policy with `lower.rs` at 521,358 bytes. All 36 WARP VALU tests passed on the new PR head and all 44 passed with #2623 and the other shader changes. Strict shader Clippy passed.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 11:10 UTC · original · approved these changes

Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-shader --lib v_cvt_norm_f16_honors_input_denormal_mode -- --test-threads=1: passed on RTX 5090 and WARP.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 192 files ok.

Cleanly honors explicit half-float input denormal flush mode in normalized f16 conversions.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 11:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3166#pullrequestreview-6073098361) · **approved these changes** Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-shader --lib v_cvt_norm_f16_honors_input_denormal_mode -- --test-threads=1`: passed on RTX 5090 and WARP. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 192 files ok. Cleanly honors explicit half-float input denormal flush mode in normalized f16 conversions. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
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/3166/head:github-bot/gh-3166'
git switch 'github-bot/gh-3166'

Merge

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