-
Notifications
You must be signed in to change notification settings - Fork 217
Windows Arm Support #1493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Windows Arm Support #1493
Changes from all commits
4ec7d5d
c39acc3
af4f5bd
4b99c29
a2e4201
1b9222a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Pack"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>netstandard2.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Content Include="..\common\CpuHeadPackage.props" Pack="true" PackagePath="buildTransitive\netstandard2.0\$(MSBuildProjectName).props" /> | ||
| <Content Include="..\common\CpuHeadPackage.targets" Pack="true" PackagePath="buildTransitive\netstandard2.0\$(MSBuildProjectName).targets" /> | ||
| <Content Include="..\empty.txt" Pack="true" PackagePath="lib\netstandard2.0\_._" /> | ||
| <Content Include="$(RepoRoot)\THIRD-PARTY-NOTICES.txt" Pack="true" PackagePath="LICENSE-LIBTORCH.txt" /> | ||
| </ItemGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,7 +30,8 @@ | |||||||||||||||||||||||||||||||||||||||||
| <CopyToPackageSemaphore>$(MainPackageFolder)\.copied.SkipTests.$(SkipTests).IncludeLibTorchCpuPackages.$(IncludeLibTorchCpuPackages)</CopyToPackageSemaphore> | ||||||||||||||||||||||||||||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| <ItemGroup Condition="'$(TargetOS)' == 'windows'"> | ||||||||||||||||||||||||||||||||||||||||||
| <ItemGroup Condition="'$(TargetOS)' == 'windows' and '$(NativeTargetArchitecture)' != 'arm64'"> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="libtorch\lib\asmjit.dll" /> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="libtorch\lib\c10.dll" /> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="libtorch\lib\libiomp5md.dll" /> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="libtorch\lib\libiompstubs5md.dll" /> | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -39,6 +40,19 @@ | |||||||||||||||||||||||||||||||||||||||||
| <File Include="libtorch\lib\torch_global_deps.dll" /> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="libtorch\lib\uv.dll" /> | ||||||||||||||||||||||||||||||||||||||||||
| </ItemGroup> | ||||||||||||||||||||||||||||||||||||||||||
| <!-- Windows ARM64 has a smaller set of DLLs and different deps names --> | ||||||||||||||||||||||||||||||||||||||||||
| <ItemGroup Condition="'$(TargetOS)' == 'windows' and '$(NativeTargetArchitecture)' == 'arm64'"> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\aoti_custom_ops.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\backend_with_compiler.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\c10.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\jitbackend_test.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\torchbind_test.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\torch.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\torch_cpu.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\torch_global_deps.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\uv.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\armpl_lp64.dll"/> | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+54
|
||||||||||||||||||||||||||||||||||||||||||
| <File Include="lib\aoti_custom_ops.dll"/> | |
| <File Include="lib\backend_with_compiler.dll"/> | |
| <File Include="lib\c10.dll"/> | |
| <File Include="lib\jitbackend_test.dll"/> | |
| <File Include="lib\torchbind_test.dll"/> | |
| <File Include="lib\torch.dll"/> | |
| <File Include="lib\torch_cpu.dll"/> | |
| <File Include="lib\torch_global_deps.dll"/> | |
| <File Include="lib\uv.dll"/> | |
| <File Include="lib\armpl_lp64.dll"/> | |
| <File Include="libtorch\lib\aoti_custom_ops.dll"/> | |
| <File Include="libtorch\lib\backend_with_compiler.dll"/> | |
| <File Include="libtorch\lib\c10.dll"/> | |
| <File Include="libtorch\lib\jitbackend_test.dll"/> | |
| <File Include="libtorch\lib\torchbind_test.dll"/> | |
| <File Include="libtorch\lib\torch.dll"/> | |
| <File Include="libtorch\lib\torch_cpu.dll"/> | |
| <File Include="libtorch\lib\torch_global_deps.dll"/> | |
| <File Include="libtorch\lib\uv.dll"/> | |
| <File Include="libtorch\lib\armpl_lp64.dll"/> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 38D666A9030BA098D1AC5DABFD995CF3D113A12D512252080978B0CC206AF205 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| F9DD47C792C900601F08265DDC0186036E01503ADA7895F0C7C90F8AF64FBC4B |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| A6B6C3D9FF25113F8E48F6C7A5DD14EFCA5BCA6DE300DE0BD003FCC309439F2C |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| DFDD2BECA32B1B3D4894EFA801DC60570849F0ED47A318734BA798A5C4D6513B |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -38,13 +38,13 @@ public static partial class torch | |||||
| RuntimeInformation.OSArchitecture == Architecture.Arm64; | ||||||
|
|
||||||
| static string nativeRid => | ||||||
| RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"win-x64" : | ||||||
| RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ($"win-{(RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "arm64" : "x64")}") : | ||||||
| RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? $"linux-x64" : | ||||||
| isAppleSilicon ? "osx-arm64" : | ||||||
| "any"; | ||||||
|
|
||||||
| static string nativeGlob => | ||||||
| RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @".*\.dll" : | ||||||
| RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @".*\.dll$" : | ||||||
|
||||||
| RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @".*\.dll$" : | |
| RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @".*\.dll" : |
Copilot
AI
Aug 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable isWindows is redeclared here when it's already available from line 129. Consider reusing the existing variable to avoid duplication.
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Windows CPU dependency loading chain is more explicit (torch_global_deps -> c10 -> uv -> torch -> torch_cpu -> LibTorchSharp) compared to the previous simpler approach that only loaded torch_cpu and LibTorchSharp. While this may be necessary for Windows ARM64, applying it to all Windows platforms (including x64) could be a breaking change. Consider:
- Whether this change is actually needed for Windows x64 or only for ARM64
- If this is needed for all Windows, testing on x64 to ensure backward compatibility
- Whether the order of dependencies is correct for all scenarios
If this change is specifically for ARM64 dependencies, consider adding a condition to only use this explicit chain for ARM64, or add a comment explaining why this is now needed for all Windows platforms.
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The absolute-path fallback loading for Windows CPU mode loads files even if earlier named-based loads succeeded (the check is if (!ok && isWindows)). However, this fallback will only execute if the previous named-based loads failed. The logic constructs paths for all dependency DLLs and attempts to load them in order. If any single load fails, the entire chain fails (the pattern if (ok) ok = ... means subsequent loads only happen if previous ones succeeded).
Consider whether this is the desired behavior, or if it should continue attempting to load remaining DLLs even if one fails, similar to how the named-based approach uses ok = ... without checking previous success for each individual library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LibTorchArchiveCoreName for Linux has been changed to "libtorch-cxx11-abi-shared-with-deps", but there is no corresponding SHA file for the 2.10.0 version (libtorch-cxx11-abi-shared-with-deps-2.10.0%2Bcpu.zip.sha). The repository contains "libtorch-shared-with-deps-2.10.0%2Bcpu.zip.sha" but not the cxx11-abi variant for 2.10.0. This will cause the build to fail when trying to validate the downloaded archive. Either:
This appears to be an unrelated change that was accidentally included in the Windows ARM64 support PR.