I have read two articles about how to generate and load kernel binary.
First article is in knowledge base, saying:
Loading A Generated Binary Kernel
- Call clBuildProgram() to setup the necessary internal program state.
err = clBuildProgram( program, 1, &device_id, NULL, NULL, NULL );
Can you explain why this is needed?
In the second article:
in this section:
List 4.7: Offline compilation - Reading the kernel binary
there is written something different see point 2.:
(const unsigned char **)&binary_buf, &binary_status, &ret);
with a note:
To summarize, in order to change the method of compilation from online to offline, the following steps are followed:
- Read the kernel as a binary
- Change clCreateProgramWithSource() to clCreateProgramWithBinary()
- Get rid of clBuildProgram()
So this is confusing. Once being said we need to call clBuildProgram and second time said we don’t need it. Both cases are for loading kernel binary. So can you please explain why I need it or do not need it?
Here is my code I am working on: