The root of the problem lies in bug in OIIO which we can work around
from our side (which does not affect pack memory usage).
Thanks Brecht for finding the root cause!
Differential D13186
Fix T93008: Cycles: Huge memory spike when saving tile to disk Authored by Sergey Sharybin (sergey) on Nov 11 2021, 12:03 PM. Tags None Subscribers None Tokens
Details The root of the problem lies in bug in OIIO which we can work around Thanks Brecht for finding the root cause! NOTE: Since it is bcon3 I'd like to have independent testing :)
Diff Detail
Event TimelineComment Actions Looks good to me. The perfectionist in me would like to refactor out the for loops so that they are not repeated in the 2 methods. That way you only need to change one thing if there is a issue later on. Comment Actions This makes saving EXR files measurably slower: P2589. From investigating the cause of memory usage, it appears to be ImageOutput::to_native_rectangle in OpenImageIO doing this. The reason it's doing a conversion is because of the overscan around tiles. We can likely avoid the problem by writing the big tile in one go, but copied to a new buffer without the overscan. To save memory, this could potentially also be done in-place in the existing buffer, though I'm not sure if that's safe. The reason it allocates so much memory is a bug in OpenImageIO: Comment Actions Solution which does not syuffer from performance impact. Modifying the render buffer in-place I'd avoid for 3.0 at least. Is not impossible to do so, but it does require modifications in the PathTrace::render_pipeline and it also could be considered an optimization than a bug fix. |