Cycles: Implement execution group concept for SVM shaders
Needs ReviewPublic

Authored by Sergey Sharybin (sergey) on Dec 17 2015, 6:50 PM.



The idea is to somehow perform clasterization of the shader graph and compile
nodes close to their DFS traversal order in order to minimize SVM stack size.

Currently clasterization is done outside of the render routines (meaning, it's
up to blender synchronization code now to perform clasterization) and SVM code
is only ensuring execution group is only starting to compile once all the group
inputs are done. Additionally, SVM compiler will not switch to another group
for until current one is not fully compiled.

Clasterization is currently happening based on the group node in blender.
This could be improved in the future, but it's not so much bad start.

This now allows to render insane files from T46872, but needs some checks with
actual production files as well.

There are some optimization possible in the code still.

Diff Detail

rB Blender
Build Status
Buildable 1027
Build 1027: arc lint + arc unit
Sergey Sharybin (sergey) retitled this revision from to Cycles: Implement execution group concept for SVM shaders.Dec 17 2015, 6:50 PM
Sergey Sharybin (sergey) updated this object.
Sergey Sharybin (sergey) planned changes to this revision.Dec 18 2015, 10:57 AM

There's one issue with the current approach -- it's possible to create groups in the way so execution group can't be fully compiled before entering another one. Here's a file demonstrating the issue:

So need to work a bit more on the patch, but overall idea will be kept the same, so we can still discuss it.

Did some optimizations and solved the deadlock issue mentioned above

The idea now is skip doing recursive execution groups, so group nodes inside of
the group node will belong to the same execution group. While it's not really
ideal it does help already.

All in all, think it's an interesting playground to put into the code, so other
ideas of scheduling might be and such could be used.

Solve crash on classroom scene

Some further optimization -- avoid re-allocation of some vectors

Solve uninitialized variable and deadlock

Update against latest master

Here is a .blend file which benefits from it (comes from T53518):