Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rdspring1
Copy link
Collaborator

Hosting documentation for NvFuser would make public adoption easier. Sphinx documentation is used for many projects at Nvidia including TransformerEngine and Cutlass. This PR takes the docstrings for the direct binding python API and Github markdown files in docs folder and packages them with Sphinx. The Sphinx template style is based on TransformerEngine.

Instructions for building documentation locally

pip install --upgrade Sphinx myst-parser
cd docs/sphinx
make html

Future TODO

  • Refactor math latex to be compatible with sphinx and github markdown.

Top-Level Preview

image

@rdspring1 rdspring1 added Python API Issues related to the Python API Direct Bindings Python extension with direct mapping to NvFuser CPP objects. labels Sep 23, 2025
Copy link

github-actions bot commented Sep 23, 2025

Review updated until commit c452481

Description

  • Add Sphinx-based documentation for NvFuser

  • Include API reference for enums and operations

  • Style customization with NVIDIA branding

  • Setup build system and templates for docs


Changes walkthrough 📝

Relevant files
Documentation
16 files
ops.cpp
Improve docstrings for normal and uniform ops                       
+7/-1     
__init__.py
Improve docstring for from_pytorch method                               
+3/-0     
footer.html
Add NVIDIA footer with legal links                                             
+23/-0   
layout.html
Customize layout with NVIDIA styling                                         
+90/-0   
README.md
Add README for documentation setup                                             
+21/-0   
nvidia_font.css
Add NVIDIA font styling                                                                   
+53/-0   
nvidia_footer.css
Add CSS for NVIDIA footer                                                               
+29/-0   
enum.rst
Document enums and POD classes                                                     
+58/-0   
general.rst
Document general API components                                                   
+133/-0 
multidevice.rst
Document multidevice API                                                                 
+27/-0   
ops.rst
Document math operations API                                                         
+16/-0   
dev
Link to dev documentation                                                               
+1/-0     
index.rst
Create main documentation index                                                   
+58/-0   
installation.rst
Add installation instructions                                                       
+42/-0   
math
Link to math documentation                                                             
+1/-0     
reading
Link to reading materials                                                               
+1/-0     
Configuration changes
2 files
conf.py
Configure Sphinx with NVIDIA extensions and settings         
+53/-0   
Makefile
Add Makefile for Sphinx documentation                                       
+39/-0   

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
⚡ Recommended focus areas for review

Documentation Format

The docstring for normal and uniform distribution functions contains a lone '+' symbol in the middle of the documentation, which may render incorrectly in Sphinx. This could be a formatting error and should be validated to ensure proper documentation generation.

Dependency Specification

The Sphinx configuration includes several extensions, but the installation instructions in README.md may not cover all required packages (e.g., sphinx_rtd_theme). This could lead to build failures if dependencies are not properly installed.

extensions = [
    "myst_parser",
    "sphinx.ext.mathjax",
    "sphinx.ext.autodoc",
    "sphinx.ext.napoleon",
    "sphinx.ext.viewcode",
    "sphinx.ext.intersphinx",
    "sphinx_toolbox.more_autodoc.overloads",
]
Inconsistent Instructions

The README.md lists additional pip packages (e.g., furo, nbsphinx) that may not be necessary for basic documentation builds, potentially confusing contributors. The required set of packages should align with the actual Sphinx configuration.

pip install --upgrade Sphinx furo pandoc myst-parser sphinx-copybutton nbsphinx nbsphinx-link sphinx-inline-tabs

@rdspring1
Copy link
Collaborator Author

!build

@naoyam
Copy link
Collaborator

naoyam commented Sep 23, 2025

I'm not familiar with Sphinx enough to review this PR, but is it possible to host the doc somewhere and make it automatically updated? Can we use Github pages?

@wujingyue
Copy link
Collaborator

Similar to Naoya's question, what's the overhead of maintaining these docs? Do you expect

pip install --upgrade Sphinx myst-parser
cd docs/sphinx
make html

to be run automatically after each Python API change?

@rdspring1
Copy link
Collaborator Author

Some thoughts for reviewers:

  • A technical review isn't required for this PR. The RST files are the code for sphinx and are straightforward.
  • Do you have an opinion on using Sphinx or some other tool?
  • Which design layout do we want? I picked the template from TransformerEngine. This corresponds with source/_static and source/_templates.
  • What do you we want to include in the docs in the future? For example, convert tests/cpp/tutorial.cpp into jupyter notebooks.

host the doc somewhere

I don't know much about hosting the docs on an Nvidia site. This is TBD once the docs are polished. I'd imagine we'd need some third-party review before posting it.

make it automatically updated?

@xwang233 has a Gitlab pipeline to push NvFuser pip wheels. I think we can do something similar for the docs. Furthermore, we can push major releases each quarter.

@xwang233
Copy link
Collaborator

generating document with sphinx is lightweight, we can add a GitHub CI action on main branch and it will rebuild doc after every commit.

If we want to host the doc in public, the easiest solution is to use GitHub pages from this repo. Should be easy to do, not a problem.

Copy link
Collaborator

@wujingyue wujingyue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Our Python API docs are currently inside .cpp binding files and are hard to discover by users. It makes sense to have them in webpages.

In addition, we may want to consider auto-generating .pyi files. This way, IDEs like Cursor can resolve Python APIs in nvFuser and show the docs too. See http://nv/eWh for an earlier discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Direct Bindings Python extension with direct mapping to NvFuser CPP objects. Python API Issues related to the Python API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants