0.107.0 LibTorchSharp.dll fails to load (0x8007007F) on Windows x64 + ARM64 due to libtorch 2.10.0 archive header/binary mismatch
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- csharp
調査の方向性
添付された repro.zip と README.md から始め、続いて libtorch-cpu-win-x64 パッケージおよび libtorch-cpu-win-arm64 パッケージに含まれる torch_cpu.dll と c10.dll に対して、LibTorchSharp.dll のインポートテーブルを調査します。0.107.0 パッケージのバイナリが両方の Windows アーキテクチャで ABI 互換であることを確認してください。完了の条件は、報告された DllNotFoundException を発生させずに repro が LibTorchSharp.dll をロードし、最初の API 呼び出しに到達することです。
索引モデルが issue の本文から書いたものです。
説明
Hi I faced with issue with version TorchSharp for my project.
Here is a Agent analysis of problem and repro:
TorchSharp 0.107.0 fails to load LibTorchSharp.dll at first API call on both Windows x64 and Windows ARM64, throwing DllNotFoundException with HResult 0x8007007F (ERROR_PROC_NOT_FOUND). The misleading top-level message is "This application or script uses TorchSharp but doesn't contain a reference to libtorch-cpu-win-arm64, Version=2.10.0.0", but the project does reference both TorchSharp 0.107.0 and the matching libtorch-cpu-win-* 2.10.0 NuGet — TorchSharp's loader finds and consolidates them correctly; the OS PE loader is the one refusing the module.
Root cause is an ABI mismatch between the shipped LibTorchSharp.dll and the libtorch 2.10.0 binaries in the libtorch-cpu-win-x64 / libtorch-cpu-win-arm64 NuGet packages. Walking LibTorchSharp.dll's import table and comparing against the export tables of the bundled torch_cpu.dll / c10.dll, 16 imports cannot be resolved. Examples (mangled names omitted, both x64 and ARM64 affected identically):
| LibTorchSharp.dll imports | torch_cpu.dll / c10.dll 2.10.0 exports |
|---|---|
| torch::inductor::AOTIModelPackageLoader(string, string, bool, size_t, DeviceIndex) — 5 args | (string, string, bool) — 3 args |
| c10::MessageLogger(const char*, int, int, bool) — 4 args | (const char*, int, int) — 3 args |
| at::Context::allowTF32CuDNN(std::optional) const | at::Context::allowTF32CuDNN() const |
| at::Context::allowFP16ReductionCuBLAS() const → CuBLASReductionOption | → bool |
| GridSampleFuncOptions::mode(variant<kBilinear, kNearest, kBicubic>) | variant<kBilinear, kNearest> (no kBicubic) |
| caffe2::TypeMeta::toScalarType() const | caffe2::TypeMeta::toScalarType() (non-const) |
| `c10::*::(try_)?(incref | decref)_pyobjectonTensorImpl/StorageImpl/intrusive_ptr_target` |
Reproduce
repro.zip
RID : win-arm64
OS : Microsoft Windows 10.0.26200
.NET : 8.0.27
base dir : C:\Users\cmake\Downloads\repro-torchsharp-arm64\src\bin\Debug\net8.0\win-arm64
native dir : C:\Users\cmake\Downloads\repro-torchsharp-arm64\src\bin\Debug\net8.0\win-arm64
aoti_custom_ops.dll 229 888 bytes
armpl_lp64.dll 37 806 080 bytes
backend_with_compiler.dll 214 016 bytes
c10.dll 1 065 472 bytes
Google.Protobuf.dll 409 368 bytes
ICSharpCode.SharpZipLib.dll 246 272 bytes
jitbackend_test.dll 177 664 bytes
libSkiaSharp.dll 8 084 920 bytes
LibTorchSharp.dll 1 848 760 bytes
Repro.dll 7 168 bytes
SkiaSharp.dll 432 568 bytes
torch.dll 9 728 bytes
torchbind_test.dll 558 080 bytes
TorchSharp.dll 1 556 920 bytes
torch_cpu.dll 105 576 960 bytes
torch_global_deps.dll 9 728 bytes
uv.dll 208 384 bytes
package: libtorch-cpu-win-arm64
Version 0.107.0
Fill free ping me for more information. Thanks!
- 主要言語
- 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 ·
-
難易度 4/5 1週間以上 初心者へのやさしさ 30/100
dotnet/TorchSharp#1581 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
dotnet/TorchSharp#1579 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
dotnet/TorchSharp#1574 ·
-
question
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
dotnet/TorchSharp#1557 ·
dotnet/TorchSharp の issue をすべて見る
似ている issue
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/dotnet-api-docs#13210 ·
メンテナーはふだん 1 日以内に返信
-
aspnet-core/svc doc-enhancement mvc/subsvc Pri2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/AspNetCore.Docs#38016 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
HicServices/RDMP#2398 ·