1

My program has several kernels. I'd like to use offline compiler to compile one kernel into binary. So how can I build my program using other kernels and that one pre-built kernel binary?

2 Answers 2

3

You should be able to compile your other kernels using clCreateProgramWithSource and clCompileProgram and load your pre-built kernel with clCreateProgramWithBinary. Then you can link these programs using clLinkProgram to link both of the programs into one new program containing all kernels.

Sign up to request clarification or add additional context in comments.

Comments

1

AFAIK it is not possible or very complicated.

Kernels suppose to be small and modular. Composite kernels is bad practice.

What u can try is Enqueue kernels built from source together with kernels loaded as binary(with/out CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE f.e, with/out blocking or not flag). This way they will run in parallel.

What is left interkernel communication. You can try following:

  1. Simple way: blocking run of kernel A after finishing start from host kernel B.

  2. Complicated way: using clEnqueueMarkerWithWaitList, clEnqueueBarrierWithWaitList, clEnqueueMarker, clEnqueueWaitLIst, clWaitForEvents, clCreateUserEventclEnqueueBarrier

  3. Pipes. You can use pipes for it. clCreatePipe I never tried. (OpenCL 2.0)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.