Commit
1cc5b335
authored
by
Committed by
swiftshader-scoped@luci-project-accounts.iam.gserviceaccount.com
Optimize reciprocal sqrt operation
This change deprecates rr::RcpSqrt_pp with rr::RcpSqrt. As with Rcp,
RcpSqrt computes the result using Newton-Rhapson if it's faster and the
initial approximation intrinsic is available on the current target.
Currently, only LLVM on Intel will use NR for RelaxedPrecision. Note
that passing in Precision::Relaxed will produce a faster, but less
precise reciprocal sqrt.
Also made it so that SprivShader instruction GLSLstd450InverseSqrt now
invokes RcpSqrt(x, Precision::Full) instead of performing 1/sqrt(x).
Note that the Vulkan spec states that inversesqrt()'s precision is 2
ULP, and sqrt()'s precision is inherited from 1.0 / inversesqrt();
however, our rr::Sqrt is implemented in terms of x86's sqrt intrinsic on
x86, or as calls to sqrt from Math.h.
Bug: b/169760262
Change-Id: I65ba9a64d1db934c523dda11c1a2c186059d220b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51268
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Nicolas Capens <nicolascapens@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Showing
Please
register
or
sign in
to comment