-
Notifications
You must be signed in to change notification settings - Fork 18
207 lines (179 loc) · 8.63 KB
/
benchmarks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Benchmarking
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
benchmarks_candidate:
runs-on: [self-hosted, ci-runner-compiler]
container:
image: matterlabs/llvm_runner:latest
credentials:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: AutoModality/action-clean@492b2d2e2e77247bfd0b17eaa89a371b2f3430ee # v1
- name: Preparing workspace. Setting environment.
run: |
echo "BENCHMARK_MODE=${{ github.event.inputs.compiler_llvm_benchmark_mode || '+M^B3' }}" >> $GITHUB_ENV
echo "BENCHMARK_PATH=${{ github.event.inputs.compiler_llvm_benchmark_path || 'tests/solidity/' }}" >> $GITHUB_ENV
echo "CANDIDATE_BRANCH_NAME=${{ github.event.inputs.compiler_tester_candidate_branch }}" >> $GITHUB_ENV
- name: Getting the branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV
- name: Checking out the Solidity repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
path: solidity
- name: Checking out the compiler-tester candidate
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: matter-labs/era-compiler-tester
submodules: recursive
path: compiler-tester
- name: Building the Solidity compiler
working-directory: solidity
run: |
mkdir -p ./build
cd ./build
cmake .. -DCMAKE_BUILD_TYPE='Release' -DSOLC_VERSION_ZKEVM='1.0.0-lts' -DPEDANTIC=OFF -DCMAKE_CXX_FLAGS='-w' -DUSE_Z3=OFF -DUSE_CVC4=OFF
make -j$(nproc)
- name: Benchmarking the Solidity compiler candidate
id: compiler_tester_run
working-directory: compiler-tester
run: |
mkdir -p './solc-bin/'
cp '../solidity/build/solc/solc' "./solc-bin/solc-${BRANCH_NAME}"
chmod +x "./solc-bin/solc-${BRANCH_NAME}"
cargo install compiler-llvm-builder
/usr/local/cargo/bin/zkevm-llvm clone && /usr/local/cargo/bin/zkevm-llvm build
export RUST_BACKTRACE='full'
export LLVM_SYS_150_PREFIX="$(pwd)/target-llvm/target-final/"
cargo build --verbose --release --bin 'compiler-tester'
cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-solidity-*/*/Cargo.toml --target-dir './target-zksolc/'
cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-vyper-*/*/Cargo.toml --target-dir './target-zkvyper/'
./target/release/compiler-tester \
--zksolc './target-zksolc/release/zksolc' \
--zkvyper './target-zkvyper/release/zkvyper' \
--path="${{ env.BENCHMARK_PATH || '' }}" \
--mode="${{ env.BENCHMARK_MODE || '' }}" \
--benchmark='candidate.json' \
--solc-bin-config-path="configs/solc-bin-zkevm-candidate-${BRANCH_NAME}.json"
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
name: candidate-benchmark
path: compiler-tester/candidate.json
benchmarks_reference:
runs-on: [self-hosted, ci-runner-compiler]
container:
image: matterlabs/llvm_runner:latest
credentials:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: AutoModality/action-clean@492b2d2e2e77247bfd0b17eaa89a371b2f3430ee # v1
- name: Preparing workspace. Setting environment.
run: |
echo "BENCHMARK_MODE=${{ github.event.inputs.compiler_llvm_benchmark_mode || '+M^B3' }}" >> $GITHUB_ENV
echo "BENCHMARK_PATH=${{ github.event.inputs.compiler_llvm_benchmark_path || 'tests/solidity/' }}" >> $GITHUB_ENV
echo "REFERENCE_BRANCH_NAME=${{ github.event.inputs.compiler_tester_reference_branch }}" >> $GITHUB_ENV
- name: Getting the branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV
- name: Checking out the Solidity repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
path: solidity
- name: Checking out the compiler-tester reference
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: matter-labs/era-compiler-tester
ref: main
submodules: recursive
path: compiler-tester
- name: Benchmarking the Solidity compiler reference
working-directory: compiler-tester
id: compiler_tester_run
run: |
cargo install compiler-llvm-builder
/usr/local/cargo/bin/zkevm-llvm clone && /usr/local/cargo/bin/zkevm-llvm build
export RUST_BACKTRACE='full'
export LLVM_SYS_150_PREFIX="$(pwd)/target-llvm/target-final/"
cargo build --verbose --release --bin 'compiler-tester'
cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-solidity-*/*/Cargo.toml --target-dir './target-zksolc/'
cargo build --verbose --release --manifest-path /usr/local/cargo/git/checkouts/era-compiler-vyper-*/*/Cargo.toml --target-dir './target-zkvyper/'
./target/release/compiler-tester \
--zksolc './target-zksolc/release/zksolc' \
--zkvyper './target-zkvyper/release/zkvyper' \
--path="${{ env.BENCHMARK_PATH || '' }}" \
--mode="${{ env.BENCHMARK_MODE || '' }}" \
--benchmark='reference.json' \
--solc-bin-config-path="configs/solc-bin-zkevm-reference-${BRANCH_NAME}.json"
- uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3
with:
name: reference-benchmark
path: compiler-tester/reference.json
benchmarks_analysis:
runs-on: [matterlabs-ci-runner]
needs: [benchmarks_candidate, benchmarks_reference]
container:
image: matterlabs/llvm_runner:latest
credentials:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: AutoModality/action-clean@492b2d2e2e77247bfd0b17eaa89a371b2f3430ee # v1
- name: Getting the branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_BASE_REF} | tr / -)" >> $GITHUB_ENV
- name: Checking out the compiler-tester repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: matter-labs/era-compiler-tester
submodules: recursive
path: compiler-tester
- uses: actions/download-artifact@master
with:
name: candidate-benchmark
path: compiler-tester
- uses: actions/download-artifact@master
with:
name: reference-benchmark
path: compiler-tester
- name: Comparing the benchmark results
id: compiler_tester_run
run: |
cd compiler-tester && \
export RUST_BACKTRACE=full && \
cargo run --release --bin benchmark-analyzer -- \
--reference 'reference.json' \
--candidate 'candidate.json' \
--output-file 'result.txt' && \
chown 1000:1000 result.txt
- name: Posting the benchmark results to the step summary
run: |
printf "Benchmark results:\n" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat ./compiler-tester/result.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat $GITHUB_STEP_SUMMARY > ./compiler-tester/result.txt
- name: Posting the benchmark results to a PR comment
if: github.event_name == 'pull_request'
uses: machine-learning-apps/pr-comment@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ./compiler-tester/result.txt
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.COMPILER_CI_MATTERMOST_WEBHOOK }} # required
if: ${{ failure() || success() }} # Skip canceled jobs