Repository navigation
asahi: share negative-zero operands for G16 uniform clamps - #48
Open
IronsideXXVI wants to merge 2 commits into
Open
IronsideXXVI wants to merge 2 commits into
IronsideXXVI wants to merge 2 commits into
Conversation
Preserve f32 saturated-add semantics while materializing one negative-zero GPR per block rather than copying every uniform source. Qualified on an M4 with matching finite blend readbacks and 6.126% lower fill submission time. Retain ASAHI_G16_SHARED_NZ=0 opt-out and include the choice in the Vulkan compiler cache key. Assisted-by: LLM
Retain a reliable opt-out for OpenGL as well as Vulkan when process flags change. Assisted-by: LLM
[Medium impact] The PR appears safe to merge. SummaryShares one negative-zero register per block for eligible G16G uniform clamps while keeping the saturated float32 add.
Reviews (1) · Last reviewed commit: "asahi: separate G16 materialization choi..." · Reviewed by Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
G16 uniform clamps currently copy each uniform into a GPR before a saturated float32 add. Reuse one negative-zero GPR per block instead, retaining the same add, operand order, saturation and precision. This is restricted to eligible G16G operands.
ASAHI_G16_SHARED_NZ=0restores the previous path; the compiler-cache key includes the choice.On an M4 MacBook Pro, a balanced same-boot old/off/on/on/off/old test of 1080p RGBA8 blended fill (depth 64, three samples per window) measured 371.494 → 348.73585 µs per submit, a 6.126% latency reduction. Every enabled sample was below every disabled sample. The selected shader changed from 178 bytes/25 compiler instructions to 170 bytes/22, with GPR/spill counts unchanged. Across all three arms, a finite 64-frame, 16-layer blend readback matched byte-for-byte and each arm had zero GPU faults. Diagnostic timings were excluded.
Validation: the experimental compiler suite passed 977 tests in both modes (one skipped and one disabled). Added tests cover materialization, captured blend expression compilation, signed zero, finite clamp boundaries and host bit-pattern cases. Production Mesa/Vulkan 1.8145 packages have now passed the official 188 Meson tests with zero failures; default and explicit opt-out compiler cases pass 3/3 each. The integration/aurora port also builds and passes those cases in both modes. Gallium and Vulkan cache keys both separate the opt-out. These are finite differential correctness results, not a full graphics conformance or macOS-parity claim; no constant-program protocol is changed.
Hardware testing used the installed 8f013bf-based Mesa plus three distribution patches. This PR ports only the optimization and its tests onto
integration/aurora; it does not import that entire source branch. No Apple binaries or captures are included.