Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Add optimization flags to bitcode compilation #101538

Merged
merged 5 commits into from
Apr 26, 2024

Conversation

radekdoulik
Copy link
Member

@radekdoulik radekdoulik commented Apr 25, 2024

While #101397 fixed the compilation errors, it also introduced new size regression by omitting the optimization flags. These flags were set before by EmccLinkOptimizationFlag and WasiClangLinkOptimizationFlag.

comping from LD optimization flags.

This should also fix the recent size regression.
@@ -148,6 +148,8 @@

<WasiClangCompileOptimizationFlag Condition="'$(WasiClangCompileOptimizationFlag)' == ''">$(_WasiClangOptimizationFlagDefault)</WasiClangCompileOptimizationFlag>
<WasmCompileOptimizationFlag>$(WasiClangCompileOptimizationFlag)</WasmCompileOptimizationFlag>
<WasiBitcodeCompileOptimizationFlag Condition="'$(WasiBitcodeCompileOptimizationFlag)' == '' and '$(Configuration)' == 'Release'">-O2</WasiBitcodeCompileOptimizationFlag>
Copy link
Member

Choose a reason for hiding this comment

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

Do we want a separate property for WASI?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have other wasi specific flags here too, like WasiClangLinkOptimizationFlag, so I kept it separate as well.

Copy link
Member

Choose a reason for hiding this comment

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

I think WasiClangLinkOptimizationFlag is specific thing for WASI. This one is a shared concept from my POV

@@ -44,6 +44,8 @@

- $(EmccLinkOptimizationFlag) - Optimization flag to use for the link step
- $(EmccCompileOptimizationFlag) - Optimization flag to use for compiling native files
- $(WasmBitcodeCompileOptimizationFlag)
Copy link
Member

Choose a reason for hiding this comment

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

If we end up having a separate WasiBitcodeCompileOptimizationFlag property for WASI, we should probably state it here.
On the other hand, this file is named common, but it contains basically the browser story properties

Copy link
Member Author

Choose a reason for hiding this comment

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

The other wasi specific properties are not listed here either. I guess we consider it rapidly moving target?

@radekdoulik
Copy link
Member Author

These are the regression this PR is fixing.

image image

Copy link
Member

@lewing lewing left a comment

Choose a reason for hiding this comment

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

Lets discuss possible improvements once we fix the regression.

@lewing lewing merged commit b8f96af into dotnet:main Apr 26, 2024
31 of 35 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants