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] Enable wasm relinking by default for Release config #49251

Merged
merged 5 commits into from
Mar 17, 2021

Conversation

radical
Copy link
Member

@radical radical commented Mar 5, 2021

Set default value for $(WasmBuildNative) based on:

  • If $(WasmBuildNative) is already set (eg. by user project) to true, then error if EMSDK_PATH is unset

  • if unset, and$(PublishTrimmed) == false, then set to false

  • if unset, and $(Configuration) == "Release", then set to true

  • If it is $(WasmBuildNative) == true after above steps, and emsdk is missing
    => then emit a warning, and set it to false

Fixes: #48349

@ghost
Copy link

ghost commented Mar 5, 2021

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

Issue Details

Fixes: #48349

Author: radical
Assignees: -
Labels:

arch-wasm, area-Build-mono

Milestone: -

@radical
Copy link
Member Author

radical commented Mar 5, 2021

Test can be added once #47683 is merged.

@lewing
Copy link
Member

lewing commented Mar 5, 2021

A couple of thoughts.

  • There is little reason to run this step if PublishTrimmed isn't true.
  • If EMSDK isn't installed
    • Error in anything other than interpreter only mode
    • Warning in interpreter mode
    • Error in a couple of other cases

@vargaz
Copy link
Contributor

vargaz commented Mar 6, 2021

Also, native linking is very slow, so making it the default will hurt user experience.

@radical radical changed the title [wasm] Set WasmBuildNative=true for Release config [wasm] Enable wasm relinking by default for Release config Mar 6, 2021
@lewing
Copy link
Member

lewing commented Mar 8, 2021

yes, In interpreter mode we don't require it unless the default icall/pinvoke tables are missing symbols (extra symbols are fine) and that will only happen if we've added references to native assets in which case we'll need to relink to include them and add to the tables. And ideally we we only do that if the native assets change.

@marek-safar
Copy link
Contributor

I don't think there is much concern for the release/deploy configuration to be slow because it runs more optimizations.

@radical
Copy link
Member Author

radical commented Mar 15, 2021

  • There is little reason to run this step if PublishTrimmed isn't true.
    👍
  • If EMSDK isn't installed

    • Error in anything other than interpreter only mode
    • Warning in interpreter mode

What do you mean by "interpreter mode"? $(AOTMode)?

  • Error in a couple of other cases

Could you enumerate those, or at least the ones that we definitely want in this PR?

- But set to `false` if `$(PublishTrimmed)` is not true

Fixes: dotnet#48349
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.

Needs to be false by default if emsdk is not present

@radical
Copy link
Member Author

radical commented Mar 17, 2021

Needs to be false by default if emsdk is not present

  1. If $(WasmBuildNative) is already set to true, then error if no emsdk?
  2. If not set at all, and we want to set it to true based on other conditions
    => then set to false if emsdk is not present, and a warning?

Something like this? I'm guessing that we would want to avoid silently skipping relinking, because EMSDK_PATH wasn't set, but maybe was expected.

@lewing
Copy link
Member

lewing commented Mar 17, 2021

yes

@radical radical requested a review from lewing March 17, 2021 12:44
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.

The logic looks good and I'm ok with landing this as is to let packages flow to aspnetcore but let's not close #48349 yet. The messages need some work and we will need a follow up that abstracts the conditional logic in a slightly different way.

@radical
Copy link
Member Author

radical commented Mar 17, 2021

The logic looks good and I'm ok with landing this as is to let packages flow to aspnetcore but let's not close #48349 yet. The messages need some work and we will need a follow up that abstracts the conditional logic in a slightly different way.

Yeah, the conditional logic will get simplified, but there are bunch of PRs in flight right now, after which it should be sorted out.

re:messages, yes!!

@radical radical merged commit 4e3deb5 into dotnet:main Mar 17, 2021
@radical radical deleted the wasm-relinking branch March 17, 2021 17:12
@trylek
Copy link
Member

trylek commented Mar 17, 2021

@radical - I think your change has broken the dotnet-linker-tests pipeline,

https://dev.azure.com/dnceng/public/_build?definitionId=861

All jobs after your check-in now show:

Job build_Browser_wasm_release_Runtime_Release depends on unknown job mono_browser_offsets.

Could you please take a look?

Cc @directhex who is still the test cop AFAIK, otherwise he'll forward as appropriate.

Cc @dotnet/runtime-infrastructure

@radical
Copy link
Member Author

radical commented Mar 17, 2021

@trylek working on a fix now, in #49774

@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document wasm relinking functionality
6 participants