- cl_int CL_err = ocl->clBuildProgram (program, num_devices, device_list, options, pfn_notify, user_data);
-
- if (CL_err != CL_SUCCESS)
- {
- size_t len = strlen (options) + 256;
-
- char *options_update = (char *) mymalloc (len + 1);
-
- snprintf (options_update, len, "%s -cl-opt-disable", options);
-
- if (data.quiet == 0) log_error ("\n=== Build failed, retry with optimization disabled ===\n");
-
- CL_err = ocl->clBuildProgram (program, num_devices, device_list, options_update, pfn_notify, user_data);
-
- myfree (options_update);
-
- if (CL_err != CL_SUCCESS)
- {
- log_error ("ERROR: %s : %d : %s\n", "clBuildProgram()", CL_err, val2cstr_cl (CL_err));
-
- log_error ("\n=== Build Options : %s ===\n", options);
-
- size_t len = 0;
-
- cl_int err = hc_clGetProgramBuildInfo (ocl, program, *device_list, CL_PROGRAM_BUILD_LOG, 0, NULL, &len);
-
- if (err == CL_SUCCESS && len > 0)
- {
- char *buf = (char *) mymalloc (len + 1);
-
- if (hc_clGetProgramBuildInfo (ocl, program, *device_list, CL_PROGRAM_BUILD_LOG, len, buf, NULL) == CL_SUCCESS)
- {
- fprintf (stderr, "\n=== Build Log (start) ===\n%s\n=== Build Log (end) ===\n", buf);
- }
-
- myfree (buf);
- }
-
- if (exitOnFail) exit (-1);
-
- return (-1);
- }
- }
-
- return 0;