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

YJIT: Compile exception handlers #8171

Merged
merged 4 commits into from Aug 8, 2023
Merged

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Aug 4, 2023

This PR supports compiling exception handlers in YJIT.

ratio_in_yjit

This improves ratio_in_yjit, e.g.

  • liquid-compile: 94.2% -> 99.9%
  • liquid-render: 89.5% -> 99.9%
  • sequel: 97.8% -> 99.9%

Benchmark

This speeds up liquid-render by 25%, liquid-compile by 6%, and sequel by 4%.

before: ruby 3.3.0dev (2023-08-08T00:21:45Z master 69292676a2) +YJIT [x86_64-linux]
after: ruby 3.3.0dev (2023-08-08T03:57:11Z yjit-exceptions 9b1b055055) +YJIT [x86_64-linux]

--------------  -----------  ----------  ----------  ----------  -------------  ------------
bench           before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
liquid-compile  41.4         0.6         39.1        0.5         1.01           1.06
liquid-render   71.7         0.2         57.5        0.2         1.12           1.25
sequel          49.0         1.8         47.1        2.1         1.02           1.04
--------------  -----------  ----------  ----------  ----------  -------------  ------------

Other benchmarks don't seem to have a significant performance impact.

@k0kubun k0kubun force-pushed the yjit-exceptions branch 3 times, most recently from 9f0f25d to 2ea3859 Compare August 4, 2023 05:31
@k0kubun k0kubun marked this pull request as ready for review August 4, 2023 06:06
@matzbot matzbot requested a review from a team August 4, 2023 06:06
vm.c Outdated Show resolved Hide resolved
yjit/src/codegen.rs Outdated Show resolved Hide resolved
yjit/src/codegen.rs Outdated Show resolved Hide resolved
yjit/src/core.rs Outdated Show resolved Hide resolved
@maximecb
Copy link
Contributor

maximecb commented Aug 4, 2023

I think that the speedups are impressive. I'm a bit uncomfortable with the added complexity for entry points and interfacing with the interpreter though. This logic was already somewhat hard to follow. Needs clearer explanations in the comments and maybe a bit more streamlining if possible.

@k0kubun k0kubun force-pushed the yjit-exceptions branch 6 times, most recently from e6a76b9 to 3d597e6 Compare August 8, 2023 03:56
@k0kubun
Copy link
Member Author

k0kubun commented Aug 8, 2023

interfacing with the interpreter

I reworked the callback in 9b1b055. It's still as complex as it needs to be, but at least it's much faster than the previous version.

@maximecb maximecb requested a review from XrXr August 8, 2023 16:50
vm.c Show resolved Hide resolved
Copy link
Contributor

@maximecb maximecb left a comment

Choose a reason for hiding this comment

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

Good work 👍 I'm excited to see the results on SFR!

k0kubun and others added 2 commits August 8, 2023 13:17
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
@k0kubun k0kubun merged commit cd8d20c into ruby:master Aug 8, 2023
3 checks passed
@k0kubun k0kubun deleted the yjit-exceptions branch August 8, 2023 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants