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

x/build/env: Add builder for GOOS=wasip1 GOARCH=wasm #59150

Closed
johanbrandhorst opened this issue Mar 20, 2023 · 12 comments
Closed

x/build/env: Add builder for GOOS=wasip1 GOARCH=wasm #59150

johanbrandhorst opened this issue Mar 20, 2023 · 12 comments
Labels
arch-wasm WebAssembly issues Builders x/build issues (builders, bots, dashboards) NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@johanbrandhorst
Copy link
Member

#58141 adds the new GOOS=wasip1 GOARCH=wasm port. This new port will require a new builder that can run the standard library tests.

I intend to submit a CL to add this.

@johanbrandhorst johanbrandhorst added Builders x/build issues (builders, bots, dashboards) arch-wasm WebAssembly issues labels Mar 20, 2023
@gopherbot gopherbot added this to the Unreleased milestone Mar 20, 2023
@heschi heschi added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 20, 2023
@heschi
Copy link
Contributor

heschi commented Mar 20, 2023

cc @golang/release

@gopherbot
Copy link

Change https://go.dev/cl/479121 mentions this issue: env: add wasip1/wasm wasmtime builder

@gopherbot
Copy link

Change https://go.dev/cl/479118 mentions this issue: env: add wasip1/wasm wazero builder

gopherbot pushed a commit to golang/build that referenced this issue Mar 30, 2023
This builder installs wasmtime, a Wasm runtime with
WASI support.

For golang/go#59150

Change-Id: I7d1db6c9f5ec2b4257e3961b552f3de0bb7ed049
Reviewed-on: https://go-review.googlesource.com/c/build/+/479121
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
@heschi
Copy link
Contributor

heschi commented Mar 30, 2023

Built the images and deployed the coordinator. Seems to be failing as expected.

@eliben
Copy link
Member

eliben commented May 25, 2023

In the past few days I've been noticing that this builder is consistently a straggler; is there any way to make it faster?

@johanbrandhorst
Copy link
Member Author

Do the builders allow any caching of artifacts? Wazero is instructed to put it's native code in $TMP, so if we have a way to persist folders between runs we should get a speedup.

@eliben
Copy link
Member

eliben commented May 26, 2023

Do the builders allow any caching of artifacts? Wazero is instructed to put it's native code in $TMP, so if we have a way to persist folders between runs we should get a speedup.

We may be able to support this kind of caching in the near(-ish) future, but could you clarify why you think it would help here?

Alternatively, would the wasmtime builder be faster (once it's fully on)? This is also worth exploring (after all our goal here is to test the wasip1 target, not the specific wasm VM). As well as some general profiling to see if the bot can be made faster.

Finally, we may consider whether this builder is needed in trybots at all (given that the wasm/js builder already runs), if the performance issues cannot be sufficiently addressed.

@johanbrandhorst
Copy link
Member Author

We may be able to support this kind of caching in the near(-ish) future, but could you clarify why you think it would help here?

I haven't tested this, but I assume most of the time consumed is in the native-code compilation step that wazero performs as part of its execution of the wasm. These artifacts are cached and could be reused between runs, so that subsequent test runs only need to rebuild those that have changed.

It is possible to run wazero in an interpreted mode, but in our testing that was significantly slower.

Wasmtime may be faster, I haven't spent any time comparing the runtime of the two yet, but it too will probably be spending most of the time in the native-code compilation step part of the execution, unless we introduce caching.

Finally, we may consider whether this builder is needed in trybots at all (given that the wasm/js builder already runs), if the performance issues cannot be sufficiently addressed.

I understand if we'd want to turn it off because it's too slow, but I don't know that wasm/js alone will be able to give us confidence that the wasip1 port isn't broken. I don't know enough about the builder system to say yet, but it may be enough to only run these on tip, is that what you mean? As long as we get notified about it breaking, that should be sufficient.

@eliben
Copy link
Member

eliben commented May 26, 2023

I haven't tested this, but I assume most of the time consumed is in the native-code compilation step that wazero performs as part of its execution of the wasm. These artifacts are cached and could be reused between runs, so that subsequent test runs only need to rebuild those that have changed.

But if the compiler itself changes in a CL, you can't reuse its JIT products from previous runs. Similarly with stdlib changes which may affect any test. So I'm not 100% how much this can save.

Wasmtime may be faster, I haven't spent any time comparing the runtime of the two yet, but it too will probably be spending most of the time in the native-code compilation step part of the execution, unless we introduce caching.

@dmitshur pointed out that in https://go.dev/cl/498616 the wasmtime bot finished much quicker than wazero, and in fact wasn't the long pole in our trybots any more. If we can have a wasip1 trybot that's not the long pole, it's fine to keep it around if you feel it covers additional stuff that js/wasm does not.

@johanbrandhorst
Copy link
Member Author

What a timely comment to be making as we just had the wasmtime runner pass all the standard library tests. I would be happy to make the switch to wasmtime for all CLs as it should find any obvious breakages, but note that symlink tests are disabled on wasmtime because it doesn't really work with the standard library test assumptions, so we'll still want to pay attention to the wazero runner.

@eliben
Copy link
Member

eliben commented May 26, 2023

Indeed, the timing is fortunate :)

Yes, the wazero builder can remain on the post-submits of course, and run on tip, but for trybots that run on every CL and affect our compile-edit-test loop it would be nice to switch to the faster configuration.

@gopherbot
Copy link

Change https://go.dev/cl/498675 mentions this issue: dashboard: use wasmtime as primary wasip1 runner

gopherbot pushed a commit to golang/build that referenced this issue May 30, 2023
The wasmtime WASI runtime completes the standard
library tests faster than wazero, which
makes it suitable for running on every CL.
Wazero will continue to be run against tip.

Querying the builders database shows the following statistics
for builder runtime (execution in seconds):

wasip1-wasm-wasmtime:

   1234.808416431
   852.305792789
   1252.596007033

wasip1-wasm-wazero:

   2421.876266138
   2419.399971708
   2439.044948166

For golang/go#59150.

Change-Id: I68c7d454109e53e860a020aabd489c6fb97121dc
Reviewed-on: https://go-review.googlesource.com/c/build/+/498675
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly issues Builders x/build issues (builders, bots, dashboards) NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants