Metal (MPS) backend availability on macOS / Apple Silicon
まだ誰も着手していません。
評価
- 難易度
- 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-arm64exists on NuGet (up to 2.10.0) and works well.- No
libtorch-mps-osx-arm64(or similarly named) package has ever been published. TorchSharp.DeviceTypedoes contain anMPSmember (it mirrors libtorch'sc10::DeviceTypewholesale), but nothing backs it on macOS today — passingDeviceType.MPSwould 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 はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/TorchSharp のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
dotnet/TorchSharp#1583 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
dotnet/TorchSharp#1579 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
dotnet/TorchSharp#1574 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
dotnet/TorchSharp#1567 ·
-
question
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
dotnet/TorchSharp#1557 ·
dotnet/TorchSharp の issue をすべて見る
似ている issue
-
area-multitenancy area-security p1-recommended priority-high technical-debt
難易度 2/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
kind/enhancement Provider Upgrade pulumi/pulumi-azure R1 Task
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
pulumi/pulumi-azure#3669 ·
-
[BUG] FromCString causes 1 byte OOB read in native code対応中かも @mattleibow が 1 日前に担当しました。 オープンtype/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mono/SkiaSharp#5426 · リアクション 1 件 · 担当者 2 名 ·
メンテナーはふだん 1 日以内に返信