Browse Source

Retain the program immediately after it's created from source.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
4beade3772
  1. 15
      ocl.c

15
ocl.c

@ -494,12 +494,17 @@ build:
applog(LOG_DEBUG, "cl_amd_media_ops not found, will not BFI_INT patch"); applog(LOG_DEBUG, "cl_amd_media_ops not found, will not BFI_INT patch");
clState->program = clCreateProgramWithSource(clState->context, 1, (const char **)&source, sourceSize, &status); clState->program = clCreateProgramWithSource(clState->context, 1, (const char **)&source, sourceSize, &status);
if (status != CL_SUCCESS) if (status != CL_SUCCESS) {
{
applog(LOG_ERR, "Error: Loading Binary into cl_program (clCreateProgramWithSource)"); applog(LOG_ERR, "Error: Loading Binary into cl_program (clCreateProgramWithSource)");
return NULL; 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 */ /* create a cl program executable for all the devices specified */
char CompilerOptions[256]; char CompilerOptions[256];
sprintf(CompilerOptions, "%s%i", "-DWORKSIZE=", (int)clState->work_size); sprintf(CompilerOptions, "%s%i", "-DWORKSIZE=", (int)clState->work_size);
@ -520,12 +525,6 @@ build:
return NULL; return NULL;
} }
clRetainProgram(clState->program);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Retaining Program (clRetainProgram)");
return NULL;
}
status = clGetProgramInfo( clState->program, CL_PROGRAM_BINARY_SIZES, sizeof(size_t)*nDevices, binary_sizes, NULL ); status = clGetProgramInfo( clState->program, CL_PROGRAM_BINARY_SIZES, sizeof(size_t)*nDevices, binary_sizes, NULL );
if (unlikely(status != CL_SUCCESS)) { if (unlikely(status != CL_SUCCESS)) {
applog(LOG_ERR, "Error: Getting program info CL_PROGRAM_BINARY_SIZES. (clGetPlatformInfo)"); applog(LOG_ERR, "Error: Getting program info CL_PROGRAM_BINARY_SIZES. (clGetPlatformInfo)");

Loading…
Cancel
Save