Skip to main content

aule-attention

FlashAttention that just works. No compilation. Any GPU.

Version: 0.4.0

What's New in 0.4.0

  • AMD MI300X Optimized Kernel: New Triton FlashAttention-2 kernel tuned for CDNA3
    • Auto-detects AMD GPUs and routes to optimized kernel
    • Uses exp2 optimization (faster than exp on AMD hardware)
    • Extended autotune configs for 7B/13B/70B/405B models

MI300X Benchmark Results (vs PyTorch SDPA)

Config Speedup
Llama-70B 4K context +20.4%
Llama-70B 8K context +19.9%
Llama-70B batch=4 +21.0%
Long context (32K-128K) +17-22%
Average across all configs +15%

What's New in 0.3.7

  • Windows DLL included - Cross-compiled Windows support with PagedAttention

What's New in 0.3.6

  • PagedAttention (vLLM-style): Block-based KV cache for 90% memory savings
  • 7-13x Faster Vulkan: New fast shader with 32x32 blocks and vec4 loads
  • Sliding Window Attention: Efficient local attention with window_size parameter
  • Native FP16/BF16 Compute: Triton kernels now use native precision (no FP32 conversion overhead)
  • Multiple Shader Variants: Choose baseline, fast, fp16, or fp16_amd for your hardware
  • Long Context Support: Validated up to 4K+ tokens

Performance Highlights

Feature Improvement
PagedAttention 90% memory savings, 7.9K tokens/sec batched
Fast Shader 7-13x speedup over baseline
Sliding Window (S=1024, W=128) 7.6x faster (544ms → 71ms)
Triton FP16/BF16 ~20-30% faster (native compute)

New Shader Variants API

from aule.vulkan import Aule

with Aule() as aule:
    # Check available variants
    print(aule.available_shader_variants)  # [0, 1, 2, 3]
    print(aule.shader_variant_name)  # "fast" (default)

    # Switch variants
    aule.set_shader_variant(Aule.SHADER_BASELINE)  # 0: Original 16x16
    aule.set_shader_variant(Aule.SHADER_FAST)      # 1: Optimized 32x32 (default)
    aule.set_shader_variant(Aule.SHADER_FP16)      # 2: FP16 with FP32 accumulation
    aule.set_shader_variant(Aule.SHADER_FP16_AMD)  # 3: FP16 for AMD 64-wide wavefronts

Sliding Window Attention

# Mistral-style sliding window (only attend to nearby tokens)
output = aule.attention_gravity(q, k, v, indices, window_size=256)

# Massive speedup for long sequences
# S=4096, window=512 → ~8x faster than full attention

What's New in 0.3.3

  • Windows Vulkan Support: Added Windows DLL - Vulkan backend now works on Windows!
  • Windows AMD Fix: Automatic fallback to Vulkan on Windows + AMD (Triton AMD doesn't support Windows)

What's New in 0.3.0

  • GQA/MQA Support: Full Grouped Query Attention and Multi-Query Attention for Vulkan backend
  • Cross-Attention: Different sequence lengths for Q and K/V tensors
  • ComfyUI Compatible: Works with Stable Diffusion, SDXL, Flux, SD3 (use causal=False)
  • 20% Faster: Phase 1 performance optimizations
  • Bug Fixes: Tensor cache fix for GQA, blocky noise fix for diffusion models

Installation

pip install aule-attention

Quick Start

from aule import flash_attention
import torch

q = torch.randn(1, 8, 512, 64, device='cuda')
k = torch.randn(1, 8, 512, 64, device='cuda')
v = torch.randn(1, 8, 512, 64, device='cuda')

output = flash_attention(q, k, v, causal=True)

ComfyUI / Diffusion Models

import aule
aule.install()  # Patches PyTorch SDPA globally

# Now all models using F.scaled_dot_product_attention use aule
# For diffusion models, causal=False is used automatically

GQA (Grouped Query Attention)

# 32 query heads, 8 key/value heads (4:1 ratio)
q = torch.randn(1, 32, 512, 64)
k = torch.randn(1, 8, 512, 64)
v = torch.randn(1, 8, 512, 64)

output = flash_attention(q, k, v, causal=True)

Features

  • No compilation at install time
  • Works on AMD, NVIDIA, Intel, and Apple GPUs
  • Training support with backward pass (Triton backend)
  • Grouped Query Attention (GQA) and Multi-Query Attention (MQA) support
  • Cross-attention with different Q/KV sequence lengths
  • Sliding window attention for efficient long sequences
  • O(N) memory complexity via FlashAttention-2 algorithm

Backends

Backend Hardware Features
Triton AMD ROCm (Linux), NVIDIA CUDA Training + Inference, head_dim up to 128
Vulkan Any Vulkan 1.2+ GPU (including Windows AMD) Inference, head_dim up to 64, GQA/MQA, Sliding Window
CPU NumPy Fallback, any head_dim

Windows + AMD: Automatically uses Vulkan backend (Triton AMD only supports Linux).

API

from aule import flash_attention, get_available_backends, install

# Compute attention
output = flash_attention(query, key, value, causal=True, scale=None)

# Check available backends
backends = get_available_backends()  # ['vulkan', 'cpu'] or ['triton', 'vulkan', 'cpu']

# Install as PyTorch SDPA replacement (for ComfyUI, Transformers, etc.)
install()  # Auto-select best backend
install(backend='vulkan', verbose=True)  # Force backend + logging

Supported Hardware

Triton Backend (Training + Inference)

  • AMD Instinct: MI300X, MI300A, MI250X, MI250, MI210, MI100
  • NVIDIA Datacenter: H100, A100, A10, L40S
  • NVIDIA Consumer: RTX 4090, 4080, 3090, 3080

Vulkan Backend (Inference)

  • AMD RDNA3: RX 7900 XTX, 7900 XT, 7800 XT
  • AMD RDNA2: RX 6900 XT, 6800 XT, 6700 XT
  • Intel Arc: A770, A750, A580
  • Intel Integrated: 12th/13th/14th Gen
  • Apple Silicon: M1, M2, M3 (via MoltenVK)

License

MIT License - Aule Technologies

Links

Metadata

Release files for aule-attention 0.5.0

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

Source distribution (sdist)

Source distribution for aule-attention 0.5.0
File Size Uploaded Provenance
aule_attention-0.5.0.tar.gz 904.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aule-attention 0.5.0
File Interpreter ABI Platform
aule_attention-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / aule_attention-0.5.0.tar.gz

Download URL aule_attention-0.5.0.tar.gz
Size 904.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f9fb18878122a37a9d92fdbaa38c1a6c15d44fdab680c239ce905957a5693358
BLAKE2b-256 checksum
How to use checksums
de53b473471227135eb393fd0fca04f86ed07880d5176a3caa1e9f77b5a5e3cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / aule_attention-0.5.0-py3-none-any.whl

Download URL aule_attention-0.5.0-py3-none-any.whl
Size 905.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a80898c67a16a54d2eb9863b184b1f1731318247d5f87c3ce44124d2f7dd47a
BLAKE2b-256 checksum
How to use checksums
e704063e122dcd66eb333a8c181f31c2096198cd158c3cc9ad38acc72903c0a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for aule-attention 0.5.0

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