Fix #107704: Release infrequently used memory in Metal buffer pools #108083

Merged
Jeroen Bakker merged 5 commits from Jason-Fielder/blender:MetalMemoryPool_Flushing into blender-v3.6-release 2023-06-01 15:48:36 +02:00
Member

Excessive memory pool bloating could occur for certain workloads in
Metal. Particularly those which continuously allocate increasingly
large buffers with minimal re-use of existing buffers.

New logic added to the memory pool flushes old buffers if they
have not been used for a set period of time. Timing is calibrated
against system resources and overall memory pressure.

Metal memory pressure will run higher than OpenGL, however,
this is an active decision to provide significant performance
improvements for scenarios which allocate lots of memory and
for keeping frames queued in flight without stalling on pending
GPU work.

Authored by Apple: Michael Parkin-White

Excessive memory pool bloating could occur for certain workloads in Metal. Particularly those which continuously allocate increasingly large buffers with minimal re-use of existing buffers. New logic added to the memory pool flushes old buffers if they have not been used for a set period of time. Timing is calibrated against system resources and overall memory pressure. Metal memory pressure will run higher than OpenGL, however, this is an active decision to provide significant performance improvements for scenarios which allocate lots of memory and for keeping frames queued in flight without stalling on pending GPU work. Authored by Apple: Michael Parkin-White
Jason Fielder added 1 commit 2023-05-19 16:13:16 +02:00
5bc8fb4fdc Fix #107704: Release infrequently used memory in Metal buffer pools
Excessive memory pool bloating could occur for certain workloads in
Metal. Particularly those which continuously allocate increasingly
large buffers with minimal re-use of existing buffers.

New logic added to the memory pool flushes old buffers if they
have not been used for a set period of time. Timing is calibrated
against system resources and overall memory pressure.

Metal memory pressure will run higher than OpenGL, however,
this is an active decision to provide significant performance
improvements for scenarios which allocate lots of memory and
for keeping frames queued in flight without stalling on pending
GPU work.

Authored by Apple: Michael Parkin-White
Jason Fielder requested review from Jeroen Bakker 2023-05-19 16:13:27 +02:00
Jason Fielder requested review from Clément Foucault 2023-05-19 16:13:37 +02:00
Jason Fielder added this to the 3.6 LTS milestone 2023-05-19 16:13:42 +02:00
Jason Fielder added 1 commit 2023-05-19 16:14:55 +02:00
Michael Parkin-White added 1 commit 2023-05-22 13:13:24 +02:00
Jeroen Bakker reviewed 2023-05-22 20:36:58 +02:00
@ -278,0 +297,4 @@
* the application is using. */
time_t deletion_time_threshold_s = 600;
/* Spare pool memory >= 2GB. */
if (allocations_in_pool_ >= 2147483648LL) {
Member

Best for readability to add some constants for those large numbers.
MEMORY_SIZE_2GB = ....

Best for readability to add some constants for those large numbers. MEMORY_SIZE_2GB = ....
Jeroen-Bakker marked this conversation as resolved
Jeroen Bakker requested changes 2023-05-22 20:37:18 +02:00
Jeroen Bakker left a comment
Member

Overall looks fine, just some code style.

Overall looks fine, just some code style.
Jason Fielder added 1 commit 2023-05-23 12:48:38 +02:00
Michael Parkin-White added 1 commit 2023-05-30 16:59:36 +02:00
Jeroen Bakker approved these changes 2023-06-01 15:45:26 +02:00
Jeroen Bakker approved these changes 2023-06-01 15:46:44 +02:00
Jeroen Bakker merged commit 3788f70647 into blender-v3.6-release 2023-06-01 15:48:36 +02:00
Jeroen Bakker added the
Interest
Metal
label 2023-06-01 15:48:47 +02:00
Jeroen Bakker added this to the EEVEE & Viewport project 2023-06-01 15:48:50 +02: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
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#108083
No description provided.