Page MenuHome

Cycles: Fix usage of memory barriers in split kernel

Authored by Sergey Sharybin (sergey) on Sep 28 2020, 4:46 PM.



On user level this fixes dead-lock of OpenCL render on Intel Iris GPUs.
Note that this patch does not include change in the logic which allows
or disallows OpenCL platforms to be used, that will happen after the
kernel fix is known to be fine for the currently officially supported

The dead-lock was caused by wrong usage of memory barriers: as per the
OpenCL specification the barrier is to be executed by the entire work
group. This means, that the following code is invalid:

void foo() {
  if (some_condition) {

void bar() {

The Cycles code was mentioning this as an invalid code on CPU, while in
fact this is invalid as per specification. From the implementation side
this change removes the ifdefs around the CPU-only barrier logic, and
is implementing similar logic in the shader setup kernel.

Tested on NUC8i7HVK NUC.

The root cause of the dead-lock was identified by Max Dmitrichenko.

The missing aspect of this change are:

  • Verify AMD OpenCL performance is still the same.
  • Verify AMD OpenCL result validity.

This is where help from Brecht and Jeroen will be very welcome!

Diff Detail

rB Blender

Event Timeline

Sergey Sharybin (sergey) requested review of this revision.Sep 28 2020, 4:46 PM
Sergey Sharybin (sergey) created this revision.
Operating system: Linux-5.4.0-48-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: AMD Radeon RX 5700 (NAVI10, DRM 3.35.0, 5.4.0-48-generic, LLVM 10.0.0) X.Org 4.6 (Core Profile) Mesa 20.0.8
CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz with 64GB RAM
OpenCL Platform: OpenCL 2.1 AMD-APP (3143.9)
OpenCL Device: OpenCL C 2.0

rB58b8724a4892: Cleanup: spelling

Benchmark complete: 
bmw27: 86.077600 seconds
classroom: 172.152000 seconds
fishy_cat: 164.916000 seconds
koro: 122.710000 seconds
pavillon_barcelona: 571.024000 seconds

This patch

Benchmark complete:
bmw27: 86.327300 seconds
classroom: 172.241000 seconds
fishy_cat: 164.827000 seconds
koro: 122.823000 seconds
pavillon_barcelona: 571.016000 seconds

I did had some mis-compilations at first (no error). But after a few minutes the driver did output usable kernels.
Anyhow the performance difference is the same and didn't see any render issues.

Also no issues found with AMD RX 5700, performance is unchanged.

This revision is now accepted and ready to land.Sep 29 2020, 12:12 PM