Vulkan: Resource Submission Tracking #105183

Merged
Jeroen Bakker merged 84 commits from Jeroen-Bakker/blender:vulkan-submission-resource-tracking into main 2023-03-24 07:48:04 +01:00
Member

In Vulkan multiple commands can be in flight simultaneously.

These commands can share resources like descriptor sets or push
constants. When between commands these resources are updated
a new version of the resources should be created.

When a resource is updated it should check the submission id of the
command buffer. If this is different than last known by the resources,
the previous resources should be freed.
If the submission id is the same than previously it has to create a
new version of the resource to not intervene with other commands that
uses the resource before the update.
When the resource wasn't updated between multiple usages in the same
submission id it could reuse the previous resource.

This PR introduces a ResourceTracker and a SubmissionTracker.
A submission tracker can check if the command buffer is submitted.
In this case all resources of the resource tracker should be freed.
Unmodified resources in the same submission can be shared.

A resource tracker will keep track of all resources that are in
flight. After the resources are used (submission + execution) have
finished the resources can be cleared.

Related issue #104771

In Vulkan multiple commands can be in flight simultaneously. These commands can share resources like descriptor sets or push constants. When between commands these resources are updated a new version of the resources should be created. When a resource is updated it should check the submission id of the command buffer. If this is different than last known by the resources, the previous resources should be freed. If the submission id is the same than previously it has to create a new version of the resource to not intervene with other commands that uses the resource before the update. When the resource wasn't updated between multiple usages in the same submission id it could reuse the previous resource. This PR introduces a `ResourceTracker` and a `SubmissionTracker`. A submission tracker can check if the command buffer is submitted. In this case all resources of the resource tracker should be freed. Unmodified resources in the same submission can be shared. A resource tracker will keep track of all resources that are in flight. After the resources are used (submission + execution) have finished the resources can be cleared. Related issue #104771
Jeroen Bakker added this to the 3.6 LTS milestone 2023-02-24 16:23:09 +01:00
Jeroen Bakker self-assigned this 2023-02-24 16:23:09 +01:00
Jeroen Bakker added a new dependency 2023-02-24 16:24:44 +01:00
Jeroen Bakker removed a dependency 2023-02-24 16:24:49 +01:00
Jeroen Bakker added a new dependency 2023-02-24 16:26:06 +01:00
Jeroen Bakker removed a dependency 2023-02-24 16:26:11 +01:00
Jeroen Bakker added this to the EEVEE & Viewport project 2023-02-24 16:27:56 +01:00
Jeroen Bakker changed title from Vulkan: Resource Submission Tracking to WIP: Vulkan: Resource Submission Tracking 2023-02-24 16:32:08 +01:00
Jeroen Bakker requested review from Clément Foucault 2023-02-24 16:32:22 +01:00
Jeroen Bakker requested review from Bastien Montagne 2023-02-24 16:32:34 +01:00
Jeroen Bakker added a new dependency 2023-02-25 08:56:13 +01:00
Jeroen Bakker removed a dependency 2023-02-25 08:56:24 +01:00
Jeroen Bakker added 5 commits 2023-02-27 13:16:58 +01:00
Jeroen Bakker added 3 commits 2023-02-27 15:30:41 +01:00
Jeroen Bakker added 1 commit 2023-02-27 16:15:30 +01:00
Jeroen Bakker added the
Interest
Vulkan
label 2023-02-27 20:51:15 +01:00
Jeroen Bakker changed title from WIP: Vulkan: Resource Submission Tracking to Vulkan: Resource Submission Tracking 2023-02-27 20:52:09 +01:00
Jeroen Bakker added 1 commit 2023-03-06 12:44:54 +01:00
Jeroen Bakker added 1 commit 2023-03-08 11:13:06 +01:00
Jeroen Bakker added 1 commit 2023-03-09 15:15:09 +01:00
Clément Foucault requested changes 2023-03-20 09:49:17 +01:00
Clément Foucault left a comment
Member

I am not sure I am understanding the whole concept. It might be easier to do an in-person explanation so I can give a better appreciation.

So for the time being I'll only review the code quality. Only a small comment about naming but looks fine otherwise.

I am not sure I am understanding the whole concept. It might be easier to do an in-person explanation so I can give a better appreciation. So for the time being I'll only review the code quality. Only a small comment about naming but looks fine otherwise.
@ -119,2 +124,3 @@
{
GPU_compute_dispatch(shader, 1, 1, 1);
/* Dispatching 1000000 times to add some stress to the GPU. Without it tests may succeed when
* using to simple shaders. */

Typo: to > too

Typo: `to` > `too`
Jeroen-Bakker marked this conversation as resolved
@ -0,0 +24,4 @@
* a new version of these resources should be created.
*
* When a resource is updated it should check the submission id of the
* command buffer. If this is different than resources can be reused.

"If this is different than resources can be reused." > "If it is different, then the resource can be reused."

"If this is different than resources can be reused." > "If it is different, then the resource can be reused."
Jeroen-Bakker marked this conversation as resolved
@ -0,0 +32,4 @@
* SubmissionID is the identifier to keep track if a new submission is
* being recorded.
*/
struct SubmissionID {

So it is a vulkan specific struct but does not have a VK prefix? Either add the prefix or move to gpu/intern.

Same thing for ResourceTracker

So it is a vulkan specific struct but does not have a `VK` prefix? Either add the prefix or move to `gpu/intern`. Same thing for `ResourceTracker`
Jeroen-Bakker marked this conversation as resolved
Jeroen Bakker added 2 commits 2023-03-21 08:41:50 +01:00
Jeroen Bakker added 3 commits 2023-03-21 08:51:47 +01:00
Clément Foucault approved these changes 2023-03-21 10:33:22 +01:00
Jeroen Bakker merged commit d5df77199b into main 2023-03-24 07:48:03 +01:00
Jeroen Bakker deleted branch vulkan-submission-resource-tracking 2023-03-24 07:48:04 +01:00
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
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#105183
No description provided.