-
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
Add Engine::precompile_compatibility_hash #5826
Conversation
fb49f07
to
1163fb0
Compare
1163fb0
to
8a14477
Compare
crates/wasmtime/src/engine.rs
Outdated
/// Returns a value that can be used to check precompiled WebAssembly compatibility. | ||
/// | ||
/// The outputs of [`Engine::precompile_module`] and [`Engine::precompile_component`] | ||
/// are compatible with a different [`Engine`] instance only if the two engines use | ||
/// compatible [`Config`]s. The value returned by this function will be the same for two | ||
/// [`Engine`]s if a binary from one can be deserialized by the other. |
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.
I think the documentation here may want to be a bit more nuanced because if two blobs are the same then you should be able to load between engines but if they're different they may still load correctly. For example different values of generate_address_map
will produce different blobs but that's not checked when loading modules into engines.
I think it may be best to reword this as something along the lines of "if two blobs are equal artifacts from one engine are guaranteed to be loadable in another" or something like that.
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.
Yeah that's what I was trying to convey but "if" is ambiguous. I'll be more explicit about it.
8a14477
to
babc4a9
Compare
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 |
Finally getting back around to this, I realized that the cache system already generates a key like this, and sure enough this has exactly what I was looking for: wasmtime/crates/wasmtime/src/module.rs Lines 1141 to 1151 in 83d00fe
Reusing this code as-is would require changing the function signature a bit, e.g.: pub fn precompile_compatibility_hash(&self) -> impl std::hash::Hash {
crate::module::HashedEngineCompileEnv(self)
} |
Sounds reasonable to me! |
This method returns a Hash, the output of which can be used to index precompiled binaries from one Engine instance that can be deserialized by another Engine instance.
babc4a9
to
a5dec57
Compare
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.
This looks sensible to me and appears to be exactly what Alex already said sounded good, so I'll go ahead and merge it. Thank you!
This method returns a Hash, the output of which can be used to index precompiled binaries from one Engine instance that can be deserialized by another Engine instance.
This method returns a Hash, the output of which can be used to index precompiled binaries from one Engine instance that can be deserialized by another Engine instance.
Closes #5802