WIP:Work sets for better work distrubtion with a Multi-GPU setup #108147
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108147
Loading…
Reference in New Issue
No description provided.
Delete Branch "leesonw/blender-cluster:work_sets"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
To improve the distribution of work between GPUs by giving them a set of work that should take roughly the same amount of time
What
This patch adds an option to the cycles performance category called "device scale factor" that determines how many vertical splits occur in a render tile or image if tiling is not used. This results in the tiles or images being broken into
n
parts each of which is given to a different device. The image tile are split by giving every1/s*w_{device}
scan lines in the tile to a each GPU. Where s is the "device scale factor" an integer value andw_{device}
the proportion of work to assign to the device.. This way they all render a similar image which results in each work set taking a similar amount of time. So for instance at the beginning for 2 GPU the weight would be equal at 0.5 each. Thus for a 256x256 tile each would get 128 scan lines.Added some performance profiles here. I also exported some of the graphs below note I need to redo "attic gpu map" as it was done with NVTX markers which slowed it down.
I think this is not implemented at the right level (but maybe that is planned as a further step already?). In this PR a device seems to fully complete rendering a slice before moving on to the next slice. But then as you increase the number of slice there is more overhead from synchronizing each time. And probably worse, GPU occupancy and coherence will drop as there is less work to keep all cores busy, especially near the end when fewer and fewer paths remain.
For example imagine a shot with a character where it's hair is the most expensive to render, but takes up only a small part of the entire image. Getting the slices small enough to distribute that works as more GPUs are added is going to require a high device scale factor, probably with too much overhead? So you'd want to be able to make that really granular, maybe even just one scanline per device.
It should be rendering pixels from all slices simultaneously, all in the same path state array. I would expect
kernel/device/gpu/work_stealing.h
to have the logic to map a global work index to a slice and coordinate in the slice.I think every device should have just one render buffer to work with that, not multiple. The
device_memory.slice
mechanism I'm not sure will work well for this, if you do path tracing for multiple slices at once, you would pass it just a single render buffer device pointer and this abstraction can't really be used to hide that.@ -973,6 +973,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=8, max=8192,
)
device_scale_factor: IntProperty(
This may be ok for debugging, but I don't think the final implementation should require tuning a parameter like this.
@ -435,6 +435,17 @@ void Device::free_memory()
metal_devices.free_memory();
}
bool Device::alloc_host(void *&shared_pointer, size_t size, bool /* pinned */) {
Please use clang-format.
@ -45,2 +46,3 @@
void *ptr = util_aligned_malloc(size, MIN_ALIGNMENT_CPU_DATA_TYPES);
void *ptr = NULL;
if(!pinned_mem) {
I'm confused by what non-pinned memory means now, since here it's just a regular memory allocation, but in the CUDA device it allocates with the CUDA API.
@ -630,3 +620,1 @@
if (knode->type == LIGHT_TREE_INSTANCE) {
/* Switch to the node with the subtree. */
*node_index = knode->instance.reference;
if (selected_index != -1) {
Unrelated change, leave out.
Yes, I totally agree. I am working on a change that will just use one render buffer and render all the slices into it. That way like you say then you don't need to restart the path tracing for each slice. I was doing this another way but now that you point it out it's probably better to use
kernel/device/gpu/work_stealing.h
to do the mapping instead of the slices andwork_sets
. I have noticed that many of the wins from this are a result of therebalance
happening less often and are quicker as the slices are smaller so the copying to and from the GPUs is way less expensive. This is particularly important with setups that have many GPUs (10 in our case where it really made a difference)Checkout
From your project repository, check out a new branch and test the changes.