Skip to content

Shaders: flush each three-way min and max input once - #3733

Open
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/minmax3-flush
Open

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/minmax3-flush

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

Flush the three inputs to v_min3_f32 and v_max3_f32 once. The first selection already uses flushed operands, so its result can go straight into the second max_min_flushed call. That result is a normal value or infinity, a signed zero, or a NaN. Both selections still use the existing signed-zero handling. DXIL FMax and FMin semantics.

Generated compute shader DXIL instructions, main → change DXIL bytes, main → change
Single min3 or max3 84 → 78 2,632 → 2,604
12 alternating min3/max3 568 → 496 5,060 → 4,716

On Microsoft WARP 1.0.22 with Agility 1.620.2, both revisions passed the existing min/max/clamp CPU-model test. A separate exact comparison returned all 438,976 output words bit for bit, covering both opcodes across subnormals, signed zeros, NaNs, infinities, ordinary values, clamp, output scaling and source modifiers. Counts are emitted DXIL from generated programs. Game performance was unmeasured. Strict all-feature shader Clippy, formatting of the changed block, and the asset policy passed.

#3352 covers explicit NaN operand selection in the shared helper and is a separate semantic change.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> if folding the change into another commit.

AI-assisted with OpenAI Codex.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

Windows CI passed on c909723, including the workspace tests and both Clippy configurations. The same DXIL instruction reduction also passed the exact-output comparison with the explicit NaN selection in #3352.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> if folding the change into another commit.

AI-assisted with OpenAI Codex.

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