Page MenuHome

Cycles: fully decouple triangle and curve primitive storage from BVH2
ClosedPublic

Authored by Brecht Van Lommel (brecht) on Oct 6 2021, 3:53 PM.

Details

Summary

Previously the storage here was optimized to avoid indirections in BVH2
traversal. This helps improve performance a bit, but makes performance
and memory usage of Embree and OptiX BVHs a bit worse also. It also adds
code complexity in other parts of the code.

Now decouple triangle and curve primitive storage from BVH2.

  • Reduced peak memory usage on all devices
  • Bit better performance for OptiX and Embree
  • Bit worse performance for CUDA
  • Simplified code:
    • Intersection.prim/object now patches ShaderData.prim/object
    • No more offset manipulation for mesh displacement before a BVH is built
    • Remove primitive packing code and flags for Embree and OptiX
    • Curve segments are now stored in a KernelCurve struct

Diff Detail

Repository
rB Blender
Branch
prim-refactor (branched from master)
Build Status
Buildable 17597
Build 17597: arc lint + arc unit

Event Timeline

Brecht Van Lommel (brecht) requested review of this revision.Oct 6 2021, 3:53 PM
Brecht Van Lommel (brecht) created this revision.

It's not great to make CUDA slower, but in a way this is the legacy code path and Embree and OptiX are what most users use, so it seems like a good trade-off to me.

Some graphs:

I've got similar relative comparison of CUDA/OptiX on RTX6000.
Think is better to aim to a hardware-supported ray intersection and optimize our code for that world.

From reading the code and testing it didn't see anything wrong.

This revision is now accepted and ready to land.Oct 6 2021, 5:09 PM