Граф коммитов

100 Коммитов

Автор SHA1 Сообщение Дата
Maxime Chevalier-Boisvert c23e2e19b7
YJIT: add code_region_overhead stat output (#8262) 2023-08-22 17:36:12 -04:00
ywenc 3dff315ed3
YJIT: Quiet mode when running with `--yjit-stats` (#8251)
Quiet mode for running with --yjit-stats
2023-08-18 18:27:59 -04:00
Maxime Chevalier-Boisvert a8cd18f08d
YJIT: implement codegen for rb_int_lshift (#8201)
* YJIT: implement codegen for rb_int_lshift

* Update yjit/src/asm/x86_64/mod.rs

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

---------

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-08-11 11:01:16 -04:00
Takashi Kokubun 493acaf4d4
YJIT: Distinguish exit and fallback reasons for invokesuper/invokeblock (#8194)
YJIT: Distinguish exit and fallback reasons

for invokesuper/invokeblock
2023-08-09 15:34:30 -04:00
Takashi Kokubun d3efce69ea
YJIT: Count throw instructions for each tag (#8188)
* YJIT: Count throw instructions for each tag

* Show % of each throw type
2023-08-09 10:16:15 -07:00
Takashi Kokubun 6acfc50bcc
YJIT: Count all opt_getconstant_path exit reasons (#8187) 2023-08-09 09:54:24 -04:00
Takashi Kokubun 81c198b5cf
YJIT: Distinguish exit and fallback reasons for send (#8159) 2023-08-02 10:19:39 -04:00
Takashi Kokubun e5effa4bd0
YJIT: Use dynamic dispatch for megamorphic send (#8125) 2023-07-27 13:09:17 -04:00
Takashi Kokubun 9bdd485972
YJIT: Count the number of dynamic send dispatches (#8122) 2023-07-26 12:59:59 -07:00
ywenc 8ca399d640
Implement `opt_aref_with` instruction (#8118)
Implement gen_opt_aref_with

Vm opt_aref_with is available

Test opt_aref_with

Stats for opt_aref_with

Co-authored-by: jhawthorn <jhawthorn@github.com>
2023-07-26 10:38:59 -04:00
Takashi Kokubun c4ef3d767b
YJIT: Rename exec_instruction to yjit_insns_count (#8102) 2023-07-20 15:54:59 -04:00
Takashi Kokubun b41fc9b9a4
YJIT: Avoid undercounting retired_in_yjit (#8038)
* YJIT: Count the number of failed instructions

* Rename yjit_insns_count to exec_instructions instead

* Hoist out the exec_instruction counter
2023-07-20 13:14:25 -04:00
Takashi Kokubun d814722fb8
YJIT: Make ratio_in_yjit always available (#8064) 2023-07-13 18:14:43 -04:00
Maxime Chevalier-Boisvert 2acb44e044
YJIT: add new stats counter for compiled ISEQ entry points (#8032)
* YJIT: add new stats counter for compiled ISEQ entry points

* Update yjit.rb

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

---------

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-07-06 10:17:03 -04:00
Takashi Kokubun 39968112f5
YJIT: Introduce RubyVM::YJIT.stats_string (#7857)
* YJIT: Introduce RubyVM::YJIT.printed_stats

* Use #string instead

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>

* Rename it to #stats_string

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>

---------

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2023-06-01 09:16:21 -07:00
Noah Gibbs e1c84e8ee6
For YJIT stats, set avg_len_in_yjit to 0 if denominator would be 0 (#7793) 2023-05-10 04:40:26 +09:00
Takashi Kokubun f84d94b803
YJIT: Show definedivar exit reasons (#7755) 2023-04-24 12:20:18 -07:00
John Hawthorn 2dff1d4fda
YJIT: Fix raw sample stack lengths in exit traces (#7728)
yjit-trace-exits appends a synthetic sample for the instruction being
exited, but we didn't increment the size of the stack. Fixing this count
correctly lets us successfully generate a flamegraph from the exits.

I also replaced the line number for instructions with 0, as I don't
think the previous value had meaning.

Co-authored-by: Adam Hess <HParker@github.com>
2023-04-18 10:09:16 -04:00
Takashi Kokubun 45c6b58768
YJIT: Add a counter to all side exits (#7720) 2023-04-14 19:49:44 -04:00
John Hawthorn acc5c74648
YJIT: Fix edge and total counts in exit_locations (#7702)
The stackprof-format raw samples are suffixed with a count (ie. how many
times did the previously recorded side-exit repeat). Previously we were
correctly using this value to increment the :samples count, but not the
:total_samples count or edges.

This made the stackprof aggregate results incorrect (though any
flamegraphs generated should have been correct, since those only rely on
raw samples).
2023-04-13 14:37:37 -04:00
Takashi Kokubun 615a1bc470
YJIT: Count the number of actually written bytes (#7658) 2023-04-05 10:32:04 -04:00
Maxime Chevalier-Boisvert d26d3575ca
YJIT: add stats for ratio of versions per block (#7653) 2023-04-04 16:41:52 -04:00
Takashi Kokubun b7717fc390
YJIT: Stack temp register allocation (#7651)
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2023-04-04 10:58:11 -07:00
Maxime Chevalier-Boisvert 39a34694a0
YJIT: Add `--yjit-pause` and `RubyVM::YJIT.resume` (#7609)
* 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>
2023-03-28 15:21:19 -04:00
Mau Magnaguagno 11f299fab7
YJIT: skip intermediate arrays in print_sorted_exit_counts (#7547)
Early total_exits condition.
Replace Array#sort_by/first(how_many) with Array#max_by(how_many).
Replace Array#map/max with Array#max_by, match print_counters style for longest_name_length.
2023-03-17 10:29:42 -04:00
Maxime Chevalier-Boisvert 473009d7cb
YJIT: add stats to keep track of when branch direction is known (#7544)
This measures the impact of changes made by @jhawthorn last year.
2023-03-16 17:24:08 -04:00
Maxime Chevalier-Boisvert 27c2572dbd
YJIT: reject large stacks so we can use i8/u8 stack_size and stack_offset (#7412)
* Reject large stacks so we can use i8/u8 stack_size and stack_offset

* Add rejection test for iseq too long as well
2023-03-01 15:09:25 -05:00
Maxime Chevalier-Boisvert de66b60f33 YJIT: add defer_empty_count stat
Count how often we defer from a block that is empty
2023-02-28 11:57:41 -05:00
Takashi Kokubun 034d5ee43c
YJIT: Use rb_ivar_get at the end of ivar chains (#7334)
* YJIT: Use rb_ivar_get at the end of ivar chains

* Rename the counter to get_ivar_max_depth
2023-02-17 12:44:39 -08:00
Takashi Kokubun 21f9c92c71
YJIT: Show Context stats on exit (#7327) 2023-02-16 11:32:13 -08:00
Takashi Kokubun f4b0e8dc61
YJIT: Pad more spaces to accommodate delimiters (#7302) 2023-02-14 11:58:34 -08:00
Maxime Chevalier-Boisvert a7e8eabeed
YJIT: add counters for polymorphic send and send with known class (#7288) 2023-02-10 16:05:16 -05:00
Maxime Chevalier-Boisvert 2c8e4aa2a0
YJIT: format numbers in stats printouts with comma separators (#7281) 2023-02-09 17:04:45 -05:00
Maxime Chevalier-Boisvert cd97976328
Add stats so we can keep track of x86 rel32 vs register calls (#7142)
* Add stats so we can keep track of x86 rel32 vs register calls

To know if we get that "prime real estate" as Alan put it.

* Fix bug pointed by Alan
2023-01-18 11:08:55 -05:00
Takashi Kokubun da7e5c7b77
YJIT: Do not refer to an undefined constant (#7112) 2023-01-12 15:09:32 -05:00
Takashi Kokubun 033e19dabf Document the public interface of YJIT [ci skip] 2022-12-22 14:43:58 -08:00
Mau Magnaguagno b2f53dccbe
YJIT: skip map in print_sorted_exit_counts (#6954)
Array#sum accepts a block.
2022-12-19 10:44:23 -05:00
Maxime Chevalier-Boisvert 1004d693b7
Make it so YJIT is no longer marked as experimental (#6909)
Tested on production workloads at Shopify for > 1 year and proven
to be quite stable. Enabling YJIT at run-time is still guarded
behind the --yjit command-line option for now.
2022-12-12 15:13:46 -05:00
Takashi Kokubun 1c057cfc2f
YJIT: Filter out 0-exit ops from Top-20 exit ops (#6892) 2022-12-09 13:14:19 -08:00
Maxime Chevalier-Boisvert d98d84b75d
YJIT: add new counters for deferred compilation and queued blocks (#6837) 2022-11-30 14:09:10 -05:00
Takashi Kokubun c80edc9f98
YJIT: Add object shape count to stats (#6754) 2022-11-17 12:59:59 -08:00
Takashi Kokubun 3f3a539197
YJIT: Add missing key for non-stats build 2022-11-17 11:31:56 -08:00
Takashi Kokubun 0446d961a0
YJIT: Fix typo in stats references (#6753) 2022-11-17 10:58:56 -08:00
Takashi Kokubun 1b8236acc2
YJIT: Add compiled_branch_count stats (#6746) 2022-11-16 15:31:13 -08:00
Takashi Kokubun 0d384ce6e6
YJIT: Include actual memory region size in stats (#6736) 2022-11-15 15:20:02 -08:00
Takashi Kokubun 6246788bc4
YJIT: Instrument global allocations on stats build (#6712)
* YJIT: Instrument global allocations on stats build

* Just use GLOVAL_ALLOCATOR.stats()
2022-11-13 12:54:41 -05:00
Takashi Kokubun 354791c248
Remove inconsistency
I meant they should be also fixed in
https://github.com/ruby/ruby/pull/6694#discussion_r1019445575
2022-11-10 10:00:16 -08:00
Jimmy Miller 8b3347950e
Enable --yjit-stats for release builds (#6694)
* Enable --yjit-stats for release builds

In order for people in the real world to report information about how their application runs with YJIT, we want to expose stats without requiring rebuilding ruby. We can do this without overhead, with the exception of count ratio in yjit, since this relies on the interpreter also counting instructions.

This change exposes those stats, while not showing ratio in yjit if we are not in a stats build.

* Update yjit.rb

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2022-11-10 12:56:22 -05:00
Eileen M. Uchitelle 9ab978b718
Fix exit locations dump (#6703)
While I was working on my RubyConf talk for tracing yjit exit locations
I realized that there were exits from the dump code included in the
stats data. For example I saw 224 interp leave exits for a simple script
that should have had 1 or 2. I realized that the dump code needs to be
called _after_ the stats are generated, otherwise the dump code will be
counted in the stats exits.

I've added a `_dump_locations` method to the `at_exit` for stats
generation to ensure that it runs last. I've updated the documentation
to add a note that if you call `dump_exit_locations` directly, your
stats will include the dump code exits as well.
2022-11-09 17:09:16 -05:00
Takashi Kokubun 5643d2bb9a
YJIT: Make more stats accessible from Ruby code (#6685) 2022-11-08 12:36:29 -05:00