Skip to content

Add an --emit-clif option to wasmtime compile#6307

Merged
elliottt merged 4 commits into
bytecodealliance:mainfrom
elliottt:trevor/emit-clif
May 1, 2023
Merged

Add an --emit-clif option to wasmtime compile#6307
elliottt merged 4 commits into
bytecodealliance:mainfrom
elliottt:trevor/emit-clif

Conversation

@elliottt
Copy link
Copy Markdown
Member

Add the --emit-clif <PATH> option to wasmtime compile, making it easier to inspect the intermediate clif produced when compiling a wasm module. The path argument is a directory that will be created if its missing, and it will be populated with files named wasm_func_<idx>.clif, where <idx> is the function index in the wasm module.

Currently this option is only supported when using cranelift to compile a wasm module, and an error will be raised if winch is used instead.

@elliottt elliottt requested a review from a team as a code owner April 28, 2023 23:31
@elliottt elliottt requested review from itsrainy and removed request for a team April 28, 2023 23:31
@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 Apr 28, 2023
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @peterhuene

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

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

  • peterhuene: wasmtime:api

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

Learn more.

@github-actions
Copy link
Copy Markdown

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.

    Details

    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.

    Details

    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.


Details

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.

@elliottt elliottt changed the title Add a --emit-clif option to wasmtime compile Add an --emit-clif option to wasmtime compile Apr 28, 2023
Copy link
Copy Markdown
Contributor

@itsrainy itsrainy left a comment

Choose a reason for hiding this comment

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

This looks good to me! Just a couple small comments.

Comment thread src/commands/compile.rs Outdated
Comment thread src/commands/compile.rs Outdated
elliottt and others added 2 commits May 1, 2023 09:09
Co-authored-by: Rainy Sinclair <844493+itsrainy@users.noreply.github.com>
@elliottt elliottt force-pushed the trevor/emit-clif branch from da45b01 to e110bad Compare May 1, 2023 16:12
@elliottt elliottt added this pull request to the merge queue May 1, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 1, 2023
@itsrainy
Copy link
Copy Markdown
Contributor

itsrainy commented May 1, 2023

Looks like the build is failing because the Path import will only be included if built with features=wasmtime/cache

image

@elliottt
Copy link
Copy Markdown
Member Author

elliottt commented May 1, 2023

Looks like the build is failing because the Path import will only be included if built with features=wasmtime/cache

image

Doh, thanks Rainy!

@elliottt elliottt enabled auto-merge May 1, 2023 21:45
@elliottt elliottt added this pull request to the merge queue May 1, 2023
Merged via the queue into bytecodealliance:main with commit be6f4a5 May 1, 2023
@elliottt elliottt deleted the trevor/emit-clif branch May 1, 2023 22:46
salewski pushed a commit to salewski/wasmtime that referenced this pull request Jun 30, 2023
)

* Add a `--emit-clif` option to `wasmtime compile`

* Better validation for the --emit-clif argument

* Better docstring for --emit-clif

Co-authored-by: Rainy Sinclair <844493+itsrainy@users.noreply.github.com>

---------

Co-authored-by: Rainy Sinclair <844493+itsrainy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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