Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into matthias/cache-faster
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasgoergens committed Dec 13, 2024
2 parents e87c446 + 0a64371 commit 5fc049a
Show file tree
Hide file tree
Showing 32 changed files with 75 additions and 136 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
skip_check:
runs-on: [self-hosted, Linux, X64]
Expand All @@ -33,25 +37,23 @@ jobs:
runs-on: [self-hosted, Linux, X64]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
target/
examples/target/
guest/target/
key: integration-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@nightly

- name: Run example
env:
RAYON_NUM_THREADS: 2
RUSTFLAGS: "-C opt-level=3"
run: cargo run --package ceno_zkvm --example riscv_opcodes -- --start 10 --end 11

- name: Run fibonacci
env:
RAYON_NUM_THREADS: 8
RUST_LOG: debug
RUSTFLAGS: "-C opt-level=3"
run: cargo run --package ceno_zkvm --bin e2e -- --platform=sp1 ceno_zkvm/examples/fibonacci.elf
35 changes: 11 additions & 24 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,18 @@ on:
branches:
- master

jobs:
skip_check:
runs-on: [self-hosted, Linux, X64]
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: 'true'
concurrent_skipping: 'same_content_newer'
paths_ignore: '["**/README.md"]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule", "merge_group"]'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
lints:
needs: [skip_check]
if: |
github.event.pull_request.draft == false &&
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: Various lints
timeout-minutes: 30
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt, clippy
Expand All @@ -45,8 +31,9 @@ jobs:
with:
path: |
target/
examples/target/
guest/target/
key: lint-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: lint-${{ runner.os }}-cargo-

- name: Install cargo make
run: |
Expand All @@ -58,13 +45,13 @@ jobs:
env:
RUSTFLAGS: "-Dwarnings"
run: |
cargo check --workspace --all-targets --exclude ceno_rt
cargo check --workspace --all-targets
# We have a lot of code under #[cfg(not(debug_assertions))] and similar,
# so we need to run cargo check in release mode, too:
cargo check --workspace --all-targets --exclude ceno_rt --release
cargo check --workspace --all-targets --release
cargo make clippy
# Same for clippy:
cargo clippy --workspace --all-targets --exclude ceno_rt --release
cargo clippy --workspace --all-targets --release
- name: Install taplo
run: taplo --version || cargo install taplo-cli
Expand Down
28 changes: 8 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,18 @@ on:
branches:
- master

jobs:
skip_check:
runs-on: [self-hosted, Linux, X64]
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: 'true'
concurrent_skipping: 'same_content_newer'
paths_ignore: '["**/README.md"]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule", "merge_group"]'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
tests:
needs: [skip_check]
if: |
github.event.pull_request.draft == false &&
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: Run Tests
timeout-minutes: 30
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
targets: riscv32im-unknown-none-elf
Expand All @@ -43,8 +30,9 @@ jobs:
with:
path: |
target/
examples/target/
guest/target/
key: tests-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: tests-${{ runner.os }}-cargo-

- name: Install cargo make
run: |
Expand Down
49 changes: 0 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[workspace]
exclude = ["examples"]
exclude = ["guest"]
members = [
"ceno_emul",
"examples-builder",
"ceno_rt",
"mpcs",
"multilinear_extensions",
"sumcheck",
Expand Down Expand Up @@ -54,6 +53,13 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[profile.dev]
lto = "thin"
# We are running our tests with optimizations turned on to make them faster.
# Please turn optimizations off, when you want accurate stack traces for debugging.
opt-level = 2

[profile.dev.package."*"]
# Set the default for dependencies in Development mode.
opt-level = 3

[profile.release]
lto = "thin"
7 changes: 0 additions & 7 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CORE = { script = ["nproc"] }
RAYON_NUM_THREADS = "${CORE}"

[tasks.tests]
args = [
Expand All @@ -11,10 +9,7 @@ args = [
"--bins",
"--tests",
"--examples",
"--release",
"--workspace",
"--exclude",
"ceno_rt",
]
command = "cargo"
workspace = false
Expand All @@ -34,8 +29,6 @@ args = [
"clippy",
"--workspace",
"--all-targets",
"--exclude",
"ceno_rt",
"--",
"-D",
"warnings",
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ Clippy and check work as usual:
```sh
cargo check
cargo clippy
cargo build
```

Alas, `cargo build` doesn't work. That's a known problem and we're working on it. Please use `cargo make build` instead for now.

### Setting up self-hosted CI docker container

To set up docker container for CI, you can run the following command:
Expand Down
4 changes: 1 addition & 3 deletions ceno_zkvm/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CORE = { script = ["nproc"] }
RAYON_NUM_THREADS = "${CORE}"

[tasks.riscv_opcodes_flamegraph]
args = ["run", "--package", "ceno_zkvm", "--release", "--example", "riscv_opcodes"]
command = "cargo"
env = { "RUST_LOG" = "debug", "RAYON_NUM_THREADS" = "8" }
env = { "RUST_LOG" = "debug" }
4 changes: 2 additions & 2 deletions ceno_zkvm/src/instructions/riscv/slt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<E: ExtensionField, I: RIVInstruction> Instruction<E> for SetLessThanInstruc

let r_insn = RInstructionConfig::<E>::construct_circuit(
cb,
InsnKind::SLT,
I::INST_KIND,
rs1_read.register_expr(),
rs2_read.register_expr(),
rd_written.register_expr(),
Expand Down Expand Up @@ -159,7 +159,7 @@ mod test {
.unwrap()
.unwrap();

let insn_code = encode_rv32(InsnKind::SLT, 2, 3, 4, 0);
let insn_code = encode_rv32(I::INST_KIND, 2, 3, 4, 0);
let (raw_witin, lkm) = SetLessThanInstruction::<_, I>::assign_instances(
&config,
cb.cs.num_witin as usize,
Expand Down
8 changes: 4 additions & 4 deletions examples-builder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn build_elfs() {
// See git history for an attempt to do this.
let output = Command::new("cargo")
.args(["build", "--release", "--examples"])
.current_dir("../examples")
.current_dir("../guest/examples")
.env_clear()
.envs(std::env::vars().filter(|x| !x.0.starts_with("CARGO_")))
.output()
Expand All @@ -41,11 +41,11 @@ fn build_elfs() {
dest,
r#"#[allow(non_upper_case_globals)]
pub const {example}: &[u8] =
include_bytes!(r"{CARGO_MANIFEST_DIR}/../examples/target/riscv32im-unknown-none-elf/release/examples/{example}");"#
include_bytes!(r"{CARGO_MANIFEST_DIR}/../guest/target/riscv32im-unknown-none-elf/release/examples/{example}");"#
).expect("failed to write vars.rs");
}
let input_path = "../examples/";
let elfs_path = "../examples/target/riscv32im-unknown-none-elf/release/examples/";
let input_path = "../guest/";
let elfs_path = "../guest/target/riscv32im-unknown-none-elf/release/examples/";

println!("cargo:rerun-if-changed={input_path}");
println!("cargo:rerun-if-changed={elfs_path}");
Expand Down
1 change: 0 additions & 1 deletion examples/.cargo/config.toml

This file was deleted.

9 changes: 0 additions & 9 deletions examples/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion examples/rust-toolchain.toml

This file was deleted.

File renamed without changes.
12 changes: 6 additions & 6 deletions examples/Cargo.lock → guest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5fc049a

Please sign in to comment.