Skip to main content

Popcorn

kernels backends implementations grid rows


Documentation  |  Kernel Explorer

About

Popcorn 🍿 is a development and dispatch library for high-performance machine learning kernels. It unifies 96 kernels and more than 100 optimized implementations behind a single API, then selects among eligible backends using hardware-specific benchmark records. Each implementation is checked against a PyTorch reference; failed and unmeasured cases remain visible evidence rather than being presented as successful validation. Popcorn also ships a growing collection of first-party kernels, along with the environment and harness to build, test, benchmark, and deploy new kernels and backends. Contributions are welcome.

Installation

Install Popcorn from PyPI using uv:

uv pip install popcorn           # first-party only
uv pip install "popcorn[liger]"  # + Liger-Kernel backends
uv pip install "popcorn[fla]"    # + FLA backends

[!NOTE] Add --torch-backend=auto to let uv select a PyTorch build for your hardware.

[!WARNING] pip install popcorn may work but is not generally supported. Install the desired PyTorch build for your hardware first, then install Popcorn with pip.

Add one extra per backend you want. There is no "everything" extra: the backends pin mutually exclusive requirements, so installing them together does not resolve.

Installing also fetches the benchmark cache that dispatch selects implementations with, from the popcorn-reports dataset at the revision this version pins. Set POPCORN_SKIP_REPORTS=1 to install without it; popcorn then falls back to the reference for every call and says so. Refresh it at any time with:

uv run python -m popcorn.bench pull

A backend is eligible only when its package is installed at a declared supported version: auto-dispatch skips unavailable ones, and forcing one raises with the install hint or version error. First-party kernels (the popcorn backend) are always included.

Benchmarking on your own hardware

The shipped cache covers the hardware it was recorded on. To measure the combinations your machine has no timing for and add them to your local cache:

uv run python -m popcorn.bench fill            # every op; --limit N to subsample large grids

Already-cached combinations are skipped; pass --force to re-measure them. Dispatch picks these up on the next call.

Installing Backends

To install the prerequisites for an additional backend:

uv pip install "popcorn[<new_extra>]"

Updating

Upgrade Popcorn and refresh its pinned report cache with:

uv pip install --upgrade popcorn

Limitations

Correctness

Popcorn validates implementations across a broad grid of inputs and does its best to warn when an exact case has not been validated. This reduces the risk of numerical errors but does not guarantee correctness for every possible input. Every comparison also assumes that the registered reference is correct: Popcorn measures agreement with that reference, not correctness in the abstract, therefore "correctness" here is the measure of similarity to the reference. Validate representative production inputs, particularly unusual shapes, dtypes, and optional arguments.

Performance

Popcorn benchmarks kernels in isolation. This is useful for comparing implementations in an apples-to-apples fashion, but these results do not necessarily predict end-to-end model performance. PyTorch and torch.compile may fuse or rewrite surrounding native operations, while a backend call or custom-op boundary can limit those optimizations. Tensor layouts, memory traffic, synchronization, and compilation overhead can also change the result in a real workload. It's important to keep in mind that dispatch currently optimizes recorded execution time, not peak memory. For some workloads, we may prefer a slower implementation with a smaller memory footprint. Benchmark representative model code and explicitly tune or select a backend when latency and memory requirements are both important.

Contributing

New kernels and backends follow a guided flow: CONTRIBUTING.md. Benchmarks come from contributors' machines; run the grid on your hardware and include its matrix rows for review. Maintainers publish accepted report evidence to the pinned dataset.

Acknowledgement

Popcorn stands on the shoulders of the open-source kernel ecosystem. The optimized backends it dispatches to are built and maintained by their authors:

The agent optimization loop (python -m popcorn.bench.loop) is inspired by AutoKernel's edit–evaluate–keep/revert cycle for autonomous kernel search.

Citation

@software{popcorn,
  author = {{Tilde Research}},
  title  = {Popcorn: kernel dispatch for PyTorch},
  url    = {https://github.com/tilde-research/popcorn},
  year   = {2026}
}

License

Apache-2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

popcorn-0.1.0.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

popcorn-0.1.0-py3-none-any.whl (2.9 MB view details)

Uploaded Python 3

File details

Details for the file popcorn-0.1.0.tar.gz.

File metadata

  • Download URL: popcorn-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for popcorn-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e11162b991ea2c288873779bcab5f23451f0137b217c1ac51fa0c08b8e808598
MD5 4660725ef0218aef7beab1793553c2e1
BLAKE2b-256 ff6e18d2c7e3857c37f8c6ac5839698939bd13742d0a9a167bcfd57e51e5f647

See more details on using hashes here.

Provenance

The following attestation bundles were made for popcorn-0.1.0.tar.gz:

Publisher: pypi.yml on tilde-research/popcorn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file popcorn-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: popcorn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for popcorn-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48be86be202f08b4bf97a3df6e7ad1bf08c924b429a14f0cf51405b0cc8b27d3
MD5 ceb247f9dff13e5f9e2c61be7f2a0a31
BLAKE2b-256 c8763ab8ec9d2ce6291fc9dd688b1c4a245cdca40af80d225f78b0d602326035

See more details on using hashes here.

Provenance

The following attestation bundles were made for popcorn-0.1.0-py3-none-any.whl:

Publisher: pypi.yml on tilde-research/popcorn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.0

1 file

0.1.1

2 files

This release

0.1.0 This release

2 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