Skip to main content

flashhub-kernels

Load CUDA kernel packages published on the flashhub CDN (https://flashhub-cdn.aodianyun.com by default).

Kernel packages on the flashhub CDN are made to be:

  • Portable: a kernel can be loaded from a local path or downloaded from the CDN into a cache, without being installed into PYTHONPATH.
  • Variant-matched: each package publishes one build per environment (torch version, CUDA version, CPU architecture); the client picks the variant that fits the local runtime and downloads only that build.
  • Verified: every artifact is checked against the sha256 digests in its metadata.json before loading.

🚀 Quick Start

Install the flashhub-kernels package (requires torch>=2.0):

pip install flashhub-kernels

Load a kernel from the flashhub CDN:

import torch

from flashhub_kernels import get_kernel

kernel = get_kernel("sdq/audio-codebook-primitives", version=1)

logits = torch.randn((4, 16), dtype=torch.bfloat16, device="cuda")
codebook = torch.randn((4, 16, 8), dtype=torch.bfloat16, device="cuda")
codes, emb = kernel.delayed_codebook_argmax_embed_bf16(
    logits, codebook, delay=2, boc=1
)

API

  • get_kernel(repo_id, revision=None, version=None) — download from the CDN into the local cache (variant-matched to torch/CUDA/arch), import and return the kernel module. version selects v<version>; revision accepts "v1"/"1". Exactly one of revision/version must be given.
  • get_local_kernel(repo_path) — import a kernel from a local repo dir.
  • has_kernel(repo_id, version=None) — whether the variant exists on the CDN.
  • get_kernel_variants(repo_id, version=None) — resolve every published variant against the current system (VariantAccepted/VariantRejected).
  • get_loaded_kernels() — snapshot of kernels loaded in this process.
  • configure(cdn_url=None, prefix=None, cache_dir=None) — override CDN settings for the process (defaults read from FLASHHUB_CDN_URL, FLASHHUB_CDN_PREFIX, FLASHHUB_CACHE_DIR).

CDN layout

repo_id is the full <org>/<pkg> (e.g. sdq/audio-codebook-primitives); the org is part of the object path.

<prefix>/<org>/<pkg>/v<version>/build/<variant>/
    metadata.json          # {"digest": {"files": {rel: b64-sha256}}}
    <py_pkg>/__init__.py
    <py_pkg>/_ops.py
    <py_pkg>/_<pkg>_cuda_<id>.so
<prefix>/<org>/<pkg>/v<version>/variants.json   # optional: published variant names

variant is derived from the runtime: torch<major><minor>-cxx11-cu<cuda>-<arch>-linux.

Release files for flashhub-kernels 0.1.2

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

Source distribution (sdist)

Source distribution for flashhub-kernels 0.1.2
File Size Uploaded
flashhub_kernels-0.1.2.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flashhub-kernels 0.1.2
File Interpreter ABI Platform
flashhub_kernels-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / flashhub_kernels-0.1.2.tar.gz

Download URL flashhub_kernels-0.1.2.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4b6583a7f163794469e069dae17c18852805ab80db712a03feba29df7da64a40
BLAKE2b-256 checksum
How to use checksums
166a4cf3a15b4efa700f425f6f103cfab77487ba0cb4bb6f1fb4349a92c77ecd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / flashhub_kernels-0.1.2-py3-none-any.whl

Download URL flashhub_kernels-0.1.2-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef0faf394b54018aac4c3a97209fda79bf27e0798f1c2924523a7fae7e7073e3
BLAKE2b-256 checksum
How to use checksums
03a8329bafe86920b2fe481eef7d2e156d11c0f3f6251a87411a6707794fd870
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

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