Skip to main content

Foundational Metal Linear Algebra Primitives for PyTorch

Project description

metalcore

Foundational Metal Linear Algebra Primitives for PyTorch on Apple Silicon.

Overview

metalcore provides a unified backend for high-performance linear algebra operations on macOS devices, bypassing generic MPS fallbacks to use optimized custom Metal kernels.

Supported Operations

1. Decompositions

  • SVD (svd): One-sided Jacobi algorithm. Highly optimized for both batched small matrices and large "tall" matrices (e.g., LLM weights).
  • QR (qr, qr_batched): Blocked Householder reflection. significantly faster for batched operations.
  • Eigh (eigh): Symmetric eigenvalue decomposition using Jacobi rotations.
  • Cholesky (cholesky): MAGMA-style shared memory optimization for Positive Definite matrices.

2. Solvers

  • Linear Solve (solve): Batched linear system solver using QR factorization and triangular solve.
  • Triangular Solve (trsm): Solve $AX=B$ where $A$ is triangular.

3. Primitives

  • Householder Reflections: Core orthogonalization primitives (geqr2, larft, larfb).

Installation

pip install metalcore

Usage

import torch
import metalcore

device = 'mps'

# SVD
A = torch.randn(100, 50, device=device)
U, S, V = metalcore.svd(A)

# Batched QR
B = torch.randn(100, 16, 16, device=device)
Q, R = metalcore.qr_batched(B)

# Cholesky
C = torch.randn(10, 32, 32, device=device)
C = C @ C.mT + 1e-4 * torch.eye(32, device=device) # Make PD
L = metalcore.cholesky(C)

Requirements

  • macOS 12.0+ with Apple Silicon (M1/M2/M3/M4)
  • Python 3.9+
  • PyTorch 2.0+

License

MIT

Project details


Download files

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

Source Distribution

metalcore-0.1.3.tar.gz (960.9 kB view details)

Uploaded Source

Built Distributions

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

metalcore-0.1.3-cp314-cp314-macosx_15_0_arm64.whl (486.3 kB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

metalcore-0.1.3-cp313-cp313-macosx_15_0_arm64.whl (486.4 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

metalcore-0.1.3-cp312-cp312-macosx_15_0_arm64.whl (486.5 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

metalcore-0.1.3-cp311-cp311-macosx_15_0_arm64.whl (485.4 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

metalcore-0.1.3-cp310-cp310-macosx_15_0_arm64.whl (484.1 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

metalcore-0.1.3-cp39-cp39-macosx_15_0_arm64.whl (477.2 kB view details)

Uploaded CPython 3.9macOS 15.0+ ARM64

File details

Details for the file metalcore-0.1.3.tar.gz.

File metadata

  • Download URL: metalcore-0.1.3.tar.gz
  • Upload date:
  • Size: 960.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for metalcore-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0261f38a2a0db6627890ff438cd34d2e8cb442adc68d2340cc6349e37839e620
MD5 9fb8b72542d8c8e20853bc6464d86a34
BLAKE2b-256 9a69d50124042929ce938861725b66ae593485cdb4bc7b496a7ac983c999cb41

See more details on using hashes here.

File details

Details for the file metalcore-0.1.3-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for metalcore-0.1.3-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 7d037f36e71287619bc99c71868710240784981627b93cc09501a89da9760aa1
MD5 dc5c92236f3ab9bcb1ba586a386e7ed6
BLAKE2b-256 f6f8f94414ef5d89beb64c212b23ee25d70b0622d4aed8b1138582d303ec22f5

See more details on using hashes here.

File details

Details for the file metalcore-0.1.3-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for metalcore-0.1.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 219b5aab8797b5d196e3c49d0a1ef3f7d8912aa41a68b71cf2e5bad6df26d115
MD5 73c3506cc099aa2b509a20f79d7aaafe
BLAKE2b-256 0941f9ab3b5eb02e2434949b8f7bc21485388db247b09762e5cbb31ff75a710c

See more details on using hashes here.

File details

Details for the file metalcore-0.1.3-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for metalcore-0.1.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 603fd5f148c98d3d8fd516eb959933dab03d36e4fe729618692824a4a28de830
MD5 0636cbfd33d72879dc3617e8c9a6f5b1
BLAKE2b-256 a668769aa1d52b3fa406cb620244b50642c677f7b82aadf57ffe89e0f756b841

See more details on using hashes here.

File details

Details for the file metalcore-0.1.3-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for metalcore-0.1.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 642b06ccf00bc1c30c8ed6d67df7c606f48e7078b55b36d192727521ce8546f8
MD5 02a449a09c323f69642c99e77a9dda2e
BLAKE2b-256 32940375cd25cd2156f80a1bbd5357c5b8255706386294ec0455581a9ad2f36d

See more details on using hashes here.

File details

Details for the file metalcore-0.1.3-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for metalcore-0.1.3-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0d0779144d4725aa48b0a4c18d4740f0bb42295856523d2ab19bbe73ee5b49a6
MD5 f2484eded482c660963b9aec87846b01
BLAKE2b-256 6ce69b785781b3cdeda5aebdaad3d0ae1232dd4f763f96471e240bf4a44754e7

See more details on using hashes here.

File details

Details for the file metalcore-0.1.3-cp39-cp39-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for metalcore-0.1.3-cp39-cp39-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 962a18031b1de50ac2ff24f3709f30daed65da46a78576bc4c9db93b12d2f350
MD5 aae0afd3de8505daef6de68bdc5a8561
BLAKE2b-256 4bb76c44e6da807aeb8fbc420943cac71b8cc8b21f8d8ad29718550eaa95adeb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page