Maniphest T98203

Potential Memory leak in BVH process with Hair
Closed, Duplicate

Assigned To
None
Authored By
Walt Talley (walt.talley)
May 17 2022, 7:46 PM
Tags
  • BF Blender
Subscribers
Philipp Oeser (lichtwerk)
Richard Antalik (ISS)
Walt Talley (walt.talley)

Description

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.15
128G of RAM (4x32G)

Blender Version
Broken: version: 3.1.2, branch: master, commit date: 2022-03-31 17:40, hash: rBcc66d1020c3b
Worked: (newest version of Blender that worked as expected); I can only guess it worked with less massive memory consumption in 2.92.

Short description of error
Seems to use an inordinate amount of RAM Memory (north of 100G) doing the BVH calculations and then rendering. And seems tied to the Hair / amount of Hair.

Exact steps for others to reproduce the error
Used the stock file for the Sinosauropteryx splash screen (from Blender 2.92) found at: https://storage.googleapis.com/5649de716dcaf85da2faee95/_%2F21271ff246be4e34975fc4932b491c62.blend?GoogleAccessId=956532172770-27ie9eb8e4u326l89p7b113gcb04cdgd%40developer.gserviceaccount.com&Expires=1652847012&Signature=rSCfJDZmnCvNNXDN4e455yYfYL5qXVEX%2F2Xu%2BvDh2epJEkW3deYJtb8i80B26NhVdbR0jAjEt5q2lfRqS5amDWm9fmpX45pywfTuJ%2FT12j6ecmShfpFqfJnGajNuXvXkdn9KpMnjdz29pTg2DS920rXbAC2%2Fh2ja7ZB5VbIBSQXW%2Fa7fpUyu19nBEDuGB4nFauS%2FJ2Osl0GCKBdGLrLJklSNZKNkQCfH3Njn46lPjrqQGbQa3stXRNXm15lrHZj7p%2FdXgB9LVmtPv8g4LvwK4vXZz1VUh3YNr4SU1dkAUUSc7cVKjm5EmaUmm2f0aghhxK4O2Pa7olSWIAoP2fQXpA%3D%3D

Render type: Cycles, Supported, GPU Compute

Ran single image render (F12). Drove huge memory consumption. Peaked at more than 100G.
Using Task Manager->Performance Tab:
It ticked up to ~60G calculating BVH
Then up to 100G when rendering (see PPT attached)

Removed the Cache. Still large memory consumption.

Reduced the Children on the ParticleSettings.001 (Hair with Edits) for object "Body.001" for the render from 450 to 200 and that reduced the memory consumption (but still seem awfully high).

Turned off the Scene->Performance->Use Hair BVH. That seemed to reduce the number of passes at BVH before packing but still used a lot of memory.

Tried unpacking all the textures - seems to have had no effect.

The report line from the renders did NOT accurately reflect actual peak memory used.

Also of note, renders pretty well and quickly in the viewport using cycles had to enable viewport on hair particle systems. But rendered to viewport pretty well after calculating

Event Timeline

Walt Talley (walt.talley) created this task.May 17 2022, 7:46 PM
Walt Talley (walt.talley) added a comment.May 17 2022, 8:25 PM

Here is the ppt in PDF form - just in case.

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Information from User.May 18 2022, 3:50 PM
Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).

I can only guess it worked with less massive memory consumption in 2.92.

Could you actually check this?
You can get 2.92 (or any previous version) here https://download.blender.org/release/

Walt Talley (walt.talley) added a comment.May 18 2022, 6:28 PM

I’m not in a position currently to download, install and test it on this previous version. I thought maybe you developers could. I might try sometime over the weekend or next week. But I cannot commit that I will do that testing.

Walt Talley (walt.talley) added a comment.May 18 2022, 6:57 PM

Actually, was easier than I thought definitely cleaner on 2.92.
Installed 2.92.
Loaded same blend file.
Set Tile size to 512x512.
Rendered (F12)
Captured mem before during and after.
See attached PDF.

Philipp Oeser (lichtwerk) changed the task status from Needs Information from User to Needs Triage.May 18 2022, 7:02 PM
Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.May 25 2022, 2:10 AM
Richard Antalik (ISS) added a subscriber: Richard Antalik (ISS).

Can you check if you have rendered with same device settings - CUDA / Optix? There is significant difference in memory consumption, but I think this was discussed here on tracker and it was considered normal. I think this was discussed in context of this particular .blend file, but not sure if I can find report.

Walt Talley (walt.talley) added a comment.May 25 2022, 11:18 PM

Yes I used the same device settings. CUDA / Optix in both attempts (3.12 and 2.92). Ad I will repeat as I did in my previous message(s) that a lot of the accumulation of memory seems to be during BVH calculations - prior to actually rendering when I think Optix / CUDA are active.

Richard Antalik (ISS) changed the task status from Needs Information from User to Needs Triage.May 26 2022, 11:26 PM

In that case I can't reproduce this issue on:
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 511.65

I would assume that optix or cuda may require different setup, because with CUDA much more (more than I have available) memory was allocated when I checked this. With Optix I was able to render scene with decent margin as far as memory usage goes.

Can you perhaps check on Windows to see if this could be linked to OS?

Walt Talley (walt.talley) added a comment.May 27 2022, 9:55 PM

I'm not in a position to diagnose down to the OS.

I can tell you (just tested) no difference regardless of denoise choices. Tried all these combinations and very similar results.

I will say it one more time - because I don't think you are hearing me - the memory leak, or mass use, seems to be during the BVH build and packing phase which I think is pre-denoiser or CUDA or actual rendering. It is the calculations done pre-render that spike so much. The actual rendering runs flat. See captures in attached PDF.

Walt Talley (walt.talley) added a comment.May 27 2022, 11:44 PM

I stand corrected. I did not realize I had to choose the Optix tab on the preferences screen. I had the check box set for my RTX 3090 in Optix AND I had the check box for the RTX in CUDA. I mistakenly thought that meant Optix for noise reduction and CUDA where needed.

Once I chose the Optix Tab, and then left the preferences, it rendered with no mass consumption of memory (and the BVH calc's ran quickly.

So, it seems it may be a CUDA thing.

Walt Talley (walt.talley) added a comment.May 28 2022, 12:41 AM

And confirmation. I get these memory use spikes with CUDA on and Optix off. But not with Optix on and CUDA off.

Same spikes as per my previous info and the info in the PDFs I sent.

Still suggest this may be a leak in the code specific to CUDA processing.

Richard Antalik (ISS) added a comment.May 29 2022, 1:48 AM

Thanks for info, can confirm issue with CUDA, so will merge to original report