Skip to content

fix c++20 lerp conflict - #35

Closed
PiterLewis wants to merge 1 commit into
tatsy:masterfrom
PiterLewis:fix/cxx20-lerp-conflict
Closed

PiterLewis wants to merge 1 commit into
tatsy:masterfrom
PiterLewis:fix/cxx20-lerp-conflict

Conversation

@PiterLewis

Copy link
Copy Markdown

Description

Fixes a compilation error with a modern c++20 toolchains caused by the lerp functions defined in 'cxx/herlper_math.h'. The global 'leap' overloads conflict with the std library 'std::lerp' declaration when compiling CUDA extension.

Changes

Renamed the four internal helper overloads. From lerp to -> mc_lerp.

Validation

Tested in Kaggle environment with:

  • Python 3.12
  • PyTorch 2.10.0+cu128
  • CUDA available
  • NVIDIA Tesla T4

Before the change, torchmcubes failed during compilation due to the
lerp/std::lerp conflict.

After the change:

  • torchmcubes builds successfully
  • import torchmcubes succeeds
  • torchmcubes.marching_cubes() executes successfully on CUDA
  • Valid vertices and triangles are produced

@tatsy

tatsy commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Thank you for your PR.
Finally, I found that "helper_math.h" is no longer necessary, as "cuda_runtime.h" provides vector arithmetics.
I have thoroughly removed the dependency on "helper_math.h" and think now it works on your environment.

@tatsy tatsy closed this Oct 19, 2026
@PiterLewis

Copy link
Copy Markdown
Author

Going to check it! Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants