Last active
August 29, 2015 14:02
-
-
Save yuyichao/8b661d51c81f1c85466e to your computer and use it in GitHub Desktop.
Beignet OpenCL 1.2 Bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile with | |
// gcc -O2 --std=gnu99 -lOpenCL -g -Wno-deprecated-declarations | |
#include <CL/cl.h> | |
#include <stdio.h> | |
#include <assert.h> | |
int | |
main() | |
{ | |
cl_platform_id platform_id = NULL; | |
cl_uint num_platforms = 0; | |
cl_int status = clGetPlatformIDs(1, &platform_id, &num_platforms); | |
assert(status == CL_SUCCESS); | |
cl_device_id device_id = NULL; | |
cl_uint num_devices = 0; | |
status = clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_DEFAULT, 1, | |
&device_id, &num_devices); | |
assert(status == CL_SUCCESS); | |
cl_context context = clCreateContext(NULL, 1, &device_id, | |
NULL, NULL, &status); | |
assert(status == CL_SUCCESS); | |
cl_command_queue queue = clCreateCommandQueue(context, device_id, | |
0, &status); | |
assert(status == CL_SUCCESS); | |
cl_event evt1; | |
status = clEnqueueMarker(queue, &evt1); | |
assert(status == CL_SUCCESS); | |
cl_event evt2; | |
status = clEnqueueBarrierWithWaitList(queue, 1, &evt1, &evt2); | |
assert(status == CL_SUCCESS); | |
status = clWaitForEvents(1, &evt2); | |
assert(status == CL_SUCCESS); | |
status = clFinish(queue); | |
assert(status == CL_SUCCESS); | |
clReleaseEvent(evt1); | |
clReleaseEvent(evt2); | |
clReleaseCommandQueue(queue); | |
clReleaseContext(context); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment