Page MenuHome

Cycles: OpenCL Separate Compilation Debug Flag
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Aug 8 2019, 3:20 PM.

Details

Summary

OpenCL Parallel compilation only works inside Blender. When using cycles in a different setup (standaline or other software) it failed compiling kernels as they don't have the appropriate Python API and command line arguments.

This change introduces a running_inside_blender debug flag, that triggers out of process compilation of the kernels. Compilation still happens in subthread that enabled the preview kernels and compilation of the kernels during BVH building

Diff Detail

Repository
rB Blender

Event Timeline

Jeroen Bakker (jbakker) planned changes to this revision.Aug 8 2019, 3:33 PM

Seems to crash during viewport rendering will need more testing.

Jeroen Bakker (jbakker) retitled this revision from Cycles: Compile Directive Parallel OpenCL Compilation to [WIP] Cycles: Compile Directive Parallel OpenCL Compilation.Aug 8 2019, 4:46 PM

loading of the compiled kernels when not using parallel compilation

Jeroen Bakker (jbakker) retitled this revision from [WIP] Cycles: Compile Directive Parallel OpenCL Compilation to Cycles: Compile Directive Parallel OpenCL Compilation.Aug 9 2019, 9:54 AM
Brecht Van Lommel (brecht) requested changes to this revision.Aug 12 2019, 11:16 AM

This does not need a build option or #ifdefs in some many places in the code as far as I can tell.

Can't we do just something like this, adding a running_inside_blender global?

bool OpenCLDevice::OpenCLProgram::compile_separate(const string &clbin)
{
  if (!DebugFlags().running_inside_blender) {
    return false;
  }

Having different code being compiled for Cycles standalone and Blender is something we should avoid as much as possible.

This revision now requires changes to proceed.Aug 12 2019, 11:16 AM

Changed to a debug flag

Jeroen Bakker (jbakker) planned changes to this revision.Aug 29 2019, 12:30 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) retitled this revision from Cycles: Compile Directive Parallel OpenCL Compilation to Cycles: OpenCL Parallel Compile Debug Flag.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Still need to test on other machines, before sending it for code review

Only use task_pool when running inside blender

Why only use the preview kernels and task pool when running inside Blender? Can't we just always use them?

Enable threaded compilation and preview kernels when not running inside blender.

Why only use the preview kernels and task pool when running inside Blender? Can't we just always use them?

Ah yes I see.

Jeroen Bakker (jbakker) retitled this revision from Cycles: OpenCL Parallel Compile Debug Flag to Cycles: OpenCL Separate Compilation Debug Flag.Aug 30 2019, 11:21 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Reverted whitespace change

This revision is now accepted and ready to land.Aug 30 2019, 11:42 AM