So I'm in the midst of implementing an SAH based BVH (the one implemented in PBRT) for my pathtracer. The whole path tracer is written inside an OpenCL kernel. Now I need to build the BVH on the CPU and pass it to the GPU.
The main problem is the SAH based BVH doesnt have a strict limit to the number primitives that can come inside a node. It all depends on the cost. If the cost to consider the current node as leaf node is less than splitting it, we won't split it even if the number of primitives in that node exceed a hard constraint. This means dynamic sized arrays to hold child info which doesn't transition well over to the GPU afaik.