Skip to content

Commit 3686fdb

Browse files
q10facebook-github-bot
authored andcommitted
Append FBGEMM CPU documentation (pytorch#2244)
Summary: - Append FBGEMM CPU documentation to the generated Sphinx docs - Re-organize the documentation in the front page Pull Request resolved: pytorch#2244 Reviewed By: spcyppt Differential Revision: D52528266 Pulled By: q10 fbshipit-source-id: d36dd9e01e7c979ea8a53042b4728d70268cd32a
1 parent 441697c commit 3686fdb

38 files changed

+1079
-562
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# Contributing to FBGEMM / FBGEMM_GPU
1+
# Contributing to FBGEMM and FBGEMM_GPU
22

33
We want to make contributing to this project as easy and transparent as
44
possible.
55

66
## Code of Conduct
77

8-
The code of conduct is described in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
8+
The code of conduct is described in the
9+
[Code of Conduct](https://github.com/pytorch/FBGEMM/blob/main/CODE_OF_CONDUCT.md).
910

1011
## Pull Requests
1112

docs/Doxyfile.in

Lines changed: 578 additions & 325 deletions
Large diffs are not rendered by default.

fbgemm_gpu/docs/Doxyfile.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -949,10 +949,11 @@ WARN_LOGFILE =
949949
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
950950
# Note: If this tag is empty the current directory is searched.
951951

952-
INPUT = "../" \
953-
"../include/" \
952+
INPUT = "../include/" \
954953
"../codegen/" \
955-
"../src/"
954+
"../src/" \
955+
"../../include/" \
956+
"../../src/"
956957

957958
# This tag can be used to specify the character encoding of the source files
958959
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -2338,7 +2339,8 @@ SEARCH_INCLUDES = YES
23382339
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
23392340

23402341
INCLUDE_PATH = "../codegen/" \
2341-
"../include/fbgemm_gpu"
2342+
"../include/fbgemm_gpu/" \
2343+
"../../include/fbgemm"
23422344

23432345
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
23442346
# patterns (like *.h and *.hpp) to filter out the header-files in the

fbgemm_gpu/docs/src/conf.py

Lines changed: 141 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,32 @@
99
# This file only contains a selection of the most common options. For a full
1010
# list see the documentation:
1111
# https://www.sphinx-doc.org/en/master/usage/configuration.html
12-
13-
# -- Path setup --------------------------------------------------------------
14-
15-
# If extensions (or modules to document with autodoc) are in another directory,
16-
# add these directories to sys.path here. If the directory is relative to the
17-
# documentation root, use os.path.abspath to make it absolute, like shown here.
1812
#
19-
# import os
20-
# import sys
21-
# sys.path.insert(0, os.path.abspath('.'))
13+
#
14+
# Configuration is based on:
15+
# https://github.com/pytorch/pytorch/blob/main/docs/cpp/source/conf.py
16+
2217
import os
2318
import sys
2419

2520
import pytorch_sphinx_theme
2621

22+
23+
# -- Project information -----------------------------------------------------
24+
25+
project = "FBGEMM"
26+
copyright = "2023, FBGEMM Team"
27+
author = "FBGEMM Team"
28+
29+
# The short X.Y version.
30+
version = "0.6"
31+
32+
# The full version, including alpha/beta/rc tags
33+
release = "0.6.0"
34+
35+
36+
# -- Path setup --------------------------------------------------------------
37+
2738
for dir_i in os.listdir("../.."):
2839
if dir_i == "fbgemm_gpu":
2940
continue
@@ -32,18 +43,56 @@
3243
sys.path.insert(0, possible_dir)
3344

3445

35-
# -- Project information -----------------------------------------------------
36-
highlight_language = "C++"
46+
# Setup absolute paths for communicating with breathe / exhale where
47+
# items are expected / should be trimmed by.
48+
# This file is {repo_root}/fbgemm_gpu/docs/src/conf.py
49+
this_file_dir = os.path.abspath(os.path.dirname(__file__))
3750

38-
project = "fbgemm"
39-
copyright = "2023, FBGEMM Team"
40-
author = "FBGEMM Team"
51+
doxygen_xml_dir = os.path.join(
52+
os.path.dirname(this_file_dir), # {repo_root}/fbgemm_gpu/docs
53+
"build", # {repo_root}/fbgemm_gpu/docs/build
54+
"xml", # {repo_root}/fbgemm_gpu/docs/build/xml
55+
)
56+
57+
repo_root = os.path.dirname( # {repo_root}
58+
os.path.dirname( # {repo_root}/fbgemm_gpu
59+
os.path.dirname( # {repo_root}/fbgemm_gpu/docs
60+
this_file_dir # {repo_root}/fbgemm_gpu/docs/src
61+
)
62+
)
63+
)
4164

42-
# The full version, including alpha/beta/rc tags
43-
release = "0.1.2"
4465

4566
# -- General configuration ---------------------------------------------------
4667

68+
# Tell sphinx what the primary language being documented is.
69+
primary_domain = "cpp"
70+
71+
# Tell sphinx what the pygments highlight language should be.
72+
highlight_language = "cpp"
73+
74+
# The name of the Pygments (syntax highlighting) style to use.
75+
pygments_style = "sphinx"
76+
77+
# The suffix(es) of source filenames.
78+
# You can specify multiple suffix as a list of string:
79+
#
80+
# source_suffix = ['.rst', '.md']
81+
source_suffix = ".rst"
82+
83+
# The master toctree document.
84+
master_doc = "index"
85+
86+
# If true, `todo` and `todoList` produce output, else they produce nothing.
87+
todo_include_todos = True
88+
89+
# If true, Sphinx will warn about all references where the target cannot be
90+
# found.
91+
nitpicky = True
92+
93+
# Make sure the target is unique
94+
autosectionlabel_prefix_document = True
95+
4796
# Add any Sphinx extension module names here, as strings. They can be
4897
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4998
# ones.
@@ -58,6 +107,12 @@
58107
"sphinx.ext.napoleon",
59108
]
60109

110+
intersphinx_mapping = {
111+
"python": ("https://docs.python.org/3", None),
112+
"pytorch": ("https://pytorch.org/docs/main", None),
113+
"numpy": ("https://numpy.org/doc/stable", None),
114+
}
115+
61116
# Add any paths that contain templates here, relative to this directory.
62117
templates_path = ["_templates"]
63118

@@ -66,54 +121,97 @@
66121
# This pattern also affects html_static_path and html_extra_path.
67122
exclude_patterns = []
68123

69-
intersphinx_mapping = {
70-
"python": ("https://docs.python.org/3", None),
71-
"pytorch": ("https://pytorch.org/docs/master", None),
72-
"numpy": ("https://numpy.org/doc/stable", None),
73-
}
74124

75-
# Setup absolute paths for communicating with breathe / exhale where
76-
# items are expected / should be trimmed by.
125+
# -- Breathe configuration ---------------------------------------------------
77126

78127
# This should be a dictionary in which the keys are project names and the values
79128
# are paths to the folder containing the doxygen output for that project.
80129
breathe_projects = {
81-
"fbgemm_gpu": "../build/xml/",
82-
"codegen": "../build/xml/codegen/",
130+
"FBGEMM": doxygen_xml_dir,
131+
"codegen": f"{doxygen_xml_dir}/codegen",
83132
}
84133

85134
# This should match one of the keys in the breathe_projects dictionary and
86135
# indicates which project should be used when the project is not specified on
87136
# the directive.
88-
breathe_default_project = "fbgemm_gpu"
137+
breathe_default_project = "FBGEMM"
89138

90-
# If true, Sphinx will warn about all references where the target cannot be
91-
# found.
92-
nitpicky = True
93-
94-
# Make sure the target is unique
95-
autosectionlabel_prefix_document = True
96-
97-
# Tell sphinx what the primary language being documented is.
98-
primary_domain = "cpp"
99-
100-
# Tell sphinx what the pygments highlight language should be.
101-
highlight_language = "cpp"
102139

103140
# -- Options for HTML output -------------------------------------------------
104141

105142
# The theme to use for HTML and HTML Help pages. See the documentation for
106143
# a list of builtin themes.
107-
#
108144
html_theme = "pytorch_sphinx_theme"
109145
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
146+
147+
# Add any paths that contain custom static files (such as style sheets) here,
148+
# relative to this directory. They are copied after the builtin static files,
149+
# so a file named "default.css" will overwrite the builtin "default.css".
150+
# NOTE: sharing python docs resources
151+
html_static_path = ["_static"]
152+
153+
# Theme options are theme-specific and customize the look and feel of a theme
154+
# further. For a list of options available for each theme, see the
155+
# documentation.
110156
html_theme_options = {
111157
"pytorch_project": "fbgemm",
112158
"collapse_navigation": True,
159+
"display_version": True,
113160
"analytics_id": "UA-117752657-2",
114161
}
115162

116-
# Add any paths that contain custom static files (such as style sheets) here,
117-
# relative to this directory. They are copied after the builtin static files,
118-
# so a file named "default.css" will overwrite the builtin "default.css".
119-
# html_static_path = ["_static"]
163+
164+
# -- Options for LaTeX output ---------------------------------------------
165+
166+
latex_elements = {
167+
# The paper size ('letterpaper' or 'a4paper').
168+
#
169+
# 'papersize': 'letterpaper',
170+
# The font size ('10pt', '11pt' or '12pt').
171+
#
172+
# 'pointsize': '10pt',
173+
# Additional stuff for the LaTeX preamble.
174+
#
175+
# 'preamble': '',
176+
# Latex figure (float) alignment
177+
#
178+
# 'figure_align': 'htbp',
179+
}
180+
181+
# Grouping the document tree into LaTeX files. List of tuples
182+
# (source start file, target name, title,
183+
# author, documentclass [howto, manual, or own class]).
184+
latex_documents = [
185+
(
186+
master_doc,
187+
"fbgemm.tex",
188+
"FBGEMM Documentation",
189+
"FBGEMM Team",
190+
"manual",
191+
),
192+
]
193+
194+
195+
# -- Options for manual page output ---------------------------------------
196+
197+
# One entry per manual page. List of tuples
198+
# (source start file, name, description, authors, manual section).
199+
man_pages = [(master_doc, "FBGEMM", "FBGEMM Documentation", [author], 1)]
200+
201+
202+
# -- Options for Texinfo output -------------------------------------------
203+
204+
# Grouping the document tree into Texinfo files. List of tuples
205+
# (source start file, target name, title, author,
206+
# dir menu entry, description, category)
207+
texinfo_documents = [
208+
(
209+
master_doc,
210+
"FBGEMM",
211+
"FBGEMM Documentation",
212+
author,
213+
"FBGEMM",
214+
"One line description of project.",
215+
"Miscellaneous",
216+
),
217+
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Quantization Utilities
2+
======================
3+
4+
Reference Implementation Methods
5+
--------------------------------
6+
7+
.. doxygengroup:: fbgemm-quant-utils-generic
8+
:content-only:
9+
10+
AVX-2 Implementation Methods
11+
----------------------------
12+
13+
.. doxygengroup:: fbgemm-quant-utils-avx2
14+
:content-only:
15+
16+
AVX-512 Implementation Methods
17+
------------------------------
18+
19+
.. doxygengroup:: fbgemm-quant-utils-avx512
20+
:content-only:

0 commit comments

Comments
 (0)