Skip to main content

FP8 and FP4 sub-byte dtype support for PyTorch MPS on Apple Silicon via Metal shaders

Project description

Registers FP8 (float8_e4m3fn, float8_e5m2) and FP4 (float4_e2m1fn_x2) support for PyTorch's MPS backend on Apple Silicon. Once installed, import torch auto-loads the extension via the torch.backends entry point, enabling tensor.to(torch.float8_e4m3fn), torch._scaled_mm, and tensor.copy_ to work transparently on MPS through Metal shader kernels dispatched via torch.mps.compile_shader. The FP8 encode is tested byte-for-byte against all 254 representable values and their midpoints to match CPU PyTorch exactly; FP4 decode is verified exhaustively against all 256 packed byte patterns. 80 tests run on macOS MPS hardware in CI.

uv pip install git+https://github.com/AppMana/mps-fp8-for-torch-and-comfyui-python-package.git

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

fp4_fp8_for_torch_mps-1.0.0.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

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

fp4_fp8_for_torch_mps-1.0.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file fp4_fp8_for_torch_mps-1.0.0.tar.gz.

File metadata

  • Download URL: fp4_fp8_for_torch_mps-1.0.0.tar.gz
  • Upload date:
  • Size: 43.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fp4_fp8_for_torch_mps-1.0.0.tar.gz
Algorithm Hash digest
SHA256 737c08f00baf38be5c710e538c902600880f9502cb832ed88b77be4cfd733e9b
MD5 e69246998bd03ee7e67f7362c88595b5
BLAKE2b-256 5d99d03926b9adedccfce2ec47fb940f89c01275cefe58719dcf3f55cc36ea4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for fp4_fp8_for_torch_mps-1.0.0.tar.gz:

Publisher: publishing.yml on AppMana/mps-fp8-for-torch-and-comfyui-python-package

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

File details

Details for the file fp4_fp8_for_torch_mps-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fp4_fp8_for_torch_mps-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2531c4c060f5bb523d825aceaa908f62a08aac7c4e5c041fc4fe0413c9d1422
MD5 0052a353ee56beb47747f7b1b1e4cba3
BLAKE2b-256 d9feec72730cd9d1be40285cd4c6162cf0e7d220171748aa88f60b6d887933fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for fp4_fp8_for_torch_mps-1.0.0-py3-none-any.whl:

Publisher: publishing.yml on AppMana/mps-fp8-for-torch-and-comfyui-python-package

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

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