-
Notifications
You must be signed in to change notification settings - Fork 7
Add Sphinx support to documentation #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
45cb921
54f0077
64425b9
2e7d1e2
1328970
ebd8d3a
cfeebcb
f275f90
c344af6
48bd17a
2d48924
b76d494
1def73c
8acfbad
5b6c4ed
d4a3e1d
dc8c802
e54bc25
7c224d9
ccc7d1e
397835c
fdba1f0
019a5de
ac7128f
74ab83e
ed0cbd9
f26adc4
97e48a4
7a1bc94
e2f9da3
0cd74f1
0e86476
ff9c648
53b493c
53b81bd
c6563f1
6acde4d
5d41a9f
c46bd65
172aa09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||
| # Read the Docs configuration file | ||||||||||
| # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||||||||||
|
|
||||||||||
| version: 2 | ||||||||||
|
|
||||||||||
| sphinx: | ||||||||||
| configuration: docs/conf.py | ||||||||||
|
||||||||||
| configuration: docs/conf.py | |
| configuration: docs/sphinx/conf.py |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Read the Docs config points to docs/conf.py, but this repo’s Sphinx config is under docs/sphinx/conf.py (and docs/sphinx is the only Sphinx config dir present). As written, RTD will fail to find the configuration file.
| configuration: docs/conf.py | |
| configuration: docs/sphinx/conf.py |
Copilot
AI
Mar 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.readthedocs.yaml installs from docs/sphinx/requirements.txt, but that file isn't present in the repository. RTD builds will fail during dependency installation unless you add this requirements file or change the python.install section to install the needed packages another way.
| - requirements: docs/sphinx/requirements.txt | |
| - method: pip | |
| path: . |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config pins Read the Docs to Python 3.10, but docs/README.md states Python 3.12 is required/expected. Align the documented requirement with what RTD uses (or update RTD to use 3.12 if that’s the actual requirement).
| python: "3.10" | |
| python: "3.12" |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -116,6 +116,9 @@ sudo systemctl reboot | |||||||
| * `libmount-dev` (Debian/Ubuntu) | ||||||||
| * `libmount-devel` (RHEL/Fedora/openSUSE) | ||||||||
|
|
||||||||
| Please the the README.md file in the docs directory for requirements | ||||||||
| for building the documentation. | ||||||||
|
|
||||||||
|
Comment on lines
+119
to
+121
|
||||||||
| Please the the README.md file in the docs directory for requirements | |
| for building the documentation. | |
| Please see docs/README.md for requirements for building the documentation. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,27 +13,88 @@ option(AIS_BUILD_DOCS "Build the hipFile docs (requires Doxygen, Sphinx, and Bre | |
|
|
||
| if(AIS_BUILD_DOCS) | ||
| find_package(Doxygen REQUIRED) | ||
| find_package(Python3 REQUIRED COMPONENTS Interpreter) | ||
|
|
||
| # Verify Sphinx + rocm_docs are available | ||
| execute_process( | ||
| COMMAND "${Python3_EXECUTABLE}" -c "import rocm_docs" | ||
| RESULT_VARIABLE _rocm_docs_found | ||
| OUTPUT_QUIET ERROR_QUIET | ||
| ) | ||
| if(NOT _rocm_docs_found EQUAL 0) | ||
| message(FATAL_ERROR "rocm_docs Python package not found. Install it with: pip install rocm-docs-core") | ||
| endif() | ||
|
Comment on lines
+18
to
+26
|
||
|
|
||
| # Set Doxygen input (pasted into Doxyfile.in) | ||
| set(AIS_DOXYFILE_INPUT "${HIPFILE_ROOT_PATH}/include") | ||
|
|
||
| # Set the path to the documentation | ||
| set(AIS_DOC_PATH "${CMAKE_CURRENT_BINARY_DIR}/docs") | ||
|
|
||
| ########### | ||
| # Doxygen # | ||
| ########### | ||
|
|
||
| # The Doxygen HTML, XML, etc. goes in docs/doxygen/ | ||
|
|
||
| # Set the Doxyfile install location | ||
| set(AIS_DOXYFILE ${AIS_DOC_PATH}/Doxyfile) | ||
| set(AIS_DOXYFILE "${AIS_DOC_PATH}/doxygen/Doxyfile") | ||
|
|
||
| # Doxygen XML output dir (consumed by Breathe inside Sphinx) | ||
| set(AIS_DOXYGEN_XML_DIR "${AIS_DOC_PATH}/doxygen/xml") | ||
|
|
||
| # Create the Doxyfile from the input file | ||
| configure_file("docs/Doxyfile.in" ${AIS_DOXYFILE}) | ||
| configure_file("docs/doxygen/Doxyfile.in" ${AIS_DOXYFILE}) | ||
|
|
||
| ########## | ||
| # Sphinx # | ||
| ########## | ||
|
|
||
| # The Sphinx HTML, XML, etc. goes in docs/sphinx/ | ||
|
|
||
| # Set the target for the config file and toc file | ||
| set(AIS_SPHINX_CONF_FILE "${AIS_DOC_PATH}/sphinx/conf.py") | ||
| set(AIS_SPHINX_TOC_FILE "${AIS_DOC_PATH}/sphinx/_toc.yml.in") | ||
|
|
||
| # Sphinx HTML output dir | ||
| set(AIS_SPHINX_BUILD_DIR "${AIS_DOC_PATH}/sphinx/html") | ||
|
|
||
| # Set the output directory | ||
| set(DOXYGEN_OUT ${AIS_DOC_PATH}) | ||
| # Copy conf.py and the table of contents file | ||
| # Need to do this so the toc file doesn't dirty the repo | ||
| # _toc.yml.in is transformed by rocm_docs, not CMake | ||
| configure_file("docs/sphinx/conf.py" ${AIS_SPHINX_CONF_FILE} COPYONLY) | ||
| configure_file("docs/sphinx/_toc.yml.in" ${AIS_SPHINX_TOC_FILE} COPYONLY) | ||
|
|
||
derobins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Configure the documentation build | ||
| add_custom_target("doc" | ||
| COMMAND ${DOXYGEN_EXECUTABLE} ${AIS_DOXYFILE} | ||
| WORKING_DIRECTORY ${AIS_DOC_PATH} | ||
| COMMENT "Generating hipFile API documentation with Doxygen" | ||
| # Build docs: Doxygen first, then Sphinx (which pulls in rocm_docs via conf.py) | ||
| add_custom_target(doc | ||
| # Step 1: Run Doxygen to produce XML for Breathe | ||
| COMMAND "${DOXYGEN_EXECUTABLE}" "${AIS_DOXYFILE}" | ||
| # Step 2: Run Sphinx (html), injecting the Doxygen paths via environment | ||
| COMMAND | ||
| ${CMAKE_COMMAND} -E env | ||
| "DOXYFILE_PATH=${AIS_DOXYFILE}" | ||
| "DOXYGEN_ROOT=${AIS_DOC_PATH}/doxygen" | ||
| "DOXYGEN_XML_DIR=${AIS_DOXYGEN_XML_DIR}" | ||
| "${Python3_EXECUTABLE}" -m sphinx | ||
| -b html | ||
| -c "${AIS_DOC_PATH}/sphinx" | ||
| "${HIPFILE_ROOT_PATH}/docs" | ||
| "${AIS_SPHINX_BUILD_DIR}" | ||
| -v | ||
| # Step 3: Run Sphinx (LaTeX), injecting the Doxygen paths via environment | ||
| COMMAND | ||
| ${CMAKE_COMMAND} -E env | ||
| "DOXYFILE_PATH=${AIS_DOXYFILE}" | ||
| "DOXYGEN_ROOT=${AIS_DOC_PATH}/doxygen" | ||
| "DOXYGEN_XML_DIR=${AIS_DOXYGEN_XML_DIR}" | ||
| "${Python3_EXECUTABLE}" -m sphinx | ||
| -b latex | ||
| -c "${AIS_DOC_PATH}/sphinx" | ||
| "${HIPFILE_ROOT_PATH}/docs" | ||
| "${AIS_SPHINX_BUILD_DIR}" | ||
| -v | ||
|
Comment on lines
+90
to
+95
|
||
| WORKING_DIRECTORY "${AIS_DOC_PATH}" | ||
| COMMENT "Generating hipFile API documentation with Doxygen + Sphinx (rocm_docs)" | ||
| VERBATIM | ||
| ) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||||||
| # hipFile Documentation | ||||||||||
|
|
||||||||||
| hipFile is documented using Doxygen markup in the public header | ||||||||||
| files and Sphinx .rst files. | ||||||||||
|
|
||||||||||
| ## Building the Documentation | ||||||||||
|
|
||||||||||
| hipFile can generate two documentation products: | ||||||||||
|
|
||||||||||
| 1. API documentation | ||||||||||
| 2. Sphinx HTML documentation (includes #1) | ||||||||||
|
|
||||||||||
| API documentation is generated from Doxygen and limited to markup | ||||||||||
| in the header files. This will generate HTML, XML, and LaTeX output. | ||||||||||
| The LaTeX can be used to create a pdf document. | ||||||||||
|
|
||||||||||
| The Sphinx documentation incorporates the Doxygen API markup and | ||||||||||
| adds reStructured text file content to generate HTML documentation | ||||||||||
| for the web. | ||||||||||
|
|
||||||||||
| The documentation CMake target currently builds both. There is | ||||||||||
| no way to select "just Doxygen". | ||||||||||
|
|
||||||||||
| ### Requirements | ||||||||||
|
|
||||||||||
| * CMake >= 3.21 | ||||||||||
| * Doxygen (we use 1.9.8, other versions are untested) | ||||||||||
| * Python 3.12 (earlier versions might work but are untested) | ||||||||||
| * The following Python packages: | ||||||||||
| * breathe | ||||||||||
| * rocm-docs-core | ||||||||||
| * sphinx | ||||||||||
| * sphinx-rtd-theme | ||||||||||
|
|
||||||||||
| If you want to build a pdf, you will need LaTeX and pdflatex. | ||||||||||
|
|
||||||||||
| ### Generation | ||||||||||
|
|
||||||||||
| Building the documentation is done via CMake by turning on the docs | ||||||||||
| option (which is off by default). | ||||||||||
|
|
||||||||||
| `cmake -DAIS_BUILD_DOCS=ON <options> <path/to/source>` | ||||||||||
|
|
||||||||||
| You can then build the `doc` target. | ||||||||||
|
|
||||||||||
| `cmake --build . --target doc` | ||||||||||
|
|
||||||||||
| The documentation will be in the `docs` subdirectory of the build | ||||||||||
| directory: | ||||||||||
|
|
||||||||||
| ``` | ||||||||||
| ├── doxygen | ||||||||||
| │ ├── html | ||||||||||
| │ ├── latex | ||||||||||
| │ └── xml | ||||||||||
| └── sphinx | ||||||||||
| └── html | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| To generate a pdf for the API docs, navigate to `doxygen/latex` and run `make pdf` to | ||||||||||
| generate a pdf named `refman.pdf`. | ||||||||||
|
|
||||||||||
| To generate a pdf for the Sphinx docs, navigate to `sphinx/html` and run `make` in | ||||||||||
|
||||||||||
| To generate a pdf for the Sphinx docs, navigate to `sphinx/html` and run `make` in | |
| To generate a pdf for the Sphinx docs, navigate to `sphinx/latex` and run `make` in |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paths here don’t match the repo layout: the API docs live under docs/api/ (lowercase), and the TOC file is under docs/sphinx/_toc.yml.in. As written, contributors may add content in the wrong place or update the wrong TOC file.
| belongs in `docs/API` and other documentation goes in `docs`. Be sure to update | |
| `sphinx/_toc.yml.in` if you add any new files. | |
| belongs in `docs/api/` and other documentation goes in `docs/`. Be sure to update | |
| `docs/sphinx/_toc.yml.in` if you add any new files. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| hipify | ||
| ====== |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| .. meta:: | ||
| :description: hipFile does hipFile stuff | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this going to be replaced later?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. This is still fundamentally a draft. I just flipped it to normal to see what Copilot was going to complain about. |
||
| :keywords: hipFile, ROCm, storage, library, API, DMA | ||
|
|
||
| ********************* | ||
| hipFile documentation | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Capitalize |
||
| ********************* | ||
|
|
||
| hipFile introduction goes here. For more information, see :doc:`introduction`. | ||
|
|
||
| The hipFile public repository is located at `<https://github.com/ROCm/hipFile>`_. | ||
|
|
||
| .. grid:: 2 | ||
| :gutter: 3 | ||
|
|
||
| .. grid-item-card:: Build and install | ||
|
|
||
| * :doc:`Configure and build <./config_build>` | ||
| * :doc:`Sanitizers <./sanitizers>` | ||
|
|
||
| .. grid-item-card:: Using hipFile | ||
|
|
||
| * :doc:`hipify <./hipify>` | ||
| * :doc:`NVIDIA compatibility <./nvidia_compat>` | ||
| * :doc:`fio <./fio>` | ||
| * :doc:`Collecting statistics <./stats_collection>` | ||
|
|
||
| .. grid-item-card:: API reference | ||
|
|
||
| * :doc:`Errors <./api/errors>` | ||
| * :doc:`Core API <./api/core>` | ||
| * :doc:`Drivers <./api/driver>` | ||
| * :doc:`File operations <./api/file>` | ||
| * :doc:`Asynchronous operations <./api/async>` | ||
| * :doc:`Batch operations <./api/batch>` | ||
| * :doc:`RDMA <./api/rdma>` | ||
| * :doc:`Other <./api/misc_api>` | ||
|
|
||
| To contribute to the documentation, refer to | ||
| `Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_. | ||
|
|
||
| You can find licensing information on the | ||
| `Licensing <https://rocm.docs.amd.com/en/latest/about/license.html>`_ page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| defaults: | ||
| numbered: False | ||
| root: index | ||
| subtrees: | ||
derobins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - entries: | ||
| - file: introduction.rst | ||
| title: Introduction | ||
|
|
||
| - caption: Build and install | ||
| entries: | ||
| - file: config_build.rst | ||
| title: Configure and build | ||
| - file: sanitizers.rst | ||
| title: Sanitizers | ||
|
|
||
| - caption: Using hipFile | ||
| entries: | ||
| - file: hipify.rst | ||
| title: hipify | ||
| - file: nvidia_compat.rst | ||
| title: cuFile compatibility | ||
| - file: fio.rst | ||
| title: fio support | ||
| - file: stats_collection.rst | ||
| title: Collecting statistics | ||
|
|
||
| - caption: API reference | ||
| entries: | ||
| - file: api/errors.rst | ||
| title: Errors | ||
| - file: api/core.rst | ||
| title: Core | ||
| - file: api/driver.rst | ||
| title: Drivers | ||
| - file: api/file.rst | ||
| title: File operations | ||
| - file: api/async.rst | ||
| title: Asynchronous operations | ||
| - file: api/batch.rst | ||
| title: Batch operations | ||
| - file: api/rdma.rst | ||
| title: RDMA | ||
| - file: api/misc_api.rst | ||
| title: Other | ||
Uh oh!
There was an error while loading. Please reload this page.