Skip to content

Commit

Permalink
move rocm stage out
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi Zhang committed Jul 2, 2024
1 parent beb2496 commit 9066cdb
Show file tree
Hide file tree
Showing 2 changed files with 267 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,201 +236,6 @@ stages:
- template: templates/clean-agent-build-directory-step.yml


- stage: NuGet_Packaging_ROCm
dependsOn:
- Setup
- Linux_C_API_Packaging_ROCm_x64
condition: succeeded()
jobs:
- job: NuGet_Packaging_ROCm
workspace:
clean: all
# we need to use a 2022 pool to create the nuget package with MAUI targets.
# VS2019 has no support for net6/MAUI and we need to use msbuild (from the VS install) to do the packing
pool: 'Onnxruntime-Win-CPU-2022'
variables:
breakCodesignValidationInjection: ${{ parameters.DoEsrp }}
ReleaseVersionSuffix: $[stageDependencies.Setup.Set_Variables.outputs['Set_Release_Version_Suffix.ReleaseVersionSuffix']]
BuildDate : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Date.BuildDate']]
BuildTime : $[stageDependencies.Setup.Set_Variables.outputs['Set_Build_Time.BuildTime']]

steps:
- checkout: self
submodules: true
fetchDepth: 1

- template: templates/flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download Pipeline Artifact - NuGet'
ArtifactName: 'onnxruntime-linux-x64-rocm'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact'
SpecificArtifact: ${{ parameters.specificArtifact }}
BuildId: ${{ parameters.BuildId }}

- task: PowerShell@2
displayName: 'Reconstruct Build Directory'
inputs:
targetType: inline
script: |
Get-ChildItem $(Build.BinariesDirectory)\nuget-artifact -Filter *.tgz | % {
# *.tar will be created after *.tgz is extracted
$cmd = "7z.exe x $($_.FullName) -y -o$(Build.BinariesDirectory)\nuget-artifact"
Write-Output $cmd
Invoke-Expression -Command $cmd
}
Get-ChildItem $(Build.BinariesDirectory)\nuget-artifact -Filter *.tar | % {
$cmd = "7z.exe x $($_.FullName) -y -o$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts"
Write-Output $cmd
Invoke-Expression -Command $cmd
}
$ort_dirs = Get-ChildItem -Path $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-* -Directory
foreach ($ort_dir in $ort_dirs)
{
$dirname = Split-Path -Path $ort_dir -Leaf
$dirname = $dirname.SubString(0, $dirname.LastIndexOf('-'))
Write-Output "Renaming $ort_dir to $dirname"
Rename-Item -Path $ort_dir -NewName $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\$dirname
}
Copy-Item -Path $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\nuget-artifacts\onnxruntime-linux-x64-rocm\lib\* -Destination $(Build.BinariesDirectory)\RelWithDebInfo
- script: |
tree /F
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Inspect Build Binaries Directory'
- script: |
mklink /D /J models C:\local\models
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Create models link'
- task: NuGetToolInstaller@0
displayName: Use Nuget 6.10.x
inputs:
versionSpec: 6.10.x

- task: MSBuild@1
displayName: 'Restore NuGet Packages and create project.assets.json'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
platform: 'Any CPU'
configuration: RelWithDebInfo
msbuildArguments: '-t:restore -p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"'
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: MSBuild@1
displayName: 'Build C# bindings'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
platform: 'Any CPU'
configuration: RelWithDebInfo
msbuildArguments: >
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
-p:OrtPackageId="Microsoft.ML.OnnxRuntime.ROCm"
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
-p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
-p:IsLinuxBuild=true
-p:IsWindowsBuild=false
-p:IsMacOSBuild=false
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- template: templates/win-esrp-dll.yml
parameters:
FolderPath: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
DisplayName: 'ESRP - Sign C# dlls'
DoEsrp: ${{ parameters.DoEsrp }}

- task: UsePythonVersion@0
displayName: 'Use Python'
inputs:
versionSpec: 3.8

- task: MSBuild@1
displayName: 'Build Nuget Packages'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.proj'
configuration: RelWithDebInfo
platform: 'Any CPU'
msbuildArguments: >
-t:CreatePackage
-p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)"
-p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm
-p:IsReleaseBuild=${{ parameters.IsReleaseBuild }}
-p:ReleaseVersionSuffix=$(ReleaseVersionSuffix)
-p:CurrentTime=$(BuildTime)
-p:CurrentDate=$(BuildDate)
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.snupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: CopyFiles@2
displayName: 'Copy nuget packages to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- template: templates/esrp_nuget.yml
parameters:
DisplayName: 'ESRP - sign NuGet package'
FolderPath: '$(Build.ArtifactStagingDirectory)'
DoEsrp: ${{ parameters.DoEsrp }}

- template: templates/validate-package.yml
parameters:
PackageType: 'nuget'
PackagePath: '$(Build.ArtifactStagingDirectory)'
PackageName: 'Microsoft.ML.OnnxRuntime.*nupkg'
PlatformsSupported: 'linux-x64'
VerifyNugetSigning: false

- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline NuGet Artifact'
inputs:
artifactName: 'drop-signed-nuget-ROCm'
targetPath: '$(Build.ArtifactStagingDirectory)'

- task: MSBuild@1
displayName: 'Clean C#'
inputs:
solution: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
platform: 'Any CPU'
configuration: RelWithDebInfo
msbuildArguments: '-t:Clean -p:OnnxRuntimeBuildDirectory="$(Build.BinariesDirectory)" -p:OrtPackageId=Microsoft.ML.OnnxRuntime.ROCm'
workingDirectory: '$(Build.SourcesDirectory)\csharp'

- template: templates/component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'

- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
displayName: 'Clean Agent Directories'
condition: always()

- template: nuget/templates/test_linux.yml
parameters:
AgentPool: AMD-GPU
ArtifactSuffix: 'ROCm'
StageSuffix: 'ROCm'
NugetPackageName: 'Microsoft.ML.OnnxRuntime.ROCm'
SpecificArtifact: ${{ parameters.specificArtifact }}
CustomOpArtifactName: 'onnxruntime-linux-x64-rocm'
BuildId: ${{ parameters.BuildId }}

- template: nuget/templates/dml-vs-2022.yml
parameters:
AgentPool: 'onnxruntime-Win2022-GPU-dml-A10'
Expand Down
Loading

0 comments on commit 9066cdb

Please sign in to comment.