PyTorch-minor-specific Kestrel MPS native op loader
Project description
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 such as torch29, torch210,
torch211, and torch212. 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.TensorPython object to itsMTLBufferplus 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.12.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kestrel_mps_torch_ext-0.1.1-cp314-cp314-macosx_13_0_arm64.whl.
File metadata
- Download URL: kestrel_mps_torch_ext-0.1.1-cp314-cp314-macosx_13_0_arm64.whl
- Upload date:
- Size: 217.8 kB
- Tags: CPython 3.14, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3b1468c5b2113671620183a137f930ab77f1d87dc89f50350179a5d75995b7c
|
|
| MD5 |
a720c8a7d29ddf9fa41ee972745151c8
|
|
| BLAKE2b-256 |
f7d119dfd608caa20b314cacb14089b28ad9a0a28f9cd8e503e515b51a836a2b
|
File details
Details for the file kestrel_mps_torch_ext-0.1.1-cp313-cp313-macosx_13_0_arm64.whl.
File metadata
- Download URL: kestrel_mps_torch_ext-0.1.1-cp313-cp313-macosx_13_0_arm64.whl
- Upload date:
- Size: 217.7 kB
- Tags: CPython 3.13, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5af9ab20eb59d2f501c77e82f2756630dcaa626a29a43bf48015dadd37d43bdb
|
|
| MD5 |
bf73057e7897c609ec5dbbb6157597c0
|
|
| BLAKE2b-256 |
75245abc7c34778b9e85eaa2650d8b09c595cab9e43f56d60ca427c66a6d8dfe
|
File details
Details for the file kestrel_mps_torch_ext-0.1.1-cp312-cp312-macosx_13_0_arm64.whl.
File metadata
- Download URL: kestrel_mps_torch_ext-0.1.1-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 217.5 kB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1788454f8bee7144d005aac116ef2482ee017ab5ecc1dd725a1935cb27c6c4c6
|
|
| MD5 |
48f9cfc636054048972819553d8d1e40
|
|
| BLAKE2b-256 |
da7dab54edfa1d13cef6a7fe516581e9e00b8ca76b7496c562f9ab375e14f045
|
File details
Details for the file kestrel_mps_torch_ext-0.1.1-cp311-cp311-macosx_13_0_arm64.whl.
File metadata
- Download URL: kestrel_mps_torch_ext-0.1.1-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 215.7 kB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
373946adcd489da9ea1f5d00ba433e7f582a5e8c887b92ea42078c40f4a2f542
|
|
| MD5 |
5ad94b5865cb40cd419848bda883222f
|
|
| BLAKE2b-256 |
dcd27064adb6e1f33307f875b15f7c6fe974a391d7644de40018da648c4c38c1
|
File details
Details for the file kestrel_mps_torch_ext-0.1.1-cp310-cp310-macosx_13_0_arm64.whl.
File metadata
- Download URL: kestrel_mps_torch_ext-0.1.1-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 210.3 kB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c99d03330472a649511b97fef9862307117208ffd375e3c826be2be93764c6b
|
|
| MD5 |
89d51ea3bacfccf029308bdb6aac6432
|
|
| BLAKE2b-256 |
2445b2d1c72b8e56f02b8eb38a519361a32365c82f065030649fcecc08ca1ad3
|