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: Add --yjit-pause and RubyVM::YJIT.resume #7609

Merged
merged 2 commits into from Mar 28, 2023

Conversation

maximecb
Copy link
Contributor

@maximecb maximecb commented Mar 28, 2023

This allows booting YJIT in a suspended state. We chose to add a new command line option as opposed to simply allowing YJIT.resume to work without any command line option because it allows for combining with YJIT tuning command line options. It also simpifies implementation.

Co-authored by Alan, Kokubun & Maxime


Benchmark results (locally on M1/Rosetta):

./run_benchmarks.rb -e "normal::ruby --yjit" -e "paused::ruby --yjit-pause" --rss liquid-render railsbench hexapdf liquid-c activerecord mail psych-load ruby-lsp sequel

normal: ruby 3.3.0dev (2023-03-28T16:04:45Z runtime-enable-yjit bee3d1410a) +YJIT dev [x86_64-darwin22]
paused: ruby 3.3.0dev (2023-03-28T16:04:45Z runtime-enable-yjit bee3d1410a) +YJIT dev [x86_64-darwin22]

-------------  -----------  ----------  ---------  -----------  ----------  ---------  -------------  --------------
bench          normal (ms)  stddev (%)  RSS (MiB)  paused (ms)  stddev (%)  RSS (MiB)  normal/paused  paused 1st itr
activerecord   47.4         1.8         82.8       44.8         1.8         60.8       1.06           0.44          
hexapdf        2485.5       3.9         840.1      2483.7       1.9         862.6      1.00           1.01          
liquid-c       63.6         3.4         66.3       63.1         2.5         55.4       1.01           1.08          
liquid-render  137.4        3.4         60.6       136.3        2.2         48.6       1.01           0.95          
mail           120.8        1.9         103.0      118.7        1.3         89.6       1.02           1.03          
psych-load     1956.3       0.2         46.5       1982.8       0.5         43.0       0.99           0.99          
railsbench     1679.0       1.3         213.1      1653.4       1.2         169.8      1.02           1.17          
ruby-lsp       142.0        63.6        296.6      130.5        77.1        279.0      1.09           1.08          
sequel         71.0         1.5         64.9       68.4         1.2         45.2       1.04           0.41          
-------------  -----------  ----------  ---------  -----------  ----------  ---------  -------------  --------------

Seems worth upstreaming as this will facilitate further testing (e.g. on SFR) and this change is not hard to revert. The RSS seems to be almost always significantly less, and performance a little bit better. We should ignore the ruby-lsp performance data point since this benchmark is so noisy.

This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.

Paired with Kokubun and Maxime.
@maximecb maximecb requested review from k0kubun and XrXr March 28, 2023 17:28
@matzbot matzbot requested a review from a team March 28, 2023 17:28
@k0kubun
Copy link
Member

k0kubun commented Mar 28, 2023

I think this is one of the options we want users to use. Can we update the help in ruby.c?

yjit.rb Show resolved Hide resolved
@k0kubun
Copy link
Member

k0kubun commented Mar 28, 2023

Benchmark results (locally on M1/Rosetta):

I got a bit confused, but given that it's getting faster while paused on boot, I guess you put RubyVM::YJIT.resume at the beginning of run_benchmark?

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
@maximecb
Copy link
Contributor Author

I think this is one of the options we want users to use. Can we update the help in ruby.c?

I was thinking we could leave it undocumented for a few weeks, until we've had time to test it on SFR/Core. WDYT?

I got a bit confused, but given that it's getting faster while paused on boot, I guess you put RubyVM::YJIT.resume at the beginning of run_benchmark?

I did

@k0kubun
Copy link
Member

k0kubun commented Mar 28, 2023

I was thinking we could leave it undocumented for a few weeks, until we've had time to test it on SFR/Core. WDYT?

That makes sense too 👍

@maximecb maximecb merged commit 39a3469 into ruby:master Mar 28, 2023
96 checks passed
@maximecb maximecb deleted the runtime-enable-yjit branch March 28, 2023 19:21
casperisfine pushed a commit to Shopify/ruby that referenced this pull request Jun 1, 2023
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume

This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.

Paired with Kokubun and Maxime.

* Update yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
jhawthorn pushed a commit to github/ruby that referenced this pull request Aug 23, 2023
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume

This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.

Paired with Kokubun and Maxime.

* Update yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
jhawthorn pushed a commit to github/ruby that referenced this pull request Sep 8, 2023
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume

This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.

Paired with Kokubun and Maxime.

* Update yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
casperisfine pushed a commit to Shopify/ruby that referenced this pull request Sep 20, 2023
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume

This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.

Paired with Kokubun and Maxime.

* Update yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
jhawthorn pushed a commit to github/ruby that referenced this pull request Sep 28, 2023
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume

This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.

Paired with Kokubun and Maxime.

* Update yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants