Fix--cdpQuadtree does not work correctly on a large number of points …
Previously, children and child_offset were derived using global IDs which caused the base pointer to overshoot by multiples of 12 times the parent index at deeper levels, leading to out-of-bounds writes when setting child node metadata and ranges. The new logic makes children the base of the next-level slice for the current 4-node group and uses the local child index (node.id() & 3) to select the correct 4-node sub-slice. This keeps all accesses within the proper subtree memory.
What I changed In build_quadtree_kernel, the computation of the children base pointer and child offset was fixed to be relative to the current 4-node group rather than relying on the global node ID. This prevents writes into the wrong part of the nodes array at deeper recursion depths.
To validate locally
- Rebuild the cdpQuadtree sample (the repo is CMake-based) and run with your usual settings. Optionally, bump num_points in cdpQuadtree.cu if you want to test 100K directly, or drive it via your existing test harness. Running with compute-sanitizer should no longer report illegal accesses, and check_quadtree should pass for large point counts.
- Analyzed OOB cause and implemented the fix in cdpQuadtree.cu.
- Skipped building here because cmake isn’t installed in this environment.
Contribution by Gittensor, learn more at https://gittensor.io/