зеркало из https://github.com/github/ruby.git
Try running with more YJIT options in CI to surface more bugs
This commit is contained in:
Родитель
b63fcafbc9
Коммит
7030cae969
|
@ -1,15 +1,22 @@
|
||||||
name: YJIT threshold one
|
name: YJIT options
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
make:
|
make:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
test_task: [ "check" ] # to make job names consistent
|
# To make job names consistent
|
||||||
|
test_task: [ "check" ]
|
||||||
|
# Run with multiple thresholds and params to surface more bugs
|
||||||
|
yjit_opts: [
|
||||||
|
"--yjit-call-threshold=1 --yjit-max-versions=1",
|
||||||
|
"--yjit-call-threshold=1",
|
||||||
|
"--yjit-call-threshold=2"
|
||||||
|
]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TESTOPTS: '-q --tty=no'
|
TESTOPTS: '-q --tty=no'
|
||||||
RUN_OPTS: '--disable-gems --yjit-call-threshold=1'
|
RUN_OPTS: '--disable-gems ${{ matrix.yjit_opts }}'
|
||||||
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
|
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
|
||||||
steps:
|
steps:
|
||||||
- run: mkdir build
|
- run: mkdir build
|
||||||
|
|
|
@ -95,7 +95,7 @@ YJIT supports all command-line options supported by upstream CRuby, but also add
|
||||||
- `--yjit-stats`: produce statistics after the execution of a program (must compile with `cppflags=-DRUBY_DEBUG` to use this)
|
- `--yjit-stats`: produce statistics after the execution of a program (must compile with `cppflags=-DRUBY_DEBUG` to use this)
|
||||||
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate (default 256 MiB)
|
- `--yjit-exec-mem-size=N`: size of the executable memory block to allocate (default 256 MiB)
|
||||||
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 2)
|
- `--yjit-call-threshold=N`: number of calls after which YJIT begins to compile a function (default 2)
|
||||||
- `--yjit-version-limit=N`: maximum number of versions to generate per basic block (default 4)
|
- `--yjit-max-versions=N`: maximum number of versions to generate per basic block (default 4)
|
||||||
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
|
- `--yjit-greedy-versioning`: greedy versioning mode (disabled by default, may increase code size)
|
||||||
|
|
||||||
### Benchmarking
|
### Benchmarking
|
||||||
|
|
4
ruby.c
4
ruby.c
|
@ -1042,8 +1042,8 @@ setup_yjit_options(const char *s, struct rb_yjit_options *yjit_opt)
|
||||||
else if (opt_match_arg(s, l, "call-threshold")) {
|
else if (opt_match_arg(s, l, "call-threshold")) {
|
||||||
yjit_opt->call_threshold = atoi(s + 1);
|
yjit_opt->call_threshold = atoi(s + 1);
|
||||||
}
|
}
|
||||||
else if (opt_match_arg(s, l, "version-limit")) {
|
else if (opt_match_arg(s, l, "max-versions")) {
|
||||||
yjit_opt->version_limit = atoi(s + 1);
|
yjit_opt->max_versions = atoi(s + 1);
|
||||||
}
|
}
|
||||||
else if (opt_match_noarg(s, l, "greedy-versioning")) {
|
else if (opt_match_noarg(s, l, "greedy-versioning")) {
|
||||||
yjit_opt->greedy_versioning = true;
|
yjit_opt->greedy_versioning = true;
|
||||||
|
|
2
yjit.h
2
yjit.h
|
@ -45,7 +45,7 @@ struct rb_yjit_options {
|
||||||
|
|
||||||
// Maximum number of versions per block
|
// Maximum number of versions per block
|
||||||
// 1 means always create generic versions
|
// 1 means always create generic versions
|
||||||
unsigned version_limit;
|
unsigned max_versions;
|
||||||
|
|
||||||
// Capture and print out stats
|
// Capture and print out stats
|
||||||
bool gen_stats;
|
bool gen_stats;
|
||||||
|
|
|
@ -421,7 +421,7 @@ block_t* find_block_version(blockid_t blockid, const ctx_t* ctx)
|
||||||
if (rb_yjit_opts.greedy_versioning)
|
if (rb_yjit_opts.greedy_versioning)
|
||||||
{
|
{
|
||||||
// If we're below the version limit, don't settle for an imperfect match
|
// If we're below the version limit, don't settle for an imperfect match
|
||||||
if ((uint32_t)rb_darray_size(versions) + 1 < rb_yjit_opts.version_limit && best_diff > 0) {
|
if ((uint32_t)rb_darray_size(versions) + 1 < rb_yjit_opts.max_versions && best_diff > 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ void limit_block_versions(blockid_t blockid, ctx_t* ctx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If this block version we're about to add will hit the version limit
|
// If this block version we're about to add will hit the version limit
|
||||||
if (get_num_versions(blockid) + 1 >= rb_yjit_opts.version_limit)
|
if (get_num_versions(blockid) + 1 >= rb_yjit_opts.max_versions)
|
||||||
{
|
{
|
||||||
// Produce a generic context that stores no type information,
|
// Produce a generic context that stores no type information,
|
||||||
// but still respects the stack_size and sp_offset constraints
|
// but still respects the stack_size and sp_offset constraints
|
||||||
|
|
|
@ -1100,8 +1100,8 @@ rb_yjit_init(struct rb_yjit_options *options)
|
||||||
if (rb_yjit_opts.call_threshold < 1) {
|
if (rb_yjit_opts.call_threshold < 1) {
|
||||||
rb_yjit_opts.call_threshold = 10;
|
rb_yjit_opts.call_threshold = 10;
|
||||||
}
|
}
|
||||||
if (rb_yjit_opts.version_limit < 1) {
|
if (rb_yjit_opts.max_versions < 1) {
|
||||||
rb_yjit_opts.version_limit = 4;
|
rb_yjit_opts.max_versions = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks_assuming_stable_global_constant_state = st_init_numtable();
|
blocks_assuming_stable_global_constant_state = st_init_numtable();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче