Skip to content

threads: add feature flags #10206

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

Merged
merged 4 commits into from
Apr 11, 2025
Merged

Conversation

abrown
Copy link
Contributor

@abrown abrown commented Feb 7, 2025

This change adds the minimal, internal flags necessary for testing the shared-everything-threads proposal. It chooses to skip the user-facing CLI flags for now and, as suggested, keeps the Cargo threads feature as the sole feature flag gating compilation of threads-related code, which will eventually include shared-everything-threads.

@github-actions github-actions bot added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime labels Feb 7, 2025
Copy link

github-actions bot commented Feb 7, 2025

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

  • If you added a new Config method, you wrote extensive documentation for
    it.

    Our documentation should be of the following form:

    Short, simple summary sentence.
    
    More details. These details can be multiple paragraphs. There should be
    information about not just the method, but its parameters and results as
    well.
    
    Is this method fallible? If so, when can it return an error?
    
    Can this method panic? If so, when does it panic?
    
    # Example
    
    Optional example here.
    
  • If you added a new Config method, or modified an existing one, you
    ensured that this configuration is exercised by the fuzz targets.

    For example, if you expose a new strategy for allocating the next instance
    slot inside the pooling allocator, you should ensure that at least one of our
    fuzz targets exercises that new strategy.

    Often, all that is required of you is to ensure that there is a knob for this
    configuration option in wasmtime_fuzzing::Config (or one
    of its nested structs).

    Rarely, this may require authoring a new fuzz target to specifically test this
    configuration. See our docs on fuzzing for more details.

  • If you are enabling a configuration option by default, make sure that it
    has been fuzzed for at least two weeks before turning it on by default.


To modify this label's message, edit the .github/label-messager/wasmtime-config.md file.

To add new label messages or remove existing label messages, edit the
.github/label-messager.json configuration file.

Learn more.

@alexcrichton
Copy link
Member

What do you think about using the preexisting threads Cargo feature for this? That's mostly avoiding runtime deps of threads/libstd/etc and having that gate both threads and shared-everything-threads seems reasonable to me

@alexcrichton
Copy link
Member

Oh and do directly answer this:

The feedback I'm look for is: what we should be gating with this new Cargo feature?

I wrote up some basic thoughts here but the tl;dr; IMO is "anything that requires a runtime dependency" aka something outside of libcore. In that sense the current threads proposal is gated because it requires mutexes/etc to implement atomic notify/wait. I don't think that shared-everything-threads will require any more than threads, though, but any nontrivial dependency above the core crate should be gated.

(or do you have specific things you're curious about too?)

abrown added 4 commits April 10, 2025 15:11
This adds both the Cargo-level and CLI-level flags for the
shared-everything-threads proposal.
As recommended in a review, we can probably use the `threads` feature
flag instead for the same kind of conditional compilation.
Since we don't expect users to be interacting with
shared-everything-threads modules from the command line, hide this for
now.
@abrown abrown force-pushed the set-feature-flags branch from 5701dd0 to 04c70f8 Compare April 10, 2025 22:26
@abrown
Copy link
Contributor Author

abrown commented Apr 10, 2025

The latest commits remove the CLI flags since we probably don't want to expose that yet to users and adopt @alexcrichton's suggestion to use the threads Cargo feature instead of creating a new, specialized shared-everything-threads feature. What is now added is all the internal flag bits necessary for running WAST tests, the absence of which is one blocker to #10518. I'm going to alter the PR message to reflect this so we get a more accurate commit message in the Git history.

@abrown abrown marked this pull request as ready for review April 10, 2025 22:32
@abrown abrown requested review from a team as code owners April 10, 2025 22:32
@abrown abrown requested review from fitzgen and removed request for a team April 10, 2025 22:32
@github-actions github-actions bot added the fuzzing Issues related to our fuzzing infrastructure label Apr 10, 2025
Copy link

Subscribe to Label Action

cc @fitzgen

This issue or pull request has been labeled: "fuzzing", "wasmtime:api", "wasmtime:config"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: fuzzing

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Technically this won't actually work if the test actually used shared-everything-threads in the sense that this block needs to be updated for fuzzing to propagate the need of shared-everything-threads to wasmtime::Config, and that's going through CLI flags which means this'll also have to add -Wshared-everything-threads.

That being said such a change is a superset of what you've got here, and this seems fine otherwise.

@abrown abrown added this pull request to the merge queue Apr 11, 2025
Merged via the queue into bytecodealliance:main with commit bb12131 Apr 11, 2025
41 checks passed
@abrown abrown deleted the set-feature-flags branch April 11, 2025 18:55
abrown added a commit to abrown/wasmtime that referenced this pull request Apr 11, 2025
This adds CLI-level flags for `shared-everything-threads` based on this
[comment].

[comment]: bytecodealliance#10206 (review)
@abrown abrown mentioned this pull request Apr 11, 2025
github-merge-queue bot pushed a commit that referenced this pull request Apr 11, 2025
This adds CLI-level flags for `shared-everything-threads` based on this
[comment].

[comment]: #10206 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants