Geometry Nodes: Blur node speed up #109764

Merged
Hans Goudey merged 4 commits from mod_moder/blender:tmp_cleanup_blur_tp_map into main 2023-07-10 13:47:36 +02:00

Slight speed up of face topology building for blur node.
Avoid using increment with replacing by adding size.
Multithreading for accumulating offsets. Early returns
for some places. This make 4x faster loop for fully splitted
faces. Final result for face topology building is
16.9 ms -> 14.3 ms for 263 * 263 * 263 cube primitive.

Slight speed up of face topology building for blur node. Avoid using increment with replacing by adding size. Multithreading for accumulating offsets. Early returns for some places. This make 4x faster loop for fully splitted faces. Final result for face topology building is 16.9 ms -> 14.3 ms for 263 * 263 * 263 cube primitive.
Iliya Katushenock added the
Interest
Geometry Nodes
label 2023-07-06 00:45:56 +02:00
Iliya Katushenock added 1 commit 2023-07-06 00:46:08 +02:00
Iliya Katushenock requested review from Hans Goudey 2023-07-06 00:49:29 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-07-06 00:49:32 +02:00
Hans Goudey reviewed 2023-07-06 14:22:03 +02:00
Hans Goudey left a comment
Member

Nice! The whole node was 1.4x faster in my test.

BEFORE
Timer 'build_face_to_face_by_edge_map': (Average: 39.9 ms, Min: 38.1 ms, Last: 42.3 ms)
Timer 'get_varray_for_context': (Average: 45.1 ms, Min: 27.2 ms, Last: 48.4 ms)

AFTER
Timer 'build_face_to_face_by_edge_map': (Average: 27.0 ms, Min: 26.4 ms, Last: 27.2 ms)
Timer 'get_varray_for_context': (Average: 32.7 ms, Min: 30.6 ms, Last: 33.1 ms)
Nice! The whole node was 1.4x faster in my test. ``` BEFORE Timer 'build_face_to_face_by_edge_map': (Average: 39.9 ms, Min: 38.1 ms, Last: 42.3 ms) Timer 'get_varray_for_context': (Average: 45.1 ms, Min: 27.2 ms, Last: 48.4 ms) AFTER Timer 'build_face_to_face_by_edge_map': (Average: 27.0 ms, Min: 26.4 ms, Last: 27.2 ms) Timer 'get_varray_for_context': (Average: 32.7 ms, Min: 30.6 ms, Last: 33.1 ms) ```
@ -198,3 +198,3 @@
Array<int> &r_indices)
{
Array<int> edge_to_poly_offsets;
Array<int> edge_to_poly_offsets_data;
Member

offsets_data -> offset_data

`offsets_data` -> `offset_data`
mod_moder marked this conversation as resolved
@ -212,0 +207,4 @@
threading::parallel_for(polys.index_range(), 4096, [&](const IndexRange range) {
for (const int poly_i : range) {
for (const int edge : corner_edges.slice(polys[poly_i])) {
/* Subtract polygon itself from list of all polygons connected to edge. */
Member

/* Subtract polygon itself from the number of polygons connected to the edge. */

` /* Subtract polygon itself from the number of polygons connected to the edge. */`
mod_moder marked this conversation as resolved
@ -216,1 +214,4 @@
});
const OffsetIndices<int> offsets = offset_indices::accumulate_counts_to_offsets(r_offsets);
r_indices.reinitialize(offsets.total_size());
if (offsets.is_empty()) {
Member

I'm not sure about adding these early returns. I'm not sure it would help performance for the expected case (which isn't where many faces have no neighbors)

I'm not sure about adding these early returns. I'm not sure it would help performance for the expected case (which isn't where many faces have no neighbors)
Author
Member

Yes, it would be strange to have such an option .. But on the other hand, maybe?

Yes, it would be strange to have such an option .. But on the other hand, maybe?
Member

It's fine to optimize the node for the expected case. Without some measurements demonstrating these returns improve performance, I'd rather leave them to a separate commit I guess

It's fine to optimize the node for the expected case. Without some measurements demonstrating these returns improve performance, I'd rather leave them to a separate commit I guess
mod_moder marked this conversation as resolved
Iliya Katushenock added 2 commits 2023-07-06 18:52:08 +02:00
progress
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
7a191f4749
Member

@blender-bot build

@blender-bot build
Iliya Katushenock added 1 commit 2023-07-06 19:16:34 +02:00
Hans Goudey approved these changes 2023-07-10 13:45:06 +02:00
Hans Goudey merged commit c78b6e9954 into main 2023-07-10 13:47:36 +02:00
Iliya Katushenock deleted branch tmp_cleanup_blur_tp_map 2023-07-10 13:53:51 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 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#109764
No description provided.