-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
wasmtime: add config option for parallel compilation #1903
Conversation
I think it should be a separate option. During development a cache doesn't help much, as the wasm file changes continuously, but parallel compilation does help. |
I agree with @bjorn3, this should ideally not be tied to whether caching is enabled. Looking at the code a bit, it's not exactly straight-forward to pipe through configuration for this, unfortunately. I wonder if it'd make sense to introduce a higher-level config struct, which would include the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this could be configured via the Tunables
structure? I agree with others that this should be a separate configuration option from caching, although if threading is disabled it should probably also disable caching.
Thank you for the suggestions; I've added a separate config option in |
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
This is looks pretty good to me, thanks! Before merging though I wanted to confirm something. Does this work being a runtime configuration option? Is the purpose here to control memory usage? It seems like systems likely either support threads or they don't, and for systems that don't support threads it may make more sense for this to be a build-time configuration option. If the purpose is something like controlling memory usage though then that makes sense because it's specific to the runtime in question. |
The primary motivation of this is to run wasmtime on an environment which doesn't (yet) support threads, so disabling it at build-time would indeed make sense. I'll try to turn the option into a build-time configuration. |
Ok makes sense! To be clear though I'm not saying this must change, I mostly just wanted to confirm if it worked for you. While a runtime configuration is possible I'm not sure if the target in question doesn't have |
@alexcrichton @ueno I agree this probably makes the most sense as a compile-time feature flag. |
Sorry for the delay; I've updated the PR to use feature flag. |
When running in embedded environments, threads creation is sometimes undesirable. This adds a feature to toggle wasmtime's internal thread creation for parallel compilation.
There was a problem hiding this 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!
Subscribe to Label Actioncc @kubkon
This issue or pull request has been labeled: "wasi"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
When parallel compilation was moved behind a compile-time feature in the `wasmtime` crate we forgot to add the corresponding feature to the C API which means that the C API hasn't been using parallel compilation since bytecodealliance#1903 (oh dear!)
When parallel compilation was moved behind a compile-time feature in the `wasmtime` crate we forgot to add the corresponding feature to the C API which means that the C API hasn't been using parallel compilation since #1903 (oh dear!)
When running in embedded environments, threads creation is sometimes undesirable. This adds a means to disable wasmtime's internal thread creation for parallel compilation and caches, by reusing the cache configuration as the indication (i.e., if cache is disabled, parallel compilation is also disabled).