New OpenCL textures and materials evaluation code

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

New OpenCL textures and materials evaluation code

Post by Dade »

Introduction

The new OpenCL code for evaluating textures and materials is finished. Its major feature is to not require dynamic kernel compilation anymore. So there is just one kernel compilation for each render engine and that is it.

For v2.4

The code is available on "for_v2.4" branch and will be included in v2.4 related releases.

Compile once

The OpenCL is now compiled once (for each render engine and for each new release) and cached. However it is a lot code to compile, it takes about 90secs with NVIDIA drivers and a AMD 3900x CPU. AMD GPU driver is likely to take more.

The most logic step would be compile the kernels at installation time. It is easy to do, it is just one LuxCore API call (KernelCacheFill()) however I have the impression Blender doesn't call anything after having installed a new plugin :?:

It may be done the first time you run the Blender with the plugin enabled :?:

The situation requires to be extra-careful because it will give the feeling at first-time users that everything is just frozen the moment they do the very first rendering: there must be some big informational note about what is going on.

RTPATHOCL

Thanks to this change, for the first time, it should be viable to use GPU rendering for view-port interactive rendering/editing.

P.S. can someone test this stuff with AMD GPUs. I don't have anymore an AMD GPU installed in my main PC.
Support LuxCoreRender project with salts and bounties
marcatore
Donor
Donor
Posts: 463
Joined: Wed Jan 10, 2018 8:04 am

Re: New OpenCL textures and materials evaluation code

Post by marcatore »

Supernice!!
fantastic!!!

Eager to test it!!!!! :)
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: New OpenCL textures and materials evaluation code

Post by Sharlybg »

:twisted: :twisted: :twisted: that is Glory days ! Well done Dade :D
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: New OpenCL textures and materials evaluation code

Post by B.Y.O.B. »

A long-time dream comes true. Thanks Dade!
Dade wrote: Fri Feb 21, 2020 11:28 am The most logic step would be compile the kernels at installation time. It is easy to do, it is just one LuxCore API call (KernelCacheFill()) however I have the impression Blender doesn't call anything after having installed a new plugin :?:
There is no special handler.
The register() function of the addon is called, so we can run code, however it is also called whenever Blender is started (not only after the installation).

Is there a way to check if the call to KernelCacheFill() is necessary?
I think Cycles (and some other engines, like VRayRT) compile the OpenCL kernels during the start of the first render. We could do the same (it is also a place where we can show messages about it, I don't think that's possible during register()).
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: New OpenCL textures and materials evaluation code

Post by alpistinho »

Sounds great =)

I have a RX 580 + Ryzen 3600 and can test on Windows (I and Linux OpenCL drivers share a mutual hate for each other).
Will compile it as soon as a stop in front of the computer
Support LuxCoreRender project with salts and bounties
juangea
Donor
Donor
Posts: 332
Joined: Thu Jan 02, 2020 6:23 pm

Re: New OpenCL textures and materials evaluation code

Post by juangea »

Wow this is going to be awesome!

Yesterday I was having a kernel compilation that lasted 15 minutes! I hope this solves everything :) I'm eager to test it!!!!
zuljin3d
Posts: 76
Joined: Sun Apr 08, 2018 12:13 pm
Location: Moscow

Re: New OpenCL textures and materials evaluation code

Post by zuljin3d »

Great news!!!! :o
Actualy sorry for my google translate english :)
juangea
Donor
Donor
Posts: 332
Joined: Thu Jan 02, 2020 6:23 pm

Re: New OpenCL textures and materials evaluation code

Post by juangea »

Regarding the moment of kernel compile... Why not put a button in settings called "Compile Kernel" with a warning explaining that Blender will be frozen for some minutes.

After that if someone has not compiled the kernel and enable OpenCl a message could appear saying "Please compile kernel, Blender will froze for some minutes" and inside the message the same button to compile it.

That will give the user the consciousness that something is happening and that if Blender froze is normal and they have to wait, and at the same time the power to decide if they want to wait or not.

What do you think? :)
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: New OpenCL textures and materials evaluation code

Post by Dade »

B.Y.O.B. wrote: Fri Feb 21, 2020 12:04 pm Is there a way to check if the call to KernelCacheFill() is necessary?
I could add a dedicated function (however calling KernelCacheFill() when the cache is already filled takes no time).
B.Y.O.B. wrote: Fri Feb 21, 2020 12:04 pm I think Cycles (and some other engines, like VRayRT) compile the OpenCL kernels during the start of the first render. We could do the same (it is also a place where we can show messages about it, I don't think that's possible during register()).
This is exactly how it works now however I'm a bit worried that a new user will not notice the little label "Compile OpenCL kernel" and it will assume everything is frozen.
Support LuxCoreRender project with salts and bounties
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: New OpenCL textures and materials evaluation code

Post by lacilaci »

I wouldn't worry about first time compilation... just have addon give a message about the kernel compilation and that's it

it is how blender optix/rtx cycles does it, and also how vray rt does it. Each update of the renderer/plugin triggers this "first time run compilation". I think people should be used to this already
Post Reply