LuxCore: OpenCL image pipeline support

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: Dade, jromang, tomb, zcott, coordinators

LuxCore: OpenCL image pipeline support

Postby Dade » Thu Jan 21, 2016 9:11 am

Introduction

The execution of Film image pipeline can become quite slow if one or more of the following conditions is met:

1) multiple radiance groups (and double the execution times for BIDIRCPU as it has eye and light buffers);
2) high rendering resolutions;
3) complex image pipeline plugins used (i.e. bloom, etc.);
4) high screen refrash rate (i.e. RT rendering modes).

For instance, this is a 1920x1280 rendering with 2 radiance buffers, Reinhard02 tone mapping plus bloom and BIDIRCPU:

Code: Select all
[LuxCore][9.450] MergeSampleBuffers time: 91ms
[LuxCore][10.615] Image pipeline 0 time: 1153ms


More than a second of CPU time (all cores used) wasted just to refresh the screen. This is also clearly a huge bottleneck for RT modes.

Film OpenCL support for merging sample buffers and running plug-ins

Both Film and image pipeline plugins code has been updated to use an OpenCL device to run the same tasks. This is the result in the above case:

Code: Select all
[LuxCore][7.425] MergeSampleBuffers time: 34ms
[LuxCore][7.476] Image pipeline 0 time: 51ms


It is more than 10 times faster.

Film OpenCL new parameters

The are 3 new properties to control the Film OpenCL support:

Code: Select all
# Enable/disable the OpenCL usage (default: true)
film.opencl.enable = 1
# The index of OpenCl platform to use (default: -1, check all platforms)
film.opencl.platform = -1
# The index of OpenCl device to use (default: -1, the first GPU available)
film.opencl.device = -1


CPU render engines

This feature can be useful for CPU render engines as you have seen, it frees CPU time that can be used for the rendering instead of image pipeline. This is quite nice for BIDIRCPU as it can still get some benefit from having a GPU even it runs only on CPUs.

Image pipeline plugins

The support for OpenCL is optional for image pipeline plugins. The frame work will take care to move stuff around (i.e. CPU <=> GPU) if a particular plugin doesn't support OpenCL. But, indeed, is better to have full OpenCL compatibile image pipeline.
There are currently only 2 plugins where I don't plan to support OpenCL for the moment: OutputSwitcher and ContourLines.
User avatar
Dade
Developer
 
Posts: 8354
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy

Re: LuxCore: OpenCL image pipeline support

Postby SATtva » Thu Jan 21, 2016 10:02 am

Dade wrote:This feature can be useful for CPU render engines as you have seen, it frees CPU time that can be used for the rendering instead of image pipeline. This is quite nice for BIDIRCPU as it can still get some benefit from having a GPU even it runs only on CPUs.

Whoa, awesome!
Linux builds packager
聞くのは一時の恥、聞かぬのは一生の恥
User avatar
SATtva
Developer
 
Posts: 7162
Joined: Tue Apr 07, 2009 12:19 pm
Location: from Siberia with love

Re: LuxCore: OpenCL image pipeline support

Postby jensverwiebe » Thu Jan 21, 2016 11:40 am

Hi Dade
I found out why blender preview is crashing with activated cl imagepipeline now.
Seems we have a numerical problem somewhat.

Try to render with this luxball.cfg ( slg4, luxcoreui, whatever you like ):
Code: Select all
film.width = 643
film.height = 480
# Use a value > 0 to enable batch mode
batch.halttime = 0
scene.file = scenes/luxball/luxball.scn
scene.fieldofview = 45
opencl.cpu.use = 0
opencl.gpu.use = 1
# Select the OpenCL platform to use (0=first platform available, 1=second, etc.)
#opencl.platform.index = 0
# The string select the OpenCL devices to use (i.e. first "0" disable the first
# device, second "1" enable the second).
#opencl.devices.select = 10
# Use a value of 0 to enable default value
opencl.gpu.workgroup.size = 64
screen.refresh.interval = 100
path.maxdepth = 16
path.russianroulette.depth = 5
light.maxdepth = 16
light.russianroulette.depth = 5
# BIASPATH settings
tile.multipass.enable = 1
tile.multipass.convergencetest.threshold = 0.09
#tile.multipass.convergencetest.threshold.reduction = 0.5
#screen.tiles.converged.show = 1
#screen.tiles.passcount.show = 1
#screen.tiles.notconverged.show = 1
biaspath.sampling.aa.size = 3
biaspath.sampling.specular.size = 5
biaspath.pathdepth.specular = 4
# Film image pipeline plug-ins
film.imagepipeline.0.type = TONEMAP_AUTOLINEAR


This will crash with 643 x 480 -> OpenCL ERROR: clEnqueueNDRangeKernel(CL_INVALID_WORK_GROUP_SIZE)
In blender, final render masks this issue cause of "even" filmsize presets, but 643 x 480 or certain viewport resolutions show this issue.

Did not tested all other stuff, todo ...
EDIT: film.imagepipeline.0.type = TONEMAP_REINHARD02 crashes too.

Jens
User avatar
jensverwiebe
Developer
 
Posts: 3403
Joined: Wed Apr 02, 2008 4:34 pm

Re: LuxCore: OpenCL image pipeline support

Postby jensverwiebe » Thu Jan 21, 2016 2:51 pm

Dade, i pushed a fix for the former problem: https://bitbucket.org/luxrender/luxrays ... 043dc05ac1

Pls check if the value is choosen okay now.

BTW: i just miss the densitygrid tex in luxcore, to do smoke/fire animations. I'll try if i can port this from classic soemehow.

Jens
User avatar
jensverwiebe
Developer
 
Posts: 3403
Joined: Wed Apr 02, 2008 4:34 pm

Re: LuxCore: OpenCL image pipeline support

Postby Dade » Fri Jan 22, 2016 3:20 am

jensverwiebe wrote:Dade, i pushed a fix for the former problem: https://bitbucket.org/luxrender/luxrays ... 043dc05ac1

Pls check if the value is choosen okay now.


I should have applied the strictly correct work size now.
User avatar
Dade
Developer
 
Posts: 8354
Joined: Sat Apr 19, 2008 6:04 pm
Location: Italy


Return to Architecture & Design

Who is online

Users browsing this forum: No registered users and 2 guests