Merge pull request #1 from mir-protocol/log-portability-stubs

Log portability stubs
This commit is contained in:
Sebastien La Duca 2022-08-06 22:34:53 -04:00 committed by GitHub
commit 86c1493d3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 20 deletions

View File

@ -194,7 +194,6 @@ impl<F: RichField + Extendable<D>, const D: usize> KeccakStark<F, D> {
}
pub fn generate_trace(&self, inputs: Vec<[u64; NUM_INPUTS]>) -> Vec<PolynomialValues<F>> {
#[allow(unused_mut)]
let mut timing = TimingTree::new("generate trace", log::Level::Debug);
// Generate the witness, except for permuted columns in the lookup argument.

View File

@ -192,7 +192,6 @@ impl<F: RichField + Extendable<D>, const D: usize> MemoryStark<F, D> {
}
pub(crate) fn generate_trace(&self, memory_ops: Vec<MemoryOp>) -> Vec<PolynomialValues<F>> {
#[allow(unused_mut)]
let mut timing = TimingTree::new("generate trace", log::Level::Debug);
// Generate most of the trace in row-major form.

View File

@ -71,7 +71,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
rate_bits: usize,
blinding: bool,
cap_height: usize,
_timing: &mut TimingTree,
timing: &mut TimingTree,
fft_root_table: Option<&FftRootTable<F>>,
) -> Self
where
@ -79,15 +79,15 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
{
let degree = polynomials[0].len();
let lde_values = timed!(
_timing,
timing,
"FFT + blinding",
Self::lde_values(&polynomials, rate_bits, blinding, fft_root_table)
);
let mut leaves = timed!(_timing, "transpose LDEs", transpose(&lde_values));
let mut leaves = timed!(timing, "transpose LDEs", transpose(&lde_values));
reverse_index_bits_in_place(&mut leaves);
let merkle_tree = timed!(
_timing,
timing,
"build Merkle tree",
MerkleTree::new(leaves, cap_height)
);

View File

@ -23,7 +23,7 @@ pub fn fri_proof<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const
lde_polynomial_values: PolynomialValues<F::Extension>,
challenger: &mut Challenger<F, C::Hasher>,
fri_params: &FriParams,
_timing: &mut TimingTree,
timing: &mut TimingTree,
) -> FriProof<F, C::Hasher, D>
where
[(); C::Hasher::HASH_SIZE]:,
@ -33,7 +33,7 @@ where
// Commit phase
let (trees, final_coeffs) = timed!(
_timing,
timing,
"fold codewords in the commitment phase",
fri_committed_trees::<F, C, D>(
lde_polynomial_coeffs,
@ -46,7 +46,7 @@ where
// PoW phase
let current_hash = challenger.get_hash();
let pow_witness = timed!(
_timing,
timing,
"find proof-of-work witness",
fri_proof_of_work::<F, C, D>(current_hash, &fri_params.config)
);

View File

@ -99,6 +99,9 @@ impl TimingTree {
})
}
#[cfg(not(feature = "timing"))]
pub fn push(&mut self, _ctx: &str, _level: log::Level) {}
/// Close the deepest open scope from this tree.
#[cfg(feature = "timing")]
pub fn pop(&mut self) {
@ -114,6 +117,9 @@ impl TimingTree {
self.exit_time = Some(Instant::now());
}
#[cfg(not(feature = "timing"))]
pub fn pop(&mut self) {}
#[cfg(feature = "timing")]
fn duration(&self) -> Duration {
self.exit_time
@ -171,26 +177,16 @@ impl TimingTree {
#[macro_export]
macro_rules! timed {
($timing_tree:expr, $level:expr, $ctx:expr, $exp:expr) => {{
#[cfg(feature = "timing")]
$timing_tree.push($ctx, $level);
let res = $exp;
#[cfg(feature = "timing")]
$timing_tree.pop();
res
}};
// If no context is specified, default to Debug.
($timing_tree:expr, $ctx:expr, $exp:expr) => {{
#[cfg(feature = "timing")]
$timing_tree.push($ctx, log::Level::Debug);
let res = $exp;
#[cfg(feature = "timing")]
$timing_tree.pop();
res
}};
}

View File

@ -69,7 +69,6 @@ impl<F: RichField + Extendable<D>, const D: usize> SystemZero<F, D> {
}
pub fn generate_trace(&self) -> Vec<PolynomialValues<F>> {
#[allow(unused_mut)]
let mut timing = TimingTree::new("generate trace", log::Level::Debug);
// Generate the witness, except for permuted columns in the lookup argument.