I have only tried compiling kernels using pyopencl, but I can only seem to be able to use OpenCl C. Looking at clinfo, I only see support for CLC listed, heres some truncated output from my pc:
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3423.0)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback
Platform Extensions function suffix AMD
Platform Host timer resolution 1ns
Platform Name AMD Accelerated Parallel Processing
Number of devices 1
Device Name gfx1031
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 2.0
Driver Version 3423.0 (HSA1.1,LC)
Device OpenCL C Version OpenCL C 2.0
Device Type GPU
Device Board Name (AMD) AMD Radeon RX 6700 XT
Device PCI-e ID (AMD) 0x73df
Device Topology (AMD) PCI-E, 0000:2f:00.0
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 20
I am using a rocm driver compiled from the AUR, I tried to also install the mesa driver alongside but could not do so (perhaps I need to uninstall the other, but I dread having to recompile it if mesa fails).
My laptop (intel hd graphics) seems to support OpenCL 3.0 but also only lists CLC support. What am I missing, is this not implemented yet? I saw something somewhere about "offline compilation" and maybe using a "clc++" option with clang but can someone elaborate?
C++ for OpenCL can be used in two ways:
Online compilation
If OpenCL device supports
cl_ext_cxx_for_opencl, it is possible to compile a program written using the C++ for OpenCL kernel language in runtime. Applications may pass-cl-std=CLC++toclCompileProgramandclBuildProgramfor programs created usingclCreateProgramFromSourceto request the program be built as C++ for OpenCL.Offline compilation
If OpenCL device allows to create the program with SPIR-V, then it is possible to compile C++ for OpenCL source into intermediate LLVM IR:
Next, LLVM IR can be translated into SPIR-V using
llvm-spirv:Finally, OpenCL program can be created using
clCreateProgramWithILcall:For PyOpenCL:
To check that OpenCL device supports SPIR-V modules, you need to use
CL_DEVICE_IL_VERSIONquery in OpenCL 2.1 or newer and theCL_DEVICE_ILS_WITH_VERSIONquery in OpenCL 3.0 or newer.For additional information about offline compilation please see Offline Compilation of OpenCL Kernels into SPIR-V Using Open Source Tooling article.