Vulkan: Pipeline pool #120899

Merged
Jeroen Bakker merged 12 commits from Jeroen-Bakker/blender:vulkan/pipeline-pool into main 2024-04-23 12:39:57 +02:00
Member

In Vulkan, a Blender shader is organized in multiple
objects. A VkPipeline is the highest level concept and represents
somewhat we call a shader. A pipeline is an device/platform optimized
version of the shader that is uploaded and executed in the GPU device.
A key difference with shaders is that its usage is also compiled
in. When using the same shader with a different blending, a new pipeline
needs to be created.

In the current implementation of the Vulkan backend the pipeline is
re-created when any pipeline parameter changes. This triggers many
pipeline compilations. Especially when common shaders are used in
different parts of the drawing code.

A requirement of our render graph implementation is that changes
of the pipeline can be detected based on the VkPipeline handle.
We only want to rebind the pipeline handle when the handle actually
changes. This improves performance (especially on NVIDIA) devices
where pipeline binds are known to be costly.

The solution of this PR is to add a pipeline pool. This holds all
pipelines and can find an already created pipeline based on pipeline
infos. Only compute pipelines support has been added.

Future enhancements

  • Recent drivers replace VkShaderModule with pipeline libraries.
    It improves sharing pipeline stages and reduce pipeline creation times.
  • GPUMaterials should be removed from the pipeline pool when they are
    destroyed. Details on this will be more clear when EEVEE support is
    added.
In Vulkan, a Blender shader is organized in multiple objects. A VkPipeline is the highest level concept and represents somewhat we call a shader. A pipeline is an device/platform optimized version of the shader that is uploaded and executed in the GPU device. A key difference with shaders is that its usage is also compiled in. When using the same shader with a different blending, a new pipeline needs to be created. In the current implementation of the Vulkan backend the pipeline is re-created when any pipeline parameter changes. This triggers many pipeline compilations. Especially when common shaders are used in different parts of the drawing code. A requirement of our render graph implementation is that changes of the pipeline can be detected based on the VkPipeline handle. We only want to rebind the pipeline handle when the handle actually changes. This improves performance (especially on NVIDIA) devices where pipeline binds are known to be costly. The solution of this PR is to add a pipeline pool. This holds all pipelines and can find an already created pipeline based on pipeline infos. Only compute pipelines support has been added. # Future enhancements - Recent drivers replace `VkShaderModule` with pipeline libraries. It improves sharing pipeline stages and reduce pipeline creation times. - GPUMaterials should be removed from the pipeline pool when they are destroyed. Details on this will be more clear when EEVEE support is added.
Jeroen Bakker added this to the 4.2 LTS milestone 2024-04-21 23:22:45 +02:00
Jeroen Bakker added the
Interest
Vulkan
label 2024-04-21 23:22:45 +02:00
Jeroen Bakker self-assigned this 2024-04-21 23:22:45 +02:00
Jeroen Bakker added 1 commit 2024-04-21 23:22:52 +02:00
1012d21907 Vulkan: Render graph compute
- Extract access flags from shader interface
- Add resource access info when applying bindings
- Late compute pipeline binding (with support for specialization constants)
  using a pipeline pool
- Use render graph for regular dispatch
Jeroen Bakker added this to the EEVEE & Viewport project 2024-04-21 23:22:59 +02:00
Jeroen Bakker added 3 commits 2024-04-22 06:01:17 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
d17151582e
Vulkan: Fix memory leak in render graph
There was a memory leak in the render graph where nodes where freed,
but not the data it could keep.
Jeroen Bakker added 1 commit 2024-04-22 21:06:59 +02:00
Jeroen Bakker added 1 commit 2024-04-23 06:07:52 +02:00
Jeroen Bakker added 1 commit 2024-04-23 08:35:22 +02:00
Jeroen Bakker added 1 commit 2024-04-23 08:40:10 +02:00
Jeroen Bakker added 2 commits 2024-04-23 08:41:46 +02:00
Jeroen Bakker added 1 commit 2024-04-23 08:50:45 +02:00
Jeroen Bakker changed title from Vulkan: Render graph compute to Vulkan: Pipeline pool 2024-04-23 08:56:46 +02:00
Jeroen Bakker added 1 commit 2024-04-23 09:38:55 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
5ac8b28f54
updated description
Author
Member

@blender-bot build

@blender-bot build
Jeroen Bakker merged commit 17c84451b9 into main 2024-04-23 12:39:57 +02:00
Jeroen Bakker referenced this issue from a commit 2024-04-23 12:39:58 +02: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 Assignees
1 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#120899
No description provided.