Skip to main content
FACILITY 3DBLOGWriting Custom Triton Kernels for FP8 Inference on Workstation GPUs
RETURN TO RESEARCH ARTICLES
Systems Engineering
11 min read•2026-10-21

Writing Custom Triton Kernels for FP8 Inference on Workstation GPUs

Practical guide to replacing standard PyTorch matrix multiplication with fused FP8 scaled GEMM kernels written in OpenAI Triton.

A
Aarav SharmaSystems Lead, AI Club

### Why Move Beyond PyTorch Native Operators?

Standard deep learning frameworks provide highly optimized cuBLAS calls. However, when combining dequantization, scaling factors, and activation functions, separate kernel launches incur significant memory bandwidth overhead.

Writing fused kernels in OpenAI Triton allows researchers to achieve near-CUDA C++ performance directly in Python without navigating raw PTX assembly.

Memory Coalescing & Block Level Tiling

The primary consideration when writing Triton kernels is aligning memory access patterns with GPU cache line boundaries:


@triton.jit
def fp8_gemm_kernel(
    a_ptr, b_ptr, c_ptr,
    M, N, K,
    stride_am, stride_ak,
    stride_bk, stride_bn,
    stride_cm, stride_cn,
    BLOCK_SIZE_M: tl.constexpr,
    BLOCK_SIZE_N: tl.constexpr,
    BLOCK_SIZE_K: tl.constexpr,
):
    # Kernel code mapping program IDs to matrix tiles
    pid = tl.program_id(axis=0)
    # Tiled matrix multiplication with fused scale multiplication

Benchmark Findings

  • Fused dequantization reduced kernel launch count from 3 to 1.
  • Sustained memory throughput reached **82% of peak theoretical bandwidth** on Ada Lovelace architecture.
ACADEMIC CITATIONS & OFFICIAL REFERENCES

RELATED RESEARCH WRITEUPS