Skip to content

Commit 5dfb043

Browse files
authored
ci(l1,l2): separate GPU builds and use x86-64-v2 target (#4090)
**Motivation** <!-- Why does this pull request exist? What are its goals? --> Current releases need CUDA installed in order to run. Also, some not so old CPUs were incompatible because of a build flag. **Description** <!-- A clear and concise general description of the changes this PR introduces --> Remove that dependency separating GPU binaries. Change CPU target for more compatibility. Worst case bench throw ~25% lower performance. For a more efficient build, consider building from source with native CPU target <img width="1210" height="786" alt="image" src="https://github.com/user-attachments/assets/fa4f43eb-7809-4f22-b131-e71e0234de89" /> <!-- Link to issues: Resolves #111, Resolves #222 -->
1 parent 2ffd28e commit 5dfb043

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

.github/workflows/tag_release.yaml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,29 @@ jobs:
2222
- ubuntu-22.04
2323
- ubuntu-24.04-arm
2424
- macos-latest
25+
gpu:
26+
- true
27+
- false
2528
include:
2629
- platform: ubuntu-22.04
2730
os: linux
2831
arch: x86_64
29-
prover_features: sp1,risc0,gpu
32+
prover_features: sp1,risc0
33+
cpu_flags: RUSTFLAGS='-C target-cpu=x86-64-v2'
3034
- platform: ubuntu-24.04-arm
3135
os: linux
3236
arch: aarch64
33-
prover_features: sp1,gpu
37+
prover_features: sp1
3438
- platform: macos-latest
3539
os: macos
3640
arch: aarch64
41+
- gpu: true
42+
gpu_flags: NVCC_PREPEND_FLAGS='-arch=sm_70'
43+
gpu_feature: ",gpu"
44+
gpu_suffix: "-gpu"
45+
exclude:
46+
- platform: macos-latest
47+
gpu: true
3748
runs-on: ${{ matrix.platform }}
3849
steps:
3950
- name: Free Disk Space (Ubuntu)
@@ -51,7 +62,7 @@ jobs:
5162
with:
5263
toolchain: ${{ vars.RUST_VERSION }}
5364

54-
- name: Install SP1
65+
- name: Install SP1 (only Linux)
5566
if: ${{ matrix.os == 'linux' }}
5667
env:
5768
SHELL: /bin/bash
@@ -60,13 +71,13 @@ jobs:
6071
curl -L https://sp1up.succinct.xyz | bash
6172
~/.sp1/bin/sp1up --version 5.0.8
6273
63-
- name: Set up QEMU
74+
- name: Set up QEMU (only Linux ARM)
6475
if: ${{ matrix.platform == 'ubuntu-24.04-arm' }}
6576
uses: docker/setup-qemu-action@v3
6677
with:
6778
platforms: amd64
6879

69-
- name: Install RISC0
80+
- name: Install RISC0 (only Linux x86)
7081
if: ${{ matrix.platform == 'ubuntu-22.04' }}
7182
env:
7283
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -75,8 +86,9 @@ jobs:
7586
~/.risc0/bin/rzup install cargo-risczero 2.3.1
7687
~/.risc0/bin/rzup install rust
7788
78-
- uses: Jimver/cuda-toolkit@v0.2.24
79-
if: ${{ matrix.platform == 'ubuntu-22.04' }}
89+
- name: Install CUDA (only Linux x86 GPU)
90+
uses: Jimver/cuda-toolkit@v0.2.24
91+
if: ${{ matrix.platform == 'ubuntu-22.04' && matrix.gpu }}
8092
id: cuda-toolkit
8193
with:
8294
cuda: "12.9.0"
@@ -96,18 +108,13 @@ jobs:
96108
sudo curl -L -o /usr/local/bin/solc https://github.com/nikitastupin/solc/raw/refs/heads/main/linux/aarch64/solc-v0.8.29
97109
sudo chmod +x /usr/local/bin/solc
98110
99-
- name: Set compiler envs
100-
if: ${{ matrix.os == 'linux' }}
101-
run: |
102-
echo COMPILE_FLAGS="RUSTFLAGS='-C target-cpu=native' NVCC_PREPEND_FLAGS='-arch=sm_70'" >> $GITHUB_ENV
103-
104111
- name: Build ethrex
105112
run: |
106-
COMPILE_CONTRACTS=true ${{ env.COMPILE_FLAGS }} cargo build --release --features "${{ matrix.prover_features }}" --bin ethrex
107-
mv target/release/ethrex ethrex-${{ matrix.os }}_${{ matrix.arch }}
113+
COMPILE_CONTRACTS=true ${{ matrix.cpu_flags }} ${{ matrix.gpu_flags }} cargo build --release --features "${{ matrix.prover_features }}${{ matrix.gpu_feature }}" --bin ethrex
114+
mv target/release/ethrex ethrex-${{ matrix.os }}_${{ matrix.arch }}${{ matrix.gpu_suffix }}
108115
109116
- name: Copy verification keys
110-
if: ${{ matrix.platform == 'ubuntu-22.04' }} # Run only once
117+
if: ${{ matrix.platform == 'ubuntu-22.04' && matrix.gpu }} # Run only once
111118
run: |
112119
mkdir -p ./verification_keys
113120
mv crates/l2/prover/zkvm/interface/risc0/out/riscv32im-risc0-vk verification_keys/ethrex-riscv32im-risc0-vk
@@ -116,11 +123,11 @@ jobs:
116123
- name: Upload artifact
117124
uses: actions/upload-artifact@v4
118125
with:
119-
name: ethrex-${{ matrix.os }}_${{ matrix.arch }}
120-
path: ethrex-${{ matrix.os }}_${{ matrix.arch }}
126+
name: ethrex-${{ matrix.os }}_${{ matrix.arch }}${{ matrix.gpu_suffix }}
127+
path: ethrex-${{ matrix.os }}_${{ matrix.arch }}${{ matrix.gpu_suffix }}
121128

122129
- name: Upload verification keys
123-
if: ${{ matrix.platform == 'ubuntu-22.04' }} # Run only once
130+
if: ${{ matrix.platform == 'ubuntu-22.04' && matrix.gpu }} # Run only once
124131
uses: actions/upload-artifact@v4
125132
with:
126133
name: verification_keys
@@ -229,4 +236,7 @@ jobs:
229236
prerelease: false
230237
tag_name: ${{ github.ref_name }}
231238
name: "ethrex: ${{ github.ref_name }}"
232-
body: ${{ steps.changelog.outputs.changes }}
239+
body: >
240+
Installation and running instructions can be found in [our docs](https://docs.ethrex.xyz/)
241+
242+
${{ steps.changelog.outputs.changes }}

0 commit comments

Comments
 (0)