OpenCL Environment
The purpose of the OpenCL Environment API is to help simplify the use of OpenCL (even though it already pretty easy to use). There's two main areas I addressed with this first release.
- First, I'm an embedded software person by trade and in my environment, there's not much room to have a run-time compiler running perpetually in the background. On a PC/MAC, this is no big deal since Clang/LLVM (the OpenCL kernel compiler for Mac OSX) is really fast (amazingly so in some situations). Even though they have a version of LLVM which will target ARM and will even produce ARMv7 instructions, this is still not the ideal situation. Ideally (as an OEM/Vendor) you'd want to compile your proprietary kernels beforehand so that you don't have to put them on the device in plain text (literally). So this first feature of this OpenCL Environment API is the clCompiler which will take a .cl file and will produce a precompiled header which you can include in your source code and then create your program from that binary data. By also implementing this compiler stage as part of the build process, you can prevent what would otherwise be run-time compile errors and push them back into being build-time errors and make them makefile dependencies.
- Second, there's a bit of setup around calling individual kernel calls from C to CL (which is like C99 with some extra keywords). So I simplified this by creating a facility which can take a compile time variably defined structure and execute the CL call with very little fuss. This has the downside (for now) that only a single function call is supported and this results in poor performance for large-scale multiple kernel applications, which any program really grows into after a few iterations on a serious problem. This will hopefully be address and somewhat mitigated in the future by a chaining feature where multiple calls can be made in serial with data going in and out at appropriate times while keeping the CL devices fully utilized.
Enjoy!
