[Libclc-dev] [PATCH 1/2] maxmag: Implement
Aaron Watry via Libclc-dev
libclc-dev at lists.llvm.org
Tue Nov 14 18:40:32 PST 2017
On Mon, 2017-11-13 at 16:33 -0500, Jan Vesely via Libclc-dev wrote:
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> I tried running CTS on carrizo. fmax currently fails on nan operands,
> and denormal fp32 values.
> maxmag follows suite, after fixing fmax nan handling both pass fp64
> and fail
> on fp32 denormals.
I've noticed this behavior for fmax/fmin as well.
Both of the minmag/maxmag patches look good to me.
--Aaron
>
> generic/include/clc/clc.h | 1 +
> generic/include/clc/math/maxmag.h | 7 +++++++
> generic/lib/SOURCES | 1 +
> generic/lib/math/maxmag.cl | 4 ++++
> generic/lib/math/maxmag.inc | 4 ++++
> 5 files changed, 17 insertions(+)
> create mode 100644 generic/include/clc/math/maxmag.h
> create mode 100644 generic/lib/math/maxmag.cl
> create mode 100644 generic/lib/math/maxmag.inc
>
> diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
> index 198f3b8..fd4bbc3 100644
> --- a/generic/include/clc/clc.h
> +++ b/generic/include/clc/clc.h
> @@ -95,6 +95,7 @@
> #include <clc/math/log2.h>
> #include <clc/math/logb.h>
> #include <clc/math/mad.h>
> +#include <clc/math/maxmag.h>
> #include <clc/math/modf.h>
> #include <clc/math/nextafter.h>
> #include <clc/math/pow.h>
> diff --git a/generic/include/clc/math/maxmag.h
> b/generic/include/clc/math/maxmag.h
> new file mode 100644
> index 0000000..4230da9
> --- /dev/null
> +++ b/generic/include/clc/math/maxmag.h
> @@ -0,0 +1,7 @@
> +#define __CLC_BODY <clc/math/binary_decl_tt.inc>
> +#define __CLC_FUNCTION maxmag
> +
> +#include <clc/math/gentype.inc>
> +
> +#undef __CLC_BODY
> +#undef __CLC_FUNCTION
> diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
> index c61a956..7526b24 100644
> --- a/generic/lib/SOURCES
> +++ b/generic/lib/SOURCES
> @@ -130,6 +130,7 @@ math/log1p.cl
> math/log2.cl
> math/logb.cl
> math/mad.cl
> +math/maxmag.cl
> math/modf.cl
> math/native_cos.cl
> math/native_divide.cl
> diff --git a/generic/lib/math/maxmag.cl b/generic/lib/math/maxmag.cl
> new file mode 100644
> index 0000000..db23fc0
> --- /dev/null
> +++ b/generic/lib/math/maxmag.cl
> @@ -0,0 +1,4 @@
> +#include <clc/clc.h>
> +
> +#define __CLC_BODY <maxmag.inc>
> +#include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/maxmag.inc
> b/generic/lib/math/maxmag.inc
> new file mode 100644
> index 0000000..88b0129
> --- /dev/null
> +++ b/generic/lib/math/maxmag.inc
> @@ -0,0 +1,4 @@
> +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE maxmag(__CLC_GENTYPE x,
> __CLC_GENTYPE y) {
> + const __CLC_GENTYPE res = select(y, x, isgreater(fabs(x),
> fabs(y)));
> + return select(res, fmax(x, y), isnan(x) | isnan(y) |
> isequal(fabs(x), fabs(y)));
> +}
More information about the Libclc-dev
mailing list