-
Notifications
You must be signed in to change notification settings - Fork 253
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
Reimplement fast-path validation of MVP types #1930
Reimplement fast-path validation of MVP types #1930
Conversation
Benchmark the "fast path" in type interning.
This commit fixes an issue from bytecodealliance#1906 which is preventing the upgrade of wasm-tools in Wasmtime. That commit implemented a fast path by skipping a function and reimplementing parts of it internally, but that then caused Wasmtime to panic when other data structures weren't filled out. The intention was that the user-facing interface doesn't change depending on features, so this is an attempt at fixing the mistake in that commit. The fix here is to remove the fast path added and restructure it differently. Instead now the fast and normal paths have much less divergence which should prevent this issue from re-surfacing. This is 15% slower than `main` but it doesn't have the same bug as `main` so for now that may be the best that can be done.
cc @Robbepop |
@alexcrichton looks reasonable. Can you provide me a link to the Wasmtime issue? It is nicer that you managed to unify both implementations. The 15% slowdown is a bummer. Do you have an idea how to make it faster again? According to my benchmarks |
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.
LGTM
The new needs_type_canonicalization
needs a #[cfg(feature = "validate")]
to fix CI issues.
No issue on the wasmtime side, just a failed build. The failure is in this loop which is iterating by rec groups and specifically this one was the failure where the fast path wasn't maintaining the rec group lists. My guess is we could probably skip maintenance of the rec group lists entirely in the fast path, but only if the other paths that read these lists understand that they may be optional and/or not populated. That might require plumbing |
Sounds great and worthwhile! |
This commit fixes an issue from #1906 which is preventing the upgrade of
wasm-tools in Wasmtime. That commit implemented a fast path by skipping
a function and reimplementing parts of it internally, but that then
caused Wasmtime to panic when other data structures weren't filled out.
The intention was that the user-facing interface doesn't change
depending on features, so this is an attempt at fixing the mistake in
that commit.
The fix here is to remove the fast path added and restructure it
differently. Instead now the fast and normal paths have much less
divergence which should prevent this issue from re-surfacing. This is
15% slower than
main
but it doesn't have the same bug asmain
so fornow that may be the best that can be done.