Skip to content
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

Make Engine's executor use &mut StoreInner (making it non-generic) #611

Merged
merged 10 commits into from
Jan 15, 2023

Conversation

Robbepop
Copy link
Member

This PR technically prepares wasmi for using the new #[union_fn] macro.
Before this PR the Engine executor was generic over a ctx: impl AsContextMut which is no longer required since the Engine executor now works given a non-generic &mut StoreInner. The StoreInner is a non-generic abstraction of the Store<T> type which holds all the data that is not associated to the T in Store<T>.

This is in preparation to making the engine executor itself use StoreInner.
These APIs were pub(crate) and just used by the engine before which is now using the StoreInner directly instead.
This step required us to save a mapping from Func -> DedupFuncType in the StoreInner itself. So this information is duplicated now between StoreInner and Store<T> since Store<T> already stores a mapping from Func -> FuncEntity<T> where FuncEntity<T> has information about the underlying DedupFuncType. I think this minor information duplication is O.K. for the big gain of a non-generic Engine executor.
@Robbepop Robbepop changed the title Make Engine' executor use &mut StoreInner (making it non-generic) Make Engine's executor use &mut StoreInner (making it non-generic) Jan 14, 2023
@paritytech-cicd-pr
Copy link

paritytech-cicd-pr commented Jan 14, 2023

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
bare_call_0
1.38ms 1.33ms 🟢 -3.47% 1.31ms 1.13ms 🟢 -11.86% 🟢 -15%
execute/
bare_call_0/typed
1.01ms 982.61µs 🟢 -2.80% 746.60µs 732.91µs 🟢 -2.19% 🟢 -25%
execute/
bare_call_1
1.46ms 1.41ms 🟢 -3.41% 1.51ms 1.40ms 🟢 -6.91% 🟢 -0%
execute/
bare_call_16
2.36ms 2.39ms ⚪ 0.96% 4.38ms 4.13ms 🟢 -5.52% 🟡 73%
execute/
bare_call_16/typed
1.58ms 1.59ms ⚪ 0.37% 2.67ms 2.38ms 🟢 -10.98% 🟢 50%
execute/
bare_call_1/typed
1.11ms 1.09ms 🟢 -1.39% 1.20ms 1.11ms 🟢 -6.71% 🟢 1%
execute/
bare_call_4
1.71ms 1.59ms 🔴 -6.95% 2.16ms 1.97ms 🟢 -8.74% 🟢 23%
execute/
bare_call_4/typed
1.08ms 1.10ms 🔴 1.79% 1.21ms 1.10ms 🟢 -8.63% 🟢 0%
execute/
br_table
1.09ms 1.15ms 🔴 4.69% 1.57ms 1.32ms 🟢 -16.68% 🟢 15%
execute/
count_until
681.17µs 645.67µs 🟢 -5.09% 2.84ms 2.12ms 🟢 -25.53% 🔴 228%
execute/
factorial_iterative
327.31µs 327.62µs ⚪ 0.47% 1.23ms 889.62µs 🟢 -27.32% 🔴 172%
execute/
factorial_recursive
650.11µs 634.14µs 🟢 -2.60% 1.54ms 1.41ms 🟢 -8.28% 🔴 123%
execute/
fib_iterative
1.43ms 1.54ms 🔴 7.30% 6.51ms 4.63ms 🟢 -28.91% 🔴 201%
execute/
fib_recursive
5.80ms 5.87ms 🔴 1.16% 13.72ms 12.43ms 🟢 -9.70% 🔴 112%
execute/
global_bump
979.96µs 971.06µs ⚪ -0.92% 3.45ms 3.29ms 🟢 -4.60% 🔴 239%
execute/
global_const
718.51µs 742.25µs 🔴 3.41% 3.26ms 2.40ms 🟢 -26.49% 🔴 223%
execute/
host_calls
29.02µs 29.34µs ⚪ -1.30% 44.83µs 43.81µs 🟢 -2.30% 🟢 49%
execute/
memory_fill
1.34ms 1.24ms 🟢 -7.34% 5.18ms 3.87ms 🟢 -25.30% 🔴 213%
execute/
memory_sum
1.30ms 1.22ms 🟢 -6.73% 5.27ms 3.89ms 🟢 -26.18% 🔴 220%
execute/
memory_vec_add
2.74ms 2.55ms 🟢 -6.79% 10.37ms 7.97ms 🟢 -23.13% 🔴 212%
execute/
recursive_is_even
1.17ms 1.17ms ⚪ 0.37% 2.35ms 2.28ms 🟢 -3.17% 🟡 95%
execute/
recursive_ok
146.22µs 148.19µs 🔴 1.31% 324.31µs 322.88µs ⚪ -0.43% 🔴 118%
execute/
recursive_scan
181.36µs 189.35µs 🔴 4.30% 439.48µs 418.93µs 🟢 -4.66% 🔴 121%
execute/
recursive_trap
14.69µs 14.37µs 🟢 -2.16% 32.88µs 33.01µs ⚪ 0.43% 🔴 130%
execute/
regex_redux
561.49µs 533.24µs 🟢 -4.89% 1.79ms 1.52ms 🟢 -15.01% 🔴 185%
execute/
rev_complement
512.94µs 479.86µs 🟢 -6.44% 1.79ms 1.42ms 🟢 -20.72% 🔴 196%
execute/
tiny_keccak
357.99µs 359.74µs ⚪ 0.25% 1.51ms 1.19ms 🟢 -21.61% 🔴 230%
execute/
trunc_f2i
919.84µs 909.83µs ⚪ -0.56% 3.01ms 2.46ms 🟢 -18.43% 🔴 170%
instantiate/
wasm_kernel
59.43µs 62.62µs ⚪ 2.89% 72.57µs 106.28µs 🔴 47.33% 🟡 70%
translate/
erc1155
209.19µs 209.47µs ⚪ -0.01% 404.56µs 408.80µs ⚪ 0.84% 🟡 95%
translate/
erc20
101.86µs 102.38µs ⚪ 0.36% 197.99µs 202.07µs 🔴 2.13% 🟡 97%
translate/
erc721
147.11µs 146.66µs ⚪ -0.60% 288.46µs 290.86µs ⚪ 0.82% 🟡 98%
translate/
spidermonkey
0.00ns 0.00ns ⚪ -1.40% 0.00ns 0.00ns ⚪ 0.75% 🟢 0%
translate/
wasm_kernel
3.79ms 3.80ms ⚪ -0.04% 7.72ms 7.74ms ⚪ -0.07% 🔴 104%

