OpenCL
General Info
OpenCL is a way to use the GPU in some graphics cards for additional general-purpose processing.
Most of the OpenCL work has been committed to the ports tree in revision r397198.
OpenCL providers on FreeBSD are installed as a ocl-icd module. ocl-icd stands for "OpenCL - Installable Client Driver". This gives us a very flexible setup. For one this doesn't lock any OpenCL-using port into a specific provider and theoretically allows more than one provider to be used at the same time. A downside is that the user must install the OpenCL provider which they want to use.
The providers to choose from are:
Clover which is the Mesa implementation, targets all Gallium drivers ; only Radeon GPUs in our case.
Beignet is for Intel GPUs starting with Ivy Bridge.
pocl is a software (running on the CPU instead) OpenCL provider. (not yet added to ports)
freeocl is also a software OpenCL provider but it does not support being built as an ocl-icd module at this time.
There is also the information utility, clinfo, which can be compared with glxinfo but instead for OpenCL.
Notes:
- For either Beignet or Clover to work, a graphics card supported by the kernel KMS drivers is needed.
- Beignet does not support Sandy Bridge class GPUs, only Ivy Bridge and higher.
- OpenCL is only support on FreeBSD 10 and newer. Due to issues with libc++ shipped with FreeBSD 10.1, there is no FreeBSD supplied beignet package. Because the oldest supported release in a branch is used to build the packages. Beignet builds fine on FreeBSD 10.2 though, so either using your own poudriere setup or building it manually from ports should work fine.
OpenCL related ports
Port |
Notes |
devel/clinfo |
glxinfo-like program for OpenCL |
devel/ocl-icd |
OpenCL - Installable Client Driver library |
devel/freeocl |
OpenCL driver that uses the CPU. Currently the only OpenCL version in ports. Not yet changed to support ocl-icd. |
devel/pocl |
Another OpenCL driver that uses the CPU, not yet in ports |
lang/clover |
OpenCL driver for Radeon GPUs, only in the mesa-next branch |
lang/beignet |
OpenCL dirver for Intel GPUs, only in the mesa-next branch |
Current results
Below are Clover and Beignet example outputs of clinfo.
Clover example
> uname -a
FreeBSD magellan.dumbbell.fr 11.0-CURRENT FreeBSD 11.0-CURRENT #0 67cdc8d(kms-drm-update-38): Thu Feb 5 09:39:28 CET 2015 root@magellan.dumbbell.fr:/usr/obj/home/dumbbell/Projects/freebsd/src/GIT/sys/GENERIC amd64
drmn0: <ATI Mobility Radeon HD 5870> on vgapci0
info: [drm] initializing kernel modesetting (JUNIPER 0x1002:0x68A0 0x1558:0x8687).
drmn0: info: VRAM: 1024M 0x0000000000000000 - 0x000000003FFFFFFF (1024M used)
drmn0: info: GTT: 512M 0x0000000040000000 - 0x000000005FFFFFFF
> clinfo
Number of platforms 1
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 MESA 10.4.3
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA
Platform Name Clover
Number of devices 1
Device Name AMD JUNIPER
Device Vendor X.Org
Device Vendor ID 0x1002
Device Version OpenCL 1.1 MESA 10.4.3
Driver Version 10.4.3
Device OpenCL C Version OpenCL C 1.1
Device Type GPU
Device Profile FULL_PROFILE
Max compute units 1
Max clock frequency 0MHz
Max work item dimensions 3
Max work item sizes 256x256x256
Max work group size 256
Preferred work group size multiple 1
Preferred / native vector sizes
char 16 / 16
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 0 (n/a)
float 4 / 4
double 2 / 2 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 1073741824 (1024MiB)
Error Correction support No
Max memory allocation 268435456 (256MiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 128 bits (16 bytes)
Global Memory cache type None
Image support No
Local memory type Local
Local memory size 32768 (32KiB)
Max constant buffer size 268435456 (256MiB)
Max number of constant args 13
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Profiling timer resolution 0ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
Device Available Yes
Compiler Available Yes
Device Extensions
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Clover
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [MESA]
clCreateContext(NULL, ...) [default] Success [MESA]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Clover
Device Name AMD JUNIPER
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1)
Platform Name Clover
Device Name AMD JUNIPER
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.3
ICD loader Profile OpenCL 1.2
Beignet example
> uname -a
FreeBSD 11.0-CURRENT FreeBSD 11.0-CURRENT #111 r278020: Sun Feb 1 21:39:20 CET 2015 root@:/usr/obj/usr/src/sys/GENERIC amd64
drmn0: <Intel IvyBridge (M)> on vgapci0
$ clinfo
Number of platforms 1
Platform Name Intel Gen OCL Driver
Platform Vendor Intel
Platform Version OpenCL 1.2 beignet 1.0
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_icd
Platform Extensions function suffix Intel
Platform Name Intel Gen OCL Driver
Number of devices 1
Device Name Intel(R) HD Graphics IvyBridge M GT2
Device Vendor Intel
Device Vendor ID 0x166
Device Version OpenCL 1.2 beignet 1.0
Driver Version 1.0
Device OpenCL C Version OpenCL C 1.2 beignet 1.0
Device Type GPU
Device Profile FULL_PROFILE
Max compute units 16
Max clock frequency 1000MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types None, None, None
Max work item dimensions 3
Max work item sizes 512x512x512
Max work group size 512
Preferred work group size multiple 16
Preferred / native vector sizes
char 16 / 8
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 8 (n/a)
float 4 / 4
double 0 / 2 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 2147483648 (2GiB)
Error Correction support No
Max memory allocation 1073741824 (1024MiB)
Unified memory for Host and Device No
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 8192
Global Memory cache line 64 bytes
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 65536 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 8192x8192 pixels
Max 3D image size 8192x8192x2048 pixels
Max number of read image args 128
Max number of write image args 8
Local memory type Global
Local memory size 65536 (64KiB)
Max constant buffer size 134217728 (128MiB)
Max number of constant args 8
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Profiling timer resolution 80ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels Yes
Prefer user sync for interop Yes
printf() buffer size 1048576 (1024KiB)
Built-in kernels __cl_copy_region_align4;__cl_copy_region_align16;__cl_cpy_region_unalign_same_offset;__cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;__cl_copy_buffer_rect;__cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;__cl_copy_image_3d_to_2d;__cl_copy_image_2d_to_3d;__cl_copy_image_3d_to_3d;__cl_copy_image_2d_to_buffer;__cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;__cl_copy_buffer_to_image_3d;__cl_fill_region_unalign;__cl_fill_region_align2;__cl_fill_region_align4;__cl_fill_region_align8_2;__cl_fill_region_align8_4;__cl_fill_region_align8_8;__cl_fill_region_align8_16;__cl_fill_region_align128;__cl_fill_image_1d;__cl_fill_image_1d_array;__cl_fill_image_2d;__cl_fill_image_2d_array;__cl_fill_image_3d;
Device Available Yes
Compiler Available Yes
Linker Available Yes
Device 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_icd
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Intel Gen OCL Driver
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [Intel]
clCreateContext(NULL, ...) [default] Success [Intel]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.3
ICD loader Profile OpenCL 1.2
