From BlenderWiki

Jump to: navigation, search

OpenCL Status

Cycles does have split OpenCL kernel since Blender release 2.75. It's an alternative approach to what is uses on CPU (so called megakernel). The idea behind splitting kernel is to have multiple smaller kernels which are not only simplier and faster to compile, but should also have better performance.

Testing

For now OpenCL is only enabled by default for AMD cards on Windows and Linux platforms and requires latest AMD drivers to be installed. It is possible to force enable OpenCL megakernel (which is still kept in the codebase for the reference) and also force split kernel to be used on a particular platform.

This is being controlled via environment variables. CYCLES_OPENCL_TEST controls whether OpenCL devices are to be listed in the interface. Possible values are: ALL, DEFAULT, CPU and GPU. Depending on the value of this variable according OpenCL platform will be listed in the user preferences.

If CYCLES_OPENCL_SPLIT_KERNEL_TEST is set to 1, then Cycles will force use split kernel, regardless on some hardcoded rules.

Known issues

There are some known issues which are common to all kernels and platforms:

  • Baking does not deliver correct results.

For now they are considered a TODO rather than a bug.

AMD

Limitations

Initial split kernel patch was done by AMD and was aimed to make Cycles render on Windows platform. This kernel works reasonably well with simple scenes, but has much harder time to work on a production files, it also lacks following features:

  • Transparent shadows (they're disabled due to AMD compiler issues)
  • Correlated multi jitter pattern, SSS and Volumes, which could be added to the split kernel, but prefer to focus on making existing feature set rock-solid first.
  • Branched path tracing which is quite tricky to integrate into current implementation of split kernel and supporting it will mean we'll do split kernel once again.

Hardware Issues

GPU

While official statement from AMD about split kernel was that all GCN devices are to be supported, we've got several bug reports in the tracker which claims some of the GCN cards with latest drivers does not work:

  • T45336 AMD FirePro W5000
  • T45417 AMD HD 8650G
  • T45330 AMD HD 7870
  • [Unreported] AMD FirePro W8000: Driver fails to compile Baking kernel (using 15.7 driver)

NOTE: We've got some workarounds in Cycles side to minimize number of features being compiled-in to absolute minimum required to render specific scene. This means simplier scene might be rendered just fine, but with more complicated shader setups kernel compilation might cause driver to crash. So in order to troubleshoot the issue please either use comprehensive scenes or disable workaorunds from Cycles side.

APU

It's also unclear whether APU are officially advertised as supported by AMD compiler, here's a list of reports about APU support:

Here in the studio kernel compilation for A10 works fine, but rendering gets stuck at some point. Similar issue to Split OpenCL on OSX.

Performance

Performance of split kernel is not ideal, especially on a complex scenes. This is caused by high registers pressure due to all functions being inlined.

There are also variety of reports which are caused by specific of how compiler works.

  • T44943 Speed regression after proper integration of selective node compilation. it seems to be caused by different order of nodes in the switch() statement now. While we can do selective nodes support to certain extent, we can't do selective ordering of nodes. And it's not an issue on other platforms, so it's something to be improved in the driver.

AMD on OSX

AMD team who's working on OSX drivers for El Capitan (OS X 10.11) did really nice work on improving the driver which is now capable of compiling and running OpenCL megakernel. The following features are supported:

  • Hard and rough surface BSDF
  • Transparent shadows
  • Motion blur (camera, object, deformation)
  • Hair

Nothing special is needed for using OpenCL on OSX now, just go to the user preferences and enable OpenCL compute device.

The following features are to be investigated for inclusion into next Blender release:

  • Correlated multi jitter noise pattern
  • Volume scatter/absorption

Other features requires a bit bigger changes and will happen in one of the later releases.

This version - compiled 15 July 2015 - should work for 10.11 beta3

Split kernel status

Split kernel on OSX has some issues with reporting back ray status to the CPU (and maybe some other ones) which makes it unusable at this platform.

This is to be investigated still, more details later.

OpenCL on other platforms

OpenCL works fine on NVIDIA cards, but performance is reasonably slower (up to 2x slowdown) compared to CUDA, so it doesn't really worth using OpenCL on NVIDIA cards at this moment.

Intel OpenCL works reasonably well. It's even possible to use OpenCL to combine GPU and CPU to render at the same time, for until some more proper solution is implemented.