Skip to content

Commit

Permalink
[mono] Check in offsets files used for AOT cross compilers (#109612)
Browse files Browse the repository at this point in the history
This allows us to remove a join point in the VMR build.
Instead of generating the offsets during the AOT cross compiler build we use the checked in files and change the existing CI job to validate that the generated file matches the checked in ones.

Fixes dotnet/source-build#3701
  • Loading branch information
akoeplinger authored Nov 8, 2024
1 parent b567474 commit ef685ad
Show file tree
Hide file tree
Showing 24 changed files with 3,274 additions and 154 deletions.
7 changes: 0 additions & 7 deletions eng/pipelines/common/global-build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,6 @@ jobs:
# credential provider is installed.
- task: NuGetAuthenticate@1

- ${{ each monoCrossAOTTargetOS in parameters.monoCrossAOTTargetOS }}:
- task: DownloadPipelineArtifact@2
displayName: Download ${{monoCrossAOTTargetOS}} AOT offset files
inputs:
artifact: Mono_Offsets_${{monoCrossAOTTargetOS}}
path: '$(Build.SourcesDirectory)/artifacts/obj/mono/offsetfiles'

- ${{ if in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator') }}:
- script: $(Build.SourcesDirectory)/eng/common/native/install-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ steps:
-arch ${{ parameters.archType }}
/p:BuildMonoAotCrossCompiler=true
/p:BuildMonoAotCrossCompilerOnly=true
/p:MonoLibClang="/usr/local/lib/libclang.so.16"
/p:MonoAOTEnableLLVM=true
/p:CrossBuild=true
displayName: "Build Mono LLVM AOT cross compiler"
Expand Down
1 change: 0 additions & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ jobs:
-arch $(archType)
/p:BuildMonoAotCrossCompiler=true
/p:BuildMonoAotCrossCompilerOnly=true
/p:MonoLibClang="/usr/local/lib/libclang.so.16"
/p:MonoAOTEnableLLVM=true
displayName: "Build Mono LLVM AOT cross compiler"

Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/coreclr/perf-non-wasm-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
platforms:
- linux_x64
jobParameters:
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoAOTEnableLLVM=true /p:MonoEnableLLVM=true /p:BuildMonoAOTCrossCompiler=true /p:MonoLibClang="/usr/local/lib/libclang.so.16" /p:AotHostArchitecture=x64 /p:AotHostOS=linux
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoAOTEnableLLVM=true /p:MonoEnableLLVM=true /p:BuildMonoAOTCrossCompiler=true /p:AotHostArchitecture=x64 /p:AotHostOS=linux
nameSuffix: AOT
isOfficialBuild: false
postBuildSteps:
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/coreclr/perf_slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ extends:
platforms:
- linux_arm64
jobParameters:
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoAOTEnableLLVM=true /p:MonoEnableLLVM=true /p:BuildMonoAOTCrossCompiler=true /p:MonoLibClang="/usr/local/lib/libclang.so" /p:AotHostArchitecture=arm64 /p:AotHostOS=linux
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoAOTEnableLLVM=true /p:MonoEnableLLVM=true /p:BuildMonoAOTCrossCompiler=true /p:AotHostArchitecture=arm64 /p:AotHostOS=linux
nameSuffix: AOT
isOfficialBuild: false
postBuildSteps:
Expand Down
76 changes: 3 additions & 73 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,46 +382,6 @@ extends:
parameters:
name: MonoRuntimePacks


# Build Mono AOT offset headers once, for consumption elsewhere
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: release
platforms:
- android_x64
- browser_wasm
- wasi_wasm
- tvos_arm64
- ios_arm64
- maccatalyst_x64
variables:
- name: _osParameter
value: -os linux
- name: _archParameter
value: -arch x64
jobParameters:
templatePath: 'templates-official'
nameSuffix: MonoAOTOffsets
buildArgs: -s mono.aotcross -c $(_BuildConfig) /p:MonoGenerateOffsetsOSGroups=$(osGroup)
postBuildSteps:
# Upload offset files
- task: CopyFiles@2
displayName: Collect offset files
inputs:
sourceFolder: '$(Build.SourcesDirectory)/artifacts/obj/mono/'
contents: '**/offsets-*.h'
targetFolder: '$(Build.SourcesDirectory)/artifacts/obj/mono/offsetfiles/'

templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish Mono AOT offsets'
condition: succeeded()
targetPath: '$(Build.SourcesDirectory)/artifacts/obj/mono/offsetfiles'
artifactName: 'Mono_Offsets_$(osGroup)$(osSubGroup)'

#
# Build Mono release AOT cross-compilers
#
Expand All @@ -438,17 +398,9 @@ extends:
jobParameters:
templatePath: 'templates-official'
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
dependsOn:
- build_android_x64_release_MonoAOTOffsets
- build_browser_wasm_linux_release_MonoAOTOffsets
- build_wasi_wasm_linux_release_MonoAOTOffsets
monoCrossAOTTargetOS:
- android
- browser
- wasi
isOfficialBuild: ${{ variables.isOfficialBuild }}
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
Expand All @@ -466,17 +418,9 @@ extends:
jobParameters:
templatePath: 'templates-official'
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
dependsOn:
- build_android_x64_release_MonoAOTOffsets
- build_browser_wasm_linux_release_MonoAOTOffsets
- build_wasi_wasm_linux_release_MonoAOTOffsets
monoCrossAOTTargetOS:
- android
- browser
- wasi
isOfficialBuild: ${{ variables.isOfficialBuild }}
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
Expand All @@ -494,23 +438,9 @@ extends:
jobParameters:
templatePath: 'templates-official'
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi+tvos+ios+maccatalyst /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
/p:MonoCrossAOTTargetOS=android+browser+wasi+tvos+ios+maccatalyst /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
dependsOn:
- build_android_x64_release_MonoAOTOffsets
- build_browser_wasm_linux_release_MonoAOTOffsets
- build_wasi_wasm_linux_release_MonoAOTOffsets
- build_tvos_arm64_release_MonoAOTOffsets
- build_ios_arm64_release_MonoAOTOffsets
- build_maccatalyst_x64_release_MonoAOTOffsets
monoCrossAOTTargetOS:
- android
- browser
- wasi
- tvos
- ios
- maccatalyst
isOfficialBuild: ${{ variables.isOfficialBuild }}
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
Expand Down
50 changes: 10 additions & 40 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ extends:
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true),
eq(variables['isRollingBuild'], true))
# Build Mono AOT offset headers once, for consumption elsewhere
# Build Mono AOT offset headers once, for validation
# Only when mono changed
#
- template: /eng/pipelines/common/platform-matrix.yml
Expand All @@ -739,8 +739,7 @@ extends:
- android_x64
- browser_wasm
- wasi_wasm
- tvos_arm64
- ios_arm64
- ios_arm64 # tvos and ios use the same offsets so we only need to build once
- maccatalyst_x64
variables:
- name: _osParameter
Expand All @@ -749,20 +748,21 @@ extends:
value: -arch x64
jobParameters:
nameSuffix: MonoAOTOffsets
buildArgs: -s mono.aotcross -c $(_BuildConfig) /p:MonoGenerateOffsetsOSGroups=$(osGroup)
buildArgs: -s mono.aotcross -c $(_BuildConfig) /p:MonoGenerateOffsetsOSGroups=$(osGroup) /p:ValidateMonoOffsets=true
postBuildSteps:
# Upload offset files
- task: CopyFiles@2
displayName: Collect offset files
condition: failed()
inputs:
sourceFolder: '$(Build.SourcesDirectory)/artifacts/obj/mono/'
contents: '**/offsets-*.h'
sourceFolder: '$(Build.SourcesDirectory)/src/mono/mono/offsets'
contents: '*.h.new'
targetFolder: '$(Build.SourcesDirectory)/artifacts/obj/mono/offsetfiles/'

- publish: '$(Build.SourcesDirectory)/artifacts/obj/mono/offsetfiles'
condition: failed()
artifact: Mono_Offsets_$(osGroup)$(osSubGroup)
displayName: Upload offset files
# needed by crossaot
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true),
Expand Down Expand Up @@ -1199,17 +1199,9 @@ extends:
- linux_musl_arm64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
dependsOn:
- build_android_x64_release_MonoAOTOffsets
- build_browser_wasm_linux_release_MonoAOTOffsets
- build_wasi_wasm_linux_release_MonoAOTOffsets
monoCrossAOTTargetOS:
- android
- browser
- wasi
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true),
Expand All @@ -1226,17 +1218,9 @@ extends:
- windows_x64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
/p:MonoCrossAOTTargetOS=android+browser+wasi /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
dependsOn:
- build_android_x64_release_MonoAOTOffsets
- build_browser_wasm_linux_release_MonoAOTOffsets
- build_wasi_wasm_linux_release_MonoAOTOffsets
monoCrossAOTTargetOS:
- android
- browser
- wasi
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true),
Expand All @@ -1257,23 +1241,9 @@ extends:
- osx_arm64
jobParameters:
buildArgs: -s mono+packs -c $(_BuildConfig)
/p:MonoCrossAOTTargetOS=android+browser+wasi+tvos+ios+maccatalyst /p:SkipMonoCrossJitConfigure=true /p:BuildMonoAOTCrossCompilerOnly=true
/p:MonoCrossAOTTargetOS=android+browser+wasi+tvos+ios+maccatalyst /p:BuildMonoAOTCrossCompilerOnly=true
nameSuffix: CrossAOT_Mono
runtimeVariant: crossaot
dependsOn:
- build_android_x64_release_MonoAOTOffsets
- build_browser_wasm_linux_release_MonoAOTOffsets
- build_wasi_wasm_linux_release_MonoAOTOffsets
- build_tvos_arm64_release_MonoAOTOffsets
- build_ios_arm64_release_MonoAOTOffsets
- build_maccatalyst_x64_release_MonoAOTOffsets
monoCrossAOTTargetOS:
- android
- browser
- wasi
- tvos
- ios
- maccatalyst
condition: >-
or(
eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
Expand Down
6 changes: 0 additions & 6 deletions src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,9 @@ if(NOT AOT_TARGET_TRIPLE STREQUAL "")
if(AOT_TARGET_TRIPLE STREQUAL "x86_64-apple-darwin10")
set(TARGET_SYSTEM_NAME "ios")
set(TARGET_ARCH "x86_64")
elseif(AOT_TARGET_TRIPLE STREQUAL "i386-apple-darwin10")
set(TARGET_SYSTEM_NAME "ios")
set(TARGET_ARCH "x86")
elseif(AOT_TARGET_TRIPLE STREQUAL "aarch64-apple-darwin10")
set(TARGET_SYSTEM_NAME "ios")
set(TARGET_ARCH "arm64")
elseif(AOT_TARGET_TRIPLE STREQUAL "arm-apple-darwin10")
set(TARGET_SYSTEM_NAME "ios")
set(TARGET_ARCH "arm")
elseif(AOT_TARGET_TRIPLE STREQUAL "x86_64-apple-maccatalyst")
set(TARGET_SYSTEM_NAME "darwin")
set(TARGET_ARCH "x86_64")
Expand Down
Loading

0 comments on commit ef685ad

Please sign in to comment.