Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Metal (MPS) backend availability on macOS / Apple Silicon

オープン
#1,581 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp

調査の方向性

The issue is about enabling the Metal (MPS) backend for TorchSharp on macOS/Apple Silicon. This depends on upstream libtorch's C++ distribution shipping Metal kernels. Research the libtorch build process and the existing libtorch-cpu-osx-arm64 package. Check if there are any existing build scripts or discussions about MPS support in the dotnet/TorchSharp repository or the PyTorch upstream. 'Done' would be a working libtorch-mps-osx-arm64 package or a clear path to building one.

索引モデルが issue の本文から書いたものです。

説明

Summary

There doesn't appear to be a native libtorch build with the Metal (MPS) backend available for TorchSharp on macOS, even though DeviceType.MPS exists in the managed DeviceType enum. Is Metal-accelerated inference/training on Apple Silicon on the roadmap, or is it considered out of scope for TorchSharp (e.g. because upstream libtorch's C++ distribution doesn't ship it the way pip install torch does)?

What I found

  • libtorch-cpu-osx-arm64 exists on NuGet (up to 2.10.0) and works well.
  • No libtorch-mps-osx-arm64 (or similarly named) package has ever been published.
  • TorchSharp.DeviceType does contain an MPS member (it mirrors libtorch's c10::DeviceType wholesale), but nothing backs it on macOS today — passing DeviceType.MPS would presumably fail at the native dispatch layer.
  • #652 ("Apple Silicon support") covered getting any osx-arm64 build working (now solved via libtorch-cpu-osx-arm64), but didn't turn into a dedicated tracking issue for GPU/Metal acceleration specifically.

Context

I'm comparing an ONNX Runtime backend against a TorchSharp backend for a small transformer inference workload, benchmarking both on Apple Silicon. TorchSharp (loading a torch.jit.traced module) matches Python's own CPU eager-mode latency closely, which is great — but Python's torch.device("mps") gets a further ~2x speedup on the same machine that TorchSharp currently has no way to reach.

I understand this is likely gated on whatever libtorch C++ distribution TorchSharp consumes actually shipping Metal kernels (unlike the PyPI torch wheel, which has since ~1.12 via torch.backends.mps) — happy to help test on an M-series Mac if that's useful, or to close this out if it's a known, permanent limitation upstream.

Thanks for TorchSharp — it's been a pleasant, direct way to run a real PyTorch-traced model from .NET without reimplementing the model architecture.

主要言語
C#
スター
1.9k
フォーク
230
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/TorchSharp のほかの issue

dotnet/TorchSharp の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。