Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/setup-environment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ runs:
}

# Install required packages
install_package git
install_package git
install_package cmake
shell: bash

Expand All @@ -45,7 +45,7 @@ runs:
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Setup proxy cache
uses: nv-gha-runners/setup-proxy-cache@main
if: hashFiles('/etc/buildkit/buildkitd.toml') != ''
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
permissions:
contents: read
pages: write
id-token: write
id-token: write

jobs:
build:
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/format-and-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Format & Lint

on:
push:
branches:
branches:
- "pull-request/[0-9]+"

concurrency:
Expand All @@ -23,7 +23,33 @@ jobs:
with:
python-version: '3.10'

- name: Check format and lint
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-

- name: Install and setup pre-commit
run: |
echo "Pre-commit version: $(pre-commit --version)"
pre-commit install-hooks

- name: Run pre-commit checks
run: |
echo "Running all pre-commit hooks (skipping commit signature check)..."
SKIP=check-commit-signature pre-commit run --all-files --show-diff-on-failure

- name: Check for uncommitted changes
run: |
pip list | grep -E 'ruff|mypy' # show ruff and mypy versions
bash .github/workflows/scripts/check-format-and-lint.sh
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Files were modified by pre-commit hooks. Please run 'pre-commit run --all-files' locally and commit the changes."
echo "Modified files:"
git status --porcelain
echo "Showing diff:"
git diff
exit 1
else
echo "✅ No files were modified - all checks passed!"
fi
5 changes: 1 addition & 4 deletions .github/workflows/scripts/run-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ echo "Found $(echo "$pyfiles" | wc -l) Python files"
# Loop through each file more traditionally
for script in $pyfiles; do
((total_scripts++))

if ! run_script "$script"; then
failed_scripts+=("$script")
((failed_count++))
Expand All @@ -64,6 +64,3 @@ else
echo "All scripts passed successfully!"
exit 0
fi



10 changes: 5 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR Tests

on:
push:
branches:
branches:
- "pull-request/[0-9]+"

concurrency:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
examples/**
pyproject.toml
base_sha: 'origin/main'

- name: Check for changes in docs
id: changed-docs
uses: step-security/changed-files@v46
Expand All @@ -59,7 +59,7 @@ jobs:
continue-on-error: true
strategy:
matrix:
runner:
runner:
- linux-amd64-gpu-l4-latest-1
runs-on: ${{ matrix.runner }}
container:
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
run: |
pip install wheel
pip install torch==2.8 # since flash-attn only has pre-built wheels for torch<=2.8, todo: update this when flash-attn supports torch>=2.9
pip install flash-attn --no-build-isolation
pip install flash-attn --no-build-isolation

- name: Run examples
run: |
Expand All @@ -144,7 +144,7 @@ jobs:
echo "Tests result: ${{ needs.tests.result }}"
echo "Docs result: ${{ needs.docs.result }}"
echo "Examples result: ${{ needs.examples.result }}"

# Check if any required job failed
if [[ "${{ needs.tests.result }}" == "failure" ]] || [[ "${{ needs.docs.result }}" == "failure" ]] || [[ "${{ needs.examples.result }}" == "failure" ]]; then
echo "One or more functional tests failed"
Expand Down
45 changes: 45 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version
rev: v0.12.3
hooks:
# Run the linter with fixes (CI will detect if files were modified)
- id: ruff-check
name: Ruff linter
args: [--fix]
types_or: [python, pyi, jupyter]
# Run the formatter - uses [tool.ruff] config from pyproject.toml
- id: ruff-format
name: Ruff formatter
types_or: [python, pyi, jupyter]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
name: MyPy type checking
# Uses [tool.mypy] configuration from pyproject.toml
additional_dependencies: [
types-tabulate,
types-tqdm,
]
# Only check files in the python package (matches original script scope)
files: ^python/
# Exclude hidet extensions (they have special mypy overrides in pyproject.toml)
exclude: ^python/tilus/extensions/hidet/
- repo: local
hooks:
- id: check-copyright-header
name: Check copyright headers
entry: python scripts/lint/check-copyright-header.py --check-and-fix
language: system
types: [python]
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Tilus is pronounced as tie-lus, /ˈtaɪləs/.
### Installation
Install Tilus using `pip`:
```
pip install tilus
pip install tilus
```

> [!NOTE]
> [!NOTE]
> Tilus depends on `cuda-python`. If your GPU driver is older than **580.65.06**, you will need to install an older version of cuda-python to ensure compatibility.
> ```
> pip install tilus "cuda-python<13"
> ```

### Usage

To get started, refer to the [tutorials](https://nvidia.github.io/tilus/getting-started/tutorials/__init__.html) to learn how to program kernels with Tilus.
To get started, refer to the [tutorials](https://nvidia.github.io/tilus/getting-started/tutorials/__init__.html) to learn how to program kernels with Tilus.

You can also check more [examples](https://github.com/NVIDIA/tilus/tree/main/examples) of using Tilus.

Expand All @@ -50,5 +50,5 @@ This project is based on the following research paper:
We would like to acknowledge the following projects for their influence on Tilus's design and development:
- **Hidet**: We take Hidet IR as our low-level target and reuse its runtime system.
- **TVM**: Hidet's initial IR was adopted from TVM, and we also learned a lot from TVM on how to build a compiler.
- **Triton**: The core idea of defining kernels at a thread-block level and working with tiles was inspired by Triton.
- **Triton**: The core idea of defining kernels at a thread-block level and working with tiles was inspired by Triton.
- **Hexcute**: We adopted the idea of using automatic layout inference to simplify programming from Hexcute.
2 changes: 1 addition & 1 deletion docs/source/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
See: https://github.com/executablebooks/sphinx-book-theme/issues/732 */
#rtd-footer-container {
margin: 0px !important;
}
}
51 changes: 23 additions & 28 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@
#
# 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 glob
import shutil
import sphinx_gallery.sorting

import tilus.utils

# from sphinx_gallery.sorting import FileNameSortKey

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'tilus'
copyright = '2025, NVIDIA'
author = 'NVIDIA'
project = "tilus"
copyright = "2025, NVIDIA"
author = "NVIDIA"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -25,30 +20,30 @@
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.coverage',
'sphinx.ext.todo',
'sphinx.ext.graphviz',
'sphinx.ext.doctest',
'sphinx_copybutton',
'autodocsumm',
'sphinx_gallery.gen_gallery'
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx.ext.coverage",
"sphinx.ext.todo",
"sphinx.ext.graphviz",
"sphinx.ext.doctest",
"sphinx_copybutton",
"autodocsumm",
"sphinx_gallery.gen_gallery",
]

autodoc_typehints = "description"
autoclass_content = 'class'
autodoc_class_signature = 'separated'
autodoc_member_order = 'alphabetical'
autoclass_content = "class"
autodoc_class_signature = "separated"
autodoc_member_order = "alphabetical"

templates_path = ['_templates']
templates_path = ["_templates"]
exclude_patterns = []

sphinx_gallery_conf = {
'examples_dirs': ['../../examples/matmul'],
'gallery_dirs': ['getting-started/tutorials/matmul'],
'filename_pattern': r'.*\.py',
'download_all_examples': True,
"examples_dirs": ["../../examples/matmul"],
"gallery_dirs": ["getting-started/tutorials/matmul"],
"filename_pattern": r".*\.py",
"download_all_examples": True,
}

intersphinx_mapping = {
Expand All @@ -60,14 +55,14 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_theme = "sphinx_book_theme"
html_theme_options = {
"repository_url": "https://github.com/NVIDIA/tilus",
"use_repository_button": True,
"show_navbar_depth": 1,
}
html_static_path = ['_static']
html_static_path = ["_static"]
html_css_files = [
'custom.css',
"custom.css",
]
html_permalinks_icon = "<span>¶</span>"
2 changes: 1 addition & 1 deletion docs/source/getting-started/tutorials/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
matmul/
matmul/
1 change: 0 additions & 1 deletion docs/source/programming-guides/autotuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,3 @@ When we launch the kernel, tilus will automatically compile the kernel with all
The kernels will be compiled in parallel when we first call the kernel with a specific input size triggering the JIT
compilation (:doc:`tilus-script`). We can use :py:func:`tilus.option.parallel_workers` to control the number of
parallel workers to compile the kernels.

1 change: 0 additions & 1 deletion docs/source/programming-guides/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@ The cache directory contains the following structure (only show the important pa
- **options.txt** the options used to compile the program

- ...

1 change: 0 additions & 1 deletion docs/source/programming-guides/control-flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,3 @@ In addition to the control flow statements mentioned above, Tilus Script also su
When encountered, it will immediately terminate the innermost loop and continue execution after the loop.
- **continue**: This statement can be used to skip the current iteration of a loop and continue with the next iteration.
When encountered, it will immediately jump to the next iteration of the innermost loop.

1 change: 0 additions & 1 deletion docs/source/programming-guides/layout-system/__init__.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ We require the user to explicitly or implicitly define the layout of global tens
the kernel and the host. As for shared and register tensors, the layout can be explicitly defined by the user, or
automatically inferred by the tilus compiler based on the usage of the tensor. We give a brief overview of the layout
inference algorithm adopted by tilus in :doc:`layout-inference`.

Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ validation phase. Each instruction has a pre-defined validation rule that checks
If we inferred all layouts successfully and all of them are valid, we will proceed to subsequent steps of compilation.

If you are interested in the details, feel free to check the source code of the layout inference algorithm in
:py:mod:`tilus.ir.layout.inference`.
:py:mod:`tilus.ir.layout.inference`.
Loading
Loading