Page MenuHome

Cycles: Add OptiX acceleration structure compaction
ClosedPublic

Authored by Patrick Mours (pmoursnv) on Dec 5 2019, 7:14 PM.

Details

Summary

This adds compaction support for OptiX acceleration structures, which reduces the device memory footprint in a post step after building. Depending on the scene this can reduce the amount of used device memory quite a bit and even improve performance (smaller acceleration structure improves cache usage).
It's only enabled for background renders to make acceleration structure builds fast in viewport.

At the same time I noticed a rather blatant bug in the memory management for OptiX acceleration structures. These were held in a dynamic vector of 'device_memory' instances and used the mem_alloc/mem_free functions. However, those keep track of memory instances in the 'cuda_mem_map' via pointers to 'device_memory' instances (which works fine everywhere else since those are never copied/moved). But in the case of the vector, it may decide to reallocate at some point, which invalidates those pointers and would result in some nasty accesses to invalid memory.
So it turns out it is not actually safe to move a 'device_memory' object, so I removed the move operator overloads again (which where added as part of D5363).

The change to the SVM file is just a revert of an unnecessary modification done as part of D5363.

Diff Detail

Repository
rB Blender
Branch
cycles_optix_compaction (branched from master)
Build Status
Buildable 5921
Build 5921: arc lint + arc unit

Event Timeline

Revert unnecessary change

Patrick Mours (pmoursnv) edited the summary of this revision. (Show Details)Dec 5 2019, 7:18 PM
Brecht Van Lommel (brecht) added inline comments.
intern/cycles/device/device_optix.cpp
272

Nitpick: always use {}.

This revision is now accepted and ready to land.Dec 5 2019, 11:40 PM