tpt-gpu-kernelgen 0.1.0

TPT GPU kernel generator CLI
tpt-gpu-kernelgen-0.1.0 is not a library.

TPT Kernel Generator

Generates TPTIR kernels either from a built-in template library or, with an AI provider configured, via a full spec → TPTIR → validate → correctness-test → benchmark pipeline.

Prerequisites

  • Rust toolchain (see repo root README.md)
  • Optional, for ai-generate: ANTHROPIC_API_KEY, OPENROUTER_API_KEY, or a local Ollama instance

Installation

cd crates/tpt-gpu-kernelgen
cargo build --release

Usage

# Generate a kernel from the built-in template library
cargo run -- generate matmul --elem f32 --shape 1024

# AI-assisted pipeline (requires an AI provider — see Prerequisites)
cargo run -- ai-generate flash_attention --elem f32 --shape 1024

# Validate a hand-written or generated TPTIR file
cargo run -- validate path/to/kernel.tptir

# Run the built-in benchmark suite
cargo run -- bench --quick

Supported built-in kernels: vector_add, matmul, softmax, flash_attention, conv_bn_relu, conv3d, layer_norm, batch_norm, group_norm.

See also tpt-gpu-kernel-optimizer for tuning the parameters of a generated kernel.