Skip to content

Commit 7cce464

Browse files
jonathanpwanggaxiombdiehsstephenh-axiom-xyzmatejav
authored
feat: tracegen on GPU (#2034)
Co-authored-by: Grigorii Alekseev <[email protected]> Co-authored-by: Christian Altamirano <[email protected]> Co-authored-by: stephenh-axiom-xyz <[email protected]> Co-authored-by: matejav <[email protected]> Co-authored-by: Teo Kitanovski <[email protected]> Co-authored-by: Arayi Khalatyan <[email protected]> Co-authored-by: Arayi <[email protected]> Co-authored-by: Golovanov399 <[email protected]> Co-authored-by: Xinding Wei <[email protected]>
1 parent fd362bc commit 7cce464

File tree

392 files changed

+35473
-2690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

392 files changed

+35473
-2690
lines changed

.github/workflows/benchmark-call.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010
instance_type:
1111
type: string
1212
required: false
13-
description: The type of runner to start ({1,2,4,8,16,32,48,64}cpu-linux-{arm64,x64})
14-
default: 64cpu-linux-arm64
13+
description: The AWS instance type or family (e.g., m7g.16xlarge)
14+
default: g6.2xlarge
1515
memory_allocator:
1616
type: string
1717
required: false
@@ -63,8 +63,8 @@ on:
6363
instance_type:
6464
type: string
6565
required: false
66-
description: The type of runner to start ({1,2,4,8,16,32,48,64}cpu-linux-{arm64,x64})
67-
default: 64cpu-linux-arm64
66+
description: The AWS instance type or family (e.g., m7g.16xlarge)
67+
default: g6.2xlarge
6868
memory_allocator:
6969
type: string
7070
required: false
@@ -107,7 +107,7 @@ on:
107107
env:
108108
S3_METRICS_PATH: s3://openvm-public-data-sandbox-us-east-1/benchmark/github/metrics
109109
S3_FLAMEGRAPHS_PATH: s3://openvm-public-data-sandbox-us-east-1/benchmark/github/flamegraphs
110-
FEATURE_FLAGS: "metrics,parallel,nightly-features,tco"
110+
FEATURE_FLAGS: "metrics,parallel,tco"
111111
INPUT_ARGS: ""
112112
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
113113

@@ -118,22 +118,24 @@ jobs:
118118
bench-new:
119119
name: Run benchmark on workflow ref/branch
120120
runs-on:
121-
- runs-on
122-
- runner=${{ inputs.instance_type }}
123-
- run-id=${{ github.run_id }}
124-
- family=m7
125-
- tag=bench-${{ inputs.benchmark_name }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
121+
- runs-on=${{ github.run_id }}-bench-${{ inputs.benchmark_id || github.event.inputs.benchmark_name || inputs.benchmark_name }}-${{ github.run_number }}-${{ github.run_attempt }}
122+
- family=${{ github.event.inputs.instance_type || inputs.instance_type }}
123+
- image=${{ startsWith(github.event.inputs.instance_type || inputs.instance_type, 'g') && 'ubuntu24-gpu-x64' || contains(github.event.inputs.instance_type || inputs.instance_type, 'g.') && 'ubuntu24-full-arm64' || 'ubuntu24-full-x64' }}
124+
- spot=capacity-optimized
125+
- tag=bench-${{ inputs.benchmark_id || github.event.inputs.benchmark_name || inputs.benchmark_name }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
126126
- extras=s3-cache
127127
steps:
128-
- uses: runs-on/action@v1
128+
- uses: runs-on/action@v2
129129
##########################################################################
130130
# Environment setup #
131131
##########################################################################
132-
- uses: actions/checkout@v4
132+
- uses: actions/checkout@v5
133133
with:
134134
ref: ${{ github.event.pull_request.head.sha || github.sha }}
135135
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
136-
136+
- run: | # avoid cross-device link error
137+
rustup component remove clippy || true
138+
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
137139
- uses: dtolnay/rust-toolchain@stable
138140
- uses: Swatinem/rust-cache@v2
139141
with:
@@ -146,9 +148,17 @@ jobs:
146148
147149
- name: Display workflow inputs
148150
run: echo "${{ toJSON(inputs) }}"
149-
- name: "Feature flags: memory allocator"
151+
- name: "Feature flags: memory allocator + e2e"
150152
run: |
151153
ALLOCATOR=${{ inputs.memory_allocator || github.event.inputs.memory_allocator }}
154+
if [[ ! "${{ inputs.instance_type || github.event.inputs.instance_type }}" =~ ^g ]]; then
155+
FEATURE_FLAGS=${FEATURE_FLAGS},nightly-features
156+
if [[ "${{ inputs.e2e_bench }}" == "true" ]]; then
157+
FEATURE_FLAGS=${FEATURE_FLAGS},evm
158+
fi
159+
else
160+
FEATURE_FLAGS=${FEATURE_FLAGS},cuda
161+
fi
152162
echo "FEATURE_FLAGS=$ALLOCATOR,${FEATURE_FLAGS}" >> $GITHUB_ENV
153163
- name: "Feature flags: aggregation"
154164
if: contains(github.event.pull_request.labels.*.name, 'run-benchmark') || (github.event_name == 'push' && github.ref == 'refs/heads/main')

.github/workflows/benchmarks-execute.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
CODSPEED_RUNNER_MODE: walltime
4343

4444
steps:
45-
- uses: runs-on/action@v1
46-
- uses: actions/checkout@v4
45+
- uses: runs-on/action@v2
46+
- uses: actions/checkout@v5
4747
- uses: dtolnay/rust-toolchain@stable
4848
- uses: Swatinem/rust-cache@v2
4949
with:
@@ -87,8 +87,8 @@ jobs:
8787
CODSPEED_RUNNER_MODE: instrumentation
8888

8989
steps:
90-
- uses: runs-on/action@v1
91-
- uses: actions/checkout@v4
90+
- uses: runs-on/action@v2
91+
- uses: actions/checkout@v5
9292
- uses: dtolnay/rust-toolchain@stable
9393
- uses: Swatinem/rust-cache@v2
9494
with:

.github/workflows/benchmarks-upload-fixtures.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
- extras=s3-cache
1818

1919
steps:
20-
- uses: runs-on/action@v1
21-
- uses: actions/checkout@v4
20+
- uses: runs-on/action@v2
21+
- uses: actions/checkout@v5
2222
- uses: dtolnay/rust-toolchain@stable
2323
- uses: Swatinem/rust-cache@v2
2424
with:

.github/workflows/benchmarks.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ jobs:
8383
else
8484
RUN_E2E=${{ github.event.inputs.run-benchmark-e2e || 'false' }}
8585
fi
86-
if [[ "$RUN_E2E" == "true" ]]; then
87-
FEATURE_FLAGS="evm,${FEATURE_FLAGS}"
88-
fi
8986
if [[ "${{ github.event.inputs.aggregation }}" == "true" ]]; then
9087
FEATURE_FLAGS="aggregation,${FEATURE_FLAGS}"
9188
fi

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
- image=ubuntu24-full-arm64
2121
- extras=s3-cache
2222
steps:
23-
- uses: runs-on/action@v1
24-
- uses: actions/checkout@v4
23+
- uses: runs-on/action@v2
24+
- uses: actions/checkout@v5
2525
- uses: dtolnay/rust-toolchain@stable
2626
- uses: Swatinem/rust-cache@v2
2727
with:

.github/workflows/cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- extras=s3-cache
4343

4444
steps:
45-
- uses: actions/checkout@v4
45+
- uses: actions/checkout@v5
4646
- uses: dtolnay/rust-toolchain@stable
4747
- uses: Swatinem/rust-cache@v2
4848
with:

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- runs-on=${{ github.run_id }}
2626
- runner=8cpu-linux-arm64
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
2929
- name: Set up Rust toolchain
3030
uses: dtolnay/rust-toolchain@nightly
3131

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Extension Tests (CUDA)
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
paths:
9+
- "crates/circuits/**"
10+
- "crates/vm/**"
11+
- "crates/toolchain/**"
12+
- "extensions/**"
13+
- "Cargo.toml"
14+
- ".github/workflows/extension-tests.cuda.yml"
15+
merge_group:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
19+
cancel-in-progress: true
20+
21+
env:
22+
CARGO_TERM_COLOR: always
23+
OPENVM_FAST_TEST: "1"
24+
25+
jobs:
26+
extension-tests-cuda:
27+
strategy:
28+
matrix:
29+
extensions: # group extensions on the same runner based on test time
30+
- "rv32im native"
31+
- "keccak256 sha256 bigint algebra ecc pairing"
32+
runs-on:
33+
- runs-on=${{ github.run_id }}-extension-tests-cuda-${{ github.run_attempt }}
34+
- runner=test-gpu-nvidia
35+
- image=ubuntu24-gpu-x64
36+
- cpu=8+32 # more cores for faster compilation
37+
- spot=capacity-optimized
38+
- tag=extension-cuda-tests
39+
- extras=s3-cache
40+
41+
steps:
42+
- uses: runs-on/action@v2
43+
- uses: actions/checkout@v5
44+
- uses: dorny/paths-filter@v3
45+
id: filter
46+
with:
47+
filters: |
48+
common:
49+
- "crates/circuits/**"
50+
- "crates/vm/**"
51+
- "crates/toolchain/**"
52+
- ".github/workflows/extension-tests.cuda.yml"
53+
rv32im:
54+
- "extensions/rv32im/**"
55+
native:
56+
- "extensions/native/**"
57+
keccak256:
58+
- "extensions/keccak256/**"
59+
sha256:
60+
- "extensions/sha256/**"
61+
bigint:
62+
- "extensions/bigint/**"
63+
algebra:
64+
- "extensions/algebra/**"
65+
ecc:
66+
- "extensions/ecc/**"
67+
pairing:
68+
- "extensions/pairing/**"
69+
70+
- name: Skip if no changes
71+
env:
72+
FILTER_OUTPUTS: ${{ toJSON(steps.filter.outputs) }}
73+
run: |
74+
# Check if common files changed
75+
COMMON_CHANGED=$(echo $FILTER_OUTPUTS | jq -r .common)
76+
77+
# Check if any extension in the current matrix group changed
78+
ANY_EXT_CHANGED=false
79+
for ext in ${{ matrix.extensions }}; do
80+
ext_changed=$(echo $FILTER_OUTPUTS | jq -r .$ext)
81+
if [[ "$ext_changed" == "true" ]]; then
82+
ANY_EXT_CHANGED=true
83+
break
84+
fi
85+
done
86+
87+
# Skip if neither common nor any extension in this matrix group changed
88+
if [[ "$COMMON_CHANGED" != "true" && "$ANY_EXT_CHANGED" != "true" ]]; then
89+
echo "No relevant changes for extensions [${{ matrix.extensions }}], skipping tests."
90+
exit 0
91+
fi
92+
93+
- run: | # avoid cross-device link error
94+
rustup component remove clippy || true
95+
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
96+
- uses: dtolnay/rust-toolchain@stable
97+
- uses: Swatinem/rust-cache@v2
98+
with:
99+
cache-on-failure: true
100+
- uses: taiki-e/install-action@nextest
101+
102+
- name: Check CUDA status and set environment variables
103+
run: |
104+
nvcc --version
105+
echo "NEXTEST_ENV=CUDA_OPT_LEVEL=1" >> $GITHUB_ENV
106+
echo "FEATURE_ARGS=--features=cuda" >> $GITHUB_ENV
107+
echo "CIRCUIT_TEST_FILTER=cuda" >> $GITHUB_ENV
108+
109+
- name: Run extension tests
110+
env:
111+
FILTER_OUTPUTS: ${{ toJSON(steps.filter.outputs) }}
112+
run: |
113+
COMMON_CHANGED=$(echo $FILTER_OUTPUTS | jq -r .common)
114+
115+
for ext in ${{ matrix.extensions }}; do
116+
ext_changed=$(echo $FILTER_OUTPUTS | jq -r .$ext)
117+
if [[ "$COMMON_CHANGED" == "true" || "$ext_changed" == "true" ]]; then
118+
echo "::group::Running tests for $ext"
119+
120+
# Run circuit tests
121+
if [ -d "extensions/$ext/circuit" ]; then
122+
pushd extensions/$ext/circuit
123+
${{ env.NEXTEST_ENV }} cargo nextest run ${{ env.CIRCUIT_TEST_FILTER }} ${{ env.FEATURE_ARGS }} --profile=heavy --no-tests=pass
124+
popd
125+
fi
126+
127+
# Run integration tests
128+
if [ -d "extensions/$ext/tests" ]; then
129+
pushd extensions/$ext/tests
130+
rustup component add rust-src --toolchain nightly-2025-02-14
131+
${{ env.NEXTEST_ENV }} cargo nextest run ${{ env.FEATURE_ARGS }} --profile=heavy --no-tests=pass
132+
popd
133+
fi
134+
echo "::endgroup::"
135+
else
136+
echo "Skipping tests for $ext as no relevant files changed."
137+
fi
138+
done

.github/workflows/extension-tests.yml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,29 @@ jobs:
3535
- { name: "algebra", path: "algebra" }
3636
- { name: "ecc", path: "ecc" }
3737
- { name: "pairing", path: "pairing" }
38+
platform:
39+
- { runner: "64cpu-linux-arm64", image: "ubuntu24-full-arm64" }
3840
# Ensure tests run in parallel even if one fails
3941
fail-fast: false
4042

4143
runs-on:
42-
- runs-on=${{ github.run_id }}
43-
- runner=64cpu-linux-arm64
44-
- image=ubuntu24-full-arm64
45-
- tag=extension-${{ matrix.extension.name }}
44+
- runs-on=${{ github.run_id }}-extension-tests-${{ github.run_attempt }}-${{ strategy.job-index }}
45+
- runner=${{ matrix.platform.runner }}
46+
- image=${{ matrix.platform.image }}
47+
- tag=extension-${{ matrix.extension.name }}-${{ matrix.platform.runner }}
4648
- extras=s3-cache
4749

4850
steps:
49-
- uses: runs-on/action@v1
50-
- uses: actions/checkout@v4
51+
- uses: runs-on/action@v2
52+
- uses: actions/checkout@v5
5153
- uses: dorny/paths-filter@v3
5254
id: filter
5355
with:
5456
filters: |
5557
- "crates/circuits/**"
5658
- "crates/vm/**"
5759
- "crates/toolchain/**"
58-
- "extensions/${{ matrix.extensions.path }}/**"
60+
- "extensions/${{ matrix.extension.path }}/**"
5961
- ".github/workflows/extension-tests.yml"
6062
- name: Skip if no changes
6163
if: steps.filter.outputs.matched == 'false'
@@ -71,21 +73,27 @@ jobs:
7173

7274
- name: Run ${{ matrix.extension.name }} circuit crate tests
7375
working-directory: extensions/${{ matrix.extension.path }}/circuit
74-
run: cargo nextest run --cargo-profile=fast --test-threads=32
76+
run: |
77+
TEST_THREADS="--test-threads=32"
78+
if [[ "${{ matrix.extension.name }}" == "algebra" ]]; then
79+
TEST_THREADS="--test-threads=4"
80+
fi
81+
cargo nextest run ${{ env.CIRCUIT_TEST_FILTER }} --cargo-profile=fast ${{ env.FEATURE_ARGS }} $TEST_THREADS --no-tests=pass
7582
83+
# We only need to run guest crate tests on CPU since we are not testing prover functionality
7684
- name: Run ${{ matrix.extension.name }} guest crate tests
7785
if: hashFiles(format('extensions/{0}/guest', matrix.extension.path)) != ''
7886
working-directory: extensions/${{ matrix.extension.path }}/guest
7987
run: |
80-
FEATURE_ARGS=""
88+
GUEST_FEATURE_ARGS=""
8189
if [[ "${{ matrix.extension.name }}" == "pairing" ]]; then
82-
FEATURE_ARGS="--features=bn254,bls12_381,halo2curves"
90+
GUEST_FEATURE_ARGS="--features=bn254,bls12_381,halo2curves"
8391
fi
84-
cargo nextest run --cargo-profile=fast $FEATURE_ARGS --no-tests=pass
92+
cargo nextest run --cargo-profile=fast $GUEST_FEATURE_ARGS --no-tests=pass
8593
8694
- name: Run ${{ matrix.extension.name }} integration tests
8795
if: hashFiles(format('extensions/{0}/tests', matrix.extension.path)) != ''
8896
working-directory: extensions/${{ matrix.extension.path }}/tests
8997
run: |
9098
rustup component add rust-src --toolchain nightly-2025-02-14
91-
cargo nextest run --cargo-profile=fast --profile=heavy --no-tests=pass
99+
cargo nextest run --cargo-profile=fast ${{ env.FEATURE_ARGS }} --profile=heavy --no-tests=pass

0 commit comments

Comments
 (0)