Skip to content

Commit 873491e

Browse files
committed
fix clippy
1 parent b81e63f commit 873491e

5 files changed

Lines changed: 37 additions & 35 deletions

File tree

crypto/math-cuda/src/fri.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ impl FriCommitState {
217217
// Keep the layer tree resident on device; copy only the 32-byte root so
218218
// R4 query openings gather paths on device instead of copying the tree.
219219
let mut root = [0u8; 32];
220-
self.stream.memcpy_dtoh(&nodes_dev.slice(0..32), &mut root)?;
220+
self.stream
221+
.memcpy_dtoh(&nodes_dev.slice(0..32), &mut root)?;
221222
self.stream.synchronize()?;
222223

223224
self.a_is_input = !self.a_is_input;

crypto/math-cuda/tests/keccak_leaves.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ fn keccak_comp_poly_leaves_matches_cpu() {
219219

220220
// Exercise the production keep path, then read the resident nodes
221221
// back to host to check the leaf bytes.
222-
let tree =
223-
math_cuda::merkle::build_comp_poly_tree_from_evals_ext3_keep(&parts_slices)
224-
.unwrap();
222+
let tree = math_cuda::merkle::build_comp_poly_tree_from_evals_ext3_keep(&parts_slices)
223+
.unwrap();
225224
let be = math_cuda::device::backend().unwrap();
226225
let stream = be.next_stream();
227226
let nodes: Vec<u8> = stream.clone_dtoh(&*tree.nodes).unwrap();

crypto/math-cuda/tests/merkle_root_parity.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,14 @@ fn new_row_major_pipeline_base_root_matches_cpu() {
299299
let fwd_tw =
300300
TwoHalfTwiddles::<GoldilocksField>::new(log_lde, false).expect("fwd twiddles");
301301

302-
let (handle, _lde) =
303-
math_cuda::lde::coset_lde_row_major_with_merkle_tree_keep(
304-
&row_major,
305-
n,
306-
num_cols,
307-
blowup,
308-
&weights_u64,
309-
)
310-
.expect("new row-major GPU pipeline");
302+
let (handle, _lde) = math_cuda::lde::coset_lde_row_major_with_merkle_tree_keep(
303+
&row_major,
304+
n,
305+
num_cols,
306+
blowup,
307+
&weights_u64,
308+
)
309+
.expect("new row-major GPU pipeline");
311310
let gpu_root = handle.tree.as_ref().expect("resident merkle tree").root;
312311

313312
let cpu_root = cpu_row_major_merkle_root(

crypto/stark/src/gpu_lde.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,11 @@ where
485485
// Transmute Vec<u64> → Vec<FieldElement<E>> (zero-copy, E == GoldilocksField).
486486
let lde_out: Vec<FieldElement<E>> = unsafe {
487487
let mut v = std::mem::ManuallyDrop::new(lde_u64);
488-
Vec::from_raw_parts(v.as_mut_ptr() as *mut FieldElement<E>, v.len(), v.capacity())
488+
Vec::from_raw_parts(
489+
v.as_mut_ptr() as *mut FieldElement<E>,
490+
v.len(),
491+
v.capacity(),
492+
)
489493
};
490494

491495
// Root-only host tree: the device tree (`handle.tree`) holds the nodes and
@@ -554,7 +558,11 @@ where
554558
v.len() % 3 == 0 && v.capacity() % 3 == 0,
555559
"lde_u64 len/capacity must be a multiple of 3 for Fp3 reinterpret"
556560
);
557-
Vec::from_raw_parts(v.as_mut_ptr() as *mut FieldElement<E>, v.len() / 3, v.capacity() / 3)
561+
Vec::from_raw_parts(
562+
v.as_mut_ptr() as *mut FieldElement<E>,
563+
v.len() / 3,
564+
v.capacity() / 3,
565+
)
558566
};
559567

560568
// Root-only host tree: the device tree (`handle.tree`) holds the nodes and

crypto/stark/src/prover.rs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ use crate::trace::LDETraceTable;
3636

3737
use super::config::{BatchedMerkleTree, BatchedMerkleTreeBackend, Commitment};
3838
use super::constraints::evaluator::ConstraintEvaluator;
39-
#[cfg(feature = "cuda")]
40-
use crypto::merkle_tree::proof::Proof;
4139
use super::domain::{Domain, DomainConstants};
4240
use super::fri::fri_decommit::FriDecommitment;
4341
use super::grinding;
4442
use super::lookup::BusPublicInputs;
4543
use super::proof::stark::{DeepPolynomialOpening, MultiProof, StarkProof};
4644
use super::trace::TraceTable;
4745
use super::traits::AIR;
46+
#[cfg(feature = "cuda")]
47+
use crypto::merkle_tree::proof::Proof;
4848

4949
pub use crate::commitment::{keccak_leaves_bit_reversed, keccak_leaves_row_pair_bit_reversed};
5050

@@ -1875,8 +1875,9 @@ pub trait IsStarkProver<
18751875
let stream = lde_trace
18761876
.bound_stream()
18771877
.expect("bound stream for device-resident composition-tree opening");
1878-
crate::gpu_lde::gather_proofs_dev(tree, indexes_to_open, &stream)
1879-
.expect("device composition-tree gather failed; resident tree has no host fallback")
1878+
crate::gpu_lde::gather_proofs_dev(tree, indexes_to_open, &stream).expect(
1879+
"device composition-tree gather failed; resident tree has no host fallback",
1880+
)
18801881
});
18811882

