Skip to content

Commit 30381b6

Browse files
Use NativeSumcheck for calculating initial_sum (#1249)
Optimization for Calculating Initial Sum in tower verify. - Remove dot product logic for calculating `initial_sum`. Use `NativeSumcheck` instead. - Flatten out evaluation arrays. - Remove arithmetic utilities no longer required. Optimization for `NativeSumcheck` - Use the additional mode on `NativeSumcheck` chip that allows passing in hint space IDs for evaluation inputs instead of loading concrete witness arrays. This significantly reduces cycles involved in loading witnesses. --------- Co-authored-by: kunxian xia <xiakunxian130@gmail.com>
1 parent bf48ae9 commit 30381b6

File tree

9 files changed

+289
-340
lines changed

9 files changed

+289
-340
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ docs/book
1515
# ceno serialized files
1616
*.bin
1717
*.json
18+
*.srs

Cargo.lock

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ ceno_gpu = { git = "https://github.com/scroll-tech/ceno-gpu-mock.git", package =
9292
cudarc = { version = "0.17.3", features = ["driver", "cuda-version-from-build-system"] }
9393

9494
# ceno-recursion dependencies
95-
openvm = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
96-
openvm-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
97-
openvm-continuations = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
98-
openvm-instructions = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
99-
openvm-native-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
100-
openvm-native-compiler = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
101-
openvm-native-compiler-derive = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
102-
openvm-native-recursion = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
103-
openvm-rv32im-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
104-
openvm-sdk = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/v1.4.1-scroll-ext", default-features = false }
95+
openvm = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
96+
openvm-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
97+
openvm-continuations = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
98+
openvm-instructions = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
99+
openvm-native-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
100+
openvm-native-compiler = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
101+
openvm-native-compiler-derive = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
102+
openvm-native-recursion = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
103+
openvm-rv32im-circuit = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
104+
openvm-sdk = { git = "https://github.com/scroll-tech/openvm.git", branch = "feat/native_sc_writeback", default-features = false }
105105

106106
openvm-cuda-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1", default-features = false }
107107
openvm-stark-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1", default-features = false }

ceno_recursion/src/aggregation/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ pub fn verify_proofs(
693693

694694
let fri_params = standard_fri_params_with_100_bits_conjectured_security(1);
695695
let vb = NativeBuilder::default();
696+
696697
air_test_impl::<BabyBearPoseidon2Engine, _>(
697698
fri_params,
698699
vb,
@@ -703,6 +704,13 @@ pub fn verify_proofs(
703704
true,
704705
)
705706
.unwrap();
707+
708+
// _debug
709+
// let engine = BabyBearPoseidon2Engine::new(fri_params);
710+
// let (mut vm, pk) = VirtualMachine::new_with_keygen(engine, vb, config).expect("create vm");
711+
// let vk = pk.get_vk();
712+
// vm.verify(&vk, &proofs)
713+
// .expect("segment proofs should verify");
706714
}
707715
}
708716

ceno_recursion/src/arithmetics/mod.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,6 @@ pub fn is_smaller_than<C: Config>(
9898
RVar::from(v)
9999
}
100100

101-
pub fn evaluate_at_point_degree_1<C: Config>(
102-
builder: &mut Builder<C>,
103-
evals: &Array<C, Ext<C::F, C::EF>>,
104-
point: &Array<C, Ext<C::F, C::EF>>,
105-
) -> Ext<C::F, C::EF> {
106-
let left = builder.get(evals, 0);
107-
let right = builder.get(evals, 1);
108-
let r = builder.get(point, 0);
109-
110-
builder.eval(r * (right - left) + left)
111-
}
112-
113101
pub fn _fixed_dot_product<C: Config>(
114102
builder: &mut Builder<C>,
115103
a: &[Ext<C::F, C::EF>],
@@ -329,24 +317,6 @@ pub fn eq_eval_with_index<C: Config>(
329317
acc
330318
}
331319

332-
// Multiply all elements in a nested Array
333-
pub fn nested_product<C: Config>(
334-
builder: &mut Builder<C>,
335-
arr: &Array<C, Array<C, Ext<C::F, C::EF>>>,
336-
) -> Ext<C::F, C::EF> {
337-
let acc = builder.constant(C::EF::ONE);
338-
iter_zip!(builder, arr).for_each(|ptr_vec, builder| {
339-
let inner_arr = builder.iter_ptr_get(arr, ptr_vec[0]);
340-
341-
iter_zip!(builder, inner_arr).for_each(|ptr_vec, builder| {
342-
let el = builder.iter_ptr_get(&inner_arr, ptr_vec[0]);
343-
builder.assign(&acc, acc * el);
344-
});
345-
});
346-
347-
acc
348-
}
349-
350320
// Multiply all elements in an Array
351321
pub fn arr_product<C: Config>(
352322
builder: &mut Builder<C>,

0 commit comments

Comments
 (0)