From c87e877bf23d2fe38a7da2898e1734a3cdeaf48c Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sun, 10 Jul 2016 20:32:01 +0200 Subject: Now passing alpha/beta to the kernel as arguments as before fp16 support; in case of fp16 arguments are cast on host and in kernel --- src/utilities.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/utilities.hpp') diff --git a/src/utilities.hpp b/src/utilities.hpp index d5efab9f..700d30d6 100644 --- a/src/utilities.hpp +++ b/src/utilities.hpp @@ -227,6 +227,12 @@ void FloatToHalfBuffer(std::vector& result, const std::vector& sour Buffer HalfToFloatBuffer(const Buffer& source, cl_command_queue queue_raw); void FloatToHalfBuffer(Buffer& result, const Buffer& source, cl_command_queue queue_raw); +// Converts a 'real' value to a 'real argument' value to be passed to a kernel. Normally there is +// no conversion, but half-precision is not supported as kernel argument so it is converted to float. +template struct RealArg { using Type = T; }; +template <> struct RealArg { using Type = float; }; +template typename RealArg::Type GetRealArg(const T value); + // ================================================================================================= // Rounding functions -- cgit v1.2.3