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] Incremental build improvements #90194

Merged
merged 10 commits into from
Aug 14, 2023
Merged

Conversation

radical
Copy link
Member

@radical radical commented Aug 8, 2023

  • [wasm] Sanity check emcc versions only when using a custom EMSDK_PATH
  • [wasm] Emit a message about compiling native assets only when actually doing so
  • [wasm] ConvertDllsToWebcil: avoid doing unncessary conversion, and other work
  • [wasm] ManagedToNativeGenerator: add support for incremental runs (time goes from 1.6s to <900ms)

This improves build times ~30% for no-op rebuilds.

With native reference Old New Difference %
First build 8.01s 8.13s +0.12s  
4th rebuild 1.91s 1.35s -0.56s 29%
rebuild with only cs change 2.90s 2.48s -0.42s 14%
Without native reference Old New Difference %
First build 5.34s 5.29 -0.05s  
4th rebuild 1.78s 1.20s -0.58s 32%
rebuild with only cs change 1.96s 1.45s -0.51s 26%

Fixes #60245 .

@radical radical added the arch-wasm WebAssembly architecture label Aug 8, 2023
@ghost ghost assigned radical Aug 8, 2023
@ghost
Copy link

ghost commented Aug 8, 2023

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

Issue Details
  • [wasm] Sanity check emcc versions only when using a custom EMSDK_PATH
  • [wasm] Emit a message about compiling native assets only when actually doing so
  • [wasm] ConvertDllsToWebcil: avoid doing unncessary conversion, and other work
Author: radical
Assignees: -
Labels:

arch-wasm

Milestone: -

@radical radical force-pushed the wasm-incremental-build branch from 0eee015 to 22f2daa Compare August 8, 2023 23:43
@radical radical changed the title wasm incremental build [wasm] Incremental build improvements Aug 8, 2023
@radical
Copy link
Member Author

radical commented Aug 11, 2023

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

- Check emcc versions *if* `EMSDK_PATH` was explicitly set, IOW,
  workloads are not in use
Convert the assemblies only if needed.
- If the inputs are older than the outputs, then no work needs to be
  done
- The inputs consist of the assemblies to scan, and a list of pinvoke
  modules.
  - Timestamps are used for the assemblies
  - And for the pinvoke modules list, we save that in a cache file, and
    use that to determine if any work needs to be done.
`EmccCompile` task build compiles some `.c` files, but skips them if the
output files are already up-to-date. But the build always emits a
`Compiling native assets with emcc with ..` message, which suggests that
there is some native build being run. Instead, emit this message only if
`EmccCompile` actually did any work.
@radical radical force-pushed the wasm-incremental-build branch from 34390f4 to dda5b20 Compare August 11, 2023 06:05
@radical radical marked this pull request as ready for review August 11, 2023 06:37
@radical radical requested a review from maraf August 11, 2023 06:38
@radical
Copy link
Member Author

radical commented Aug 11, 2023

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radical
Copy link
Member Author

radical commented Aug 11, 2023

Failures are unrelated.

src/mono/wasm/Makefile Outdated Show resolved Hide resolved
Copy link
Member

@kg kg left a comment

Choose a reason for hiding this comment

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

I don't see anything wrong in here, though I'm not an expert on the table generators or msbuild

Copy link
Member

@maraf maraf left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@radical radical merged commit 711447a into dotnet:main Aug 14, 2023
@radical radical deleted the wasm-incremental-build branch August 14, 2023 15:49
@ghost ghost locked as resolved and limited conversation to collaborators Sep 13, 2023
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.

WebAssembly native dependency builds incrementalism is still slow
4 participants