diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-07-10 20:32:01 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2016-07-10 20:32:01 +0200 |
commit | c87e877bf23d2fe38a7da2898e1734a3cdeaf48c (patch) | |
tree | d091dfdd826dd11e5c9e533eb46b22aeb7f6f823 /src/utilities.hpp | |
parent | 57f09178d89a1cf4f38a0bb338c864ed850d5470 (diff) |
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
Diffstat (limited to 'src/utilities.hpp')
-rw-r--r-- | src/utilities.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
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<half>& result, const std::vector<float>& sour Buffer<float> HalfToFloatBuffer(const Buffer<half>& source, cl_command_queue queue_raw); void FloatToHalfBuffer(Buffer<half>& result, const Buffer<float>& 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 <typename T> struct RealArg { using Type = T; }; +template <> struct RealArg<half> { using Type = float; }; +template <typename T> typename RealArg<T>::Type GetRealArg(const T value); + // ================================================================================================= // Rounding functions |