Try running with more YJIT options in CI to surface more bugs

This commit is contained in:
Maxime Chevalier-Boisvert 2021-06-23 13:55:34 -04:00 коммит произвёл Alan Wu
Родитель b63fcafbc9
Коммит 7030cae969
6 изменённых файлов: 20 добавлений и 13 удалений

13
.github/workflows/yjit.yml поставляемый
Просмотреть файл

@ -1,15 +1,22 @@
name: YJIT threshold one
name: YJIT options
on: [push, pull_request]
jobs:
make:
strategy:
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
runs-on: ubuntu-latest
env:
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 }}
steps:
- 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-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-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)
### Benchmarking

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")) {
yjit_opt->call_threshold = atoi(s + 1);
}
else if (opt_match_arg(s, l, "version-limit")) {
yjit_opt->version_limit = atoi(s + 1);
else if (opt_match_arg(s, l, "max-versions")) {
yjit_opt->max_versions = atoi(s + 1);
}
else if (opt_match_noarg(s, l, "greedy-versioning")) {
yjit_opt->greedy_versioning = true;

2
yjit.h
Просмотреть файл

@ -45,7 +45,7 @@ struct rb_yjit_options {
// Maximum number of versions per block
// 1 means always create generic versions
unsigned version_limit;
unsigned max_versions;
// Capture and print out 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 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;
}
}
@ -438,7 +438,7 @@ void limit_block_versions(blockid_t blockid, ctx_t* ctx)
return;
// 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,
// 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) {
rb_yjit_opts.call_threshold = 10;
}
if (rb_yjit_opts.version_limit < 1) {
rb_yjit_opts.version_limit = 4;
if (rb_yjit_opts.max_versions < 1) {
rb_yjit_opts.max_versions = 4;
}
blocks_assuming_stable_global_constant_state = st_init_numtable();