Skip to content

Commit

Permalink
initialize query results in the C++ bindings (#128)
Browse files Browse the repository at this point in the history
This results in more deterministic results in the cases where a query
generates an error.
  • Loading branch information
bashbaug authored Dec 19, 2024
1 parent b1a1675 commit 9cc654f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions include/CL/opencl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2441,7 +2441,7 @@ class Device : public detail::Wrapper<cl_device_id>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -2700,7 +2700,7 @@ class Platform : public detail::Wrapper<cl_platform_id>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -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, &param, flags, properties, image_format, image_desc);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -3590,7 +3590,7 @@ class Event : public detail::Wrapper<cl_event>
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, &param);
if (err != nullptr) {
*err = result;
Expand All @@ -3613,7 +3613,7 @@ class Event : public detail::Wrapper<cl_event>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -3779,7 +3779,7 @@ class Memory : public detail::Wrapper<cl_mem>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -5667,7 +5667,7 @@ class Sampler : public detail::Wrapper<cl_sampler>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -5875,7 +5875,7 @@ class Kernel : public detail::Wrapper<cl_kernel>
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, &param);
if (err != nullptr) {
*err = result;
Expand All @@ -5897,7 +5897,7 @@ class Kernel : public detail::Wrapper<cl_kernel>
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, &param);
if (err != nullptr) {
*err = result;
Expand All @@ -5921,7 +5921,7 @@ class Kernel : public detail::Wrapper<cl_kernel>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -6755,7 +6755,7 @@ class Program : public detail::Wrapper<cl_program>
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, &param);
if (err != nullptr) {
*err = result;
Expand All @@ -6778,7 +6778,7 @@ class Program : public detail::Wrapper<cl_program>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -6811,7 +6811,7 @@ class Program : public detail::Wrapper<cl_program>

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, &param);
devInfo.push_back(
std::pair<cl::Device, typename detail::param_traits<detail::cl_program_build_info, name>::param_type>
Expand Down Expand Up @@ -7598,7 +7598,7 @@ class CommandQueue : public detail::Wrapper<cl_command_queue>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -9269,7 +9269,7 @@ class DeviceCommandQueue : public detail::Wrapper<cl_command_queue>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down Expand Up @@ -10765,7 +10765,7 @@ class CommandBuffer : public detail::Wrapper<cl_command_buffer_khr>
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, &param);
if (err != nullptr) {
*err = result;
Expand Down

0 comments on commit 9cc654f

Please sign in to comment.