AnsweredAssumed Answered

Bug when querying CL_DEVICE_MAX_CONSTANT_ARGS ?

Question asked by c0nfig on Jun 4, 2012
Latest reply on Jun 4, 2012 by c0nfig

Hi.

I hope this is the right place to post it.

I'm not sure if I'm doing something wrong or maybe it is a bug.

 

I use OpenCL 1.2 AMD-APP (923.1) on radeon 6970.

This simple program prints the number of devices found before and after  querying CL_DEVICE_MAX_CONSTANT_ARGS.

The first print 2 as expected (CPU and GPU), however the second print is 0...

It is  happen if I'm using another clGetDeviceInfo before as shown in the code.

#include <CL/cl.h>
#include <iostream>

using namespace std;
int main()
{

    cl_uint numplatforms=0;
    size_t returned_size=0;

    cl_uint devicesnum=0;

//getting platforms
    clGetPlatformIDs(0,NULL,&numplatforms);
    cl_platform_id platforms[numplatforms];
    clGetPlatformIDs(numplatforms,platforms,NULL);

//getting devices
    clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_ALL, NULL, NULL, &devicesnum);
    cl_device_id device_ids[devicesnum];
    clGetDeviceIDs(platforms[0], CL_DEVICE_TYPE_ALL, devicesnum, device_ids, NULL);

//querying devices
    cl_ulong local_mem=0;
    cl_uint max_const_args=0;
    clGetDeviceInfo(device_ids[0], CL_DEVICE_LOCAL_MEM_SIZE , sizeof(cl_ulong), &local_mem, &returned_size);
    cout<<"devices num "<<devicesnum<<endl;
    clGetDeviceInfo(device_ids[0], CL_DEVICE_MAX_CONSTANT_ARGS  , sizeof(cl_ulong), &max_const_args, &returned_size);
    cout<<"devices num "<<devicesnum<<endl;
}

Outcomes