[Libclc-dev] [PATCH v2 1/1] rootn: Flush denormals if not supported.
Jan Vesely via Libclc-dev
libclc-dev at lists.llvm.org
Mon Apr 30 11:05:30 PDT 2018
On Tue, 2018-04-24 at 12:31 -0400, Jan Vesely wrote:
> It's OK to either flush to 0 or return denormal result if the device
> does not support denormals. See sec 7.2 and 7.5.3 of OCL specs
>
> v2: Use 0.0f explicitly intead of relying on GPU to flush it.
>
> Fixes CTS on carrizo and turks
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> This removes the need for the second patch
> generic/lib/math/clc_rootn.cl | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/generic/lib/math/clc_rootn.cl b/generic/lib/math/clc_rootn.cl
> index d7ee185..0a2c98d 100644
> --- a/generic/lib/math/clc_rootn.cl
> +++ b/generic/lib/math/clc_rootn.cl
> @@ -170,16 +170,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_rootn(float x, int ny)
> tv = USE_TABLE(exp_tbl_ep, j);
>
> float expylogx = mad(tv.s0, poly, mad(tv.s1, poly, tv.s1)) + tv.s0;
> - float sexpylogx;
> - if (!__clc_fp32_subnormals_supported()) {
> - int explg = ((as_uint(expylogx) & EXPBITS_SP32 >> 23) - 127);
> - m = (23-(m + 149)) == 0 ? 1: m;
> - uint mantissa = ((as_uint(expylogx) & MANTBITS_SP32)|IMPBIT_SP32) >> (23-(m + 149));
> - sexpylogx = as_float(mantissa);
> - } else {
> - sexpylogx = expylogx * as_float(0x1 << (m + 149));
> - }
> -
> + float sexpylogx = __clc_fp32_subnormals_supported() ? expylogx * as_float(0x1 << (m + 149)) : 0.0f;
>
> float texpylogx = as_float(as_int(expylogx) + m2);
> expylogx = m < -125 ? sexpylogx : texpylogx;
ping.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20180430/8519170f/attachment.sig>
More information about the Libclc-dev
mailing list