Using
clGetEventInfo(event, CL_EVENT_COMMAND_QUEUE, size, &obtainedCommandQueue, NULL)
to obtain the command queue that is associated with an event does not seem to work.
I’ve tested it with driver version 195.39 and Toolkit+SDK version 3.0 beta1, on Windows XP 32 bit with a GeForce 8800 GT, and on Windows Vista 64 bit with 2 GeForce cards (295’s?)
It may be reproduced with the following program:
[codebox]
#include <CL/cl.h>
int main()
{
cl_platform_id *platforms = new cl_platform_id[1];
clGetPlatformIDs(1, platforms, NULL);
cl_context_properties contextProperties[3] =
{ CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[0], 0 };
cl_context context = clCreateContextFromType(
contextProperties, CL_DEVICE_TYPE_GPU, NULL, NULL, NULL);
cl_device_id *devices = new cl_device_id[1];
clGetContextInfo(context, CL_CONTEXT_DEVICES,
sizeof(cl_device_id), devices, NULL);
// Create a command queue
cl_command_queue commandQueue =
clCreateCommandQueue(context, devices[0], 0, NULL);
// Prepare something to enqueue
int size = 4;
cl_mem mem = clCreateBuffer(context,
CL_MEM_READ_WRITE, size * sizeof(int), NULL, NULL);
int *target = new int;
// Enqueue a buffer write, and pass in an event
cl_event event;
clEnqueueWriteBuffer(commandQueue, mem,
CL_TRUE, 0, size * sizeof(int), target, 0, NULL, &event);
clWaitForEvents(1, &event);
// Try to obtain the command queue via getEventInfo
cl_command_queue obtained;
clGetEventInfo(event, CL_EVENT_COMMAND_QUEUE,
sizeof(cl_command_queue), &obtained, NULL);
printf(“commandQueue %p\n”, commandQueue);
printf("obtained %p\n", obtained);
return 0;
}
[/codebox]
I’d expect that the “commandQueue” and the “obtained” command queue should be equal, but they are not. Did I misinterpret the specification in this point? (presumably not: When using the AMD implementation, the correct command queue is returned…).
Is this a known issue? A seach for the related keywords in the forum and the release notes did not bring up any results…