Skip to main content

dew-flash-attn

FlashAttention for JAX, built for Dew. It packages Dao-AILab's CUDA kernels as libraries with no Python ABI that register XLA FFI targets with JAX: FlashAttention-2 through flash_attn_jax's port, and FlashAttention-3, Hopper's kernels, through flash-attn3-jax's torch-free port, all BSD-3.

There is one wheel for each CUDA major of your jax, for Linux x86_64 and any Python from 3.11:

pip install dew-flash-attn-cu12   # jax with jax-cuda12-plugin
pip install dew-flash-attn-cu13   # jax with jax-cuda13-plugin

The wheel ships no CUDA runtime: it needs a CUDA build of JAX of the same major in the same environment (jax[cuda12] or jax[cuda13]), whose libcudart it loads.

With it installed, Dew's attention_impl="auto" runs FlashAttention on an A100 (sm80), an Ada GPU (sm89) and an H100 (sm90) for calls without a mask, bias or softcap, sliding windows and attention sinks included, with heads up to 256 wide. attention_impl="flash" asks for it on any sm8x, sm90 or sm120 GPU.

FlashAttention-2 is compiled for sm80, which every compute capability 8.x runs, and for sm120, Blackwell's workstation and consumer parts (the RTX PRO 6000 and the RTX 50 series). FlashAttention-3 is compiled for sm90a (H100, H200), for bf16 and fp16 heads of 64, 128, 192 and 256 (a narrower head is padded up to the next), with variable lengths and sliding windows and without split keys, paged caches, softcap or fp8. The same two functions run whichever the GPU has.

Called directly:

from dew_flash_attn import flash_mha

out = flash_mha(query, key, value, is_causal=True)  # [B, S, H, D], bf16 or fp16

Key heads may divide the query's (grouped-query attention). The backward pass is the kernel's own.

A sliding window and attention sinks, one learned logit a query head in each row's softmax denominator with no value (gpt-oss, MiMo-V2), go to either function:

out = flash_mha(query, key, value, is_causal=True, window_size=(127, 0), sinks=sinks)  # sinks [H]

window_size (left, right) keeps the left keys before each query and the right after it, -1 bounding neither side. The sinks scale the kernel's output by each row's share of the softmax, sigmoid(lse - sink), and take their gradient from the kernel's own backward.

Packed sequences, [T, H, D] with int32 offsets cu_seqlens [N + 1] from 0 to T, attend each within itself:

from dew_flash_attn import flash_mha_varlen

out = flash_mha_varlen(query, key, value, cu_seqlens, max_seqlen, is_causal=True)

Keys packed by offsets of their own, key_cu_seqlens [N + 1] over the keys' [T_k, H_k, D] with at most key_max_seqlen a sequence, pair sequence i's queries with sequence i's keys alone: cross-attention between packed documents, such as a head's slots reading their own document's tokens.

out = flash_mha_varlen(query, key, value, cu_seqlens, max_seqlen,
                       key_cu_seqlens=key_cu_seqlens, key_max_seqlen=key_max_seqlen)

The packed backward launches its CTAs over the batch's blocks, not over N times max_seqlen's: patches/ changes both ports' backward kernels so that a sequence's blocks start at cu_seqlens[i] / block + i and a CTA finds its sequence by a binary search, so a batch of many empty or short sequences costs what its tokens do. The patches apply to the pinned checkouts (build.sh) and are written to go upstream.

Metadata

Release files for dew-flash-attn-cu13 0.3.6

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

Built distributions (wheels)

Table of built distributions (wheels) for dew-flash-attn-cu13 0.3.6
File Interpreter ABI Platform Actions
dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_x86_64.whl
dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_aarch64.whl

Total release size: 155.2 MB

Release files / dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_x86_64.whl

Download URL dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_x86_64.whl
Size 77.8 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
6a2a593f1bb8e302f399eb96f036d88ae41993f03afc13e40855482fad022706
BLAKE2b-256 checksum
How to use checksums
43b187f81f120de3edc9d3c672cf207f9b6f31eb23f9f498fc195cf85f7009f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_aarch64.whl

Download URL dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_aarch64.whl
Size 77.4 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
18b6a73d1a35ed658427ab09a82efe7f41993e8b6f4209d890fa25309325af01
BLAKE2b-256 checksum
How to use checksums
f08613ca2c3bcdf1b7aff3dc07f76f426d6f19a398e1b5a9b8b63e9e33ceccd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for dew-flash-attn-cu13 0.3.6

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dew_flash_attn_cu13-0.3.6-py3-none-manylinux_2_28_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

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