Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

AI-bench: Unified AI Benchmarking Suite

Tests Lint KernelBench Perf Status

A benchmarking framework for evaluating AI kernel implementations across multiple backends (PyTorch, Triton, Helion) and devices (CPU, XPU).

Installation

The project is using uv package manager.

uv can be installed locally using:

pip install uv

The project can be installed with appropriate device-specific extensions using:

# CPU only
uv sync --extra cpu

# CPU + XPU
uv sync --extra xpu

Usage

Command Line Interface

After installation, the ai-bench command is available:

# Show help
ai-bench --help

# PyTorch on CPU (default)
ai-bench

# PyTorch on XPU
ai-bench --xpu

# PyTorch compile on XPU
ai-bench --xpu --torch-compile

# Triton on XPU
ai-bench --xpu --triton

# Helion on XPU
ai-bench --xpu --helion

# Benchmark mode (with timing)
ai-bench --xpu --bench

# Log results to CSV
ai-bench --xpu --bench --csv results.csv --note "baseline run"

Using Scripts Directly

Run KernelBench problems with different backends and devices:

# PyTorch on CPU (default)
python infra/scripts/run_kernel_bench.py

# PyTorch on XPU
python infra/scripts/run_kernel_bench.py --xpu

# PyTorch compile on XPU
python infra/scripts/run_kernel_bench.py --xpu --torch-compile

# Triton on XPU
python infra/scripts/run_kernel_bench.py --xpu --triton

# Helion on XPU
python infra/scripts/run_kernel_bench.py --xpu --helion

# Benchmark mode (with timing)
python infra/scripts/run_kernel_bench.py --xpu --bench

# Triton benchmark on XPU
python infra/scripts/run_kernel_bench.py --xpu --triton --bench

As a Library

import ai_bench
import torch

# Configure paths if running outside project root
ai_bench.configure(
    specs_dir="/path/to/specs",
    kernels_dir="/path/to/kernels",
)

# Create benchmark runner
runner = ai_bench.KernelBenchRunner(
    spec_type=ai_bench.SpecKey.V_BENCH_GPU,
    device=torch.device("xpu"),
    backend=ai_bench.Backend.PYTORCH,
    flops_unit=ai_bench.FlopsUnit.TFLOPS,
    mem_bw_unit=ai_bench.MemBwUnit.GBS,
    csv_path="results.csv",
)
runner.run_kernels()

CSV Logging

Benchmark results can be logged to a CSV file using the --csv option:

# Log results to CSV
python infra/scripts/run_kernel_bench.py --xpu --triton --bench --csv results.csv

# Add a note to identify the run
python infra/scripts/run_kernel_bench.py --xpu --triton --bench --csv results.csv --note "BMG card test"

The CSV file includes the following columns:

  • kernel_name: Name of the kernel
  • kernel_type: Backend used (pytorch/triton)
  • problem_level: KernelBench problem level
  • flops: Number of floating-point operations
  • flops_val: Computed FLOPS value
  • flops_unit: FLOPS unit (GFLOPS/TFLOPS)
  • flops_note: FLOPS measurement annotation (see 'Notes legend')
  • mem_bytes: Number of memory bytes transferred - input reads + output writes
  • mem_bw_val: Computed memory bandwidth value
  • mem_bw_unit: Memory bandwidth unit (MB/s or GB/s)
  • mem_note: Memory measurement annotation (see 'Notes legend')
  • time_us: Execution time in microseconds
  • input_values: Input dimensions as JSON
  • note: User-provided note

Additionally, any environment variables prefixed with AIBENCH_ are automatically captured and included in the CSV output. This is useful for recording system configuration:

# Set environment variables for tracking
export AIBENCH_CARD="BMG"
export AIBENCH_SYSTEM="TestRig1"
python infra/scripts/run_kernel_bench.py --xpu --triton --bench --csv results.csv

Notes legend:

  • ⚠️: estimated value, use with caution

Command Line Options

Option Description
--xpu Run on Intel XPU (default: CPU)
--triton Use Triton backend (default: PyTorch)
--torch-compile Use PyTorch compile mode
--bench Run benchmarks with timing (default: CI validation)
--gflops Report GFLOPS (default: TFLOPS)
--mbs Report MB/s (default: GB/s)
--csv PATH Log results to specified CSV file
--note TEXT Add a note to CSV output for identifying runs
--specs-dir PATH Path to specs directory (CLI only)
--kernels-dir PATH Path to kernels directory (CLI only)

Testing

Run tests with pytest:

pytest -v

Linting

The project uses pre-commit to run various checks automatically.

All checks can be run using:

pre-commit run -a

Config variables

Environment variables used for project configuration:

Variable Description
AIBENCH_LOG=INFO|DEBUG|... Globally overrides logging level
AIBENCH_SPECS_DIR Path to specs directory
AIBENCH_KERNELS_DIR Path to PyTorch kernels directory
AIBENCH_TRITON_KERNELS_DIR Path to Triton kernels directory
AIBENCH_HELION_KERNELS_DIR Path to Helion kernels directory

License

MIT License - see LICENSE for details.

Metadata

Release files for ai-bench-suite 0.2.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-bench-suite 0.2.0b1
File Size Uploaded Provenance
ai_bench_suite-0.2.0b1.tar.gz 29.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-bench-suite 0.2.0b1
File Interpreter ABI Platform
ai_bench_suite-0.2.0b1-py3-none-any.whl Python 3 none any Details

Total release size: 52.0 kB

Release files / ai_bench_suite-0.2.0b1.tar.gz

Download URL ai_bench_suite-0.2.0b1.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7493c7c9b3d3fdbf69c58a8fd8b1d8f29b5ce9943e8821d5a3732de368e6f57d
BLAKE2b-256 checksum
How to use checksums
b1401ce3af69cdf04aa0887c54ddab2e44cb08a0af8727df2bfc6b5fb2916ff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / ai_bench_suite-0.2.0b1-py3-none-any.whl

Download URL ai_bench_suite-0.2.0b1-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0e0cb4f63185ff42303f8c3b78b150fd7bd5782320426078ef5b8fa227632fe
BLAKE2b-256 checksum
How to use checksums
21e5c587f4a776bb7cc390dfbed62e326247864b2f7e98fe49f1f2bfb2760a6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for ai-bench-suite 0.2.0b1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page