Cycles: oneAPI: Improve performance of scenes not using volume #109245

Closed
Nikita Sirgienko wants to merge 2 commits from Sirgienko/blender:oneapi_shade_surface_perf_optimization into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

This changes is introducing an optimization for oneAPI execution. On my machine with Intel® Arc™ A770, I have got the same performance for some scenes and perf. improvement for the rest (2-15% overall, see charts below - blue is before and orange is after):
image

This changes is introducing an optimization for oneAPI execution. On my machine with Intel® Arc™ A770, I have got the same performance for some scenes and perf. improvement for the rest (2-15% overall, see charts below - blue is before and orange is after): ![image](/attachments/24367547-6b7d-4472-b663-f84d11cd4ed1)
Nikita Sirgienko added this to the 4.0 milestone 2023-06-22 15:50:07 +02:00
Nikita Sirgienko added the
Module
Render & Cycles
label 2023-06-22 15:50:07 +02:00
Xavier Hallade was assigned by Nikita Sirgienko 2023-06-22 15:50:08 +02:00
Nikita Sirgienko added this to the Render & Cycles project 2023-06-22 15:50:26 +02:00
Nikita Sirgienko requested review from Sergey Sharybin 2023-06-22 15:50:33 +02:00
Nikita Sirgienko requested review from Brecht Van Lommel 2023-06-22 15:50:39 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR109245) when ready.

Can we avoid having the volume nodes in the surface shader at all, and do this change for all GPU devices?

Maybe some code needs to be added to properly skip unsupported SVM nodes, to get the right offset.

Can we avoid having the volume nodes in the surface shader at all, and do this change for all GPU devices? Maybe some code needs to be added to properly skip unsupported SVM nodes, to get the right offset.
Author
Member

Can we avoid having the volume nodes in the surface shader at all, and do this change for all GPU devices?

If I will simply disable volume nodes in the shade_surface, then the test "T49936" and "T49936 indirect" will start to fail. And while I think it is possible to move volume nodes from shade_surface (into shade_volume) - I personally don't think that I am familiar with shade_surface enough for implementing such changes properly.
Also, about all GPU devices change - I don't really want to do it in the same PR, as this change is performance related and benefit may vary across different technologies (for example, according to testing on my other machine, NVIDIA won't benefit from this change at all).

