From 9cc654fd4c99eff34d17585457f179d2ca413b13 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Thu, 19 Dec 2024 13:43:08 -0800 Subject: [PATCH] initialize query results in the C++ bindings (#128) This results in more deterministic results in the cases where a query generates an error. --- include/CL/opencl.hpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/CL/opencl.hpp b/include/CL/opencl.hpp index a134a2b..2d21cf5 100644 --- a/include/CL/opencl.hpp +++ b/include/CL/opencl.hpp @@ -2441,7 +2441,7 @@ class Device : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_device_info, name>::param_type param; + detail::cl_device_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -2700,7 +2700,7 @@ class Platform : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_platform_info, name>::param_type param; + detail::cl_platform_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -3389,7 +3389,7 @@ class Context getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_context_info, name>::param_type param; + detail::cl_context_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -3472,7 +3472,7 @@ class Context cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_image_requirements_info_ext, type>::param_type param; + detail::cl_image_requirements_info_ext, type>::param_type param{}; cl_int result = getImageRequirementsInfoExt(type, ¶m, flags, properties, image_format, image_desc); if (err != nullptr) { *err = result; @@ -3590,7 +3590,7 @@ class Event : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_event_info, name>::param_type param; + detail::cl_event_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -3613,7 +3613,7 @@ class Event : public detail::Wrapper getProfilingInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_profiling_info, name>::param_type param; + detail::cl_profiling_info, name>::param_type param{}; cl_int result = getProfilingInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -3779,7 +3779,7 @@ class Memory : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_mem_info, name>::param_type param; + detail::cl_mem_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -4692,7 +4692,7 @@ class Image : public Memory getImageInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_image_info, name>::param_type param; + detail::cl_image_info, name>::param_type param{}; cl_int result = getImageInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -5560,7 +5560,7 @@ class Pipe : public Memory getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_pipe_info, name>::param_type param; + detail::cl_pipe_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -5667,7 +5667,7 @@ class Sampler : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_sampler_info, name>::param_type param; + detail::cl_sampler_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -5875,7 +5875,7 @@ class Kernel : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_kernel_info, name>::param_type param; + detail::cl_kernel_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -5897,7 +5897,7 @@ class Kernel : public detail::Wrapper getArgInfo(cl_uint argIndex, cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_kernel_arg_info, name>::param_type param; + detail::cl_kernel_arg_info, name>::param_type param{}; cl_int result = getArgInfo(argIndex, name, ¶m); if (err != nullptr) { *err = result; @@ -5921,7 +5921,7 @@ class Kernel : public detail::Wrapper getWorkGroupInfo(const Device& device, cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_kernel_work_group_info, name>::param_type param; + detail::cl_kernel_work_group_info, name>::param_type param{}; cl_int result = getWorkGroupInfo(device, name, ¶m); if (err != nullptr) { *err = result; @@ -6755,7 +6755,7 @@ class Program : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_program_info, name>::param_type param; + detail::cl_program_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -6778,7 +6778,7 @@ class Program : public detail::Wrapper getBuildInfo(const Device& device, cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_program_build_info, name>::param_type param; + detail::cl_program_build_info, name>::param_type param{}; cl_int result = getBuildInfo(device, name, ¶m); if (err != nullptr) { *err = result; @@ -6811,7 +6811,7 @@ class Program : public detail::Wrapper for (const cl::Device &d : devs) { typename detail::param_traits< - detail::cl_program_build_info, name>::param_type param; + detail::cl_program_build_info, name>::param_type param{}; result = getBuildInfo(d, name, ¶m); devInfo.push_back( std::pair::param_type> @@ -7598,7 +7598,7 @@ class CommandQueue : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_command_queue_info, name>::param_type param; + detail::cl_command_queue_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -9269,7 +9269,7 @@ class DeviceCommandQueue : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_command_queue_info, name>::param_type param; + detail::cl_command_queue_info, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result; @@ -10765,7 +10765,7 @@ class CommandBuffer : public detail::Wrapper getInfo(cl_int* err = nullptr) const { typename detail::param_traits< - detail::cl_command_buffer_info_khr, name>::param_type param; + detail::cl_command_buffer_info_khr, name>::param_type param{}; cl_int result = getInfo(name, ¶m); if (err != nullptr) { *err = result;