Link to pipeline

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2023

Codecov Report

Merging #611 (3119956) into master (cc05d72) will decrease coverage by 0.32%.
The diff coverage is 74.65%.

@@            Coverage Diff             @@
##           master     #611      +/-   ##
==========================================
- Coverage   80.98%   80.65%   -0.33%     
==========================================
  Files          82       83       +1     
  Lines        6758     6820      +62     
==========================================
+ Hits         5473     5501      +28     
- Misses       1285     1319      +34     
Impacted Files Coverage Δ
crates/arena/src/lib.rs 50.81% <ø> (ø)
crates/wasmi/src/global.rs 44.44% <ø> (-1.44%) ⬇️
crates/wasmi/src/instance.rs 86.04% <ø> (+5.65%) ⬆️
crates/wasmi/src/engine/mod.rs 81.44% <20.00%> (-1.72%) ⬇️
crates/arena/src/component_vec.rs 23.25% <23.25%> (ø)
crates/wasmi/src/engine/executor.rs 97.98% <73.68%> (+0.13%) ⬆️
crates/wasmi/src/engine/cache.rs 81.17% <83.33%> (-1.54%) ⬇️
crates/wasmi/src/store.rs 86.39% <92.45%> (+1.59%) ⬆️
crates/wasmi/src/module/instantiate/tests.rs 98.21% <100.00%> (ø)
crates/wasmi/src/memory/mod.rs 59.20% <0.00%> (-4.00%) ⬇️
... and 4 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Robbepop Robbepop merged commit 2d139d7 into master Jan 15, 2023
@Robbepop Robbepop deleted the rf-engine-use-store-inner branch January 15, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants