Page MenuHome

Blender Crashing when rendering with Opencl GPU on Ubuntu.
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Linux-5.8.0-45-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: Radeon RX 580 Series (POLARIS10, DRM 3.38.0, 5.8.0-45-generic, LLVM 10.0.1) X.Org 4.6 (Core Profile) Mesa 20.1.6

Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-03-15 19:47, hash: rBbe51d671b500
Worked: 2.83.13

Short description of error
Blender crashing while compiling shader during rendering. Happens with gpu only and gpu+cpu. I'm using a fresh Ubuntu 20.04.1instal with Radeon gpu 20.45 driver, non-pro version with no-dkms and opencl legacy flags. Blender 2.83.13 works fine but 2.92 is also broken.


Exact steps for others to reproduce the error

  1. Open default blender scene and switch to cycles.
  2. Enable opencl gpu rendering in user pref.
  3. Render with GPU.
  4. Crash

Event Timeline

Same crash with openSUSE Leap 15.2, distribution provided graphics driver + v20.40 AMD opencl library.
Happens on Blender 2.92 and 2.93.

Can be avoided by compiling Blender without nanoVDB.

...or change ~/blender-2.92.0-linux64/2.92/scripts/addons/cycles/source/kernel/kernels/opencl/kernel_opencl_image.h
add a new
#undef WITH_NANOVDB
after the
#ifdef WITH_NANOVDB
near the top of the file.

That will allow compiling the cycles kernels but you won't get rendered volume objects when rendering on the gpu.

The cause of the crash seems to be located in the following piece of code in kernel_opencl_image.h:

#ifdef WITH_NANOVDB
  /* NanoVDB Float */
  else if (texture_type == IMAGE_DATA_TYPE_NANOVDB_FLOAT) {
    cnanovdb_coord coord;
    coord.mVec[0] = x;
    coord.mVec[1] = y;
    coord.mVec[2] = z;
    float f = cnanovdb_readaccessor_getValueF((cnanovdb_readaccessor *)acc, &coord);
    return make_float4(f, f, f, 1.0f);
  }
  /* NanoVDB Float3 */
  else if (texture_type == IMAGE_DATA_TYPE_NANOVDB_FLOAT3) {
    cnanovdb_coord coord;
    coord.mVec[0] = x;
    coord.mVec[1] = y;
    coord.mVec[2] = z;
    cnanovdb_Vec3F f = cnanovdb_readaccessor_getValueF3((cnanovdb_readaccessor *)acc, &coord);
    return make_float4(f.mVec[0], f.mVec[1], f.mVec[2], 1.0f);
  }
#endif

Replacing the 2.93 version of kernel_opencl_image.h by the 2.91 version and compiling wihout nanoVDB will avoid the crash and bring back volume objects rendered on the gpu.

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Thu, Mar 25, 2:16 PM
Germano Cavalcante (mano-wii) triaged this task as High priority.
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

Due to the growing number of reports (many of which are mentioned in T85099: Cycles GPU render crashes in 2.92, 2.93 on Ubuntu with rx580), I believe that this problem deserves priority.
So I am confirming the issue even though I am not able to replicate the problem on Windows.
I hope @thomas-29 (thomas-29)'s findings help the devs to solve the problem.

Switching off the opencl compiler optimization of one pointer prevents the crash during cycles kernel compilation.
Applying this patch


to ~/blender-git/lib/linux_centos7_x86_64/nanovdb/include/nanovdb/CNanoVDB.h
allows compiling blender with nanoVDB switched on and rendering a volume object on gpu.
Unfortunately the render result is not as expected:

rendered on GPU

rendered on CPU

A part of the volume is not rendered.
(looks like the part of the volume object in -y direction from the origin of the object)

Don't try to render the viewport via GPU. It seems to freeze blender, at least on my computer.

I believe that this bug has already been fixed by rB91c44fe88547: Cycles: disable NanoVDB for AMD OpenCL.

Please try the latest daily build: https://builder.blender.org/download/

If the problem persists, please let us know so we can re-open the report. Don't forget to mention the specific version you tested again.

gabe2252 (gabe2252) added a comment.EditedMon, Apr 12, 7:31 PM

Alright I tested version: 2.93.0 Alpha, branch: master, commit date: 2021-04-11 20:10, hash: 09d7d88cc42a with my RX580 and it seems to be fixed.

I tested blender-2.93.0-09d7d88cc42a-linux64 from https://builder.blender.org/download/

The crash is gone, but for the cost of not rendering volume objects on the GPU with AMD OpenCL.
On CPU the volume objects are still rendered.

I think there could be a proper way of just disabeling the use of nanoVDB for rendering volume objects with AMD OpenCL and still rendering the volume objects with AMD OpenCL.
The workaround:
"Replacing the 2.93 version of kernel_opencl_image.h by the 2.91 version and compiling wihout nanoVDB will avoid the crash and bring back volume objects rendered on the gpu."
still works when applied to the latest commit 2bd9f9d976560.

Would you mind re-opening?

gabe2252 (gabe2252) added a comment.EditedMon, Apr 12, 9:52 PM

The volume objects are rendering for me.

Edit: I'm using the 20.50 driver for ubuntu.

Edit2: I was wrong and Volume objects don't work.

The crash is gone, but for the cost of not rendering volume objects on the GPU with AMD OpenCL.
(...)
Would you mind re-opening?

The description in the report does not mention volumes, so this appears to be a different problem.
And I'm not sure if it's really related to the fix.
CC @Brecht Van Lommel (brecht)

@gabe2252 (gabe2252)
could you please double check rendering using Cycles and OpenCL with GPU selected in the preferences as well as in the render setting with this file:

Thanks!

Oh, I was thinking objects with cycles volume rendering. I haven't used the new volume objects and I didn't realize that's you where talking about that. I'll try your blend file in few hours when I get back to my computer. Feeling a bit embarrassed.

Alright, I tested the @thomas-29 (thomas-29) 's blend file and can confirm that the new volume objects do not work.