Marching Cubes cuda extension

Summary:
Torch CUDA extension for Marching Cubes
- MC involving 3 steps:
  - 1st forward pass to collect vertices and occupied state for each voxel
  - Compute compactVoxelArray to skip non-empty voxels
  - 2nd pass to genereate interpolated vertex positions and faces by marching through the grid
- In contrast to existing MC:
   - Bind each interpolated vertex with a global edge_id to address floating-point precision
   - Added deduplication process to remove redundant vertices and faces

Benchmarks (ms):

| N / V(^3)      | python          | C++             |   CUDA   | Speedup |
| 2 / 20          |    12176873  |       24338     |     4363   | 2790x/5x|
| 1 / 100          |     -             |    3070511     |   27126   |    113x    |
| 2 / 100          |     -             |    5968934     |   53129   |    112x    |
| 1 / 256          |     -             |  61278092     | 430900   |    142x    |
| 2 / 256          |     -             |125687930     | 856941   |    146x   |

Reviewed By: kjchalup

Differential Revision: D39644248

fbshipit-source-id: d679c0c79d67b98b235d12296f383d760a00042a
This commit is contained in:
Jiali Duan
2022-11-15 19:42:04 -08:00
committed by Facebook GitHub Bot
parent 9a0b0c2e74
commit 8b8291830e
8 changed files with 922 additions and 347 deletions

View File

@@ -14,10 +14,11 @@ def bm_marching_cubes() -> None:
case_grid = {
"algo_type": [
"naive",
"cextension",
"extension",
],
"batch_size": [1, 5, 20],
"V": [5, 10, 20],
"batch_size": [1, 2],
"V": [5, 10, 20, 100, 512],
"device": ["cpu", "cuda:0"],
}
test_cases = itertools.product(*case_grid.values())
kwargs_list = [dict(zip(case_grid.keys(), case)) for case in test_cases]