DrawManager: Improved Task Scheduler #75120

Closed
opened 2020-03-27 09:56:54 +01:00 by Jeroen Bakker · 6 comments
Member

The current task scheduler when converting meshes into GPU Batches can be improved.

Current Implementation

Every object is handled in serial. When a mesh object needs to create GPUBatches the generation of these batches are done in parallel.
After all batches for an object has been created the next object is processed.

  • Some extractors are scheduled without threading as they are really fast, but the current implementation schedules these with high priority.

Screenshot from 2020-03-27 13-28-10.png

Target Implementation

A single Task Scheduler is created that handles all objects in parallel.
There are some hurdles to take into account:

  • lines_loose is a sub buffer of lines It can only run after the lines buffer has been created.
  • objects can share meshes. We should not schedule a mesh twice.
  • Some extractors are scheduled without threading as they are really fast. In the target situation they would be scheduled with normal priority.
  • mesh_render_data_create could also be run as a task.
  • Use a different control flow where a task can have related sub-tasks. These subtasks will be calculated after the parent has finished. There are multiple ways how to implement this
    Parent task knows its children and adds them to the task scheduler when the parent task is finished Child task has a parent task id and the scheduler checks if that task is already completed. This has some draw backs as chained tasks will get lower prio.

Benefits

  • The algorithm of some extractors cannot be spliced into chunks and therefor don't schedule optimal. In current implementation they are scheduled with a higher priority to be sure they are completed as first. In the target implementation these tasks will be scheduled better as we schedule all these extractors in a single task scheduler.
  • In scenes with multiple characters the performance would increase as more work can be scheduled in parallel and less syncs are needed.
The current task scheduler when converting meshes into GPU Batches can be improved. ## Current Implementation Every object is handled in serial. When a mesh object needs to create GPUBatches the generation of these batches are done in parallel. After all batches for an object has been created the next object is processed. * Some extractors are scheduled without threading as they are really fast, but the current implementation schedules these with high priority. ![Screenshot from 2020-03-27 13-28-10.png](https://archive.blender.org/developer/F8430362/Screenshot_from_2020-03-27_13-28-10.png) ## Target Implementation A single Task Scheduler is created that handles all objects in parallel. There are some hurdles to take into account: * `lines_loose` is a sub buffer of `lines` It can only run after the lines buffer has been created. * objects can share meshes. We should not schedule a mesh twice. * Some extractors are scheduled without threading as they are really fast. In the target situation they would be scheduled with normal priority. * `mesh_render_data_create` could also be run as a task. * Use a different control flow where a task can have related sub-tasks. These subtasks will be calculated after the parent has finished. There are multiple ways how to implement this **Parent task knows its children and adds them to the task scheduler when the parent task is finished** Child task has a parent task id and the scheduler checks if that task is already completed. This has some draw backs as chained tasks will get lower prio. ### Benefits * The algorithm of some extractors cannot be spliced into chunks and therefor don't schedule optimal. In current implementation they are scheduled with a higher priority to be sure they are completed as first. In the target implementation these tasks will be scheduled better as we schedule all these extractors in a single task scheduler. * In scenes with multiple characters the performance would increase as more work can be scheduled in parallel and less syncs are needed.
Author
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Added subscriber: @sozap

Added subscriber: @sozap

Added subscriber: @ckohl_art

Added subscriber: @ckohl_art
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jeroen Bakker self-assigned this 2020-06-28 08:36:15 +02:00
Author
Member

Main goal of the task is done. There are some improvements to increase performance, but that should be done during regular optimizations.

Main goal of the task is done. There are some improvements to increase performance, but that should be done during regular optimizations.
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 project
No Assignees
3 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#75120
No description provided.