Skip to content
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

feat: ci refactor #684

Merged
merged 39 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 137 additions & 13 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,143 @@
name: PR Lint
name: PR

on:
pull_request_target:
types:
- opened
- edited

permissions:
pull-requests: read
push:
branches: [main]
pull_request:
branches:
- "**"
paths:
- "cli/**"
- "core/**"
- "prover/**"
- "recursion/**"
- "sdk/**"
- ".github/workflows/**"
merge_group:
types: [checks_requested]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
main:
name: Title
runs-on: warp-ubuntu-latest-arm64-4x
test-x86:
name: Test (x86-64)
runs-on: runs-on,runner=64cpu-linux-x64
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- uses: amannn/action-semantic-pull-request@v5
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup CI
uses: ./.github/actions/setup

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets --all-features
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_LOG: info
RUST_BACKTRACE: 1

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --release -- --nocapture
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_BACKTRACE: 1
FRI_QUERIES: 1
SP1_DEV: 1

test-arm:
name: Test (ARM)
runs-on: runs-on,runner=64cpu-linux-arm64
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup CI
uses: ./.github/actions/setup

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets --all-features
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_LOG: info
RUST_BACKTRACE: 1

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --release
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_BACKTRACE: 1
FRI_QUERIES: 1
SP1_DEV: 1

lint:
name: Formatting & Clippy
runs-on: runs-on,runner=8cpu-linux-x64
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup CI
uses: ./.github/actions/setup

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
env:
CARGO_INCREMENTAL: 1

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets -- -D warnings -A incomplete-features
env:
CARGO_INCREMENTAL: 1

examples:
name: Examples
runs-on: runs-on,runner=8cpu-linux-x64
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup CI
uses: ./.github/actions/setup

- name: Install SP1 toolchain
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --manifest-path examples/Cargo.toml --all-targets --all-features
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_LOG: info
RUST_BACKTRACE: 1
19 changes: 19 additions & 0 deletions .github/workflows/pr_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: PR Lint

on:
pull_request_target:
types:
- opened
- edited

permissions:
pull-requests: read

jobs:
main:
name: Title
runs-on: warp-ubuntu-latest-arm64-4x
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103 changes: 0 additions & 103 deletions .github/workflows/tests.yml

This file was deleted.

8 changes: 6 additions & 2 deletions core/src/cpu/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,12 @@ impl CpuChip {

fn pad_to_power_of_two<F: PrimeField>(values: &mut Vec<F>) {
let n_real_rows = values.len() / NUM_CPU_COLS;

values.resize(n_real_rows.next_power_of_two() * NUM_CPU_COLS, F::zero());
let padded_nb_rows = if n_real_rows < 16 {
16
} else {
n_real_rows.next_power_of_two()
};
values.resize(padded_nb_rows * NUM_CPU_COLS, F::zero());

// Interpret values as a slice of arrays of length `NUM_CPU_COLS`
let rows = unsafe {
Expand Down
10 changes: 0 additions & 10 deletions core/src/stark/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,6 @@ impl<SC: StarkGenericConfig> std::error::Error for MachineVerificationError<SC>
#[allow(non_snake_case)]
pub mod tests {

use serial_test::serial;

use crate::io::SP1Stdin;
use crate::runtime::tests::fibonacci_program;
use crate::runtime::tests::simple_memory_program;
Expand Down Expand Up @@ -662,26 +660,18 @@ pub mod tests {
}

#[test]
#[serial]
fn test_fibonacci_prove() {
setup_logger();
let program = fibonacci_program();
run_test(program).unwrap();
}

#[test]
#[serial]
fn test_fibonacci_prove_batch() {
std::env::set_var("SHARD_BATCH_SIZE", "1");
std::env::set_var("SHARD_SIZE", "16384");

setup_logger();
let program = fibonacci_program();
let stdin = SP1Stdin::new();
run_and_prove(program, &stdin, BabyBearPoseidon2::new());

std::env::remove_var("SHARD_BATCH_SIZE");
std::env::remove_var("SHARD_SIZE");
}

#[test]
Expand Down
12 changes: 10 additions & 2 deletions core/src/stark/quotient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use p3_matrix::Matrix;
use p3_maybe_rayon::prelude::*;
use p3_util::log2_strict_usize;

use crate::air::MachineAir;

use super::folder::ProverConstraintFolder;
use super::Chip;
use super::Domain;
Expand All @@ -31,7 +33,7 @@ pub fn quotient_values<SC, A, Mat>(
public_values: &[Val<SC>],
) -> Vec<SC::Challenge>
where
A: for<'a> Air<ProverConstraintFolder<'a, SC>>,
A: for<'a> Air<ProverConstraintFolder<'a, SC>> + MachineAir<Val<SC>>,
SC: StarkGenericConfig,
Mat: Matrix<Val<SC>> + Sync,
{
Expand All @@ -46,7 +48,13 @@ where

let ext_degree = SC::Challenge::D;

assert!(quotient_size >= PackedVal::<SC>::WIDTH);
assert!(
quotient_size >= PackedVal::<SC>::WIDTH,
"quotient size is too small: got {}, expected at least {} for chip {}",
quotient_size,
PackedVal::<SC>::WIDTH,
chip.name()
);

(0..quotient_size)
.into_par_iter()
Expand Down
12 changes: 6 additions & 6 deletions core/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub const fn indices_arr<const N: usize>() -> [usize; N] {
pub fn pad_to_power_of_two<const N: usize, T: Clone + Default>(values: &mut Vec<T>) {
debug_assert!(values.len() % N == 0);
let mut n_real_rows = values.len() / N;
if n_real_rows < 8 {
n_real_rows = 8;
if n_real_rows < 16 {
n_real_rows = 16;
}
values.resize(n_real_rows.next_power_of_two() * N, T::default());
}
Expand Down Expand Up @@ -67,8 +67,8 @@ pub fn limbs_from_access<T: Copy, N: ArrayLength, M: MemoryCols<T>>(cols: &[M])
pub fn pad_rows<T: Clone, const N: usize>(rows: &mut Vec<[T; N]>, row_fn: impl Fn() -> [T; N]) {
let nb_rows = rows.len();
let mut padded_nb_rows = nb_rows.next_power_of_two();
if padded_nb_rows == 2 || padded_nb_rows == 1 {
padded_nb_rows = 4;
if padded_nb_rows < 16 {
padded_nb_rows = 16;
}
if padded_nb_rows == nb_rows {
return;
Expand Down Expand Up @@ -104,8 +104,8 @@ pub fn pad_rows_fixed<R: Clone>(
}
None => {
let mut padded_nb_rows = nb_rows.next_power_of_two();
if padded_nb_rows < 8 {
padded_nb_rows = 8;
if padded_nb_rows < 16 {
padded_nb_rows = 16;
}
rows.resize(padded_nb_rows, dummy_row);
}
Expand Down
Loading
Loading