From f8dad616c2ee2d83b3162da8d86865b0f2a782de Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 20 Sep 2022 06:07:28 +0900 Subject: [PATCH] YJIT: Show --yjit-stats of railsbench on CI (#6403) * YJIT: Show --yjit-stats of railsbench on CI * YJIT: Use --enable-yjit=dev to see ratio_in_yjit * YJIT: Show master GitHub URL for quick comparison * YJIT: Avoid making CI red by a yjit-bench failure --- .github/workflows/yjit-ubuntu.yml | 18 ++++++++++++++++-- .gitignore | 3 +++ yjit/yjit.mk | 13 +++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/yjit-ubuntu.yml b/.github/workflows/yjit-ubuntu.yml index bf90b80efb..3c0d5c046c 100644 --- a/.github/workflows/yjit-ubuntu.yml +++ b/.github/workflows/yjit-ubuntu.yml @@ -59,10 +59,16 @@ jobs: - test_task: "test-bundled-gems" configure: "--enable-yjit=dev" + + - test_task: "yjit-bench" + configure: "--enable-yjit=dev" + yjit_bench_opts: "--yjit-stats" env: GITPULLOPTIONS: --no-tags origin ${{github.ref}} RUN_OPTS: ${{ matrix.yjit_opts }} + YJIT_BENCH_OPTS: ${{ matrix.yjit_bench_opts }} RUBY_DEBUG: ci + BUNDLE_JOBS: 8 # for yjit-bench runs-on: ubuntu-20.04 if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: @@ -98,7 +104,7 @@ jobs: - run: ./autogen.sh working-directory: src - name: Run configure - run: ../src/configure -C --disable-install-doc ${{ matrix.configure }} + run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install ${{ matrix.configure }} - run: make incs - run: make prepare-gems if: ${{ matrix.test_task == 'test-bundled-gems' }} @@ -111,12 +117,20 @@ jobs: if: ${{ matrix.test_task == 'check' }} - name: Enable YJIT through ENV run: echo "RUBY_YJIT_ENABLE=1" >> $GITHUB_ENV - - run: make -s ${{ matrix.test_task }} RUN_OPTS="$RUN_OPTS" + - name: make ${{ matrix.test_task }} + run: make -s -j ${{ matrix.test_task }} RUN_OPTS="$RUN_OPTS" YJIT_BENCH_OPTS="$YJIT_BENCH_OPTS" timeout-minutes: 60 env: RUBY_TESTOPTS: "-q --tty=no" TEST_BUNDLED_GEMS_ALLOW_FAILURES: "" PRECHECK_BUNDLED_GEMS: "no" + continue-on-error: ${{ matrix.test_task == 'yjit-bench' }} + - name: Show ${{ github.event.pull_request.base.ref }} GitHub URL for yjit-bench comparison + run: echo "https://github.com/${BASE_REPO}/commit/${BASE_SHA}" + env: + BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + if: ${{ matrix.test_task == 'yjit-bench' && startsWith(github.event_name, 'pull') }} - uses: k0kubun/action-slack@v2.0.0 with: payload: | diff --git a/.gitignore b/.gitignore index 73012bb3ed..c15b68f676 100644 --- a/.gitignore +++ b/.gitignore @@ -238,5 +238,8 @@ lcov*.info /include/ruby-*/*/rb_mjit_min_header-*.h /lib/mjit/instruction.rb +# YJIT +/yjit-bench + # /wasm/ /wasm/tests/*.wasm diff --git a/yjit/yjit.mk b/yjit/yjit.mk index 81441a7925..fe182b3dcc 100644 --- a/yjit/yjit.mk +++ b/yjit/yjit.mk @@ -51,6 +51,19 @@ endif # TODO: might need to move for BSD Make support miniruby$(EXEEXT): $(YJIT_LIBS) +# By using YJIT_BENCH_OPTS instead of RUN_OPTS, you can skip passing the options to `make install` +YJIT_BENCH_OPTS = $(RUN_OPTS) --enable-gems +YJIT_BENCH = benchmarks/railsbench/benchmark.rb + +# Run yjit-bench's ./run_once.sh for CI +yjit-bench: install update-yjit-bench PHONY + $(Q) cd $(srcdir)/yjit-bench && PATH=$(prefix)/bin:$$PATH \ + ./run_once.sh $(YJIT_BENCH_OPTS) $(YJIT_BENCH) + +update-yjit-bench: + $(Q) $(tooldir)/git-refresh -C $(srcdir) --branch main \ + https://github.com/Shopify/yjit-bench yjit-bench $(GIT_OPTS) + # Generate Rust bindings. See source for details. # Needs `./configure --enable-yjit=dev` and Clang. ifneq ($(strip $(CARGO)),) # if configure found Cargo