Fix--cdpQuadtree does not work correctly on a large number of points … #391
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Contribution by Gittensor, learn more at https://gittensor.io/