Skip to content

[WASM] Add ILStrip task to wasm app build process - #88926

Merged
fanyang-mono merged 21 commits into
dotnet:mainfrom
fanyang-mono:enable_il_trim_wasm
Aug 10, 2023
Merged

[WASM] Add ILStrip task to wasm app build process#88926
fanyang-mono merged 21 commits into
dotnet:mainfrom
fanyang-mono:enable_il_trim_wasm

Conversation

@fanyang-mono

@fanyang-monofanyang-mono commented Jul 14, 2023

Copy link
Copy Markdown
Member

Fixes#88696

With this PR, the customer is able to create an WASM app and enabling IL trimming for AOT compiled methods. By default, this is disabled. To enable it, build the app with WasmStripILAfterAOT =true. This change help producing a smaller WASM app.

Impact of this change is displayed as follows. I measured the size of _framework after compression using brotli for wasm apps with AOT enabled:

  • Wasm app under src/mono/sample/wasm/browser
    • 6.0M -> 5.8M (-p:WasmEnableWebcil=false) (3.3% smaller)
    • 5.9M -> 5.8M (-p:WasmEnableWebcil=true) (1.7% smaller)
  • Wasm app under src/mono/sample/wasm/browser-bench
    • 7.1M -> 6.8M (-p:WasmEnableWebcil=false) (4.2% smaller)
    • 7.1M -> 6.8M (-p:WasmEnableWebcil=true) (4.2% smaller)

@ghostghost added the area-Build-mono label Jul 14, 2023
@lewing
lewing requested a review from vargazJuly 14, 2023 19:25
@lewing

lewing commented Jul 14, 2023

Copy link
Copy Markdown
Member

Are we confident that this handles all the cases where wasm might transition to the interpreter appropriately?

Comment threadsrc/mono/wasm/build/WasmApp.Native.targets Outdated
Comment threadsrc/mono/wasm/build/WasmApp.InTree.targets
@radical

Copy link
Copy Markdown
Member

Also, test needed in src/mono/wasm/Wasm.Build.Tests.

@radical

Copy link
Copy Markdown
Member

And could you please add some detail about what the PR is doing, like what the default is for the property, and what it will do, and/or affect?

@radicalradical added the arch-wasm WebAssembly architecture label Jul 14, 2023
@ghost

Copy link
Copy Markdown

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #88696

Author:fanyang-mono
Assignees:fanyang-mono
Labels:

arch-wasm, area-Build-mono

Milestone:-

@radicalradical added this to the 8.0.0 milestone Jul 14, 2023
@fanyang-monofanyang-mono changed the title [WASM] Add ILStrip task to wasm app build process[WASM][WIP] Add ILStrip task to wasm app build processJul 16, 2023
* Methods which have 'deopt' set can enter the interpreter during EH.
* Methods which have 'interp_entry_only' set are AOTed, but the AOT
code is only used to enter the interpreter.
@lewing

Copy link
Copy Markdown
Member

cc @kg

@fanyang-mono
fanyang-mono marked this pull request as draft July 26, 2023 20:20
@fanyang-mono

Copy link
Copy Markdown
MemberAuthor

Are we confident that this handles all the cases where wasm might transition to the interpreter appropriately?

I am trying to test it with as many apps as I could get a hold on before merging it. TBH, I can't guarantee that this feature is going to work 100% for all wasm apps, that's why it is off by default.

Comment threadsrc/mono/mono/mini/aot-compiler.c Outdated
Comment threadsrc/mono/mono/mini/interp/transform.c
@vargaz

Copy link
Copy Markdown
Contributor

The mono changes look ok to me.

@lambdageeklambdageek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Consider changing WASMStripIL to WasmStripIL.

Is it worth calling out that this only makes sense with AOT right in the property name? Maybe WasmStripILAfterAOT ?

Comment threadsrc/mono/wasm/build/WasmApp.targets Outdated
@fanyang-mono

Copy link
Copy Markdown
MemberAuthor

Will enable WASM AOT tests with WasmStripILAfterAOT =true in a follow-up PR.

Comment threadsrc/mono/mono/mini/aot-compiler.c Outdated
Comment threadsrc/mono/mono/mini/aot-compiler.c
Comment threadsrc/mono/mono/mini/aot-compiler.c Outdated
Comment threadsrc/mono/mono/mini/interp/interp.c Outdated
kg
kg approved these changes Aug 9, 2023
@fanyang-mono
fanyang-mono merged commit 867e185 into dotnet:mainAug 10, 2023
@ghostghost locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasmWebAssembly architecturearea-Build-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WASM] Enable new IL trim feature for WASM apps

7 participants

@fanyang-mono@lewing@radical@vargaz@kg@lambdageek@BrzVlad