Skip to main content
Pre-release

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

FlashRWKV2

FlashRWKV2 is a high-performance CUDA operator library for RWKV-7. Its public inference API exposes the highest semantic fusion islands used by the model; kernel composition and shape-dependent dispatch remain internal. Complete models, schedulers, and training frameworks remain the responsibility of downstream projects.

Requirements

  • Python 3.10 or newer
  • Linux, a writable PyTorch extension cache, and a CUDA GPU with Compute Capability 8.0 or newer
  • A system CUDA Toolkit compatible with PyTorch, a compatible host compiler, and Ninja
  • uv, using the repository-local ./.venv

The runtime supports PyTorch 2.11 through 2.13. Importing the package does not compile CUDA code. The first CUDA operator call builds one private ordinary ATen/pybind extension from the packaged csrc/sm80 sources for the exact Compute Capability of all visible GPUs, then reuses PyTorch's extension cache. All visible GPUs must have the same Compute Capability.

Installation

The project publishes a universal py3-none-any source wheel containing only Python and CUDA/C++ sources. It contains no precompiled extension or architecture fallback. Building the wheel does not import Torch or run NVCC:

python -m pip install --pre FlashRWKV2

To prewarm the runtime cache explicitly, use the same build path as the first operator call:

python -m flashrwkv2.compile

The command emits JSON containing status (compiled or cached), target, cache_key, and library. Build failures preserve the original compiler diagnostics; FlashRWKV2 does not download a compiler or select another backend.

For development from a checkout:

git clone https://github.com/rwkv-rs/FlashRWKV2.git
cd FlashRWKV2
uv sync
./.venv/bin/python -m pip install -v --no-build-isolation -e .

Kernel API

See the Kernel API reference for the complete public operator surface and tensor contracts.

Tests

./.venv/bin/python -m pytest -q

CUDA tests build and load flashrwkv2._C lazily and require the toolchain above.

Benchmarks

Operator benchmarks live in benchmarks/. For example, run the WKV7 recurrent correctness benchmark with:

./.venv/bin/python -m benchmarks.tmix.wkv7.bench \
  --shapes h32d64 \
  --dtype bfloat16 \
  --correctness-only \
  --output /tmp/flashrwkv2-wkv7-correctness.json

These benchmarks measure individual operators. They do not report or infer model-level latency.

The release-specific WKV7 measurements, evidence identities, acceptance boundaries, and non-target advisory regressions are recorded in the FlashRWKV2 0.1.0a9 WKV7 performance report.

For Albatross-compatible TMix low-rank inference, varlen means that the operator consumes packed token rows; it does not mean that one fused kernel is used for every row count. The public composite callers automatically use the canonical fused rank-in window at M<=7, the fused rank-out/value-residual window at M<=4, and the canonical large-row linear dispatcher otherwise. Callers may provide both the original checkpoint layout and a runtime layout. Both layouts must be prepared outside the timed forward region and retained for the lifetime of the inference weights; FlashRWKV2 never transposes or copies a missing layout during dispatch.

TMix inference benchmarks are owned by the public wkv_prepare and readout modules. Native-private Linear, activation, VRes, gate and sparse helpers do not have standalone public benchmark entry points.

License

FlashRWKV2 is distributed under the MIT License.

Metadata

Release files for FlashRWKV2 0.1.0a15

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

Source distribution (sdist)

Source distribution for FlashRWKV2 0.1.0a15
File Size Uploaded
flashrwkv2-0.1.0a15.tar.gz 194.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for FlashRWKV2 0.1.0a15
File Interpreter ABI Platform
flashrwkv2-0.1.0a15-py3-none-any.whl Python 3 none any Details

Total release size: 472.0 kB

Release files / flashrwkv2-0.1.0a15.tar.gz

Download URL flashrwkv2-0.1.0a15.tar.gz
Size 194.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0ff1a79b05aaa78b082ce24762e433d234ce2154f1883045dcd9d41d91fb8067
BLAKE2b-256 checksum
How to use checksums
4411d94d9059381c3ecf1567fa389a2a9cc9a9102b52c35966febb777b3689e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 15, 2026.

Transparency log

Release files / flashrwkv2-0.1.0a15-py3-none-any.whl

Download URL flashrwkv2-0.1.0a15-py3-none-any.whl
Size 277.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51fc16d0d3e43c9d78c5b3ffa7960c63cc9b7e8266885f72860b300d66525878
BLAKE2b-256 checksum
How to use checksums
d6ca78004d3dcf1dd47912a1b2b949b43e831786ed5591c63a01c9e8dfdebd00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 15, 2026.

Transparency log
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