Random Error encountered when doing bottom up bounding box calculation of BVH

Hi guys,

I am following this blog and the paper to implement a fully parallel BVH construction. Here is my code.

However, I countered some weired random error when running that code.

To see this, please switch to branch ray_casting and compile the code. After that, you can run the executable by ./learn_cuda ../test.obj and it will dump two files that record leaf nodes and internal nodes of BVH checkInternals.txt and checkLeafs.txt. After running serveral times, we can make sure that the topology of the tree is fixed (parent indices are always the same) while only the bouding boxes at z dimension sometimes broke. You can see this by using vimdiff or other compare tools on the dumped files. I calculate the the AABBs of the tree in link by bottom up parallel traverse with an atomic flag at each internal node.

Looking forward to get professional suggestions from you guys.

Best