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

Remove broken features non_pow2_rayon_thread and riv64 #723

Merged
merged 6 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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