Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

Pre-release

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

FlashRWKV2

FlashRWKV2 is a TileLang operator library for RWKV-7 with a shared BF16 training and inference forward, FP32 accumulation, and FP32 recurrent state. 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.

An optional FP16-state inference mode halves state storage while keeping BF16 token IO and FP32 arithmetic. It does not promise bitwise equality with FP32 training. The default FP32-state path retains training precision and parity.

Requirements

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

The runtime supports PyTorch 2.11 through 2.14 and pins TileLang 0.1.15. Importing the package does not compile kernels. TileLang specializes model operators for the active GPU and caches compiled kernels. Packed metadata validation and sampling use a small ATen/pybind extension, compiled from the packaged native sources for the Compute Capability of the visible GPUs. All GPUs visible to that extension 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 metadata and sampling extension cache:

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.

Training operators support torch.compile(fullgraph=True), including backward, LoRA/NoRA, and CUDA Graph capture. Preserve the BF16 intermediate rounding contract with Inductor's precision option:

compiled_model = torch.compile(
    model, fullgraph=True, options={"emulate_precision_casts": True},
)

Prepare tuning with eager forward-and-backward calls before compiling or capturing. StateTune chunk metadata is prepared once with prepare_tmix_wkv7_statetune_metadata and supplied through prepared_metadata; see the training contract.

Tests

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

CUDA tests compile TileLang kernels and the metadata/sampling extension lazily. The full block suite checks outputs, FP32 state, and selected logprobs bitwise across training/inference, prefill/decode, and batch composition.

CI and release acceptance

Quality Gate is the required merge check. Ordinary PRs run CPU contracts, package checks when needed, and the affected owners' complete CUDA test matrices on PRO6000 with Torch 2.14.1. Provider changes expand to their consumers and the block integration suite. Kernel changes also run the selected memcheck/racecheck cases. Changes to dependencies, native interfaces, or runtime loading add the Torch 2.11–2.14 compatibility matrix. Tests load the installed source wheel; pytest's checkout import path is excluded from GPU validation.

Daily validation runs at 08:17 UTC on main, with full correctness, CUDA Graph, memcheck, and racecheck coverage. Sunday adds all supported Torch versions, a cold native build, and the complete benchmark/tuning suite. Daily performance reports measure owners changed since their latest compatible successful measurement. Performance failures and regressions appear in an independent report; they do not block the PR quality check. The Actions summary records actual selected/executed tests and tracks five completed PR timings against an initial 20-minute target for a single-owner change, excluding queue time.

Successful results and original distributions share one 90-day artifact bundle. Identical source trees can reuse CPU results and individual GPU version results when the policy, environment, and complete collected test scope match. A full run can add missing compatibility or cold-build checks to an existing bundle. Validation never combines module coverage from different source revisions.

Before releasing, run the Quality Gate workflow on the exact release tag with mode=full and extended=true. This produces the original wheel/sdist, full PRO6000 correctness and compatibility results, and a separate complete performance report. The PyPI release workflow verifies these results and publishes those original files. Its manual tag input verifies acceptance without publishing.

RTX4090 acceptance is independent. On its checkout of the same tag, download the PRO6000 flashrwkv2-quality-v7-<source-tree> artifact to artifacts/acceptance. Use the project .venv, with the default Torch version, and the wheel from that bundle. With read access to Actions available through GH_TOKEN, the existing CI entrypoints produce the independent reports:

timeout 600s uv sync --frozen --no-install-project --group dev
timeout 60s .venv/bin/python ci/quality_gate.py plan \
  --base HEAD^ --head HEAD --mode full --extended --target sm89 \
  --output artifacts/sm89/plan.json
timeout 60s .venv/bin/python ci/quality_gate.py package \
  --directory artifacts/acceptance --output artifacts/sm89/package.json
CUDA_VISIBLE_DEVICES="" timeout 600s .venv/bin/python ci/quality_gate.py test \
  --plan artifacts/sm89/plan.json --suite cpu --output artifacts/sm89/cpu.json \
  --reuse artifacts/acceptance/quality-manifest.json
