Skip to main content

kestrel-mps-torch-ext

Small ABI-specific sidecar for Kestrel's native MPS tensor/stream handles.

This package follows the same basic pattern as torch-c-dlpack-ext: the Python loader selects a native library whose filename includes the runtime PyTorch major/minor version and loads it with ctypes.CDLL. The native library still links against libtorch, so this is not a stable ABI. It just isolates the torch-version-sensitive part into a small package.

Wheels are published per Python ABI (cp310, cp311, ...). Each wheel can bundle multiple PyTorch-minor-specific dylibs. Current wheels cover torch 2.9 through 2.14 (torch29, torch210, torch211, torch212, torch213, and torch214). Patch versions do not get separate dylibs: torch 2.12.0 and 2.12.1 both resolve to torch212.

This package does not ship Metal kernel source, a metallib, or Kestrel torch op registrations. It only exports a narrow C ABI for:

  • resolving a torch.Tensor Python object to its MTLBuffer plus shape/stride metadata;
  • accessing the current PyTorch MPS stream, command buffer, device, and queue;
  • ending PyTorch kernel coalescing and committing the stream.

The main kestrel-kernels package remains responsible for loading kestrel_mps.metallib and dispatching the actual Metal kernels.

Build

Install the exact PyTorch version you want this wheel to target, then build without PEP 517 isolation so CMake sees that same torch install:

python -m pip install "torch==2.14.0" scikit-build-core cmake ninja packaging wheel
python -m pip wheel --no-build-isolation .

The build backend defaults MACOSX_DEPLOYMENT_TARGET to 13.0, so a build on macOS 15 still produces a macosx_13_0_arm64 wheel. Override the target only when intentionally changing the runtime support floor:

MACOSX_DEPLOYMENT_TARGET=14.0 python -m pip wheel --no-build-isolation .

No Kestrel source checkout is required.

Runtime

import kestrel_mps_torch_ext

kestrel_mps_torch_ext.load_torch_mps_bridge()

After that call, the ABI-matched dylib is loaded with RTLD_GLOBAL, so the main Kestrel native library can find KestrelMPSTorchExtAPI_v1 with dlsym.

Unsupported PyTorch Minors

If the installed PyTorch minor is not bundled in the wheel, import fails before any native code is used. The error lists the installed torch version, the supported torch minors, and the missing dylib name.

Use one of the listed PyTorch minors, install a newer kestrel-mps-torch-ext wheel that includes your minor, or email contact@moondream.ai for help.

Metadata

Release files for kestrel-mps-torch-ext 0.1.2

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 kestrel-mps-torch-ext 0.1.2
File
kestrel_mps_torch_ext-0.1.2-cp314-cp314-macosx_13_0_arm64.whl CPython 3.14 CPython 3.14 macOS 13.0+ ARM64 Details
kestrel_mps_torch_ext-0.1.2-cp313-cp313-macosx_13_0_arm64.whl CPython 3.13 CPython 3.13 macOS 13.0+ ARM64 Details
kestrel_mps_torch_ext-0.1.2-cp312-cp312-macosx_13_0_arm64.whl CPython 3.12 CPython 3.12 macOS 13.0+ ARM64 Details
kestrel_mps_torch_ext-0.1.2-cp311-cp311-macosx_13_0_arm64.whl CPython 3.11 CPython 3.11 macOS 13.0+ ARM64 Details
kestrel_mps_torch_ext-0.1.2-cp310-cp310-macosx_13_0_arm64.whl CPython 3.10 CPython 3.10 macOS 13.0+ ARM64 Details

Total release size: 1.6 MB

Release files / kestrel_mps_torch_ext-0.1.2-cp314-cp314-macosx_13_0_arm64.whl

Download URL kestrel_mps_torch_ext-0.1.2-cp314-cp314-macosx_13_0_arm64.whl
Size 327.1 kB
Tags CPython 3.14 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
d548e18aa9edc5bdb6da7ec6c114443df1d0f04f3992f8c364d70a6c4bebf94f
BLAKE2b-256 checksum
How to use checksums
ed49819f1518ac97bbfd60df90ffaa6f5ec97f6e7b2422277c4861b0fc8a9e52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release files / kestrel_mps_torch_ext-0.1.2-cp313-cp313-macosx_13_0_arm64.whl

Download URL kestrel_mps_torch_ext-0.1.2-cp313-cp313-macosx_13_0_arm64.whl
Size 326.9 kB
Tags CPython 3.13 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
10edab7280b63fa64595510e117b8f1398f014d474a7cf16c1fb03666affdf7b
BLAKE2b-256 checksum
How to use checksums
280ea602c90deb6b88504aafdf14571e576f8d2d3be125c3f6dc8b046d6d1154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release files / kestrel_mps_torch_ext-0.1.2-cp312-cp312-macosx_13_0_arm64.whl

Download URL kestrel_mps_torch_ext-0.1.2-cp312-cp312-macosx_13_0_arm64.whl
Size 326.6 kB
Tags CPython 3.12 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
2c7bd937239827dfa1e7fde2980851f308608dbc86a51970bf92cd3515fc9dae
BLAKE2b-256 checksum
How to use checksums
7405869fb8240b4c4bdc9d61347d53ae25196e0effbdb1536a0d9368f5dfa381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release files / kestrel_mps_torch_ext-0.1.2-cp311-cp311-macosx_13_0_arm64.whl

Download URL kestrel_mps_torch_ext-0.1.2-cp311-cp311-macosx_13_0_arm64.whl
Size 324.1 kB
Tags CPython 3.11 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
367cc1988b9244f4574c90175e669552e640aab6e11dafc5706e49667153a32c
BLAKE2b-256 checksum
How to use checksums
daf0ed81182ce3cf4566ae78fa7f5d43d88b72641fbdf08efc3f7fca946ed583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release files / kestrel_mps_torch_ext-0.1.2-cp310-cp310-macosx_13_0_arm64.whl

Download URL kestrel_mps_torch_ext-0.1.2-cp310-cp310-macosx_13_0_arm64.whl
Size 315.8 kB
Tags CPython 3.10 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
4f0ea9c82fa68e7aba7c616cad2d1bb18a41c0adebe1c1a50e8abbb8f3321b07
BLAKE2b-256 checksum
How to use checksums
367820a593ca0e17d54ba3eddcfcf17021390142db2935d6039d0bfd0c23436f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.8

Release history Release notifications | RSS feed

This release

0.1.2 This release

5 release files

0.1.1

5 release files

0.1.0

5 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