[Libclc-dev] Add initial support for half precision builtins (take 3)

Aaron Watry via Libclc-dev libclc-dev at lists.llvm.org
Tue May 15 09:46:14 PDT 2018

On Mon, May 14, 2018 at 10:09 PM, Jan Vesely via Libclc-dev
<libclc-dev at lists.llvm.org> wrote:
> Hi,
> I've tried to post this patch but it's too big for the ML (and I don't
> know who to bug to get it released).
> It adds basic fp16 builtins. The rest will probably need a fp32 wrapper
> (especially the sw implementations of math functions), but that needs
> fixed conversion routines.
> This should be enough to make clpeak happy (BZ: 96897)

In: amdgcn/lib/math/fmax.cl
+   return (y < x) ? y : x;

Isn't this backwards? This is returning the minimum of the two values,
not the max.  It looks like you did fmin first, and then copy-pasted
to fmax, but forgot to change the ternary. It is correct in
generic/lib/math/fmax.cl at least, so just the GCN codepath is

Otherwise, I've skimmed my way through the rest.  I noted a bunch of
your TODOs for things that are reliant on atan2/sin/cos
implementations and a few functions that are disabled for
half-precision. Nothing really stands out as blatantly wrong other
than that amdgcn fmax bit I noted up above.


> Jan
> --
> Jan Vesely <jan.vesely at rutgers.edu>
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev

More information about the Libclc-dev mailing list