Compositor: Implement per-node execution time report #117885

Merged
Sergey Sharybin merged 7 commits from Sergey/blender:compositor_timings into main 2024-02-09 10:19:34 +01:00

Visually it is the same as the execution time implemented for the
geometry nodes, and it is to be enabled in the overlay popover.

The implementation is separate from the geometry nodes, as it is
not easy or practical to re-use the geometry nodes implementation.

The execution time is stored in a run-time hash, indexed by a node
instance key. This is similar to the storage of the mode preview
images, but is stored on the scene runtime data and not on the node
tree. Indexing the storage by key allows to easily copy execution
statistics from localized tree to its original version.

The time is only implemented for full-frame compositor, as for the
tiled compositor it could be tricky to calculate reliable time for
pixel processing nodes which process one pixel at a time.

Visually it is the same as the execution time implemented for the geometry nodes, and it is to be enabled in the overlay popover. The implementation is separate from the geometry nodes, as it is not easy or practical to re-use the geometry nodes implementation. The execution time is stored in a run-time hash, indexed by a node instance key. This is similar to the storage of the mode preview images, but is stored on the scene runtime data and not on the node tree. Indexing the storage by key allows to easily copy execution statistics from localized tree to its original version. The time is only implemented for full-frame compositor, as for the tiled compositor it could be tricky to calculate reliable time for pixel processing nodes which process one pixel at a time.
Sergey Sharybin added the
Interest
Compositing
Module
VFX & Video
labels 2024-02-06 10:23:15 +01:00
Sergey Sharybin added 1 commit 2024-02-06 10:23:23 +01:00
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
44d5f7bf22
Compositor: Implement per-node execution time report
Visually it is the same as the execution time implemented for the
geometry nodes, and it is to be enabled in the overlay popover.

The implementation is separate from the geometry nodes, as it is
not easy or practical to re-use the geometry nodes implementation.

The execution time is stored in a run-time hash, indexed by a node
instance key. This is similar to the storage of the mode preview
images.

The time is only implemented for full-frame compositor, as for the
tiled compositor it could be tricky to calculate reliable time for
pixel processing nodes which process one pixel at a time.
Sergey Sharybin added this to the Compositing project 2024-02-06 10:23:32 +01:00
Sergey Sharybin requested review from Hans Goudey 2024-02-06 10:24:58 +01:00
Sergey Sharybin requested review from Omar Emara 2024-02-06 10:25:04 +01:00
Author
Owner

@blender-bot build

@blender-bot build
Author
Owner

An example of how it looks like on the interface: Screenshot 2024-02-06 at 11.30.27.png

An example of how it looks like on the interface: ![Screenshot 2024-02-06 at 11.30.27.png](/attachments/e6449a8f-6891-40f2-8cbb-4fe90eacbcf3)
Sergey Sharybin added 1 commit 2024-02-07 15:44:36 +01:00
Evan Wilson reviewed 2024-02-07 17:34:14 +01:00
Evan Wilson left a comment
Member

Just a few grammar/spelling things I noticed in the comments. :)

Just a few grammar/spelling things I noticed in the comments. :)
@ -0,0 +17,4 @@
class Profiler {
/* Per-node accumulated execution time. Includes execution time of all operations the node was
* break down into. */
Member

break->broken

break->broken
@ -2459,12 +2463,89 @@ static std::optional<std::chrono::nanoseconds> node_get_execution_time(
return std::nullopt;
}
/* Cerate node key instance, assuming the node comes from the currently editing node tree. */
Member

Cerate->Create

Cerate->Create
@ -2626,2 +2740,3 @@
if (!(snode.edittree->type == NTREE_GEOMETRY)) {
/* Currently geometry nodes are the only nodes to have extra infos per nodes. */
/* Currently geometry and compositor nodes are the only nodes to have extra infos per nodes. */
Member

infos->info

infos->info
Sergey Sharybin added 1 commit 2024-02-07 17:37:04 +01:00
Member

I am hitting the assert in the default node tree:

BLI_assert failed: source/blender/editors/space_node/node_draw.cc:2470, current_node_instance_key(), at 'snode.edittree == snode.treepath.last'
I am hitting the assert in the default node tree: ``` BLI_assert failed: source/blender/editors/space_node/node_draw.cc:2470, current_node_instance_key(), at 'snode.edittree == snode.treepath.last' ```
Omar Emara reviewed 2024-02-07 17:55:44 +01:00
@ -321,2 +321,4 @@
BKE_callback_exec_id(bmain, &scene->id, BKE_CB_EVT_COMPOSITE_CANCEL);
cj->cancelled = true;
cj->ntree->runtime->compositor.per_node_execution_time =
Member

When adjusting parameters in the node tree and it gets repeatedly canceled, this will display <1ms. So perhaps we shouldn't update the timings for canceled executions?

When adjusting parameters in the node tree and it gets repeatedly canceled, this will display `<1ms`. So perhaps we shouldn't update the timings for canceled executions?
Author
Owner

That is a good question. I can see this could be useful when quickly tweaking something. But in a case when execution takes a long time, and you stopped it (Esc, or via the status bar) it might be interesting and useful to see which nodes took the longes so far.

That is a good question. I can see this could be useful when quickly tweaking something. But in a case when execution takes a long time, and you stopped it (Esc, or via the status bar) it might be interesting and useful to see which nodes took the longes so far.
Member

Aha, that will be useful indeed, then it is fine.

Aha, that will be useful indeed, then it is fine.
OmarEmaraDev marked this conversation as resolved
Sergey Sharybin added 1 commit 2024-02-07 17:58:02 +01:00
Omar Emara approved these changes 2024-02-07 18:39:41 +01:00
Sergey Sharybin added 2 commits 2024-02-08 15:13:52 +01:00
Hans Goudey approved these changes 2024-02-08 16:18:46 +01:00
Hans Goudey left a comment
Member

Looks good, thanks. Just a few inline comments, nothing that needs another round of review.

Looks good, thanks. Just a few inline comments, nothing that needs another round of review.
@ -0,0 +26,4 @@
/* Profiler implementation which is used by the node execution system. */
class Profiler {
/* Local copy of the profiling data, which is known to not cause threading conflicts with the
* interface thread while the compositing tree is evaluated in background. */
Member

in background -> in the background

`in background` -> `in the background`
@ -0,0 +39,4 @@
void Profiler::finalize(const bNodeTree &node_tree)
{
accumulate_node_group_times(node_tree);
Member

this->accumulate_node_group_times

`this->accumulate_node_group_times`
@ -0,0 +51,4 @@
const bNodeInstanceKey key = BKE_node_instance_key(parent_key, &node_tree, node);
if (node->type != NODE_GROUP) {
/* Non-group node, no need to recurs into. Simply accumulate the node's execution time to the
Member

recurs -> recurse

`recurs` -> `recurse`
@ -2459,12 +2467,87 @@ static std::optional<std::chrono::nanoseconds> node_get_execution_time(
return std::nullopt;
}
/* Create node key instance, assuming the node comes from the currently editing node tree. */
Member

editing -> edited

`editing` -> `edited`
Sergey Sharybin added 1 commit 2024-02-08 17:11:08 +01:00
Sergey Sharybin merged commit 467a132166 into main 2024-02-09 10:19:34 +01:00
Sergey Sharybin deleted branch compositor_timings 2024-02-09 10:19:36 +01:00
Sign in to join this conversation.
No reviewers
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 project
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#117885
No description provided.