> Can we avoid having the volume nodes in the surface shader at all, and do this change for all GPU devices? If I will simply disable volume nodes in the shade_surface, then the test "T49936" and "T49936 indirect" will start to fail. And while I think it is possible to move volume nodes from shade_surface (into shade_volume) - I personally don't think that I am familiar with shade_surface enough for implementing such changes properly. Also, about all GPU devices change - I don't really want to do it in the same PR, as this change is performance related and benefit may vary across different technologies (for example, according to testing on my other machine, NVIDIA won't benefit from this change at all).
Author
Member

Can we avoid having the volume nodes in the surface shader at all

BTW, @brecht , that I have struggled to understand - are this volume related nodes even processed in the surface shader?
I am talking about SVM nodes "NODE_TEX_VOXEL", "NODE_PRINCIPLED_VOLUME", "NODE_CLOSURE_VOLUME" and unnamed node in svm_node_attr (under IF_KERNEL_NODES_FEATURE(VOLUME) condition).
If it is not processed in shade_surface, then it is indeed make sense to just disable volume handling in surface shader instead of just making a specific variant (with expected outcome of some compilation time increase).

>Can we avoid having the volume nodes in the surface shader at all BTW, @brecht , that I have struggled to understand - are this volume related nodes even processed in the surface shader? I am talking about SVM nodes "NODE_TEX_VOXEL", "NODE_PRINCIPLED_VOLUME", "NODE_CLOSURE_VOLUME" and unnamed node in `svm_node_attr` (under `IF_KERNEL_NODES_FEATURE(VOLUME)` condition). If it is not processed in shade_surface, then it is indeed make sense to just disable volume handling in surface shader instead of just making a specific variant (with expected outcome of some compilation time increase).
Author
Member

I have rechecked and tests "T49936" and "T49936 indirect" actually failing with current PR on ONEAPI device - it seems this two scene/test relay on some code (or maybe even svn node) under IF_KERNEL_NODES_FEATURE(VOLUME), yet Blender don't report that this scenes are using volume feature ("scene.cpp:578] Use Volume False"). Seems to be a separate problem from this PR, but I still will investigate it and handle separately.

I have rechecked and tests "T49936" and "T49936 indirect" actually failing with current PR on ONEAPI device - it seems this two scene/test relay on some code (or maybe even svn node) under `IF_KERNEL_NODES_FEATURE(VOLUME)`, yet Blender don't report that this scenes are using volume feature ("scene.cpp:578] Use Volume False"). Seems to be a separate problem from this PR, but I still will investigate it and handle separately.

It's using a Point Density Texture node, which seems to work for surfaces as well.

This is a bit of a legacy feature, now that we have geometry nodes it's much more natural to do this with a points to volume node. @Sergey do you remember if there was a good reason to have this node work for surfaces? And what do you think about removing this point density texture node entirely for 4.0?

It's using a Point Density Texture node, which seems to work for surfaces as well. This is a bit of a legacy feature, now that we have geometry nodes it's much more natural to do this with a points to volume node. @Sergey do you remember if there was a good reason to have this node work for surfaces? And what do you think about removing this point density texture node entirely for 4.0?
Author
Member

It's using a Point Density Texture node, which seems to work for surfaces as well.

This is a bit of a legacy feature, now that we have geometry nodes it's much more natural to do this with a points to volume node. @Sergey do you remember if there was a good reason to have this node work for surfaces? And what do you think about removing this point density texture node entirely for 4.0?

I have also found a problem that Point Density Texture shader node are is reporting properly needed kernel feature (NODE_VOLUME in this case) - even if it is submit a SVM_TEX_VOXED for execution to SVM compiler. I have already written a fix for this and I am testing it already - I will include it later into this PR.

> It's using a Point Density Texture node, which seems to work for surfaces as well. > > This is a bit of a legacy feature, now that we have geometry nodes it's much more natural to do this with a points to volume node. @Sergey do you remember if there was a good reason to have this node work for surfaces? And what do you think about removing this point density texture node entirely for 4.0? I have also found a problem that Point Density Texture shader node are is reporting properly needed kernel feature (NODE_VOLUME in this case) - even if it is submit a SVM_TEX_VOXED for execution to SVM compiler. I have already written a fix for this and I am testing it already - I will include it later into this PR.

@brecht I think it just happened to work. I don't remember any practical usecase for it to make to work for surfaces.

For the removal of the node: i was considering it. On the one hand I do agree that nowadays there are much more powerful and artists-controllable ways to achieve the same functionality. On another hand it is one of those cases where a functionality is legacy, but did not really need much maintenance. So can't say i have strong opinion, but if you feel storngly then now it is a good time to do such breaking change.

@brecht I think it just happened to work. I don't remember any practical usecase for it to make to work for surfaces. For the removal of the node: i was considering it. On the one hand I do agree that nowadays there are much more powerful and artists-controllable ways to achieve the same functionality. On another hand it is one of those cases where a functionality is legacy, but did not really need much maintenance. So can't say i have strong opinion, but if you feel storngly then now it is a good time to do such breaking change.
Nikita Sirgienko force-pushed oneapi_shade_surface_perf_optimization from 85eef073cc to 88d90a8251 2023-06-26 10:44:40 +02:00 Compare
Author
Member

@Sergey, @brecht, I have added changes (an additional commit) needed to cover a feature reporting issue with Point Density Texture shader node. As a result, my changes don't cause any new fails of tests for oneAPI anymore.

@Sergey, @brecht, I have added changes (an additional commit) needed to cover a feature reporting issue with Point Density Texture shader node. As a result, my changes don't cause any new fails of tests for oneAPI anymore.
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR109245) when ready.

I think we should then remove point density texture support for surfaces, since that was more supported by accident than intentionally. And then we can do this optimization for all devices.

I think we should then remove point density texture support for surfaces, since that was more supported by accident than intentionally. And then we can do this optimization for all devices.

Superseded by #109712.

Superseded by #109712.
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.

Pull request closed

Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#109245
No description provided.