Current Status

cpu (llvmpipe) nv50 nvc0 r700 Evergreen/NI Cayman Southern/Sea Islands
gallium hw interface N/A MOSTLY MOSTLY TODO MOSTLY MOSTLY MOSTLY
handling GPU buffers TODO TODO TODO TODO DONE DONE DONE
execute TGSI compute shader TODO TODO TODO TODO N/A N/A N/A
execute LLVM-IR compute shader TODO TODO TODO TODO DONE DONE DONE
performance profiling TODO TODO TODO TODO DONE DONE DONE
global address space TODO TODO TODO TODO DONE DONE DONE
local address space TODO TODO TODO TODO DONE DONE DONE
private address space TODO TODO TODO TODO DONE DONE DONE
constant adress space TODO TODO TODO TODO DONE DONE DONE
local sync TODO TODO TODO TODO DONE DONE DONE
global sync TODO TODO TODO N/A WIP WIP DONE
local atomics TODO TODO TODO N/A DONE DONE DONE
global atomics TODO TODO TODO N/A WIP WIP DONE
2D image read TODO TODO TODO TODO TODO TODO TODO
3D image read TODO TODO TODO N/A TODO TODO TODO
2D image write TODO TODO TODO TODO TODO TODO TODO
3D image write TODO TODO TODO N/A TODO TODO TODO
accurate4 arithmetics TODO TODO TODO TODO MOSTLY7 MOSTLY7 DONE
OpenCL5 1.0 TODO TODO TODO N/A6 WIP WIP MOSTLY
OpenCL 1.1 TODO TODO TODO N/A WIP WIP MOSTLY
OpenCL 1.2 TODO TODO TODO N/A WIP WIP WIP
OpenGL interoperability TODO TODO TODO TODO TODO TODO TODO

4 OpenCL defines some level expected accuracy. Some hardware doesn't support it, so we need software emulation

5 OpenCL front-end is a separate project, we aim to support all features needed by the front-end to implement the standard

6 Only partial OpenCL support is possible, support through vertex shaders.

7 Mostly reliable for float and integer types. char, short, long, and double types need more testing.

Hardware

AMD / Radeon

Supported GPUs

Supported Linux Kernel Versions

  • r600g compute is known to work with stable Linux Kernel versions >= 3.1. Versions older than 3.1 may work, but have not been tested.

How to Install

Getting the source code

  • Current Development version:

    • LLVM / Clang:

      git clone http://llvm.org/git/llvm.git
      cd llvm/tools
      git clone http://llvm.org/git/clang.git
      
    • libclc:

      git clone http://llvm.org/git/libclc.git
      
    • Mesa:

      git clone git://anongit.freedesktop.org/mesa/mesa
      
  • Stable Version (NOTE: Gallium Compute is still under heavy development, so the development version is recommended for best results):

    • LLVM / Clang:

      wget http://www.llvm.org/releases/3.6.1/llvm-3.6.1.src.tar.xz
      tar -xJf llvm-3.6.1.src.tar.xz
      cd llvm-3.6.1.src/tools
      
      
      wget http://www.llvm.org/releases/3.6.1/cfe-3.6.1.src.tar.xz
      tar -xJf cfe-3.6.1.src.tar.xz
      mv cfe-3.6.1.src clang
      
    • libclc:

      git clone http://llvm.org/git/libclc.git
      
    • Mesa:

      wget ftp://ftp.freedesktop.org/pub/mesa/10.5.8/mesa-10.5.8.tar.gz
      tar -xzf mesa-10.5.8.tar.gz
      

Building

  1. LLVM / Clang:

    cd llvm/
    mkdir build
    cd build/
    ../configure --enable-targets=x86,amdgpu --enable-shared
    make -j3 && make install
    
    • For building versions of LLVM prior to 3.7, replace amdgpu with r600 when configuring.
    • LLVM builds all supported targets by default, so adding --enable-targets=x86 will speed up the build time. NOTE: Mesa requires the X86 target to be built.
    • LLVM will try to use clang as its compiler by default. This may not work for you in all cases (e.g. you have an old version of clang installed). You can force llvm to use gcc by appending CC=gcc CXX=g++ to the configure arguments.
  2. libclc:

    cd libclc/
    ./configure.py
    make
    make install
    
    • libclc's pkgconfig file is installed to ${prefix}/share/pkgconfig, so you will need to make sure this path is added to your PKG_CONFIG_PATH environment variable before you configure Mesa. Also, if you have installed old versions of libclc on your system it is recommended that you remove the old libclc.pc file which is located at ${prefix}/lib/pkgconfig. The default ${prefix} for libclc is /usr/local.
  3. Mesa:

    cd mesa/
    ./autogen.sh --with-dri-drivers="" --with-gallium-drivers=r600,radeonsi --enable-opencl
    make -j3
    make install
    

Testing

  • OpenCL examples that mostly work with clover and r600g can be found here.
  • Piglit:
    • Use the quick_cl.py profile for normal testing.
    • You can run the OpenCV OpenCL test suite from piglit by adding the path to the opencv_test_ocl test executable to your piglit.conf. Details are in the piglit.conf.example file in the piglit tree.

Troubleshooting

  • If see this error message: radeon: Failed to get PCI ID, error number -13, make sure you have permissions to access the device (usually /dev/dri/card0), and get the latest version of mesa from git. Prior to this commit: 044de40cb0c6af54d99252f55145972780362afa, you would have seen this error message when running compute programs and X at the same time.
  • If you get the error message "cannot find stddef.h" when you try to run a compute program, this means that clang can't find its builtin include files. The solution for this is to make sure that clang and llvm are both installed to the same $(LIBDIR). Clover expects the clang builtin includes to be in $(LLVM_LIBDIR)/clang/$(LLVM_VERSION)/

Working Applications

NOTE: This is not a complete list

  • bfgminer v3.1.1 and newer (Mesa >= 9.2, LLVM >= 3.3)

    If you run bfgminer at high intensities (-I option) you may experience hangs in your desktop system. It is recommended that you run bfgminer without an X server.

    Not all configurations and kernels work. The recommended options are:

    ./bfgminer  -o mining.eligius.st:3334 -O addr:pass --gpu-threads=1 -I10 -v4 -k phatk
    
  • pyrit (Mesa >= 10.1, LLVM >= 3.5)

Todo

R600ToDo#Compute