Helion Examples
This directory contains examples demonstrating how to use Helion for high-performance tensor operations. The examples are organized into the following categories:
Basic Operations
add.py
: Element-wise addition with broadcasting supportexp.py
: Element-wise exponential functionsum.py
: Sum reduction along the last dimensionlong_sum.py
: Efficient sum reduction along a long dimensionsoftmax.py
: Different implementations of the softmax function
Matrix Multiplication Operations
matmul.py
: Basic matrix multiplicationbmm.py
: Batch matrix multiplicationmatmul_split_k.py
: Matrix multiplication using split-K algorithm for better parallelismmatmul_layernorm.py
: Fused matrix multiplication and layer normalizationfp8_gemm.py
: Matrix multiplication using FP8 precision
Attention Operations
attention.py
: Scaled dot-product attention mechanismfp8_attention.py
: Attention mechanism using FP8 precision
Normalization
rms_norm.py
: Root Mean Square (RMS) normalization
Sparse and Jagged Tensors
jagged_dense_add.py
: Addition between a jagged tensor and a dense tensorjagged_mean.py
: Computing the mean of each row in a jagged tensorsegment_reduction.py
: Segmented reduction operationmoe_matmul_ogs.py
: Mixture-of-Experts matrix multiplication using Outer-Gather-Scatter
Other Operations
concatenate.py
: Tensor concatenation along a dimensioncross_entropy.py
: Cross entropy loss functionembedding.py
: Embedding lookup operationall_gather_matmul.py
: All-gather operation followed by matrix multiplication

FP8 General Matrix Multiplication (GEMM) with Helion

Matrix Multiplication with Layer Normalization Example

Mixture-of-Experts (MoE) Matmul with Outer-Gather-Scatter (OGS)