[rocjitsu] Match hardware transcendental results #12510
<!-- therock-pr-bot-policy-check -->
✅ All Checks Passed — Ready for Review
| Check | Status | Details |
|---|:---:|---|
| 📝 PR Description | ✅ Pass | — |
| ⛔ Forbidden Files | ✅ Pass | — |
| 🧪 Unit Test | ✅ Pass | — |
| 🔎 pre-commit | ✅ Pass | — |
| 🚫 Draft PR | 🔜 To Be Enabled | — |
| 🚩 Feature Flag | 🔜 To Be Enabled | — |
| 📊 Code Coverage | 🔜 To Be Enabled | — |
| 🤖 therock-pr-bot | ✅ Pass | — |
🎉 All checks passed! This PR is ready for review.
📖 Need help? See the Policy FAQ for details on every check and how to fix failures.
<!-- therock-pr-bot-fix-policies -->
🎉 All checks passed! This PR is ready for review.
Can we simplify this by removing amdgpu_rsq_f16, amdgpu_sqrt_f16, and their two SIMD adapters? A repository-wide search finds only the definitions and adapter calls; instruction execution already uses transcendental::map_f16 / map_f16_simd for half rounding, denormal handling, overflow, and NaN policy.
The unused helpers expose unrounded F32 results (and RSQ has no selectable NaN quieting). Their documentation here and in amdgpu_sqrt.h:187-188 also says to narrow after output modifiers, whereas the execution path rounds and handles half output denormals before OMOD. If these helpers need to remain, we should correct that contract to require the half rounding/denormal/overflow stages before OMOD. This is an API maintenance concern; current instruction callers use the shared policy path.
One small suggestion
I'm quite interested in getting hardware exact constant folding of all intrinsics in the compiler. Is it possible to put this into a library somewhere?
I'm quite interested in getting hardware exact constant folding of all intrinsics in the compiler. Is it possible to put this into a library somewhere?
That's the plan down the road, but until then, you can extract it if you want, the license is quite permissive.
LGTM
<!-- therock-bump-breadcrumb -->
TheRock Submodule Bump Activity
_Newest first_
sjain-stanford
kuhar
Replace host approximations with hardware-derived F32 LOG, EXP, SIN/COS, RCP, RSQ and SQRT mappings. Match scalar and vector F32 results. Apply F16 denormal and finite-overflow policies before output modifiers, and preserve host floating-point state and architecture-specific NaN behavior.
Retain physical RDNA3/RDNA4 witnesses, exhaustive input digests and cross-target MODE/modifier tests. Other targets share the ISA-compatible approximation; bit-identical hardware results are qualified on RDNA3/4. Validate scalar and SIMD paths with Clang and GCC, including ASan and UBSan.
Issue #12429.