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

Forward constants in local.tee translation with constant value inputs #885

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

Robbepop
Copy link
Member

Before this change the translator forwarded the assigned local variable instead of C. However, it is possible in this particular case to forward the constant value instead of the local variable which improves code generation of following instructions due to improved optimization opportunities.

Before this change the translator forwarded the assigned local variable instead of C. However, it is possible in this particular case to forward the constant value instead of the local variable which improves codegen of following instructions due to improved optimization opportunities.
@Robbepop
Copy link
Member Author

Robbepop commented Jan 12, 2024

Note: The clippy CI issue seems to be a bug in clippy since I cannot see how the flagged code can be unconditionally recursive.

rust-lang/rust-clippy#12133

@paritytech-cicd-pr
Copy link

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
br_table
1.74ms 1.50ms 🟢 -13.47% 1.31ms 1.37ms 🔴 5.07% 🟢 -9%
execute/
call/host/1
50.76µs 50.81µs ⚪ 0.10% 63.31µs 63.41µs ⚪ 0.17% 🟢 25%
execute/
call/rec
171.24µs 171.41µs ⚪ 0.10% 336.45µs 334.04µs ⚪ -0.71% 🟡 95%
execute/
count_until
5.34ms 5.75ms 🔴 7.72% 7.50ms 7.50ms ⚪ 0.03% 🟢 30%
execute/
divrem
6.32ms 6.31ms ⚪ -0.18% 7.06ms 7.05ms ⚪ -0.09% 🟢 12%
execute/
factorial/iter
266.81µs 245.18µs 🟢 -8.11% 394.76µs 294.41µs 🟢 -25.42% 🟢 20%
execute/
factorial/rec
692.51µs 671.72µs 🟢 -3.00% 1.68ms 1.21ms 🟢 -28.11% 🟡 80%
execute/
fibonacci/iter
1.33ms 1.33ms ⚪ 0.14% 1.24ms 1.24ms ⚪ 0.10% 🟢 -7%
execute/
fibonacci/rec
5.92ms 5.83ms 🟢 -1.41% 11.96ms 12.30ms 🔴 2.81% 🔴 111%
execute/
fibonacci/tail
1.25ms 1.34ms 🔴 7.24% 4.36ms 4.31ms ⚪ -1.07% 🔴 221%
execute/
fuse
7.10ms 7.16ms ⚪ 0.80% 11.79ms 11.80ms ⚪ 0.10% 🟡 65%
execute/
global/bump
1.32ms 1.32ms ⚪ 0.10% 1.79ms 1.79ms ⚪ 0.00% 🟢 36%
execute/
global/get_const
479.89µs 479.22µs ⚪ -0.14% 746.64µs 746.55µs ⚪ -0.01% 🟡 56%
execute/
is_even/rec
1.10ms 1.14ms 🔴 4.03% 2.06ms 2.08ms ⚪ 0.65% 🟡 82%
execute/
memory/fill_bytes
1.10ms 1.19ms 🔴 8.04% 1.30ms 1.30ms ⚪ 0.07% 🟢 9%
execute/
memory/sum_bytes
1.05ms 1.05ms ⚪ -0.53% 1.33ms 1.33ms ⚪ 0.07% 🟢 28%
execute/
memory/vec_add
2.95ms 2.94ms ⚪ -0.14% 3.58ms 3.56ms ⚪ -0.34% 🟢 21%
execute/
recursive_scan
187.02µs 189.71µs ⚪ 1.44% 353.98µs 352.79µs ⚪ -0.34% 🟡 86%
execute/
recursive_trap
15.73µs 15.79µs ⚪ 0.41% 32.13µs 63.32µs 🔴 97.09% 🔴 301%
execute/
regex_redux
582.34µs 579.71µs ⚪ -0.45% 1.12ms 1.12ms ⚪ -0.27% 🟡 93%
execute/
rev_complement
448.27µs 442.90µs ⚪ -1.20% 682.76µs 680.87µs ⚪ -0.28% 🟡 54%
execute/
tiny_keccak
351.62µs 353.23µs ⚪ 0.46% 634.08µs 384.93µs 🟢 -39.29% 🟢 9%
execute/
trunc_f2i
640.42µs 645.16µs ⚪ 0.74% 957.52µs 957.16µs ⚪ -0.04% 🟢 48%
instantiate/
wasm_kernel
55.19µs 55.42µs ⚪ 0.41% 56.00µs 57.80µs 🔴 3.23% 🟢 4%
overhead/
call/typed/0
1.23ms 1.27ms 🔴 2.79% 853.96µs 865.99µs 🔴 1.41% 🟢 -32%
overhead/
call/typed/16
1.67ms 1.66ms ⚪ -0.16% 2.56ms 2.71ms 🔴 5.64% 🟡 63%
overhead/
call/untyped/0
1.59ms 1.60ms ⚪ 0.50% 1.18ms 1.18ms ⚪ -0.05% 🟢 -26%
overhead/
call/untyped/16
2.42ms 2.51ms 🔴 3.44% 4.28ms 4.31ms ⚪ 0.54% 🟡 72%
translate/
bz2/checked/eager/default
1.33ms 1.33ms ⚪ 0.63% 2.38ms 2.41ms 🔴 1.29% 🟡 81%
translate/
bz2/checked/eager/fuel
1.43ms 1.44ms ⚪ 0.61% 2.61ms 2.62ms ⚪ 0.75% 🟡 82%
translate/
bz2/checked/lazy-translation/default
543.10µs 544.95µs ⚪ 0.34% 968.10µs 964.84µs ⚪ -0.34% 🟡 77%
translate/
bz2/checked/lazy/default
36.83µs 36.70µs ⚪ -0.35% 46.34µs 46.03µs ⚪ -0.67% 🟢 25%
translate/
bz2/unchecked/eager/default
1.08ms 1.10ms 🔴 1.69% 1.82ms 1.85ms 🔴 1.62% 🟡 68%
translate/
erc1155/checked/eager/default
277.83µs 281.09µs ⚪ 1.17% 468.72µs 477.88µs 🔴 1.95% 🟡 70%
translate/
erc1155/checked/eager/fuel
297.22µs 300.59µs ⚪ 1.13% 502.25µs 510.44µs 🔴 1.63% 🟡 70%
translate/
erc1155/checked/lazy-translation/default
128.30µs 127.56µs ⚪ -0.58% 210.74µs 210.42µs ⚪ -0.15% 🟡 65%
translate/
erc1155/checked/lazy/default
26.00µs 26.18µs ⚪ 0.71% 33.23µs 32.43µs 🟢 -2.39% 🟢 24%
translate/
erc1155/unchecked/eager/default
230.04µs 234.43µs 🔴 1.91% 362.33µs 366.31µs ⚪ 1.10% 🟡 56%
translate/
erc20/checked/eager/default
134.93µs 136.74µs 🔴 1.34% 224.17µs 227.63µs 🔴 1.55% 🟡 66%
translate/
erc20/checked/eager/fuel
143.15µs 144.52µs ⚪ 0.95% 238.35µs 241.72µs ⚪ 1.41% 🟡 67%
translate/
erc20/checked/lazy-translation/default
66.09µs 64.81µs 🟢 -1.93% 106.18µs 106.76µs ⚪ 0.55% 🟡 65%
translate/
erc20/checked/lazy/default
19.08µs 19.03µs ⚪ -0.22% 24.64µs 24.65µs ⚪ 0.07% 🟢 30%
translate/
erc20/unchecked/eager/default
110.46µs 114.08µs 🔴 3.28% 172.99µs 175.30µs 🔴 1.33% 🟡 54%
translate/
erc721/checked/eager/default
191.91µs 195.10µs 🔴 1.66% 324.98µs 330.41µs 🔴 1.67% 🟡 69%
translate/
erc721/checked/eager/fuel
204.00µs 203.87µs ⚪ -0.06% 344.99µs 348.56µs ⚪ 1.03% 🟡 71%
translate/
erc721/checked/lazy-translation/default
92.36µs 91.05µs 🟢 -1.42% 151.98µs 151.01µs ⚪ -0.63% 🟡 66%
translate/
erc721/checked/lazy/default
22.91µs 23.39µs 🔴 2.09% 28.83µs 29.02µs ⚪ 0.64% 🟢 24%
translate/
erc721/unchecked/eager/default
155.15µs 160.43µs 🔴 3.40% 245.51µs 248.56µs 🔴 1.24% 🟡 55%
translate/
pulldown_cmark/checked/eager/default
3.59ms 3.60ms ⚪ 0.15% 6.09ms 6.16ms 🔴 1.18% 🟡 71%
translate/
pulldown_cmark/checked/eager/fuel
3.88ms 3.89ms ⚪ 0.20% 6.59ms 6.68ms ⚪ 1.25% 🟡 72%
translate/
pulldown_cmark/checked/lazy-translation/default
1.54ms 1.51ms 🟢 -1.85% 2.57ms 2.56ms ⚪ -0.31% 🟡 69%
translate/
pulldown_cmark/checked/lazy/default
254.76µs 232.09µs 🟢 -8.90% 250.31µs 250.99µs ⚪ 0.27% 🟢 8%
translate/
pulldown_cmark/unchecked/eager/default
3.03ms 3.06ms 🔴 1.19% 4.78ms 4.82ms ⚪ 0.67% 🟡 57%
translate/
spidermonkey/checked/eager/default
75.71ms 76.31ms ⚪ 0.79% 131.17ms 133.42ms 🔴 1.72% 🟡 75%
translate/
spidermonkey/checked/eager/fuel
82.16ms 82.38ms ⚪ 0.26% 142.38ms 144.27ms 🔴 1.33% 🟡 75%
translate/
spidermonkey/checked/lazy-translation/default
31.95ms 31.86ms ⚪ -0.30% 55.19ms 55.49ms ⚪ 0.53% 🟡 74%
translate/
spidermonkey/checked/lazy/default
3.25ms 3.24ms ⚪ -0.32% 3.85ms 3.86ms ⚪ 0.14% 🟢 19%
translate/
spidermonkey/unchecked/eager/default
63.01ms 64.38ms 🔴 2.17% 101.46ms 103.51ms 🔴 2.03% 🟡 61%
translate/
wasm_kernel/checked/eager/default
5.02ms 5.07ms ⚪ 0.89% 8.62ms 8.80ms 🔴 2.05% 🟡 74%
translate/
wasm_kernel/checked/eager/fuel
5.20ms 5.22ms ⚪ 0.24% 9.13ms 9.28ms 🔴 1.60% 🟡 78%
translate/
wasm_kernel/checked/lazy-translation/default
2.41ms 2.41ms ⚪ -0.12% 3.98ms 3.99ms ⚪ 0.46% 🟡 66%
translate/
wasm_kernel/checked/lazy/default
427.16µs 428.44µs ⚪ 0.30% 490.87µs 482.26µs 🟢 -1.75% 🟢 13%
translate/
wasm_kernel/unchecked/eager/default
4.11ms 4.19ms 🔴 2.00% 6.63ms 6.63ms ⚪ 0.03% 🟡 58%

Link to pipeline

@Robbepop Robbepop merged commit bd6f740 into master Jan 12, 2024
19 of 20 checks passed
@Robbepop Robbepop deleted the rf-local-tee-const-forward branch January 12, 2024 10:20
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.

2 participants