Skip to content

Commit 5e11da4

Browse files
authored
Fix sphinx warnings (#871)
1 parent d963181 commit 5e11da4

36 files changed

+587
-165
lines changed

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def connect(self, event: str, callback: Callable[..., None]) -> None:
176176
# Output directory for HTML files
177177
html_output_dir = "../site"
178178

179+
# Base URL for sitemap and canonical links
180+
html_baseurl = "https://helionlang.com/"
181+
179182
# -- Options for autodoc extension ------------------------------------------
180183

181184
autodoc_default_options = {

examples/README.rst

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Helion Examples
2-
==============
2+
===============
33

44
This directory contains examples demonstrating how to use Helion for high-performance tensor operations.
55
The examples are organized into the following categories:
66

77
Basic Operations
8-
~~~~~~~~~~~~~~~
8+
~~~~~~~~~~~~~~~~
99

1010
- :doc:`add.py <add>`: Element-wise addition with broadcasting support
1111
- :doc:`exp.py <exp>`: Element-wise exponential function
@@ -15,7 +15,7 @@ Basic Operations
1515

1616

1717
Matrix Multiplication Operations
18-
~~~~~~~~~~~~~~~~
18+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1919

2020
- :doc:`matmul.py <matmul>`: Basic matrix multiplication
2121
- :doc:`bmm.py <bmm>`: Batch matrix multiplication
@@ -24,13 +24,13 @@ Matrix Multiplication Operations
2424
- :doc:`fp8_gemm.py <fp8_gemm>`: Matrix multiplication using FP8 precision
2525

2626
Attention Operations
27-
~~~~~~~~~~~~~~~~~~~
27+
~~~~~~~~~~~~~~~~~~~~
2828

2929
- :doc:`attention.py <attention>`: Scaled dot-product attention mechanism
3030
- :doc:`fp8_attention.py <fp8_attention>`: Attention mechanism using FP8 precision
3131

3232
Normalization
33-
~~~~~~~~~~~~
33+
~~~~~~~~~~~~~
3434

3535
- :doc:`rms_norm.py <rms_norm>`: Root Mean Square (RMS) normalization
3636

@@ -43,7 +43,7 @@ Sparse and Jagged Tensors
4343
- :doc:`moe_matmul_ogs.py <moe_matmul_ogs>`: Mixture-of-Experts matrix multiplication using Outer-Gather-Scatter
4444

4545
Other Operations
46-
~~~~~~~~~~~~~~~
46+
~~~~~~~~~~~~~~~~
4747

4848
- :doc:`concatenate.py <concatenate>`: Tensor concatenation along a dimension
4949
- :doc:`cross_entropy.py <cross_entropy>`: Cross entropy loss function
@@ -55,26 +55,6 @@ Other Operations
5555
:maxdepth: 2
5656
:caption: Contents
5757
:hidden:
58+
:glob:
5859

59-
add
60-
all_gather_matmul
61-
all_reduce
62-
attention
63-
bmm
64-
concatenate
65-
cross_entropy
66-
embedding
67-
exp
68-
fp8_attention
69-
fp8_gemm
70-
jagged_dense_add
71-
jagged_mean
72-
long_sum
73-
matmul
74-
matmul_layernorm
75-
matmul_split_k
76-
moe_matmul_ogs
77-
rms_norm
78-
segment_reduction
79-
softmax
80-
sum
60+
*

examples/add.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"""
22
Element-wise Addition Example
3-
===========================
3+
=============================
44
55
This example demonstrates how to implement an element-wise addition kernel using Helion.
66
"""
77

88
# %%
99
# Imports
1010
# -------
11+
12+
# %%
1113
from __future__ import annotations
1214

1315
import torch
@@ -16,10 +18,12 @@
1618
from helion._testing import run_example
1719
import helion.language as hl
1820

19-
2021
# %%
2122
# Addition Kernel
22-
# --------------
23+
# ---------------
24+
25+
26+
# %%
2327
@helion.kernel()
2428
def add(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
2529
"""
@@ -48,7 +52,10 @@ def add(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
4852

4953
# %%
5054
# Verification Function
51-
# -------------------
55+
# ---------------------
56+
57+
58+
# %%
5259
def check(m: int, n: int) -> None:
5360
"""
5461
Verify the add kernel implementation against PyTorch's native add function.
@@ -64,7 +71,10 @@ def check(m: int, n: int) -> None:
6471

6572
# %%
6673
# Main Function
67-
# -----------
74+
# -------------
75+
76+
77+
# %%
6878
def main() -> None:
6979
"""
7080
Main entry point that runs the add kernel verification with 1024x1024 tensors.

examples/all_gather_matmul.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# %%
1010
# Imports
1111
# -------
12+
13+
# %%
1214
from __future__ import annotations
1315

1416
import os

examples/all_reduce.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
One-Shot All-Reduce Example
3-
========================================
3+
===========================
44
This example demonstrates how to implement a one-shot pulling all-reduce operation
55
using Helion and PyTorch's distributed capabilities. It includes a Helion kernel
66
demonstrating how to do cross-device synchronization using symmetric memory signal pads
@@ -10,6 +10,8 @@
1010
# %%
1111
# Imports
1212
# -------
13+
14+
# %%
1315
from __future__ import annotations
1416

1517
import os
@@ -24,6 +26,8 @@
2426

2527
# %%
2628
# Work around before symm mem natively supports extract dev_ptrs as tensors: from_blob
29+
30+
# %%
2731
from_blob_cpp = """
2832
#include <cuda.h>
2933
#include <cuda_runtime.h>
@@ -72,7 +76,10 @@ def dev_array_to_tensor_short(
7276

7377
# %%
7478
# One Shot All-Reduce Kernel Implementation
75-
# ----------------------------------------
79+
# -----------------------------------------
80+
81+
82+
# %%
7683
@helion.jit(
7784
config=helion.Config(
7885
block_sizes=[8192],
@@ -159,7 +166,10 @@ def one_shot_all_reduce_kernel(
159166

160167
# %%
161168
# Attract tensors from symmetric memory handler
162-
# ----------------------------------------
169+
# ---------------------------------------------
170+
171+
172+
# %%
163173
def helion_one_shot_all_reduce(a_shared: torch.Tensor) -> torch.Tensor:
164174
"""
165175
Prepares symmetric memory tensors for Helion one-shot all-reduce kernel.
@@ -203,7 +213,10 @@ def helion_one_shot_all_reduce(a_shared: torch.Tensor) -> torch.Tensor:
203213

204214
# %%
205215
# Testing Function
206-
# ----------------------------------------
216+
# ----------------
217+
218+
219+
# %%
207220
def test(N: int, device: torch.device, dtype: torch.dtype) -> None:
208221
"""
209222
Test the Helion all-reduce implementation against PyTorch's reference implementation.

examples/attention.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Attention Example
3-
========================
3+
=================
44
55
This code implements a custom attention kernel using Helion and PyTorch for efficient computation of scaled dot-product attention,
66
with support for both static and dynamic input shapes.
@@ -9,6 +9,8 @@
99
# %%
1010
# Imports
1111
# -------
12+
13+
# %%
1214
from __future__ import annotations
1315

1416
import math
@@ -22,10 +24,12 @@
2224
from helion._testing import run_example
2325
import helion.language as hl
2426

25-
2627
# %%
2728
# Attention Kernel Implementation
28-
# ----------------------------
29+
# -------------------------------
30+
31+
32+
# %%
2933
@helion.kernel(
3034
# Static shapes provides a speedup for attention
3135
static_shapes=True,
@@ -86,7 +90,9 @@ def attention(
8690

8791
# %%
8892
# Dynamic Shape Version
89-
# ------------------
93+
# ---------------------
94+
95+
# %%
9096
attention_dynamic: object = helion.kernel( # pyright: ignore[reportCallIssue]
9197
attention.fn,
9298
configs=attention.configs, # pyright: ignore[reportArgumentType]
@@ -100,7 +106,10 @@ def attention(
100106

101107
# %%
102108
# Testing Function
103-
# -------------
109+
# ----------------
110+
111+
112+
# %%
104113
def test(
105114
z: int,
106115
h: int,
@@ -147,7 +156,10 @@ def ref_attention(
147156

148157
# %%
149158
# Main Function
150-
# -----------
159+
# -------------
160+
161+
162+
# %%
151163
def main() -> None:
152164
"""
153165
Main entry point that runs the attention kernel test with specific parameters.

examples/bmm.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"""
22
Batch Matrix Multiplication Example
3-
===============================
3+
===================================
44
55
This example demonstrates how to implement a batch matrix multiplication kernel using Helion.
66
"""
77

88
# %%
99
# Imports
1010
# -------
11+
12+
# %%
1113
from __future__ import annotations
1214

1315
from packaging import version
@@ -17,11 +19,13 @@
1719
from helion._testing import run_example
1820
import helion.language as hl
1921

20-
2122
# %%
2223
# Batch Matrix Multiplication Kernel
23-
# -------------------------------
24+
# ----------------------------------
2425
# static_shapes=True gives a performance boost for matmuls
26+
27+
28+
# %%
2529
@helion.kernel(static_shapes=True)
2630
def bmm(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
2731
"""
@@ -52,7 +56,10 @@ def bmm(A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
5256

5357
# %%
5458
# Verification Function
55-
# -------------------
59+
# ---------------------
60+
61+
62+
# %%
5663
def check(b: int, m: int, k: int, n: int) -> None:
5764
"""
5865
Verify the bmm kernel implementation against PyTorch's native bmm function.
@@ -70,7 +77,10 @@ def check(b: int, m: int, k: int, n: int) -> None:
7077

7178
# %%
7279
# Main Function
73-
# -----------
80+
# -------------
81+
82+
83+
# %%
7484
def main() -> None:
7585
"""
7686
Main entry point that runs the bmm kernel verification with specific parameters.

examples/concatenate.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"""
22
Tensor Concatenation Example
3-
========================
3+
============================
44
55
This example demonstrates how to implement a tensor concatenation operation using Helion.
66
"""
77

88
# %%
99
# Imports
1010
# -------
11+
12+
# %%
1113
from __future__ import annotations
1214

1315
import torch
@@ -16,10 +18,12 @@
1618
from helion._testing import run_example
1719
import helion.language as hl
1820

19-
2021
# %%
2122
# Concatenation Kernel
22-
# -----------------
23+
# --------------------
24+
25+
26+
# %%
2327
@helion.kernel()
2428
def concat2d_dim1(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
2529
"""
@@ -54,7 +58,10 @@ def concat2d_dim1(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
5458

5559
# %%
5660
# Main Function
57-
# -----------
61+
# -------------
62+
63+
64+
# %%
5865
def main() -> None:
5966
"""
6067
Main entry point that runs the concatenation kernel verification.

0 commit comments

Comments
 (0)