From 25caca9086a12a7658cf401cbc570900c3377977 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 28 Jan 2012 16:26:53 +1100 Subject: [PATCH 1/2] Revert "Don't explicitly retain the cl program as it is of no benefit to do so and may lead to problems when trying to release the program." This reverts commit 32910463a3124265b56aca48a6c0fbb107ccfb70. Turns out this does help. --- ocl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ocl.c b/ocl.c index d963fc1e..28d5a871 100644 --- a/ocl.c +++ b/ocl.c @@ -465,6 +465,12 @@ build: return NULL; } + clRetainProgram(clState->program); + if (status != CL_SUCCESS) { + applog(LOG_ERR, "Error: Retaining Program (clRetainProgram)"); + return NULL; + } + /* create a cl program executable for all the devices specified */ char *CompilerOptions = calloc(1, 256); @@ -588,6 +594,12 @@ build: applog(LOG_ERR, "Error: Loading Binary into cl_program (clCreateProgramWithBinary)"); return NULL; } + + clRetainProgram(clState->program); + if (status != CL_SUCCESS) { + applog(LOG_ERR, "Error: Retaining Program (clRetainProgram)"); + return NULL; + } } free(source); From 1e5035497bf362d1e9484e889dc769eec1e62fcc Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 28 Jan 2012 16:29:19 +1100 Subject: [PATCH 2/2] Retain cl program after every possible place we might build the program. --- ocl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ocl.c b/ocl.c index 28d5a871..7e16f605 100644 --- a/ocl.c +++ b/ocl.c @@ -639,6 +639,12 @@ built: applog(LOG_INFO, "%s", log); return NULL; } + + clRetainProgram(clState->program); + if (status != CL_SUCCESS) { + applog(LOG_ERR, "Error: Retaining Program (clRetainProgram)"); + return NULL; + } } /* get a kernel object handle for a kernel with the given name */