Creates a program object for a context, and loads the IL into the program object.

cl_program clCreateProgramWithIL ( cl_context context,
  const void *il,
  size_t length,
  cl_int *errcode_ret)



Must be a valid OpenCL context.


A pointer to a length-byte block of memory containing SPIR-V or an implementation-defined intermediate language.



Returns an appropriate error code. If errcode_ret is NULL, no error code is returned.



Returns a valid non-zero program object and errcode_ret is set to CL_SUCCESS if the program object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:

  • CL_INVALID_CONTEXT if context is not a valid context.
  • CL_INVALID_VALUE if il is NULL or length is zero.
  • CL_INVALID_VALUE if the length-byte memory pointed to by il does not contain well-formed intermediate language input that can be consumed by the OpenCL runtime.
  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.


OpenCL Specification

Also see

clCreateProgramWithSource, clCreateProgramWithBuiltInKernels, clCreateProgramWithBinary

Copyright © 2007-2015 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.