CUDA_VISIBLE_DEVICES=0,1 PATH="$PWD/.venv/bin:$PATH" timeout 6600s .venv/bin/python ci/quality_gate.py gpu \
  --plan artifacts/sm89/plan.json --package artifacts/acceptance \
  --python .venv/bin/python --output artifacts/sm89
# Compatibility testing ends on an older Torch; restore the primary version.
timeout 600s uv sync --frozen --no-install-project --group dev
timeout 180s uv pip install --python .venv/bin/python --no-deps --reinstall artifacts/acceptance/dist/*.whl
timeout 120s .venv/bin/python ci/quality_gate.py finalize \
  --plan artifacts/sm89/plan.json --package artifacts/acceptance \
  --validation artifacts/sm89 --output artifacts/sm89-quality-manifest.json
CUDA_VISIBLE_DEVICES=0,1 PATH="$PWD/.venv/bin:$PATH" timeout 13800s .venv/bin/python ci/benchmark_gate.py report \
  --quality artifacts/sm89-quality-manifest.json --package artifacts/acceptance \
  --profile full --repository rwkv-rs/FlashRWKV2 --python .venv/bin/python \
  --output artifacts/sm89/performance --summary artifacts/sm89/performance.md
timeout 30s cp artifacts/sm89/performance/summary.json artifacts/sm89-performance-summary.json

Attach sm89-quality-manifest.json and sm89-performance-summary.json to the tag's draft GitHub release. Both identify the exact source tree and wheel SHA256; the release verifier checks RTX4090 identity, full test completion, compatibility, sanitizer coverage, and complete performance results on both architectures. Publish the release after its manual verification succeeds.

Benchmarks

Operator benchmarks live in benchmarks/. The WKV matrix covers batch size, sequence length, and head dimensions:

PYTHONPATH=benchmarks ./.venv/bin/python benchmarks/tmix/wkv7/bench.py \
  --shapes h12d64 h16d64 h32d64 h40d64 h64d64 h80d64 h16d128 h8d256 \
  --cases 1x1 16x1 1x16 64x16 1x128 --tune --timing-mode graph \
  --output artifacts/wkv7-recurrent-bf16.json

Deterministic strategies on RTX 4090 (SM89/128 SM) and PRO 6000 (SM120/188 SM) prepare bounded kernel variants for dynamic batch/token workloads. Supply real first/later-layer, decode/prefill and training-backward calls with their actual layouts and gradient requirements:

from flashrwkv2 import prepare_tuning

report = prepare_tuning(warmup_calls, mode="tune")
assert report["complete"]

Prepare before torch.compile specialization and CUDA Graph capture. Other paths retain verified profiles and bounded tuning. After upgrading, prepare again; compatible TileLang binaries can be reused. See the preparation and cache contract for coverage, state ownership, validation and performance results.

License

FlashRWKV2 is distributed under the MIT License.

Metadata

Release files for FlashRWKV2 0.1.0a18

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

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for FlashRWKV2 0.1.0a18
File Size Uploaded Provenance Actions
flashrwkv2-0.1.0a18.tar.gz 102.4 kB Without provenance Details for flashrwkv2-0.1.0a18.tar.gz

Built distribution (wheel)

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

Total release size: 211.4 kB

Release files / flashrwkv2-0.1.0a18.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL flashrwkv2-0.1.0a18.tar.gz
Size 102.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e3b157a97dc458777822d4bc554830e6730ceec8ebf51dd64872bb461ff3e220
BLAKE2b-256 checksum
How to use checksums
6a09fc792a97d9b8cfbba0b2bcb35c1d3f9cb2c6ff839df02b987df1d304e116
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL flashrwkv2-0.1.0a18-py3-none-any.whl
Size 109.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27f5a7042dc389d8f64f07bd5cc7f0f6ddc3af4d5355ae12dc18b201b6899ee5
BLAKE2b-256 checksum
How to use checksums
f2b221d5f954bb198b244e1ef3d4d76d2650eb925d09e2f94afb244136478296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for FlashRWKV2 0.1.0a18

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.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.0a16 2 files With provenance
  • Added 0.1.0a18 2 files Without provenance

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.

Release history Release notifications | RSS feed

This release
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