18821883
for (qi, index) in indexes_to_open.iter().enumerate() {
@@ -1892,12 +1893,9 @@ pub trait IsStarkProver<
18921893
#[cfg(feature = "cuda")]
18931894
{
18941895
if let Some(proofs) = &main_dev_proofs {
1895-
Self::open_polys_with_proofs(
1896-
domain,
1897-
proofs[qi].clone(),
1898-
*index,
1899-
|row| lde_trace.gather_main_row(row),
1900-
)
1896+
Self::open_polys_with_proofs(domain, proofs[qi].clone(), *index, |row| {
1897+
lde_trace.gather_main_row(row)
1898+
})
19011899
} else {
19021900
Self::open_polys_with(domain, &main_commit.tree, *index, |row| {
19031901
lde_trace.gather_main_row(row)
@@ -1950,12 +1948,9 @@ pub trait IsStarkProver<
19501948
#[cfg(feature = "cuda")]
19511949
{
19521950
if let Some(proofs) = &aux_dev_proofs {
1953-
Self::open_polys_with_proofs(
1954-
domain,
1955-
proofs[qi].clone(),
1956-
*index,
1957-
|row| lde_trace.gather_aux_row(row),
1958-
)
1951+
Self::open_polys_with_proofs(domain, proofs[qi].clone(), *index, |row| {
1952+
lde_trace.gather_aux_row(row)
1953+
})
19591954
} else {
19601955
Self::open_polys_with(domain, &aux.tree, *index, |row| {
19611956
lde_trace.gather_aux_row(row)
@@ -2098,8 +2093,8 @@ pub trait IsStarkProver<
20982093
.iter()
20992094
.enumerate()
21002095
.map(|(idx, (_, trace, _))| {
2101-
let lde_size = domains[idx].interpolation_domain_size
2102-
* domains[idx].blowup_factor;
2096+
let lde_size =
2097+
domains[idx].interpolation_domain_size * domains[idx].blowup_factor;
21032098
estimate_table_vram_bytes(trace.num_main_columns, 0, lde_size)
21042099
})
21052100
.collect();
@@ -2303,8 +2298,8 @@ pub trait IsStarkProver<
23032298
.iter()
23042299
.enumerate()
23052300
.map(|(idx, (_, trace, _))| {
2306-
let lde_size = domains[idx].interpolation_domain_size
2307-
* domains[idx].blowup_factor;
2301+
let lde_size =
2302+
domains[idx].interpolation_domain_size * domains[idx].blowup_factor;
23082303
estimate_table_vram_bytes(
23092304
trace.num_main_columns,
23102305
trace.num_aux_columns,

0 commit comments

Comments
 (0)