Skip to content

Potential issue with libmorton BMI2 path in Release builds (Total amount of voxels: 0) #70

@zhaoruifeng1211

Description

@zhaoruifeng1211

First of all, thank you very much for open-sourcing your excellent work and for the effort you put into maintaining the code and helping users. I really appreciate being able to study and use your implementation.

On my local machine I encountered a behavior difference between Debug and Release builds:

  • In Debug mode, everything works as expected.

  • In Release mode, the voxel count is always 0 for any dataset I try to Build.

After some debugging, it seems related to the compiler’s AVX2/BMI2 optimizations in Release:

  • When AVX2/BMI2 optimizations are enabled, libmorton appears to take the BMI2 decode path.

  • In that path, the Morton decode for the partitioned grid seems to always return (0, 0, 0).

  • As a result, the entire voxel grid collapses into a single cell, and all subsequent logic sees no valid voxels.

At the moment I unfortunately don’t have enough time to properly track down and fix this in a clean, portable way. The purpose of this issue is therefore mainly to:

  1. Leave a note for future users who might see “voxel count = 0 in Release” and need a hint where to start debugging.

  2. Provide some debugging guidance (check the libmorton BMI2 decode path and consider disabling AVX2/BMI2 for that part).

This issue is not a request for you to fix the bug; it is mostly a report and a reference for others who may run into the same problem.

Again, thank you very much for your research and for making the code available to the community.

My environment details are attached for reference.

Environment:

  • OS: Ubuntu 22.04.5 LTS on WSL2 (Linux kernel 6.6.87.2-microsoft-standard-WSL2)
  • Compiler: gcc/g++ 11.4.0, clang 14.0.0
  • CMake: 3.22.1
  • Build system: Make 4.3
  • GPU: NVIDIA GeForce RTX 3050 Laptop GPU
  • CUDA: 12.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions