|
@@ -24,7 +24,7 @@ typedef struct {
|
|
|
cl_context context;
|
|
|
cl_program program;
|
|
|
cl_kernel kernel;
|
|
|
- cl_mem fpga_buffer;
|
|
|
+ cl_mem fpga_write_buffer;
|
|
|
cl_mem check_buffer;
|
|
|
} App;
|
|
|
|
|
@@ -72,9 +72,8 @@ close_pcilib (App *app)
|
|
|
}
|
|
|
|
|
|
static cl_mem
|
|
|
-create_fpga_buffer (App *app, size_t size, cl_int *error)
|
|
|
+create_fpga_write_buffer (App *app, size_t size, cl_int *error)
|
|
|
{
|
|
|
- cl_mem buffer;
|
|
|
cl_mem_flags flags;
|
|
|
cl_bus_address_amd addr;
|
|
|
|
|
@@ -89,7 +88,6 @@ static bool
|
|
|
init_opencl (App *app)
|
|
|
{
|
|
|
cl_int error;
|
|
|
- cl_platform_id platform;
|
|
|
|
|
|
app->ocl = ocl_new_with_queues (0, CL_DEVICE_TYPE_GPU, CL_QUEUE_PROFILING_ENABLE);
|
|
|
app->device = ocl_get_devices (app->ocl)[0];
|
|
@@ -105,7 +103,7 @@ init_opencl (App *app)
|
|
|
app->check_buffer = clCreateBuffer (app->context, CL_MEM_WRITE_ONLY, 8, NULL, &error);
|
|
|
OCL_CHECK_ERROR (error);
|
|
|
|
|
|
- app->fpga_buffer = create_fpga_buffer (app, 1024 * 64, &error);
|
|
|
+ app->fpga_write_buffer = create_fpga_write_buffer (app, 1024 * 64, &error);
|
|
|
OCL_CHECK_ERROR (error);
|
|
|
|
|
|
return error != CL_SUCCESS ? false : true;
|
|
@@ -116,7 +114,7 @@ close_opencl (App *app)
|
|
|
{
|
|
|
OCL_CHECK_ERROR (clReleaseKernel (app->kernel));
|
|
|
OCL_CHECK_ERROR (clReleaseProgram (app->program));
|
|
|
- OCL_CHECK_ERROR (clReleaseMemObject (app->fpga_buffer));
|
|
|
+ OCL_CHECK_ERROR (clReleaseMemObject (app->fpga_write_buffer));
|
|
|
OCL_CHECK_ERROR (clReleaseMemObject (app->check_buffer));
|
|
|
ocl_free (app->ocl);
|
|
|
}
|
|
@@ -154,7 +152,7 @@ launch_signal (App *app)
|
|
|
check_value (app, addr, value);
|
|
|
|
|
|
value = 0xdeadf00d;
|
|
|
- OCL_CHECK_ERROR (clSetKernelArg (app->kernel, 0, sizeof (cl_mem), &app->fpga_buffer));
|
|
|
+ OCL_CHECK_ERROR (clSetKernelArg (app->kernel, 0, sizeof (cl_mem), &app->fpga_write_buffer));
|
|
|
OCL_CHECK_ERROR (clSetKernelArg (app->kernel, 1, sizeof (cl_mem), &app->check_buffer));
|
|
|
OCL_CHECK_ERROR (clSetKernelArg (app->kernel, 2, sizeof (uint32_t), &addr));
|
|
|
OCL_CHECK_ERROR (clSetKernelArg (app->kernel, 3, sizeof (uint32_t), &value));
|
|
@@ -182,11 +180,11 @@ launch_signal (App *app)
|
|
|
if (check[0] == addr && check[1] == value)
|
|
|
printf ("success\n");
|
|
|
else
|
|
|
- printf ("failed [0x%x != 0x%x || 0x%x != 0x%x]\n", check[0], addr, check[1], value);
|
|
|
+ printf ("failed [0x%x != %p || 0x%x != 0x%x]\n", check[0], (void *) addr, check[1], value);
|
|
|
|
|
|
- printf ("> exec : %llu ns\n", end - start);
|
|
|
- printf ("> submit: %llu ns\n", end - submitted);
|
|
|
- printf ("> queue : %llu ns\n", end - queued);
|
|
|
+ printf ("> exec : %lu ns\n", end - start);
|
|
|
+ printf ("> submit: %lu ns\n", end - submitted);
|
|
|
+ printf ("> queue : %lu ns\n", end - queued);
|
|
|
}
|
|
|
|
|
|
int
|