Skip to content

Commit 2f780ba

Browse files
committed
[Doc] Use sphinx to generate docs.
1 parent c7374d9 commit 2f780ba

File tree

14 files changed

+509
-0
lines changed

14 files changed

+509
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_build/

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= python -m sphinx
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Tile Language Documentation
2+
3+
The documentation was built upon [Sphinx](https://www.sphinx-doc.org/en/master/).
4+
5+
## Dependencies
6+
7+
Run the following command in this directory to install dependencies first:
8+
9+
```bash
10+
pip3 install -r requirements.txt
11+
```
12+
13+
## Build the Documentation
14+
15+
Then you can build the documentation by running:
16+
17+
```bash
18+
make html
19+
```
20+
21+
## View the Documentation
22+
23+
Run the following command to start a simple HTTP server:
24+
25+
```bash
26+
cd _build/html
27+
python3 -m http.server
28+
```
29+
30+
Then you can view the documentation in your browser at `http://localhost:8000` (the port can be customized by appending ` -p PORT_NUMBER` in the python command above).

docs/_static/img/logo-row.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/conf.py

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# -*- coding: utf-8 -*-
2+
import os
3+
import sys
4+
5+
import tlcpack_sphinx_addon
6+
7+
# -- General configuration ------------------------------------------------
8+
9+
sys.path.insert(0, os.path.abspath("../tilelang"))
10+
sys.path.insert(0, os.path.abspath("../"))
11+
autodoc_mock_imports = ["torch"]
12+
13+
# General information about the project.
14+
project = "tilelang"
15+
author = " Contributors"
16+
copyright = "2025-2025, %s" % author
17+
18+
# Version information.
19+
20+
version = "0.1.0"
21+
release = "0.1.0"
22+
23+
extensions = [
24+
"sphinx_tabs.tabs",
25+
"sphinx_toolbox.collapse",
26+
"sphinxcontrib.httpdomain",
27+
"sphinx.ext.autodoc",
28+
"sphinx.ext.napoleon",
29+
"sphinx_reredirects",
30+
]
31+
32+
redirects = {"get_started/try_out": "../index.html#getting-started"}
33+
34+
source_suffix = [".rst"]
35+
36+
language = "en"
37+
38+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
39+
40+
# The name of the Pygments (syntax highlighting) style to use.
41+
pygments_style = "sphinx"
42+
43+
# A list of ignored prefixes for module index sorting.
44+
# If true, `todo` and `todoList` produce output, else they produce nothing.
45+
todo_include_todos = False
46+
47+
# -- Options for HTML output ----------------------------------------------
48+
49+
# The theme is set by the make target
50+
import sphinx_rtd_theme
51+
52+
html_theme = "sphinx_rtd_theme"
53+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
54+
55+
templates_path = []
56+
57+
html_static_path = []
58+
59+
footer_copyright = "© 2025-2025 Tile Language"
60+
footer_note = " "
61+
62+
html_logo = "_static/img/logo-row.svg"
63+
64+
html_theme_options = {
65+
"logo_only": True,
66+
}
67+
68+
header_links = [
69+
("Home", "https://github.com/tile-ai/tilelang"),
70+
("Github", "https://github.com/tile-ai/tilelang"),
71+
("Discord Server", "https://discord.gg"),
72+
]
73+
74+
header_dropdown = {
75+
"name": "Other Resources",
76+
"items": [
77+
78+
],
79+
}
80+
81+
html_context = {
82+
"footer_copyright": footer_copyright,
83+
"footer_note": footer_note,
84+
"header_links": header_links,
85+
"header_dropdown": header_dropdown,
86+
"display_github": True,
87+
"github_user": "tile-ai",
88+
"github_repo": "tilelang",
89+
"github_version": "main/docs/",
90+
"theme_vcs_pageview_mode": "edit",
91+
# "header_logo": "/path/to/logo",
92+
# "header_logo_link": "",
93+
# "version_selecter": "",
94+
}
95+
96+
97+
# add additional overrides
98+
templates_path += [tlcpack_sphinx_addon.get_templates_path()]
99+
html_static_path += [tlcpack_sphinx_addon.get_static_path()]

docs/get_started/Installation.rst

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
Installation Guide
2+
==================
3+
4+
Installing with pip
5+
-------------------
6+
7+
**Prerequisites for installation via wheel or PyPI:**
8+
9+
- **Operating System**: Ubuntu 20.04 or later
10+
11+
- **Python Version**: >= 3.8
12+
13+
- **CUDA Version**: >= 11.0
14+
15+
The easiest way to install TileLang is directly from PyPI using pip. To install the latest version, run the following command in your terminal:
16+
17+
.. code:: bash
18+
19+
pip install tilelang
20+
21+
Alternatively, you may choose to install TileLang using prebuilt packages available on the Release Page:
22+
23+
.. code:: bash
24+
25+
pip install tilelang-0.0.0.dev0+ubuntu.20.4.cu120-py3-none-any.whl
26+
27+
To install the latest version of TileLang from the GitHub repository, you can run the following command:
28+
29+
.. code:: bash
30+
31+
pip install git+https://github.com/tile-ai/tilelang.git
32+
33+
After installing TileLang, you can verify the installation by running:
34+
35+
.. code:: bash
36+
37+
python -c "import tilelang; print(tilelang.__version__)"
38+
39+
Building from Source
40+
--------------------
41+
42+
**Prerequisites for building from source:**
43+
44+
- **Operating System**: Linux
45+
46+
- **Python Version**: >= 3.7
47+
48+
- **CUDA Version**: >= 10.0
49+
50+
We recommend using a Docker container with the necessary dependencies to build TileLang from source. You can use the following command to run a Docker container with the required dependencies:
51+
52+
.. code:: bash
53+
54+
docker run --gpus all -it --rm --ipc=host nvcr.io/nvidia/pytorch:23.01-py3
55+
56+
To build and install TileLang directly from source, follow these steps. This process requires certain pre-requisites from Apache TVM, which can be installed on Ubuntu/Debian-based systems using the following commands:
57+
58+
.. code:: bash
59+
60+
sudo apt-get update
61+
sudo apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev
62+
63+
After installing the prerequisites, you can clone the TileLang repository and install it using pip:
64+
65+
.. code:: bash
66+
67+
git clone --recursive https://github.com/tile-ai/tilelang.git
68+
cd TileLang
69+
pip install . # Please be patient, this may take some time.
70+
71+
If you want to install TileLang in development mode, you can run the following command:
72+
73+
.. code:: bash
74+
75+
pip install -e .
76+
77+
We currently provide three methods to install **TileLang**:
78+
79+
1. Install from Source (using your own TVM installation)
80+
81+
2. Install from Source (using the bundled TVM submodule)
82+
83+
3. Install Using the Provided Script
84+
85+
86+
Method 1: Install from Source (Using Your Own TVM Installation)
87+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88+
89+
If you already have a compatible TVM installation, follow these steps:
90+
91+
1. **Clone the Repository**:
92+
93+
.. code:: bash
94+
95+
git clone --recursive https://github.com/tile-ai/tilelang
96+
cd TileLang
97+
98+
**Note**: Use the `--recursive` flag to include necessary submodules.
99+
100+
2. **Configure Build Options**:
101+
102+
Create a build directory and specify your existing TVM path:
103+
104+
.. code:: bash
105+
106+
mkdir build
107+
cd build
108+
cmake .. -DTVM_PREBUILD_PATH=/your/path/to/tvm/build # e.g., /workspace/tvm/build
109+
make -j 16
110+
111+
3. **Set Environment Variables**:
112+
113+
Update `PYTHONPATH` to include the `tile-lang` Python module:
114+
115+
.. code:: bash
116+
117+
export PYTHONPATH=/your/path/to/tile-lang/python:$PYTHONPATH
118+
# TVM_IMPORT_PYTHON_PATH is used by 3rd-party frameworks to import TVM
119+
export TVM_IMPORT_PYTHON_PATH=/your/path/to/tvm/python
120+
121+
Method 2: Install from Source (Using the Bundled TVM Submodule)
122+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123+
124+
If you prefer to use the built-in TVM version, follow these instructions:
125+
126+
1. **Clone the Repository**:
127+
128+
.. code:: bash
129+
130+
git clone --recursive https://github.com/tile-ai/tilelang
131+
cd TileLang
132+
133+
**Note**: Ensure the `--recursive` flag is included to fetch submodules.
134+
135+
2. **Configure Build Options**:
136+
137+
Copy the configuration file and enable the desired backends (e.g., LLVM and CUDA):
138+
139+
.. code:: bash
140+
141+
mkdir build
142+
cp 3rdparty/tvm/cmake/config.cmake build
143+
cd build
144+
echo "set(USE_LLVM ON)" >> config.cmake
145+
echo "set(USE_CUDA ON)" >> config.cmake
146+
# or echo "set(USE_ROCM ON)" >> config.cmake to enable ROCm runtime
147+
cmake ..
148+
make -j 16
149+
150+
The build outputs (e.g., `libtilelang.so`, `libtvm.so`, `libtvm_runtime.so`) will be generated in the `build` directory.
151+
152+
3. **Set Environment Variables**:
153+
154+
Ensure the `tile-lang` Python package is in your `PYTHONPATH`:
155+
156+
.. code:: bash
157+
158+
export PYTHONPATH=/your/path/to/TileLang/python:$PYTHONPATH
159+
160+
Method 3: Install Using the Provided Script
161+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162+
163+
For a simplified installation, use the provided script:
164+
165+
1. **Clone the Repository**:
166+
167+
.. code:: bash
168+
169+
git clone --recursive https://github.com/tile-ai/tilelang
170+
cd TileLang
171+
172+
2. **Run the Installation Script**:
173+
174+
.. code:: bash
175+
176+
bash install.sh
177+
# or bash `install_amd.sh` if you want to enable ROCm runtime

0 commit comments

Comments
 (0)