Commit 440b9d03 authored by Rhys Perry's avatar Rhys Perry
Browse files

nir/algebraic: disable rcp(exp(a)) -> exp(-a) optimization



Fixes a Borderlands 3 precision issue with the expression:
floor(71 / exp(-3.3219280242919921875)).

fossil-db (navi21):
Totals from 1055 (0.78% of 135636) affected shaders:
Instrs: 1175831 -> 1178025 (+0.19%); split: -0.00%, +0.19%
CodeSize: 6373172 -> 6373148 (-0.00%); split: -0.00%, +0.00%
Latency: 28242666 -> 28263222 (+0.07%); split: -0.00%, +0.07%
InvThroughput: 4682055 -> 4686146 (+0.09%)
SClause: 50943 -> 50954 (+0.02%); split: -0.00%, +0.03%
Copies: 60667 -> 60657 (-0.02%); split: -0.04%, +0.02%

Signed-off-by: Rhys Perry's avatarRhys Perry <pendingchaos02@gmail.com>
Closes: mesa/mesa#7752
parent 3061bc79
Pipeline #743779 waiting for manual action with stages
......@@ -1309,7 +1309,8 @@ optimizations.extend([
(('~fpow', ('fpow', a, 2.2), 0.454545), a),
(('~fpow', ('fabs', ('fpow', a, 2.2)), 0.454545), ('fabs', a)),
(('~fsqrt', ('fexp2', a)), ('fexp2', ('fmul', 0.5, a))),
(('~frcp', ('fexp2', a)), ('fexp2', ('fneg', a))),
# Disabled because of Borderlands 3 requires the less precise computation (GitLab #7752).
#(('~frcp', ('fexp2', a)), ('fexp2', ('fneg', a))),
(('~frsq', ('fexp2', a)), ('fexp2', ('fmul', -0.5, a))),
(('~flog2', ('fsqrt', a)), ('fmul', 0.5, ('flog2', a))),
(('~flog2', ('frcp', a)), ('fneg', ('flog2', a))),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment