diff --git a/src/c_wrapper/error.h b/src/c_wrapper/error.h index b14fdfe887f1f53de8ed271be34ebd1a50446e2d..5014ea87effc46255600e9ce511beaf8c9f3716f 100644 --- a/src/c_wrapper/error.h +++ b/src/c_wrapper/error.h @@ -97,6 +97,12 @@ struct __CLPost<T, decltype((void)(std::declval<T>().post()))> { } }; +template<typename T, class = void> +struct is_out_arg : std::false_type {}; + +template<typename T> +struct is_out_arg<T, enable_if_t<rm_ref_t<T>::is_out> > : std::true_type {}; + template<typename T, class = void> struct __CLPrintOut { static PYOPENCL_INLINE void @@ -106,7 +112,7 @@ struct __CLPrintOut { }; template<typename T> -struct __CLPrintOut<T, enable_if_t<rm_ref_t<T>::is_out> > { +struct __CLPrintOut<T, enable_if_t<is_out_arg<T>::value> > { static inline void call(T v, std::ostream &stm) { @@ -125,6 +131,9 @@ struct __CLPrint { } else { first = false; } + if (is_out_arg<T>::value) { + stm << "{out}"; + } v.print(stm); } }; @@ -162,7 +171,7 @@ class CLArgPack : public ArgPack<CLArg, Types...> { std::cerr << name << "("; __CLCall<__CLPrint, sizeof...(Types) - 1, decltype(*that)>::call(*that, std::cerr, true); - std::cerr << ") = (" << res; + std::cerr << ") = (ret: " << res; __CLCall<__CLPrintOut, sizeof...(Types) - 1, decltype(*that)>::call(*that, std::cerr); std::cerr << ")" << std::endl; diff --git a/src/c_wrapper/utils.h b/src/c_wrapper/utils.h index 015ad8774d4339b4a496ef80cf893e61e17fb7bc..11a0e95e39b0707d4f3bb4a27d1ed9da0db493cf 100644 --- a/src/c_wrapper/utils.h +++ b/src/c_wrapper/utils.h @@ -137,9 +137,7 @@ struct CLGenericArgPrinter<std::nullptr_t, void> { }; template<typename T, class = void> -struct CLGenericArgOut { - constexpr static bool value = false; -}; +struct CLGenericArgOut : std::false_type {}; template<typename T, class = void> class CLArg { @@ -411,16 +409,12 @@ template<typename T> using pyopencl_buf_ele_t = typename rm_ref_t<T>::element_type; template<typename T, class = void> -struct is_pyopencl_buf { - constexpr static bool value = false; -}; +struct is_pyopencl_buf : std::false_type {}; template<typename T> struct is_pyopencl_buf< T, enable_if_t<std::is_base_of<pyopencl_buf<pyopencl_buf_ele_t<T> >, - rm_ref_t<T> >::value> > { - constexpr static bool value = true; -}; + rm_ref_t<T> >::value> > : std::true_type {}; template<ArgType AT, typename T> struct _ToArgBuffer<AT, T, enable_if_t<is_pyopencl_buf<T>::value &&