Skip to content

Commit a788114

Browse files
authored
[wasm] Add the illink substitutions for SIMD (#79672)
This should fix size regression introduce with #78068 The untrimmed S.N.Vector class added few kilobytes to the assemblies of the bench sample. That wasn't that bad, OTOH the code produced by the aot compiler was much larger, 5MB in this case. So this will case default non-SIMD case. In the case of SIMD build we will need more investigation.
1 parent b340291 commit a788114

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@
248248
<PlatformManifestFileEntry Include="emcc-default.rsp" IsNative="true" />
249249
<PlatformManifestFileEntry Include="emcc-link.rsp" IsNative="true" />
250250
<PlatformManifestFileEntry Include="emcc-props.json" IsNative="true" />
251+
<PlatformManifestFileEntry Include="ILLink.Substitutions.WasmIntrinsics.xml" IsNative="true" />
252+
<PlatformManifestFileEntry Include="ILLink.Substitutions.NoWasmIntrinsics.xml" IsNative="true" />
251253
<!-- ICU-specific files -->
252254
<PlatformManifestFileEntry Include="libicudata.a" IsNative="true" />
253255
<PlatformManifestFileEntry Include="libicui18n.a" IsNative="true" />

src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Microsoft.NET.Runtime.WebAssembly.Sdk.pkgproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
<PackageFile Include="Sdk\AutoImport.props" TargetPath="Sdk" />
1414
<PackageFile Include="Sdk\Sdk.props" TargetPath="Sdk" />
15+
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\ILLink.Substitutions.*.xml" TargetPath="Sdk" />
1516
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\WasmApp.props" TargetPath="Sdk" />
1617
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\WasmApp.targets" TargetPath="Sdk" />
1718
<PackageFile Include="$(RepoRoot)\src\mono\wasm\build\WasmApp.Native.*" TargetPath="Sdk" />
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<linker>
2+
<assembly fullname="System.Private.CoreLib">
3+
<type fullname="System.Numerics.Vector">
4+
<method signature="System.Boolean get_IsHardwareAccelerated()" body="stub" value="false" />
5+
</type>
6+
<type fullname="System.Runtime.Intrinsics.Vector128">
7+
<method signature="System.Boolean get_IsHardwareAccelerated()" body="stub" value="false" />
8+
</type>
9+
<type fullname="System.Runtime.Intrinsics.Wasm.PackedSimd">
10+
<method signature="System.Boolean get_IsSupported()" body="stub" value="false" />
11+
</type>
12+
</assembly>
13+
</linker>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<linker>
2+
<assembly fullname="System.Private.CoreLib">
3+
<type fullname="System.Numerics.Vector">
4+
<method signature="System.Boolean get_IsHardwareAccelerated()" body="stub" value="true" />
5+
</type>
6+
<type fullname="System.Runtime.Intrinsics.Vector128">
7+
<method signature="System.Boolean get_IsHardwareAccelerated()" body="stub" value="true" />
8+
</type>
9+
<type fullname="System.Runtime.Intrinsics.Wasm.PackedSimd">
10+
<method signature="System.Boolean get_IsSupported()" body="stub" value="true" />
11+
</type>
12+
</assembly>
13+
</linker>

src/mono/wasm/build/WasmApp.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109
<WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">false</WasmGenerateAppBundle>
110110
<UseAppHost>false</UseAppHost>
111111
<TrimMode Condition="'$(TrimMode)' == ''">partial</TrimMode>
112+
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true'">$(_ExtraTrimmerArgs) --substitutions $(MSBuildThisFileDirectory)/ILLink.Substitutions.WasmIntrinsics.xml</_ExtraTrimmerArgs>
113+
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions $(MSBuildThisFileDirectory)/ILLink.Substitutions.NoWasmIntrinsics.xml</_ExtraTrimmerArgs>
112114

113115
<!-- Temporarily `false`, till sdk gets a fix for supporting the new file -->
114116
<WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == '' and '$(RunAOTCompilation)' != 'true'">false</WasmEmitSymbolMap>

0 commit comments

Comments
 (0)