|
89 | 89 | pool: |
90 | 90 | vmImage: 'macos-latest' |
91 | 91 |
|
| 92 | +- template: /build/ci/job-template.yml |
| 93 | + parameters: |
| 94 | + prepScript: echo "no prep needed" |
| 95 | + name: Windows_arm64 |
| 96 | + buildScript: dotnet build /p:SkipCuda=true /p:TargetArchitecture=arm64 /p:SkipNetFxBuild=true -c |
| 97 | + testScript: echo "Cannot run ARM64 tests on x64 Azure Pipelines agent" |
| 98 | + pool: |
| 99 | + vmImage: 'windows-latest' |
| 100 | + |
92 | 101 | ################################################################################ |
93 | 102 | # {Build} --> combine --> package to build native bits on multiple OS's |
94 | 103 | ################################################################################ |
@@ -285,13 +294,72 @@ jobs: |
285 | 294 | - publish: $(Build.SourcesDirectory)/bin/obj/packprep/$(BuildConfig) |
286 | 295 | artifact: MacAssets_arm64 |
287 | 296 |
|
| 297 | +################################################################################ |
| 298 | +- job: Windows_arm64_Native_Build_For_Packages |
| 299 | +################################################################################ |
| 300 | + condition: and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}')) |
| 301 | + variables: |
| 302 | + BuildConfig: Release |
| 303 | + OfficialBuildId: $(BUILD.BUILDNUMBER) |
| 304 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 305 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
| 306 | + DOTNET_MULTILEVEL_LOOKUP: 0 |
| 307 | + pool: |
| 308 | + vmImage: 'windows-latest' |
| 309 | + steps: |
| 310 | + # Initial cleanup |
| 311 | + - script: | |
| 312 | + rmdir /s /q .git 2>nul |
| 313 | + dotnet nuget locals all --clear |
| 314 | + dir |
| 315 | + displayName: Initial cleanup |
| 316 | + continueOnError: true |
| 317 | +
|
| 318 | + - task: UseDotNet@2 |
| 319 | + displayName: 'Use .NET Core sdk' |
| 320 | + inputs: |
| 321 | + packageType: sdk |
| 322 | + version: 8.0.x |
| 323 | + installationPath: $(Agent.ToolsDirectory)/dotnet |
| 324 | + |
| 325 | + # Download ARM64 LibTorch and clean immediately |
| 326 | + - script: | |
| 327 | + dotnet build -c $(BuildConfig) src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=windows /p:TargetArchitecture=arm64 /t:Build /p:IncludeLibTorchCpuPackages=true |
| 328 | + del /s /q *.zip 2>nul |
| 329 | + del /s /q *.tar.gz 2>nul |
| 330 | + displayName: Download ARM64 libtorch native binaries and cleanup |
| 331 | + condition: eq('${{ parameters.BuildLibTorchPackages }}', true) |
| 332 | +
|
| 333 | + # Cross-compile LibTorchSharp for ARM64 on x64 host |
| 334 | + - script: dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true /p:TargetArchitecture=arm64 |
| 335 | + condition: eq('${{ parameters.BuildLibTorchPackages }}', true) |
| 336 | + displayName: Build TorchSharp win-arm64 |
| 337 | + |
| 338 | + - script: dotnet build -c $(BuildConfig) src/TorchVision/TorchVision.csproj /p:SkipCuda=true /p:SkipTests=true /p:TargetArchitecture=arm64 |
| 339 | + displayName: Build TorchVision |
| 340 | + |
| 341 | + - script: dotnet build -c $(BuildConfig) src/TorchAudio/TorchAudio.csproj /p:SkipCuda=true /p:SkipTests=true /p:TargetArchitecture=arm64 |
| 342 | + displayName: Build TorchAudio |
| 343 | + |
| 344 | + # Clean up unnecessary files before publishing |
| 345 | + - script: | |
| 346 | + del /s /q $(Build.SourcesDirectory)\bin\*.pdb 2>nul |
| 347 | + del /s /q $(Build.SourcesDirectory)\bin\*.xml 2>nul |
| 348 | + del /s /q $(Build.SourcesDirectory)\bin\obj\packprep\$(BuildConfig)\*.lib 2>nul |
| 349 | + displayName: Clean up unnecessary files |
| 350 | + continueOnError: true |
| 351 | +
|
| 352 | + - publish: $(Build.SourcesDirectory)/bin/obj/packprep/$(BuildConfig) |
| 353 | + artifact: WindowsAssets_arm64 |
| 354 | + |
288 | 355 | ################################################################################ |
289 | 356 | - job: Build_TorchSharp_And_libtorch_cpu_Packages |
290 | 357 | ################################################################################ |
291 | 358 | condition: and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}')) |
292 | 359 | dependsOn: |
293 | 360 | - Linux_Native_Build_For_Packages |
294 | 361 | - Windows_Native_Build_For_Packages |
| 362 | + - Windows_arm64_Native_Build_For_Packages |
295 | 363 | - MacOS_arm64_Native_Build_For_Packages |
296 | 364 | timeoutInMinutes: 90 |
297 | 365 | variables: |
@@ -496,6 +564,56 @@ jobs: |
496 | 564 | displayName: Clean WindowsAssets immediately |
497 | 565 | continueOnError: true |
498 | 566 |
|
| 567 | + # Process Windows ARM64 assets |
| 568 | + - task: DownloadPipelineArtifact@2 |
| 569 | + displayName: Download Windows ARM64 TorchSharp assets |
| 570 | + inputs: |
| 571 | + artifact: WindowsAssets_arm64 |
| 572 | + patterns: | |
| 573 | + TorchSharp/** |
| 574 | + path: $(Pipeline.Workspace)/WindowsAssets_arm64 |
| 575 | + retryCountOnTaskFailure: 3 |
| 576 | + |
| 577 | + - task: DownloadPipelineArtifact@2 |
| 578 | + displayName: Download Windows ARM64 TorchAudio assets |
| 579 | + inputs: |
| 580 | + artifact: WindowsAssets_arm64 |
| 581 | + patterns: | |
| 582 | + TorchAudio/** |
| 583 | + path: $(Pipeline.Workspace)/WindowsAssets_arm64 |
| 584 | + retryCountOnTaskFailure: 3 |
| 585 | + |
| 586 | + - task: DownloadPipelineArtifact@2 |
| 587 | + displayName: Download Windows ARM64 TorchVision assets |
| 588 | + inputs: |
| 589 | + artifact: WindowsAssets_arm64 |
| 590 | + patterns: | |
| 591 | + TorchVision/** |
| 592 | + path: $(Pipeline.Workspace)/WindowsAssets_arm64 |
| 593 | + retryCountOnTaskFailure: 3 |
| 594 | + |
| 595 | + - task: DownloadPipelineArtifact@2 |
| 596 | + displayName: Download Windows ARM64 libtorch-cpu assets |
| 597 | + condition: eq('${{ parameters.BuildLibTorchPackages }}', true) |
| 598 | + inputs: |
| 599 | + artifact: WindowsAssets_arm64 |
| 600 | + patterns: | |
| 601 | + libtorch-cpu-win-arm64/** |
| 602 | + path: $(Pipeline.Workspace)/WindowsAssets_arm64 |
| 603 | + retryCountOnTaskFailure: 3 |
| 604 | + continueOnError: true |
| 605 | + |
| 606 | + - task: CopyFiles@2 |
| 607 | + displayName: Copy Windows ARM64 native assets (batch) |
| 608 | + inputs: |
| 609 | + sourceFolder: $(Pipeline.Workspace)/WindowsAssets_arm64 |
| 610 | + targetFolder: $(Build.SourcesDirectory)/bin/obj/packprep/$(BuildConfig) |
| 611 | + cleanTargetFolder: false |
| 612 | + |
| 613 | + - script: rmdir /s /q $(Pipeline.Workspace)\WindowsAssets_arm64 |
| 614 | + displayName: Clean WindowsAssets_arm64 immediately |
| 615 | + continueOnError: true |
| 616 | + |
499 | 617 | # Restore and pack |
500 | 618 | - script: dotnet restore pkg/pack.proj /p:Configuration=Release --nologo |
501 | 619 | displayName: Restore package projects |
|
0 commit comments