Lets say I have a device which, while it has the capability to support, does not currently support OpenCL. I have the ISA, the hardware design documents and a lot of other documentation. My system which the device is located on currently has C and C++ compilers and has support for many linux distributions.
Now I want to add OpenCL (lets say the latest version, 2.2) support to my device. What do I actually need to do in order to have my device supported? I see documentation for SPIR-V on their site, ie: SPIR-V registry page, opencl extended instruction set overview, normal spir-V overview.
Now lets say I do implement a SPIR-V-to-my-device-ISA compiler, do I now support OpenCL 2.2? I see another registry for OpenCL but I don't see a thing that says "if you implement these functions, write code that does this etc.. you now have implemented the OpenCL 2.2 specification on your system".
What are the actual steps I need to take in order to implement OpenCL for my device?
Well you have to provide an implementation of the open cl api. This api implementation needs to efficiently compile opencl kernels for your architecture.
To support a certain set of features (meaning OpenCL versions and extensions) you will need to support certain features in the api and the opencl c /c++ kernel language. All these things are specified in the open cl standard which you can find on the khronos website.
For simplifying the whole process companies like intel,nvidia,amd,... all base their compiler on LLVM. If you need to further reduce the effort having a look at POCL might also be an option.
Does your system have a custom architecture or is it just a custom software stack?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With