Skip to content

MPS: improved backend#1983

Merged
matthewdouglas merged 2 commits into
mainfrom
mps-improvement
Jul 1, 2026
Merged

MPS: improved backend#1983
matthewdouglas merged 2 commits into
mainfrom
mps-improvement

Conversation

@matthewdouglas

Copy link
Copy Markdown
Member

Makes the MPS backend usable without the kernels-community/bitsandbytes-mps hub kernel - either because the user is on macOS < 26, doesn't have kernels installed, the hub kernel lacks support for the shape/blocksize, or the hub kernel fails to load for any reason. Previously it was not usable in these situations.

Changes:

  • Most ops are now unconditionally registered, and will attempt to use the HF Hub kernels before falling back to a slower implementation.
  • Hub kernel is only attempted on macOS 26+
  • Fix validation of shapes/blocksizes to match what Hub kernels support
  • Improved performance of the fallback MPS op implementations

At this point, MPS works with all of the 4bit or LLM.int8() configurations. All tests pass on M4 + macOS 15, with exception of the optimizer support, which will be a future PR.

The MPS path in general requires torch >= 2.9, and for the hub kernels will currently require torch 2.10-2.12. Documentation updates regarding this will be addressed in a future PR.

@matthewdouglas matthewdouglas added this to the v0.50.0 milestone Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@matthewdouglas matthewdouglas merged commit 8ab26f7 into main Jul 1, 2026
128 checks passed
@matthewdouglas matthewdouglas deleted the mps-improvement branch July 1, 2026 21:00
@hellopahe

Copy link
Copy Markdown

@matthewdouglas are you planning the optimizer support yourself, or is it up for grabs? Happy to take it on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants