Maxime Chevalier-Boisvert
ea3e17e430
YJIT: fix bug in top cfunc logging in `--yjit-stats` ( #9056 )
...
YJIT: correctly handle case where there are no cfunc calls
Fix bug in top cfunc logging in `--yjit-stats`
2023-11-28 22:27:11 +00:00
Maxime Chevalier-Boisvert
7f50c70574
YJIT: add top C function call counts to `--yjit-stats` ( #9047 )
...
* YJIT: gather call counts for individual cfuncs
Co-authored by Takashi Kokubun
2023-11-27 22:49:53 +00:00
Maxime Chevalier-Boisvert
f05d586cc9
YJIT: record `num_send_cfunc` stat ( #9022 )
...
* YJIT: record num_send_cfunc stat
Also report num_send_known_cfunc as percentage of num_send_cfunc
* Rename num_send_known_cfunc => num_send_cfunc_inline
Name seems more descriptive of what we do with out custom codegen
2023-11-23 15:33:43 -05:00
Alan Wu
277a3ecbf5
[DOC] RubyVM::YJIT doc improvements
...
* Weaken notice about API stability. A few public APIs in here now.
* Prune out APIs from the docs that are private in nature
* Enable markdown mode and ensure `--` options are quoted so they are
rendered as two dashes in the HTML.
2023-11-10 19:08:13 -05:00
Mau Magnaguagno
eb2abc3f16
YJIT: refactor format_number ( #8869 )
...
Replace enumerators with simpler and faster version that only inserts commas before '.' or end of integer string.
2023-11-08 10:37:19 -05:00
Takashi Kokubun
9877f3ada8
YJIT: Inline basic Ruby methods ( #8855 )
...
* YJIT: Inline basic Ruby methods
* YJIT: Fix "InsnOut operand made it past register allocation"
checktype should not generate a useless instruction.
2023-11-07 10:54:33 -05:00
Mau Magnaguagno
d3ea9070bb
YJIT: skip to_a in format_number ( #8815 )
...
String#chars returns an array instead of an enumerator since Ruby 2.0.
2023-11-01 18:40:40 +00:00
Alan Wu
9047fe5ea4
YJIT: Print exit reasons on failure in test_yjit.rb
...
For <https://bugs.ruby-lang.org/issues/19921 >, I suspect the test is
failing due to a timing related interrupt, which on paper could
happen with slow-enough GC runs.
In any case, it's helpful for debugging to have more information when
tests fail.
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-10-19 15:14:20 -04:00
Takashi Kokubun
6beb09c2c9
YJIT: Add RubyVM::YJIT.enable ( #8705 )
2023-10-19 10:54:35 -07:00
Alan Wu
d2b0c9da2e
YJIT: Add a live ISeq counter
...
It's an estimator for application size and could be used as a
compilation heuristic later.
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-10-18 23:46:35 +00:00
Takashi Kokubun
d458b4127f
YJIT: Add a few missing counters for send fallback ( #8681 )
2023-10-17 11:36:13 -04:00
Maxime Chevalier-Boisvert
b2e1ddffa5
YJIT: port call threshold logic from Rust to C for performance ( #8628 )
...
* Port call threshold logic from Rust to C for performance
* Prefix global/field names with yjit_
* Fix linker error
* Fix preprocessor condition for rb_yjit_threshold_hit
* Fix third linker issue
* Exclude yjit_calls_at_interv from RJIT bindgen
---------
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-10-12 10:05:34 -04:00
Maxime Chevalier-Boisvert
ea491802fa
YJIT: add heuristic to avoid compiling cold ISEQs ( #8522 )
...
* YJIT: Add counter to measure how often we compile "cold" ISEQs (#535 )
Fix counter name in DEFAULT_COUNTERS
YJIT: add --yjit-cold-threshold, don't compile cold ISEQs
YJIT: increase default cold threshold to 200_000
Remove rb_yjit_call_threshold()
Remove conflict markers
Fix compilation errors
Threshold 1 should compile immediately
Debug deadlock issue with test_ractor
Fix call threshold issue with tests
* Revert exception threshold logic. Document option in yjid.md
* (void) for 0 parameter functions in C99
* Rename iseq_entry_cold => cold_iseq_entry
* Document --yjit-cold-threshold in ruby.c
* Update doc/yjit/yjit.md
Co-authored-by: Jean byroot Boussier <jean.boussier+github@shopify.com>
* Shorten help string to appease test
* Address bug found by Kokubun. Reorder logic.
---------
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Jean byroot Boussier <jean.boussier+github@shopify.com>
2023-10-03 17:45:46 -04:00
Takashi Kokubun
592acba5d5
YJIT: Report all insn exit reasons ( #8541 )
2023-09-29 10:03:02 -04:00
Takashi Kokubun
0ae7f2d1ac
YJIT: Add compilation time counter ( #8417 )
...
* YJIT: Add compilation time counter
* YJIT: Use Instant instead
2023-09-12 13:52:40 -04:00
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