From 469bb936987d67cca86b1fc54a4abb31331f0ea9 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Mon, 17 May 2021 12:09:38 -0400 Subject: [PATCH 1/4] Initial pass at trying to run catalyst in aot interp only mode --- eng/pipelines/runtime-staging.yml | 42 +++++++++++++++++++ eng/testing/tests.mobile.targets | 7 +++- src/tasks/AppleAppBuilder/AppleAppBuilder.cs | 2 +- src/tasks/AppleAppBuilder/Templates/runtime.m | 10 ++++- src/tasks/AppleAppBuilder/Xcode.cs | 3 +- 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index a778f606253b0..6ac61d654a55c 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -96,6 +96,48 @@ jobs: eq(variables['monoContainsChange'], true), eq(variables['isFullMatrix'], true)) +# +# MacCatalyst interp - requires AOT Compilation and Interp flags +# Build the whole product using Mono and run libraries tests +# +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: + - MacCatalyst_x64 + - MacCatalyst_arm64 + variables: + # map dependencies variables to local variables + - name: librariesContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ] + - name: monoContainsChange + value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ] + jobParameters: + testGroup: innerloop + nameSuffix: AllSubsets_Mono + buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunAOTCompilation=true /p:MonoForceInterpreter=true + timeoutInMinutes: 180 + condition: >- + or( + eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true), + eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true), + eq(variables['isFullMatrix'], true)) + # extra steps, run tests + extraStepsTemplate: /eng/pipelines/libraries/helix.yml + extraStepsParameters: + creator: dotnet-bot + interpreter: true + testRunNamePrefixSuffix: Mono_$(_BuildConfig) + condition: >- + or( + eq(variables['librariesContainsChange'], true), + eq(variables['monoContainsChange'], true), + eq(variables['isFullMatrix'], true)) + # # Build the whole product using Mono and run libraries tests # diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 2fedf68d95600..a2ad345b3ff3f 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -160,6 +160,11 @@ AppleTestRunner.dll <_MobileIntermediateOutputPath Condition="'$(RunAOTCompilation)' == 'true'">$(IntermediateOutputPath)mobile + + Full + Full + JustInterp + @(MonoAOTCompilerDefaultAotArguments, ';') @@ -175,7 +180,7 @@ Date: Mon, 17 May 2021 12:27:20 -0400 Subject: [PATCH 2/4] Cleanup --- src/tasks/AppleAppBuilder/Xcode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 9ea613caf3394..34982bb28c36a 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -197,7 +197,7 @@ public string GenerateXCode( { defines.AppendLine("add_definitions(-DFORCE_INTERPRETER=1)"); } - + if (forceAOT) { defines.AppendLine("add_definitions(-DFORCE_AOT=1)"); From 0949826247ee5f261cf00577e0933ccc5e46a052 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Mon, 17 May 2021 13:18:17 -0400 Subject: [PATCH 3/4] Remove yml dup --- eng/pipelines/runtime-staging.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml index 6ac61d654a55c..7b29783774ef1 100644 --- a/eng/pipelines/runtime-staging.yml +++ b/eng/pipelines/runtime-staging.yml @@ -66,7 +66,6 @@ jobs: platforms: - iOSSimulator_x64 - tvOSSimulator_x64 - - MacCatalyst_x64 variables: # map dependencies variables to local variables - name: librariesContainsChange From 227847cb6b1ea703d7f4ac27d30422245022df7a Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Thu, 20 May 2021 20:51:09 -0400 Subject: [PATCH 4/4] Incorporate @lambdageek's changes and identify native libraries to skip during System.Diagnostics.FileVersionInfo test run --- eng/testing/tests.mobile.targets | 5 ++++- .../System.Diagnostics.FileVersionInfo.Tests.csproj | 5 +++++ src/mono/CMakeLists.txt | 9 +++------ src/mono/Directory.Build.props | 3 ++- src/mono/mono/utils/mono-mmap.c | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index a2ad345b3ff3f..1a8c3d9405909 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -166,7 +166,10 @@ JustInterp - + <_AotExcludeAssemblies Include="$(PublishDir)System.Runtime.WindowsRuntime.dll" /> + <_AotExcludeAssemblies Include="@(NativeLibraries->'$(PublishDir)%(Identity)')" /> + + @(MonoAOTCompilerDefaultAotArguments, ';') @(MonoAOTCompilerDefaultProcessArguments, ';') diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj index 7efbc8bc54c82..ad027e8be2547 100644 --- a/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj +++ b/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj @@ -19,6 +19,11 @@ PreserveNewest + + + + + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 22cf849b4460f..801610da782fb 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -160,11 +160,11 @@ if(NOT AOT_TARGET_TRIPLE STREQUAL "") elseif(AOT_TARGET_TRIPLE STREQUAL "x86_64-apple-maccatalyst") set(TARGET_SYSTEM_NAME "Darwin") set(TARGET_ARCH "x86_64") - set(CMAKE_SYSTEM_VARIANT "MacCatalyst") + set(TARGET_MACCAT 1) elseif(AOT_TARGET_TRIPLE STREQUAL "aarch64-apple-maccatalyst") set(TARGET_SYSTEM_NAME "Darwin") set(TARGET_ARCH "arm64") - set(CMAKE_SYSTEM_VARIANT "MacCatalyst") + set(TARGET_MACCAT 1) elseif(AOT_TARGET_TRIPLE STREQUAL "wasm32-unknown-none") set(TARGET_SYSTEM_NAME "Emscripten") set(TARGET_ARCH "wasm") @@ -296,9 +296,6 @@ if(TARGET_SYSTEM_NAME STREQUAL "Darwin") set(TARGET_MACH 1) set(TARGET_OSX 1) set(TARGET_DARWIN 1) - if(CMAKE_SYSTEM_VARIANT STREQUAL "MacCatalyst") - set(TARGET_MACCAT 1) - endif() elseif(TARGET_SYSTEM_NAME STREQUAL "iOS" OR TARGET_SYSTEM_NAME STREQUAL "tvOS") set(TARGET_MACH 1) set(TARGET_IOS 1) @@ -744,7 +741,7 @@ set(FULL_VERSION ${product_version_string}) ###################################### # OS SPECIFIC CHECKS ###################################### -if(TARGET_IOS OR TARGET_ANDROID OR TARGET_MACCAT) +if(HOST_IOS OR HOST_ANDROID OR HOST_MACCAT) # FIXME: the mobile products use mono_dllmap_insert so allow this unset(DISABLE_DLLMAP) else() diff --git a/src/mono/Directory.Build.props b/src/mono/Directory.Build.props index 356a3175019ad..2eb7bc5647519 100644 --- a/src/mono/Directory.Build.props +++ b/src/mono/Directory.Build.props @@ -18,7 +18,8 @@ 2.0 5.1 10.13 - 11.0 + + 11.0 diff --git a/src/mono/mono/utils/mono-mmap.c b/src/mono/mono/utils/mono-mmap.c index e362b698dc454..08ce984f25e6c 100644 --- a/src/mono/mono/utils/mono-mmap.c +++ b/src/mono/mono/utils/mono-mmap.c @@ -305,7 +305,7 @@ mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type) } if ((flags & MONO_MMAP_JIT) && (use_mmap_jit || is_hardened_runtime == 1)) mflags |= MAP_JIT; -#if defined(HOST_ARM64) +#if defined(HOST_ARM64) && !defined(HOST_MACCAT) /* Patching code on apple silicon seems to cause random crashes without this flag */ /* No __builtin_available in old versions of Xcode that could be building Mono on x86 or amd64 */ if (__builtin_available (macOS 11, *))