8000 Merge pull request #101 from Shopify/yjit_thresholds · eileencodes/ruby@0f09623 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f09623

Browse files
authored
Merge pull request ruby#101 from Shopify/yjit_thresholds
Try running with more YJIT options in CI to surface more bugs
2 parents 9a3c7ea + 4024979 commit 0f09623

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

.github/workflows/yjit.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
name: YJIT threshold one
1+
name: YJIT options
22
on: [push, pull_request]
33
jobs:
44
make:
55
strategy:
66
matrix:
7-
test_task: [ "check" ] # to make job names consistent
7+
# To make job names consistent
8+
test_task: [ "check" ]
9+
# Run with multiple thresholds and params to surface more bugs
10+
yjit_opts: [
11+
"--yjit-call-threshold=1 --yjit-max-versions=1",
12+
"--yjit-call-threshold=1",
13+
"--yjit-call-threshold=2"
14+
]
815
fail-fast: false
916
runs-on: ubuntu-latest
1017
env:
1118
TESTOPTS: '-q --tty=no'
12-
RUN_OPTS: '--disable-gems --yjit-call-threshold=1'
13-
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
19+
RUN_OPTS: '--disable-gems ${{ matrix.yjit_opts }}'
20+
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
1421
steps:
1522
- run: mkdir build
1623
working-directory:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ YJIT supports all command-line options supported by upstream CRuby, but also add
9595
- `--yjit-stats`: produce statistics after the execution of a program (must compile with `cppflags=-DRUBY_DEBUG` to use this)
9696
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate (default 256 MiB)
9797
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 2)
98-
- `--yjit-version-limit=N`: maximum number of versions to generate per basic block (default 4)
98+
- `--yjit-max-versions=N`: maximum number of versions to generate per basic block (default 4)
9999
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
100100

101101
### Benchmarking
@@ -125,7 +125,7 @@ We welcome open source contributors. You should feel free to open new issues to
125125
Suggestions on how to make this readme file more helpful for new contributors are most welcome.
126126

127127
Bug fixes and bug reports are very valuable to us. If you find a bug in YJIT, it's very possible be that nobody has reported it before,
128-
or that we don't have a good reproduction for it, so please open an issue and provide as much information as you can about your configuration and a description of how you encountered the problem. List the commands you used to run YJIT so that we can easily reproduce the issue on our end and investigate it. If you are able to produce a small program reproducing the error to help us track it down, that is very much appreciated as well.
128+
or that we don't have a good reproduction for it, so please open an issue and provide as much information as you can about your configuration and a description of how you encountered the problem. List the commands you used to run YJIT so that we can easily reproduce the issue on our end and investigate it. If you are able to produce a small program reproducing the error to help us track it down, that is very much appreciated as well.
129129

130130
If you would like to contribute a large patch to YJIT, we suggest opening an issue or a discussion on this repository so that
131131
we can have an active discussion. A common problem is that sometimes people submit large pull requests to open source projects

ruby.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,8 @@ setup_yjit_options(const char *s, struct rb_yjit_options *yjit_opt)
10371037
else if (opt_match_arg(s, l, "call-threshold")) {
10381038
yjit_opt->call_threshold = atoi(s + 1);
10391039
}
1040-
else if (opt_match_arg(s, l, "version-limit")) {
1041-
yjit_opt->version_limit = atoi(s + 1);
1040+
else if (opt_match_arg(s, l, "max-versions")) {
1041+
yjit_opt->max_versions = atoi(s + 1);
10421042
}
10431043
else if (opt_match_noarg(s, l, "greedy-versioning")) {
10441044
yjit_opt->greedy_versioning = true;

yjit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct rb_yjit_options {
4545

4646
// Maximum number of versions per block
4747
// 1 means always create generic versions
48-
unsigned version_limit;
48+
unsigned max_versions;
4949

5050
// Capture and print out stats
5151
bool gen_stats;

yjit_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ block_t* find_block_version(blockid_t blockid, const ctx_t* ctx)
421421
if (rb_yjit_opts.greedy_versioning)
422422
{
423423
// If we're below the version limit, don't settle for an imperfect match
424-
if ((uint32_t)rb_darray_size(versions) + 1 < rb_yjit_opts.version_limit && best_diff > 0) {
424+
if ((uint32_t)rb_darray_size(versions) + 1 < rb_yjit_opts.max_versions && best_diff > 0) {
425425
return NULL;
426426
}
427427
}
@@ -438,7 +438,7 @@ void limit_block_versions(blockid_t blockid, ctx_t* ctx)
438438
return;
439439

440440
// If this block version we're about to add will hit the version limit
441-
if (get_num_versions(blockid) + 1 >= rb_yjit_opts.version_limit)
441+
if (get_num_versions(blockid) + 1 >= rb_yjit_opts.max_versions)
442442
{
443443
// Produce a generic context that stores no type information,
444444
// but still respects the stack_size and sp_offset constraints

yjit_iface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,8 @@ rb_yjit_init(struct rb_yjit_options *options)
11001100
if (rb_yjit_opts.call_threshold < 1) {
11011101
rb_yjit_opts.call_threshold = 10;
11021102
}
1103-
if (rb_yjit_opts.version_limit < 1) {
1104-
rb_yjit_opts.version_limit = 4;
1103+
if (rb_yjit_opts.max_versions < 1) {
1104+
rb_yjit_opts.max_versions = 4;
11051105
}
11061106

11071107
blocks_assuming_stable_global_constant_state = st_init_numtable();

0 commit comments

Comments
 (0)
0