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 */
impl->context.get(), CL_CONTEXT_NUM_DEVICES, sizeof(size_t), &deviceListSize, nullptr) !=
MIOPEN_THROW("Error: Getting Handle Info (device list size, clGetContextInfo)");
if(deviceListSize == 0)
MIOPEN_THROW("Error: No devices found.");
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?
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.