Skip to content

Commit 14e6411

Browse files
authored
Skip AOT of Microsoft.CodeAnalysis.CSharp.dll for WASM, due to out-of-memory issues in CI (#63958)
1 parent 193aeef commit 14e6411

File tree

9 files changed

+42
-9
lines changed

9 files changed

+42
-9
lines changed

eng/testing/tests.wasm.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
<BuildAOTTestsOn Condition="'$(BuildAOTTestsOn)' == ''">local</BuildAOTTestsOn>
2424
</PropertyGroup>
2525

26+
<ItemGroup>
27+
<_AOT_InternalForceInterpretAssemblies Include="@(HighAotMemoryUsageAssembly)" />
28+
</ItemGroup>
29+
2630
<!--
2731
This is running during compile time and therefore $(Scenario) is empty, unless the specific project sets it.
2832
Any settings in the project file could be replaced on Helix.
@@ -120,7 +124,7 @@
120124
<PropertyGroup>
121125
<_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath>
122126
<RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath>
123-
<EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl%252C-O0 -Wl%252C-lto-O0</EmccLinkOptimizationFlag>
127+
<EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl,-O0 -Wl,-lto-O0</EmccLinkOptimizationFlag>
124128
</PropertyGroup>
125129

126130
<Error Text="Item WasmAssembliesToBundle is empty. This is likely an authoring error." Condition="@(WasmAssembliesToBundle->Count()) == 0" />
@@ -171,6 +175,9 @@
171175
<_WasmItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" />
172176
173177
-->
178+
179+
<_WasmItemsToPass Include="@(_AOT_InternalForceInterpretAssemblies)" OriginalItemName__="_AOT_InternalForceInterpretAssemblies" />
180+
174181
</ItemGroup>
175182

176183
<!-- This file gets imported by the project file on helix -->

src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
66
</PropertyGroup>
77

8+
<ItemGroup>
9+
<HighAotMemoryUsageAssembly Include="Microsoft.CodeAnalysis.CSharp.dll" />
10+
</ItemGroup>
11+
812
<Import Project="Microsoft.Extensions.Logging.Generators.targets"/>
913

1014
<ItemGroup>

src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<WasmNativeStrip>false</WasmNativeStrip>
99
</PropertyGroup>
1010

11+
<ItemGroup>
12+
<HighAotMemoryUsageAssembly Include="Microsoft.CodeAnalysis.CSharp.dll" />
13+
</ItemGroup>
14+
1115
<Import Project="Microsoft.Extensions.Logging.Generators.targets"/>
1216

1317
<ItemGroup>

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<ItemGroup>
4+
<HighAotMemoryUsageAssembly Include="Microsoft.CodeAnalysis.CSharp.dll" />
5+
</ItemGroup>
6+
37
<Import Project="System.Text.Json.SourceGeneration.Tests.targets" />
48

59
<ItemGroup>

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
55
</PropertyGroup>
66

7+
<ItemGroup>
8+
<HighAotMemoryUsageAssembly Include="Microsoft.CodeAnalysis.CSharp.dll" />
9+
</ItemGroup>
10+
711
<Import Project="System.Text.Json.SourceGeneration.Unit.Tests.targets" />
812

913
<ItemGroup>

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
66
</PropertyGroup>
77

8+
<ItemGroup>
9+
<HighAotMemoryUsageAssembly Include="Microsoft.CodeAnalysis.CSharp.dll" />
10+
</ItemGroup>
11+
812
<Import Project="System.Text.Json.SourceGeneration.Unit.Tests.targets" />
913

1014
<ItemGroup>

src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Generators.Tests/System.Text.RegularExpressions.Generators.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
1111
</PropertyGroup>
1212

13+
<ItemGroup>
14+
<HighAotMemoryUsageAssembly Include="Microsoft.CodeAnalysis.CSharp.dll" />
15+
</ItemGroup>
16+
1317
<ItemGroup>
1418
<ProjectReference Include="$(LibrariesProjectRoot)System.Text.RegularExpressions\src\System.Text.RegularExpressions.csproj" />
1519
<PackageReference Include="Microsoft.CodeAnalysis" Version="$(MicrosoftCodeAnalysisVersion)" />

src/libraries/tests.proj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@
2525

2626
<!-- Wasm aot on !windows -->
2727
<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(BuildAOTTestsOnHelix)' == 'true' and '$(RunDisabledWasmTests)' != 'true' and '$(RunAOTCompilation)' == 'true' and '$(BrowserHost)' != 'Windows'">
28-
<!-- Exceeds VM resources in CI on compilation: https://github.com/dotnet/runtime/issues/61339 -->
29-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Logging.Abstractions\tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj" />
30-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Logging.Abstractions\tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj" />
31-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj" />
32-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj" />
33-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj" />
34-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\System.Text.RegularExpressions.Generators.Tests\System.Text.RegularExpressions.Generators.Tests.csproj" />
35-
3628
<!-- https://github.com/dotnet/runtime/issues/61756 -->
3729
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\System.Text.RegularExpressions.Tests.csproj" />
3830
</ItemGroup>

src/mono/wasm/build/WasmApp.Native.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,13 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_
519519
<_WasmAOTSearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)\lib\net7.0" />
520520
</ItemGroup>
521521

522+
<ItemGroup>
523+
<!-- Skip known-huge assemblies specified in csproj -->
524+
<_AotInputAssemblies Condition="'%(Filename)' != '' and '@(_AotInputAssemblies->Metadata(`Filename`))' != '' and '@(_AOT_InternalForceInterpretAssemblies->Metadata(`Filename`))' != ''">
525+
<AOT_InternalForceToInterpret>true</AOT_InternalForceToInterpret>
526+
</_AotInputAssemblies>
527+
</ItemGroup>
528+
522529
<PropertyGroup>
523530
<!--<AOTMode Condition="'$(AOTMode)' == '' and '$(AOTProfilePath)' != ''">LLVMOnlyInterp</AOTMode>-->
524531
<AOTMode Condition="'$(AOTMode)' == ''">LLVMOnlyInterp</AOTMode>
@@ -575,6 +582,9 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_
575582
<ItemGroup>
576583
<_BitcodeFile Include="%(_WasmAssembliesInternal.LlvmBitcodeFile)" />
577584
<_BitcodeFile ObjectFile="$(_WasmIntermediateOutputPath)%(FileName).o" />
585+
586+
<!-- Add the skipped assemblies -->
587+
<_WasmAssembliesInternal Include="@(_AotInputAssemblies->WithMetadataValue('AOT_InternalForceToInterpret', 'true'))" />
578588
</ItemGroup>
579589
</Target>
580590

0 commit comments

Comments
 (0)