mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:10:53 +01:00
[PR #1587] rdna2spirv: flush v_exp_f32 denormal results (SHADER-EXP-F32-DENORM) #1607
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1607
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1587
Author: @exoticLgk
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix-exp-f32-denorm📝 Commits (1)
eb39d27rdna2spirv: flush v_exp_f32 denormal results📊 Changes
7 files changed (+53 additions, -2 deletions)
View changed files
📝
docs/design.md(+1 -1)📝
runtime/test/shaders/check.py(+17 -0)➕
runtime/test/shaders/ps_exp_f32_denorm.asm(+12 -0)➕
runtime/test/shaders/ps_exp_f32_denorm_rt.asm(+10 -0)📝
scripts/run_gpu_tests.py(+5 -1)📝
tests/semantic/test_alu_exp_f32.py(+6 -0)📝
tools/rdna2spirv.py(+2 -0)📄 Description
Coordination
Claimed in the coordination issue as:
SHADER-EXP-F32-DENORMThe claim could not be posted because coordination issue #14 reached GitHub's 2,500-comment limit and no successor was found. Following the precedent in #1544, the claim is recorded here:
Searched existing claims and open PRs before implementation. No directly overlapping contribution was identified.
What and why
The RDNA2 hardware measurements documented in
docs/design.mdestablish thatv_exp_f32flushes denormal results, including when MODE requests denormal preservation.The translator previously emitted GLSL
Exp2without explicitly modelling this behaviour.This PR:
Gen.flush_f32to flush the rawv_exp_f32result before output modifiers.The semantic regression reproduces the following differences:
0x004000000x000000000x002000000x000000000x000000010x00000000Normal results at -125 and -126 remain unchanged.
Tested
c7e82e26e.Both GPU fixtures also pass without the translator change on the tested NVIDIA device. They establish GPU compatibility rather than a hardware-visible regression on this device. The semantic regression distinguishes the corrected implementation from the previous one.
Full GPU runs before the final rebase and addition of the second fixture:
The existing
cs_imgatomic_extfailure was reproduced without this patch on the earlier base and persisted after rebuilding on the updated base. PR #1518 appears relevant to that failure but was not tested here.Output modifier checks
Eight additional semantic probes were performed:
0x000000000x000000000x004000000x000000000x3f8000000x408000000x410000000x3f800000All eight match the intended implementation.
The existing hardware measurements in
docs/design.md, particularly the VOP3 modifier validation, support flushing denormal intermediate results before output modifiers.Post-scaling underflow remains outside this PR's scope because the exact
v_exp_f32boundary behaviour has not been independently established on native RDNA2.The existing
f32_fuzz.pyreference deliberately declines denormal exponential results. Its behaviour is left unchanged.Compatibility with #1231
PR #1231 addresses special results for other f32 transcendental instructions and explicitly leaves denormal handling unchanged.
A temporary local merge was tested:
No additional regression was detected in the combined configuration.
The temporary merge was aborted after testing. No changes from #1231 are included in this PR.
The final branch was checked against upstream main immediately before submission: zero commits behind, one commit ahead, clean working tree and clean
git diff --check.GPUs tested
Limitations
AI-assisted
ChatGPT assisted with investigation, implementation, regression tests, documentation and compatibility analysis. The reported local tests were executed on my machine.
Checklist
docs/design.md.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.