OpenCL on mainline

Which Khadas SBC do you use?

VIM3

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu

Which version of system do you use? Khadas official images, self built images, or others?

Khadas mainline 6.1.0 jammy

Please describe your issue below:

Is OpenCL (for GPU) supported on mainline kernel? I’m getting errors running clinfo and opencl applications. What packages and/or kernel modules might I be missing?

Post a console log of your issue below:


$ clinfo
Number of platforms                               1
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 2.0 git.c8adbf9.122c9daed32dbba4b3056f41a2f23c58
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image cl_khr_image2d_from_buffer cl_khr_depth_images cl_khr_subgroups cl_khr_create_command_queue cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory cl_arm_shared_virtual_memory
  Platform Extensions function suffix             ARM

  Platform Name                                   ARM Platform
Number of devices                                 1
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Device Name                                     <printDeviceInfo:0: get CL_DEVICE_NAME size : error -6>
  Device Vendor                                   ARM
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Device Vendor ID                                <printDeviceInfo:2: get CL_DEVICE_VENDOR_ID : error -6>

Silly question… did you run it as root ? (sudo) ?

I am using the debian11 build and it seems its all there. This is what I done to get ARMNN working with OpenCL (Note - I used non GUI version … debian11 minimal)

   wget -c "https://github.com/ARM-software/armnn/releases/download/v23.02/ArmNN-linux-aarch64.tar.gz"
   mkdir /lib/armnn
   tar -xf ArmNN*.tar.gz -C /lib/armnn
   
  wget "https://dl.khadas.com/repos/vim4/pool/main/l/linux-gpu-mali-wayland/linux-gpu-mali-wayland_1.1-r37p0-202208_arm64.deb"
   dpkg -i linux-gpu-mali-wayland_1.1-r37p0-202208_arm64.deb

@RichardPar that package is for the vim4, vim3 should be utilizing a different package.
I believe this one specifically:

https://dl.khadas.com/repos/vim3/pool/main/l/linux-gpu-mali-fbdev/linux-gpu-mali-fbdev_1.5-r12p0_arm64.deb

Youre right! … sorry :smiley: I had VIM3 and VIM4 environments open … copy/pasted the wrong one :smiley: