Page MenuHome

Cycles: Metal integrator state size tuning
ClosedPublic

Authored by Michael Jones (michael_jones) on Oct 21 2022, 5:00 PM.

Details

Summary

This patch tunes the integrator state sizing for Metal (num_concurrent_states and num_concurrent_busy_states).

On all GPUs architecture, we adjust the busy:total states ratio to be 1:4 which gives better rendering performance than the previous 1:16 ratio (independent of total state count). This gives a small performance uplift (e.g. 2-3% on M1 Ultra).

Additionally for M2 architectures, we double the overall state size if there is available headroom. Inclusive of the first change, we can expect uplift of close to 10% in future, as this results in larger dispatch sizes and minimises work submission overheads. In order to make an accurate determination of available headroom, we defer the calculation of num_concurrent_states and num_concurrent_busy_states until the time of integrator state allocation (i.e. after all of the scene data has been allocated). We also refactor alloc_integrator_soa to calculate an *exact* single-state-size in a first pass, right before allocating the integrator SoA buffers in a second pass.

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 24389
Build 24389: arc lint + arc unit

Event Timeline

Michael Jones (michael_jones) requested review of this revision.Oct 21 2022, 5:00 PM
Michael Jones (michael_jones) created this revision.
Brecht Van Lommel (brecht) requested changes to this revision.Oct 21 2022, 6:43 PM

Seems generally fine.

intern/cycles/integrator/path_trace_work_gpu.cpp
129

This code only runs if integrator_state_gpu_.parent_struct.name == nullptr, so on the second updates it's not going to count everything.

I think it would be more clear to keep this as two separate loops like before, just adding the kernel_features & (feature) test to estimate_single_state_size.

This revision now requires changes to proceed.Oct 21 2022, 6:43 PM
  • Restore estimate_single_state_size, but with kernel_features parameter
  • make format
Michael Jones (michael_jones) marked an inline comment as done.Oct 24 2022, 11:25 AM

I have updated estimate_single_state_size as suggested. Thanks @Brecht Van Lommel (brecht)

This revision is now accepted and ready to land.Oct 24 2022, 1:59 PM