Skip to content

Commit

Permalink
Docs for cuda bindings and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maturk committed Oct 3, 2023
1 parent 75d79de commit 2415b3e
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 0 deletions.
181 changes: 181 additions & 0 deletions docs/source/_C/cuda.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
Cuda Lib
===================================

.. currentmodule:: diff_rast


Some of the important CUDA backend functions are exposed to python with the `cuda` submodule. You can import the CUDA bindings with:

.. code-block:: python
import diff_rast.cuda as _C
help(_C)
The following functions are currently supported:

* _C.rasterize_forward
* _C.rasterize_backward
* _C.compute_cov2d_bounds_forward
* _C.project_gaussians_forward
* _C.project_gaussians_backward
* _C.compute_sh_forward
* _C.compute_sh_backward
* _C.compute_cumulative_intersects
* _C.map_gaussian_to_intersects


rasterize_forward
-------

.. code-block:: python
_C.rasterize_forward(*args, **kwargs)
PARAMETERS:
xys: Float[Tensor, "*batch 2"],
depths: Float[Tensor, "*batch 1"],
radii: Float[Tensor, "*batch 1"],
conics: Float[Tensor, "*batch 3"],
num_tiles_hit: Int[Tensor, "*batch 1"],
colors: Float[Tensor, "*batch channels"],
opacity: Float[Tensor, "*batch 1"],
img_height: int,
img_widt: int,
background: Float[Tensor, "channels"]
rasterize_backward
-------

.. code-block:: python
_C.rasterize_backward(*args, **kwargs)
PARAMETERS:
img_height: int,
img_width: int,
gaussian_ids_sorted: ,
tile_bins: Int[Tensor, "x h 1"],
xys: Float[Tensor, "*batch 2"],
conics: Float[Tensor, "*batch 3"],
colors: Float[Tensor, "*batch channels"],
opacity: Float[Tensor, "*batch 1"],
background: Float[Tensor, "channels"],
final_Ts: Float[Tensor, "*batch 1"],
final_idx: Float[Tensor, "*batch 1"],
v_out_img: Float[Tensor, "*batch channels"]
compute_cov2d_bounds_forward
-------

.. code-block:: python
_C.compute_cov2d_bounds_forward(*args, **kwargs)
PARAMETERS:
cov2d: Float[Tensor, "*batch 3"]
project_gaussians_forward
-------

.. code-block:: python
_C.project_gaussians_forward(*args, **kwargs)
PARAMETERS:
num_points: int,
means3d: Float[Tensor, "*batch 3"],
scales: Float[Tensor, "*batch 3"],
glob_scale: int,
quats: Float[Tensor, "*batch 4"],
viewmat: Float[Tensor, "*batch 4 4"],
projmat: Float[Tensor, "*batch 4 4"],
fx: float,
fy: float,
img_height: int,
img_width: int,
tile_bounds: Int[Tensor, "tiles.x tiles.y 1"],
clip_thresh: float,
project_gaussians_backward
-------

.. code-block:: python
_C.project_gaussians_backward(*args, **kwargs)
PARAMETERS:
num_points int,
means3d: Float[Tensor, "*batch 3"],
scales: Float[Tensor, "*batch 3"],
glob_scale: int,
quats: Float[Tensor, "*batch 4"],
viewmat:Float[Tensor, "*batch 4 4"],
projmat: Float[Tensor, "*batch 4 4"],
fx: float,
fy: float,
img_height: int,
img_width: int,
cov3d: Int[Tensor, "*batch 5"],
radii: Int[Tensor, "*batch 1"],
conics: Float[Tensor, "*batch 3"],
v_xys: Float[Tensor, "*batch 2"],
v_conics: Float[Tensor, "*batch 3"]
compute_sh_forward
-------

.. code-block:: python
_C.compute_sh_forward(*args, **kwargs)
PARAMETERS:
num_points: int,
degree: int,
viewdirs: Float[Tensor, "*batch 3"],
coeffs: Float[Tensor, "*batch degree channels"]
compute_sh_backward
-------

.. code-block:: python
_C.compute_sh_backward(*args, **kwargs)
PARAMETERS:
num_points: int,
degree: int,
viewdirs: Float[Tensor, "*batch 3"],
v_colors: Float[Tensor, "*batch channels"]
compute_cumulative_intersects
-------

.. code-block:: python
_C.compute_cumulative_intersects(*args, **kwargs)
PARAMETERS:
num_points: int,
num_tiles_hit: Int[Tensor, "*batch 1"]
map_gaussian_to_intersects
-------

.. code-block:: python
_C.map_gaussian_to_intersects(*args, **kwargs)
PARAMETERS:
num_points: int,
xys: Int[Tensor, "*batch 2"],
depths: Int[Tensor, "*batch 1"],
radii: Int[Tensor, "*batch 1"],
cum_tiles_hit: Int[Tensor, "*batch 1"],
tile_bounds: Int[Tensor, "tiles.x tiles.y 1"]
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ Links

apis/*

Cuda Lib
-------------

.. toctree::
:glob:
:maxdepth: 1
:caption: Cuda Lib

_C/*

Tests
-------------

.. toctree::
:glob:
:maxdepth: 1
:caption: Tests

tests/*

Citations
-------------
.. bibliography::
Expand Down
20 changes: 20 additions & 0 deletions docs/source/tests/tests.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Tests
===================================

.. currentmodule:: diff_rast

Testing and verifying CUDA implementations
--------------------------------------------

The `tests/` folder provides automatic test scripts that are ran to verify that the CUDA implementations agree with native PyTorch ones.
They are also ran with any pull-requests into main branch on our github repository.


.. code-block:: python
:caption: tests/
./test_project_gaussians.py
./test_map_gaussians.py
./test_cumulative_intersects.py
./test_cov2d_bounds.py

0 comments on commit 2415b3e

Please sign in to comment.