Skip to content

Commit

Permalink
Remove broken features non_pow2_rayon_thread and riv64 (#723)
Browse files Browse the repository at this point in the history
Features `non_pow2_rayon_thread` and `riv64` are not tested: we can't
even compile with them.

Because `riv64` is gone, we can make `riv32` invisible: it's effects are
now just the default.
  • Loading branch information
matthiasgoergens authored Dec 12, 2024
1 parent 2cd6a6d commit 3bb18fe
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 93 deletions.
4 changes: 0 additions & 4 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ CUR_TARGET = { script = ['''
'''] }
RAYON_NUM_THREADS = "${CORE}"

[tasks.build]
# Override the default `--all-features`, that's broken, because some of our features are mutually exclusive.
args = ["build"]

[tasks.tests]
args = [
"test",
Expand Down
5 changes: 1 addition & 4 deletions ceno_zkvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,9 @@ pprof2.workspace = true
glob = "0.3"

[features]
default = ["riv32", "forbid_overflow"]
default = ["forbid_overflow"]
flamegraph = ["pprof2/flamegraph", "pprof2/criterion"]
forbid_overflow = []
non_pow2_rayon_thread = []
riv32 = []
riv64 = []

[[bench]]
harness = false
Expand Down
4 changes: 1 addition & 3 deletions ceno_zkvm/src/instructions/riscv/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ pub const PUBLIC_IO_IDX: usize = 6;
pub const LIMB_BITS: usize = 16;
pub const LIMB_MASK: u32 = 0xFFFF;

#[cfg(feature = "riv32")]
pub const BIT_WIDTH: usize = 32usize;
#[cfg(feature = "riv64")]
pub const BIT_WIDTH: usize = 64usize;

pub type UInt<E> = UIntLimbs<BIT_WIDTH, LIMB_BITS, E>;
pub type UIntMul<E> = UIntLimbs<{ 2 * BIT_WIDTH }, LIMB_BITS, E>;
/// use UInt<x> for x bits limb size
Expand Down
3 changes: 0 additions & 3 deletions sumcheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,3 @@ criterion.workspace = true
[[bench]]
harness = false
name = "devirgo_sumcheck"

[features]
non_pow2_rayon_thread = []
2 changes: 0 additions & 2 deletions sumcheck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![deny(clippy::cargo)]
#![feature(decl_macro)]
#[cfg(feature = "non_pow2_rayon_thread")]
pub mod local_thread_pool;
pub mod macros;
mod prover;
mod prover_v2;
Expand Down
32 changes: 0 additions & 32 deletions sumcheck/src/local_thread_pool.rs

This file was deleted.

27 changes: 5 additions & 22 deletions sumcheck/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ use rayon::{
};
use transcript::{Challenge, Transcript, TranscriptSyncronized};

#[cfg(feature = "non_pow2_rayon_thread")]
use crate::local_thread_pool::{LOCAL_THREAD_POOL, create_local_pool_once};

use crate::{
macros::{entered_span, exit_span},
structs::{IOPProof, IOPProverMessage, IOPProverState},
Expand Down Expand Up @@ -119,25 +116,11 @@ impl<E: ExtensionField> IOPProverState<E> {
if rayon::current_num_threads() >= max_thread_id {
rayon::spawn(spawn_task);
} else {
#[cfg(not(feature = "non_pow2_rayon_thread"))]
{
panic!(
"rayon global thread pool size {} mismatch with desired poly size {}, add --features non_pow2_rayon_thread",
rayon::current_num_threads(),
polys.len()
);
}

#[cfg(feature = "non_pow2_rayon_thread")]
unsafe {
create_local_pool_once(max_thread_id, true);

if let Some(pool) = LOCAL_THREAD_POOL.as_ref() {
pool.spawn(spawn_task)
} else {
panic!("empty local pool")
}
}
panic!(
"rayon global thread pool size {} mismatch with desired poly size {}.",
rayon::current_num_threads(),
polys.len()
);
}
}

Expand Down
28 changes: 5 additions & 23 deletions sumcheck/src/prover_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ use rayon::{
};
use transcript::{Challenge, Transcript, TranscriptSyncronized};

#[cfg(feature = "non_pow2_rayon_thread")]
use crate::local_thread_pool::{LOCAL_THREAD_POOL, create_local_pool_once};

use crate::{
macros::{entered_span, exit_span},
structs::{IOPProof, IOPProverMessage, IOPProverStateV2},
Expand Down Expand Up @@ -235,26 +232,11 @@ impl<'a, E: ExtensionField> IOPProverStateV2<'a, E> {
{
rayon::in_place_scope(scoped_fn)
} else {
#[cfg(not(feature = "non_pow2_rayon_thread"))]
{
panic!(
"rayon global thread pool size {} mismatch with desired poly size {}, add
--features non_pow2_rayon_thread",
rayon::current_num_threads(),
polys.len()
);
}

#[cfg(feature = "non_pow2_rayon_thread")]
unsafe {
create_local_pool_once(max_thread_id, true);

if let Some(pool) = LOCAL_THREAD_POOL.as_ref() {
pool.scope(scoped_fn)
} else {
panic!("empty local pool")
}
}
panic!(
"rayon global thread pool size {} mismatch with desired poly size {}.",
rayon::current_num_threads(),
polys.len()
);
};

if log2_max_thread_id == 0 {
Expand Down

0 comments on commit 3bb18fe

Please sign in to comment.