Add support for cl_khr_il_program extension

This commit is contained in:
Grzegorz Wawiorko
2020-03-30 17:31:55 +02:00
committed by Alastair Murray
parent 3730bce4e8
commit adec8f9412
4 changed files with 55 additions and 9 deletions

View File

@@ -665,11 +665,32 @@ static int create_single_kernel_helper_create_program_offline(cl_context context
size_t length = modifiedKernelBuf.size();
log_info("offlineCompiler: clCreateProgramWithSource replaced with clCreateProgramWithIL\n");
if (gCoreILProgram) {
*outProgram = clCreateProgramWithIL(context, &modifiedKernelBuf[0], length, &error);
}
else {
cl_platform_id platform;
error = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(cl_platform_id), &platform, NULL);
print_error(error, "clGetDeviceInfo for CL_DEVICE_PLATFORM failed");
clCreateProgramWithILKHR_fn clCreateProgramWithILKHR = NULL;
clCreateProgramWithILKHR = (clCreateProgramWithILKHR_fn)clGetExtensionFunctionAddressForPlatform(platform, "clCreateProgramWithILKHR");
if (clCreateProgramWithILKHR == NULL)
{
log_error("ERROR: clGetExtensionFunctionAddressForPlatform failed\n");
return -1;
}
*outProgram = clCreateProgramWithILKHR(context, &modifiedKernelBuf[0], length, &error);
}
*outProgram = clCreateProgramWithIL(context, &modifiedKernelBuf[0], length, &error);
if (*outProgram == NULL || error != CL_SUCCESS)
{
print_error(error, "clCreateProgramWithIL failed");
if (gCoreILProgram) {
print_error(error, "clCreateProgramWithIL failed");
}
else {
print_error(error, "clCreateProgramWithILKHR failed");
}
return error;
}
}