Is it possible to compile OpenCL C 2.0 kernels separately in rocm environment?
I am trying OpenCL C 2.0 features and clBuildProgram seems to terminate with segfault. I am thinking that compiling with some other way might give some messages indicating what is wrong.
I have read that compiling OpenCL kernel is somehow related to clang. I have clang 4.0 on my system and I also see /opt/rocm/opencl/bin/x86_64/clang and /opt/rocm/bin/clang-ocl that came with ROCM 1.7.
If possible, with what command can I compile opencl (2.0) kernel file?
First of all, if you're observing a crash in clBuildProgram, please report the issue here: Issues · RadeonOpenCompute/ROCm · GitHub . Actually, ROCm has a separate GitHub place to report an issue or post a query related to it.
Regarding the offline compilation, both clang and clang-ocl tools can be used. I think clang-ocl is easier to use because it requires less number of flags. Say,
>> clang-ocl simple.cl -o simple.o
>> clang-ocl simple.cl -mcpu=ARCH -o simple.o
Here ARCH denotes specific architecture, for example, gfx803 for Fiji or gfx900 for Vega.
Also OpenCL 2.0 specific flags might be required for compiling OpenCL 2.0 kernels. As I haven't used it myself, I can't provide the exact command or steps. Please check ROCm community for more information.
I just did report the issue to ROCm github place.
I think following command might work. However, at the moment clang crashes during the compilation as well.
/opt/rocm/bin/clang-ocl -cl-std=CL2.0 -mcpu=gfx803 gpu.cl -o output.o
clang: error: unable to execute command: Segmentation fault (core dumped)
However, I recently found that ryzen has some kind of a bug: How serious is the AMD Ryzen segfault bug for "non-programmers"? I wonder if the I have affected Ryzen CPU causing issues.