-
Notifications
You must be signed in to change notification settings - Fork 25
feat(evm): enable basic performance check in ci #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5fb843f
c482133
65019a8
36fd85d
71fb235
248058f
b4f0bd2
bf6afd5
d5438be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -201,3 +201,169 @@ jobs: | |||||
| export ENABLE_GAS_METER=true | ||||||
|
|
||||||
| bash .ci/run_test_suite.sh | ||||||
|
|
||||||
| performance_regression_check: | ||||||
| name: Performance Regression Check (${{ matrix.mode }}) | ||||||
| if: github.event_name == 'pull_request' | ||||||
| runs-on: ubuntu-latest | ||||||
| permissions: | ||||||
| contents: read | ||||||
| pull-requests: write | ||||||
| issues: write | ||||||
| strategy: | ||||||
| fail-fast: false | ||||||
| matrix: | ||||||
| mode: [interpreter, multipass] | ||||||
| container: | ||||||
| image: dtvmdev1/dtvm-dev-x64:main | ||||||
| steps: | ||||||
| - name: Check out code | ||||||
| uses: actions/checkout@v3 | ||||||
| with: | ||||||
| submodules: "true" | ||||||
| fetch-depth: 0 | ||||||
|
|
||||||
| - name: Setup git safe directory | ||||||
| run: | | ||||||
| echo "Configuring git safe directory: ${{ github.workspace }}" | ||||||
| git config --global --add safe.directory /__w/DTVM/DTVM | ||||||
|
|
||||||
| - name: Code Format Check | ||||||
| run: | | ||||||
| ./tools/format.sh check | ||||||
|
|
||||||
| - name: Restore baseline cache | ||||||
| id: baseline-cache | ||||||
| uses: actions/cache@v4 | ||||||
| with: | ||||||
| path: /tmp/perf_baseline_${{ matrix.mode }}.json | ||||||
| key: perf-baseline-${{ matrix.mode }}-${{ github.event.pull_request.base.sha }} | ||||||
|
|
||||||
| - name: Build baseline library (${{ github.base_ref }}) | ||||||
| if: steps.baseline-cache.outputs.cache-hit != 'true' | ||||||
| run: | | ||||||
| echo "Building baseline library from branch: ${{ github.base_ref }}" | ||||||
|
|
||||||
| export LLVM_SYS_150_PREFIX=/opt/llvm15 | ||||||
| export LLVM_DIR=$LLVM_SYS_150_PREFIX/lib/cmake/llvm | ||||||
| export PATH=$LLVM_SYS_150_PREFIX/bin:$PATH | ||||||
|
|
||||||
| git stash push -u -m "perf-check-stash" | ||||||
| git checkout ${{ github.base_ref }} | ||||||
|
|
||||||
| cmake -S . -B build \ | ||||||
| -DCMAKE_BUILD_TYPE=Release \ | ||||||
| -DZEN_ENABLE_SINGLEPASS_JIT=OFF \ | ||||||
| -DZEN_ENABLE_MULTIPASS_JIT=ON \ | ||||||
| -DZEN_ENABLE_EVM=ON \ | ||||||
| -DZEN_ENABLE_LIBEVM=ON \ | ||||||
| -DZEN_ENABLE_JIT_PRECOMPILE_FALLBACK=ON \ | ||||||
| -DZEN_ENABLE_CPU_EXCEPTION=ON \ | ||||||
| -DZEN_ENABLE_VIRTUAL_STACK=ON | ||||||
| cmake --build build -j 16 | ||||||
|
|
||||||
| mkdir -p /tmp/baseline_lib | ||||||
| cp build/lib/* /tmp/baseline_lib/ | ||||||
|
|
||||||
| rm -rf build | ||||||
| git checkout ${{ github.sha }} | ||||||
| git stash pop || true | ||||||
|
|
||||||
| - name: Build current PR and check regression | ||||||
| id: perf-check | ||||||
| run: | | ||||||
| echo "Building PR branch: ${{ github.sha }}" | ||||||
|
|
||||||
| export LLVM_SYS_150_PREFIX=/opt/llvm15 | ||||||
| export LLVM_DIR=$LLVM_SYS_150_PREFIX/lib/cmake/llvm | ||||||
| export PATH=$LLVM_SYS_150_PREFIX/bin:$PATH | ||||||
|
|
||||||
| rm -rf build evmone | ||||||
|
|
||||||
| export CMAKE_BUILD_TARGET=Release | ||||||
| export ENABLE_ASAN=false | ||||||
| export RUN_MODE=multipass | ||||||
| export ENABLE_LAZY=false | ||||||
| export ENABLE_MULTITHREAD=true | ||||||
| export TestSuite=benchmarksuite | ||||||
| export CPU_EXCEPTION_TYPE='cpu' | ||||||
| export BENCHMARK_MODE=${{ matrix.mode }} | ||||||
| export BENCHMARK_THRESHOLD=0.20 | ||||||
| export BENCHMARK_BASELINE_CACHE=/tmp/perf_baseline_${{ matrix.mode }}.json | ||||||
| export BENCHMARK_BASELINE_LIB=/tmp/baseline_lib | ||||||
| export BENCHMARK_SUMMARY_FILE=/tmp/perf_summary_${{ matrix.mode }}.md | ||||||
|
|
||||||
| bash .ci/run_test_suite.sh | ||||||
| continue-on-error: true | ||||||
|
|
||||||
| - name: Write Performance Summary | ||||||
| if: always() | ||||||
| run: | | ||||||
| MODE="${{ matrix.mode }}" | ||||||
| OUTCOME="${{ steps.perf-check.outcome }}" | ||||||
| SUMMARY_FILE="/tmp/perf_summary_${MODE}.md" | ||||||
| if [ "$OUTCOME" = "success" ]; then | ||||||
| echo "✅ **Performance Check Passed (${MODE})**" >> $GITHUB_STEP_SUMMARY | ||||||
| else | ||||||
| echo "⚠️ **Performance Regression Detected (${MODE})**" >> $GITHUB_STEP_SUMMARY | ||||||
| fi | ||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||
| if [ -f "$SUMMARY_FILE" ]; then | ||||||
| cat "$SUMMARY_FILE" >> $GITHUB_STEP_SUMMARY | ||||||
| else | ||||||
| echo "_No benchmark summary available._" >> $GITHUB_STEP_SUMMARY | ||||||
| fi | ||||||
|
|
||||||
| - name: Save performance artifacts | ||||||
| if: always() | ||||||
| run: | | ||||||
| mkdir -p /tmp/perf-artifacts | ||||||
| echo "${{ github.event.pull_request.number }}" > /tmp/perf-artifacts/pr_number | ||||||
| echo "${{ steps.perf-check.outcome }}" > /tmp/perf-artifacts/outcome | ||||||
| cp "/tmp/perf_summary_${{ matrix.mode }}.md" /tmp/perf-artifacts/summary.md 2>/dev/null || \ | ||||||
| echo "_No benchmark summary available._" > /tmp/perf-artifacts/summary.md | ||||||
|
|
||||||
| - name: Upload performance results | ||||||
| if: always() | ||||||
| uses: actions/upload-artifact@v4 | ||||||
| with: | ||||||
| name: perf-results-${{ matrix.mode }} | ||||||
| path: /tmp/perf-artifacts/ | ||||||
| retention-days: 7 | ||||||
|
|
||||||
| - name: Comment on PR | ||||||
| if: always() | ||||||
| uses: actions/github-script@v6 | ||||||
|
||||||
| uses: actions/github-script@v6 | |
| uses: actions/github-script@v7 |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||||
| name: Post Performance Check Results | ||||||||
|
|
||||||||
| on: | ||||||||
| workflow_run: | ||||||||
| workflows: ["DTVM-EVM test CI in x86-64"] | ||||||||
| types: | ||||||||
| - completed | ||||||||
|
|
||||||||
| permissions: | ||||||||
| pull-requests: write | ||||||||
|
||||||||
| pull-requests: write | |
| pull-requests: write | |
| issues: write |
Copilot
AI
Feb 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow trusts pr_number from artifacts generated by a pull_request run. For fork PRs, artifact contents are attacker-controlled; with this workflow’s write token, a malicious PR can set pr_number to any issue/PR and cause the workflow to spam or overwrite comments elsewhere in the repo. Please derive the PR number from github.event.workflow_run.pull_requests (and/or verify the artifact PR number matches that list) before posting/updating comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -eis enabled, socp build/lib/* $EVMONE_DIR/will fail the whole benchmark run if the glob doesn’t match (or ifbuild/libcontains non-regular files). Since onlylibdtvmapi.sois needed for the benchmark runner, consider copying that specific file (and/or enablingnullglob/ adding an explicit existence check) to make the CI step more robust.