diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..e35d8850c --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +_build diff --git a/docs/.readthedocs.yaml b/docs/.readthedocs.yaml new file mode 100644 index 000000000..3c7cfab87 --- /dev/null +++ b/docs/.readthedocs.yaml @@ -0,0 +1,17 @@ +version: 2 + +build: + os: "ubuntu-24.04" + tools: + python: "3.12" + jobs: + pre_build: + - python -m pip install . + +python: + install: + - requirements: docs/requirements.txt + - requirements: pytorch-cpu-requirements.txt + +sphinx: + configuration: docs/conf.py diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..86bb2730e --- /dev/null +++ b/docs/README.md @@ -0,0 +1,49 @@ +# API Docs + +This directory uses Sphinx to build documentation that is hosted at +https://iree-turbine.readthedocs.io/. + +## Building the API documentation locally + +### Setup virtual environment with requirements + +From this docs/ directory: + +```shell +python -m venv .venv +source .venv/bin/activate + +# Install sphinx website generator requirements and PyTorch dep. +python -m pip install -r requirements.txt +python -m pip install -r ../pytorch-cpu-requirements.txt + +# Install iree-turbine itself. +# Editable so you can make local changes and preview them easily. +python -m pip install -e .. +``` + +### Build docs + +```shell +sphinx-build -b html . _build +``` + +### Serve locally locally with autoreload + +```shell +# Default config - only watch for changes to this folder (.rst files). +sphinx-autobuild . _build + +# Advanced config - also watch for changes to the entire project (.py files). +sphinx-autobuild . _build --watch .. +``` + +Then open http://127.0.0.1:8000 as instructed by the logs and make changes to +the files in this directory as needed to update the documentation. + +## Authoring documentation + +### Useful references + +* https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html +* https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..2016640d2 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,45 @@ +# Copyright 2025 The IREE Authors +# +# Licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import os +import sys + +try: + import iree.turbine +except ImportError: + sys.path.insert(0, os.path.abspath("../")) + import iree.turbine + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "IREE Turbine" +copyright = "2025, The IREE Authors" +author = "The IREE Authors" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "myst_parser", +] + +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "*.venv", "README.md"] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] diff --git a/docs/core/aot.rst b/docs/core/aot.rst new file mode 100644 index 000000000..04c897070 --- /dev/null +++ b/docs/core/aot.rst @@ -0,0 +1,39 @@ +`iree.turbine.aot` +===================== + +aot +-------------- + +.. automodule:: iree.turbine.aot + :imported-members: + :members: + :undoc-members: + +passes +-------------- + +.. automodule:: iree.turbine.aot.passes + :imported-members: + :members: + :undoc-members: + +support +-------------- + +.. automodule:: iree.turbine.aot.support.procedural + :imported-members: + :members: + :undoc-members: + +.. automodule:: iree.turbine.aot.support.procedural.exported_program + :members: + :undoc-members: + +build actions +-------------- + +.. py:module:: iree.turbine.aot.build_actions + +.. autofunction:: turbine_generate +.. autoclass:: RemoteGenerator +.. autoclass:: TurbineBuilderAction diff --git a/docs/core/dynamo.rst b/docs/core/dynamo.rst new file mode 100644 index 000000000..833744336 --- /dev/null +++ b/docs/core/dynamo.rst @@ -0,0 +1,7 @@ +`iree.turbine.dynamo` +===================== + +.. automodule:: iree.turbine.dynamo + :imported-members: + :members: + :undoc-members: diff --git a/docs/core/runtime.rst b/docs/core/runtime.rst new file mode 100644 index 000000000..6570da492 --- /dev/null +++ b/docs/core/runtime.rst @@ -0,0 +1,15 @@ +`iree.turbine.runtime` +===================== + +.. automodule:: iree.turbine.runtime + :imported-members: + :members: + :undoc-members: + +op_reg +-------------- + +.. automodule:: iree.turbine.runtime.op_reg + :imported-members: + :members: + :undoc-members: diff --git a/docs/core/support.rst b/docs/core/support.rst new file mode 100644 index 000000000..4b6f558a4 --- /dev/null +++ b/docs/core/support.rst @@ -0,0 +1,32 @@ +`iree.turbine.support` +===================== + +.. automodule:: iree.turbine.support + :imported-members: + :members: + :undoc-members: + +conversions +-------------- + +.. py:module:: iree.turbine.support.conversions + +.. autofunction:: dtype_to_element_type +.. autofunction:: torch_dtype_to_numpy + +debugging +-------------- + +.. py:module:: iree.turbine.support.debugging + +.. autoclass:: DebugFlags + :members: + :undoc-members: + +logging +-------------- + +.. py:module:: iree.turbine.support.logging + +.. autoclass:: DefaultFormatter +.. autofunction:: get_logger diff --git a/docs/core/tools.rst b/docs/core/tools.rst new file mode 100644 index 000000000..0eaade84b --- /dev/null +++ b/docs/core/tools.rst @@ -0,0 +1,8 @@ +`iree.turbine.tools` +===================== + +.. py:module:: iree.turbine.tools + +.. autoclass:: Interpreter + :members: + :undoc-members: diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..3d3f87585 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,39 @@ +IREE Turbine documentation +========================== + +Welcome to the documentation for https://github.com/iree-org/iree-turbine! + +API reference material +================= + +.. toctree:: + :maxdepth: 1 + :caption: IREE Turbine Core + :glob: + + core/* + +.. toctree:: + :maxdepth: 1 + :caption: TK and TKW + :glob: + + kernel/* + + +Project documentation +================= + +.. toctree:: + :maxdepth: 1 + :caption: Infrastructure + :glob: + + infra/* + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/releasing.md b/docs/infra/releasing.md similarity index 89% rename from docs/releasing.md rename to docs/infra/releasing.md index a2e6c3323..7b65bfe35 100644 --- a/docs/releasing.md +++ b/docs/infra/releasing.md @@ -1,8 +1,8 @@ -# Releasing iree-turbine +# Releasing iree-turbine packages -This project hosts the https://pypi.org/project/iree-turbine/ package, which -depends on the https://pypi.org/project/iree-base-compiler/ and -https://pypi.org/project/iree-base-runtime/ packages. Releases can either be +This project hosts the package, which +depends on the and + packages. Releases can either be conducted independently, or they can be coordinated across projects by initiating a release here. diff --git a/docs/kernel/wave.rst b/docs/kernel/wave.rst new file mode 100644 index 000000000..b0acf909d --- /dev/null +++ b/docs/kernel/wave.rst @@ -0,0 +1,8 @@ +TKW (`turbine.kernel.wave`) +=========================== + +.. py:module:: iree.turbine.kernel.wave.wave + +.. autoclass:: LaunchableWave + :members: + :undoc-members: diff --git a/docs/kernel/wave_codegen.rst b/docs/kernel/wave_codegen.rst new file mode 100644 index 000000000..5b62c3ed0 --- /dev/null +++ b/docs/kernel/wave_codegen.rst @@ -0,0 +1,6 @@ +Wave Codegen +============ + +.. automodule:: iree.turbine.kernel.wave.codegen + :members: + :undoc-members: diff --git a/docs/kernel/wave_ops.rst b/docs/kernel/wave_ops.rst new file mode 100644 index 000000000..84e50328f --- /dev/null +++ b/docs/kernel/wave_ops.rst @@ -0,0 +1,6 @@ +Wave Ops +=================== + +.. automodule:: iree.turbine.kernel.ops.wave_ops + :members: + :undoc-members: diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..afeb7db29 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx==8.1.3 +sphinx-autobuild==2024.10.3 +sphinx-rtd-theme==3.0.2 +myst-parser==4.0.0