diff options
Diffstat (limited to 'src/utilities.hpp')
-rw-r--r-- | src/utilities.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/utilities.hpp b/src/utilities.hpp index 5a4eef0f..75bd5a69 100644 --- a/src/utilities.hpp +++ b/src/utilities.hpp @@ -80,8 +80,9 @@ constexpr auto kArgComparecblas = "cblas"; constexpr auto kArgStepSize = "step"; constexpr auto kArgNumSteps = "num_steps"; constexpr auto kArgNumRuns = "runs"; +constexpr auto kArgWarmUp = "warm_up"; -// The client-specific arguments in string form +// The test-specific arguments in string form constexpr auto kArgFullTest = "full_test"; constexpr auto kArgVerbose = "verbose"; @@ -186,6 +187,10 @@ std::string ToString(T value); template <typename T> T ConvertArgument(const char* value); +// Variant of "ConvertArgument" with default values +template <typename T> +T ConvertArgument(const char* value, T default_value); + // Basic argument parser, matching patterns in the form of "-option value" and "--option value" template <typename T> T GetArgument(const int argc, char **argv, std::string &help, @@ -226,6 +231,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 |