Skip to content

BFloat16 Unsupported on MPS (macOS Sequoia 15.1.1, Intel, AMD) #141864

Description

@SkyForceCoder

🐛 Describe the bug

I am encountering the error TypeError: BFloat16 is not supported on MPS while using PyTorch with Apple's Metal Performance Shaders (MPS) backend. This issue arises across multiple projects, specifically Stable Diffusion WebUI Forge and ComfyUI, both of which depend on PyTorch for GPU acceleration.

Processor:

Model: Intel(R) Xeon(R) W-2140B CPU
Speed: 3.20 GHz
Cores: 8 cores (with Hyper-Threading enabled)

Memory (RAM):

Total RAM: 32 GB (34359738368 bytes)

GPU:

Model: Radeon Pro Vega 56
VRAM: 8 GB
Bus: PCIe (x16)
Metal Support: Metal 3 (supports Apple's graphics framework)

Projects where this issue occurs:

  1. [Stable Diffusion WebUI Forge Issue #2399](macOS Sequoia 15.1.1 (intel, AMD) - with MPS and PyTorch (BFloat16 Unsupported) lllyasviel/stable-diffusion-webui-forge#2399)
  2. [ComfyUI Issue #5829](ComfyUI Startup Log on macOS Sequoia 15.1.1 with MPS and PyTorch (BFloat16 Unsupported) Comfy-Org/ComfyUI#5829)

Steps to Reproduce:

  1. Use macOS with an MPS-supported GPU.
  2. Run ComfyUi or Forge that utilize BFloat16 operations during processing.
  3. The error consistently appears during model sampling or inference:
    TypeError: BFloat16 is not supported on MPS

Observations:

  • The error suggests that the MPS backend in PyTorch doesn't support BFloat16 precision.
  • This issue is critical because many ML pipelines and UIs default to BFloat16 or use it for performance reasons.

System:
macOS : Sequoia (15.1.1) Intel, AMD

Request:

Can BFloat16 support be added to MPS in PyTorch, CPU is very very slow for this type of operations.

Versions

2.1.2
ALL VERSIONS

cc @seemethere @malfet @osalpekar @atalman @albanD @frank-wei @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @kulinseth @DenisVieriu97 @jhavukainen

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: binariesAnything related to official binaries that we release to usersmodule: intelSpecific to x86 architecturemodule: macosMac OS related issuesmodule: mpsRelated to Apple Metal Performance Shaders frameworktriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions