Skip to content

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

Open
andrewpozdnakov7-jpg wants to merge 2 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/normalized-f16-input-denorms
Open

andrewpozdnakov7-jpg wants to merge 2 commits into
Marvisak:mainfrom
andrewpozdnakov7-jpg:fix/normalized-f16-input-denorms

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

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 <andrewpozdnakov7-jpg@users.noreply.github.com>.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant