Skip to content

Commit 8438ec0

Browse files
authored
doc: fix documentation build error (#1797)
<!-- .github/pull_request_template.md --> ## 📌 Description The documentation build was failed on main branch, this PR fixes the issues. We used to run doc build without installing flashinfer package to reduce documentation build time. However, it's not sustainable and cause lots of issues. The core package don't require heavy build process (JIT), and starting from this PR, we begin to install the package before build documentation. Summary of changes in this PR: 1. install flashinfer package before building doc 2. add back comm module 3. add documentation build check for every PR, and only deploy for commits on main branch. ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [x] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
1 parent 08b8da3 commit 8438ec0

File tree

8 files changed

+485
-434
lines changed

8 files changed

+485
-434
lines changed

.github/workflows/build-doc.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
pull_request:
9+
branches:
10+
- main
11+
812
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
913
permissions:
1014
contents: read
@@ -42,17 +46,18 @@ jobs:
4246
python -m pip install -r docs/requirements.txt
4347
4448
- name: Bulid Documentation
45-
if: github.ref == 'refs/heads/main'
4649
run: |
4750
cd docs
4851
./build_docs.sh
4952
5053
- name: Upload artifact
54+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5155
uses: actions/upload-pages-artifact@v3
5256
with:
5357
# Upload entire repository
5458
path: 'docs/_build/html'
5559

5660
- name: Deploy to GitHub Pages
61+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5762
id: deployment
5863
uses: actions/deploy-pages@v4

docs/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ help:
1616

1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19-
%: export FLASHINFER_BUILDING_DOCS=1
2019
%: Makefile
2120
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/api/comm.rst

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
.. _apicomm:
2+
3+
flashinfer.comm
4+
===============
5+
6+
.. currentmodule:: flashinfer.comm
7+
8+
This module provides communication primitives and utilities for distributed computing, including CUDA IPC, AllReduce operations, and memory management utilities.
9+
10+
CUDA IPC Utilities
11+
------------------
12+
13+
.. autosummary::
14+
:toctree: ../generated
15+
16+
CudaRTLibrary
17+
create_shared_buffer
18+
free_shared_buffer
19+
20+
DLPack Utilities
21+
----------------
22+
23+
.. autosummary::
24+
:toctree: ../generated
25+
26+
pack_strided_memory
27+
28+
Mapping Utilities
29+
-----------------
30+
31+
.. autosummary::
32+
:toctree: ../generated
33+
34+
Mapping
35+
36+
TensorRT-LLM AllReduce
37+
----------------------
38+
39+
Types and Enums
40+
~~~~~~~~~~~~~~~~
41+
42+
.. autosummary::
43+
:toctree: ../generated
44+
45+
AllReduceFusionOp
46+
AllReduceFusionPattern
47+
AllReduceStrategyConfig
48+
AllReduceStrategyType
49+
FP4QuantizationSFLayout
50+
51+
Core Operations
52+
~~~~~~~~~~~~~~~
53+
54+
.. autosummary::
55+
:toctree: ../generated
56+
57+
trtllm_allreduce_fusion
58+
trtllm_custom_all_reduce
59+
trtllm_moe_allreduce_fusion
60+
trtllm_moe_finalize_allreduce_fusion
61+
62+
Workspace Management
63+
~~~~~~~~~~~~~~~~~~~~
64+
65+
.. autosummary::
66+
:toctree: ../generated
67+
68+
trtllm_create_ipc_workspace_for_all_reduce
69+
trtllm_create_ipc_workspace_for_all_reduce_fusion
70+
trtllm_destroy_ipc_workspace_for_all_reduce
71+
trtllm_destroy_ipc_workspace_for_all_reduce_fusion
72+
73+
Initialization and Utilities
74+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75+
76+
.. autosummary::
77+
:toctree: ../generated
78+
79+
trtllm_lamport_initialize
80+
trtllm_lamport_initialize_all
81+
compute_fp4_swizzled_layout_sf_size
82+
83+
vLLM AllReduce
84+
--------------
85+
86+
.. autosummary::
87+
:toctree: ../generated
88+
89+
vllm_all_reduce
90+
vllm_dispose
91+
vllm_init_custom_ar
92+
vllm_register_buffer
93+
vllm_register_graph_buffers
94+
vllm_get_graph_buffer_ipc_meta
95+
vllm_meta_size
96+
97+
MNNVL (Multi-Node NVLink)
98+
-------------------------
99+
100+
.. currentmodule:: flashinfer.comm.mnnvl
101+
102+
Core Classes
103+
~~~~~~~~~~~~
104+
105+
.. autosummary::
106+
:toctree: ../generated
107+
108+
MnnvlMemory
109+
McastGPUBuffer
110+
111+
Utility Functions
112+
~~~~~~~~~~~~~~~~~
113+
114+
.. autosummary::
115+
:toctree: ../generated
116+
117+
create_tensor_from_cuda_memory
118+
alloc_and_copy_to_cuda
119+
120+
TensorRT-LLM MNNVL AllReduce
121+
----------------------------
122+
123+
.. currentmodule:: flashinfer.comm.trtllm_mnnvl_ar
124+
125+
.. autosummary::
126+
:toctree: ../generated
127+
128+
trtllm_mnnvl_all_reduce
129+
trtllm_mnnvl_fused_allreduce_rmsnorm
130+
mpi_barrier

docs/build_docs.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ set -eo pipefail
33
set -x
44
echo "Building FlashInfer documentation..."
55

6+
# Install flashinfer package first
7+
echo "Installing FlashInfer package..."
8+
pip install -e ..
9+
610
make clean
711
make SPHINXOPTS='-T -v' html
812

docs/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import os
2-
import sys
31
from pathlib import Path
42
from typing import Any, List
53

4+
import flashinfer # noqa: F401
5+
66
# import tlcpack_sphinx_addon
77
# Configuration file for the Sphinx documentation builder.
88
#
@@ -13,8 +13,7 @@
1313
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1414

1515
root = Path(__file__).parents[1].resolve()
16-
sys.path.insert(0, str(root))
17-
os.environ["BUILD_DOC"] = "1"
16+
# FlashInfer is installed via pip before building docs
1817
autodoc_mock_imports = [
1918
"torch",
2019
"triton",

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ FlashInfer is a library and kernel generator for Large Language Models that prov
3131
api/gemm
3232
api/fused_moe
3333
api/cascade
34+
api/comm
3435
api/sparse
3536
api/page
3637
api/sampling

0 commit comments

Comments
 (0)