cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

marty1885
Adept II

Found a misused OpenCL API in MIOpen. Need help reaching the team

Hello. I have been studying MIOpen's source code since it's launch. After a while, I found that MIOpen built with OpenCL will fail half of it's test. with something throwing std::bad_alloc.

Digging into the source. I found the following code snippet.

/* First, get the size of device list data */

    size_t deviceListSize;

    if(clGetContextInfo(

           impl->context.get(), CL_CONTEXT_NUM_DEVICES, sizeof(size_t), &deviceListSize, nullptr) !=

       CL_SUCCESS)

    {

        MIOPEN_THROW("Error: Getting Handle Info (device list size, clGetContextInfo)");

    }

    if(deviceListSize == 0)

    {

        MIOPEN_THROW("Error: No devices found.");

    }

    std::vector<cl_device_id> devices(deviceListSize);

But according to OpenCL's API documentation(clGetContextInfo). When param_name is CL_CONTEXT_NUM_DEVICES, return type is cl_uint . not size_t.

This causes deviceListSize being not set correctly. And thus being a really large value, causing the std::vector trying to allocate really really large amount of memory and thus throwing.

The MIOpen repo seems to be just there to publish the code. Can anyone here help me to reach the team?

Best, Martin

0 Likes
1 Reply
dipak
Big Boss

Hi Martin,

MIOpen is part of AMD's GPUOpen initiative and there is a separate place to post queries/issues related to MIOpen. Please follow the below link to report your issue to the concerned team.

Issues · ROCmSoftwarePlatform/MIOpen · GitHub

Regards,

0 Likes