Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
cleanup warnings related to the new compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-zk committed May 20, 2024
1 parent 95c786c commit 05a3d79
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 35 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ opt-level = 3
[features]
log_tracing = ["tracing"]
# Currently packed_simd is no longer working with the newest nightly.
include_packed_simd = ["packed_simd"]
include_packed_simd = ["packed_simd"]
cr_paranoia_mode = []
debug_track = []
2 changes: 1 addition & 1 deletion src/cs/traits/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'set, 'tgt: 'set, T: SmallField> DstBuffer<'set, 'tgt, T> {
*offset += 1;
}
DstBuffer::MutSliceIndirect(dst, debug_track, offset) => {
if cfg!(debug_track) && *debug_track {
if cfg!(feature = "debug_track") && *debug_track {
log!(" set out {} <- {}", *offset, value.as_raw_u64())
}

Expand Down
4 changes: 2 additions & 2 deletions src/dag/guide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl<'a, T: Copy + Debug, F: SmallField, Cfg: CSResolverConfig> GuideOrder<'a, T
pos += span.buffer.len();
}

if cfg!(cr_paranoia_mode) && self.guide.tracing {
if cfg!(feature = "cr_paranoia_mode") && self.guide.tracing {
log!(
"Released span {}: {:?}",
self.guide.spans[0].id.0,
Expand Down Expand Up @@ -684,7 +684,7 @@ impl<T: Debug, F: SmallField, Cfg: CSResolverConfig> BufferGuide<T, F, Cfg> {
}

pub(crate) fn flush(&mut self) -> BufferGuideFinalization<'_, T, F, Cfg> {
if cfg!(cr_paranoia_mode) && self.tracing {
if cfg!(feature = "cr_paranoia_mode") && self.tracing {
log!("CRG: flush.");
}

Expand Down
12 changes: 9 additions & 3 deletions src/dag/resolver_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub(crate) fn invocation_binder<Fn, F: SmallField>(
// Safety: This is the actual type of the provided function.
let bound = resolver.resolve_fn::<Fn>();

if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA) && false {
if (cfg!(feature = "cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA) && false {
log!(
"Ivk: Ins [{}], Out [{}], Out-addr [{}], Thread [{}]",
resolver
Expand All @@ -448,7 +448,10 @@ pub(crate) fn invocation_binder<Fn, F: SmallField>(
)
}

if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA) && debug_track && false {
if (cfg!(feature = "cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA)
&& debug_track
&& false
{
log!(
"Ivk: provided inputs:\n - {:?}",
ins.iter().map(|x| x.as_raw_u64()).collect_vec()
Expand All @@ -457,7 +460,10 @@ pub(crate) fn invocation_binder<Fn, F: SmallField>(

bound(ins, &mut DstBuffer::MutSliceIndirect(out, debug_track, 0));

if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA) && debug_track && true {
if (cfg!(feature = "cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA)
&& debug_track
&& true
{
log!(
"Ivk: calculated outputs:\n - {:?}",
out.iter().map(|x| x.as_raw_u64()).collect_vec()
Expand Down
12 changes: 6 additions & 6 deletions src/dag/resolvers/mt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<V: SmallField, RS: ResolverSortingMode<V>, CFG: CSResolverConfig>

Check warning on line 169 in src/dag/resolvers/mt/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/mod.rs
let debug_track = vec![];

if cfg!(cr_paranoia_mode) || PARANOIA {
if cfg!(feature="cr_paranoia_mode") || PARANOIA {
log!("Contains tracked keys {:?} ", debug_track);
}

Expand Down Expand Up @@ -269,7 +269,7 @@ impl<V: SmallField, RS: ResolverSortingMode<V>, CFG: CSResolverConfig>

Check warning on line 269 in src/dag/resolvers/mt/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/mod.rs
self.sorter.write_sequence();

if cfg!(cr_paranoia_mode) || PARANOIA {
if cfg!(feature="cr_paranoia_mode") || PARANOIA {
log!("CR {:?}", unsafe {
self.common.awaiters_broker.stats.u_deref()
});
Expand Down Expand Up @@ -1487,7 +1487,7 @@ mod test {

Check warning on line 1487 in src/dag/resolvers/mt/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/mod.rs
storage.wait_till_resolved();

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
log!("Test: total value result: \n - {}", unsafe {
(*storage.common.values.get())
.variables
Expand All @@ -1509,7 +1509,7 @@ mod test {
let act = Place::from_variable(Variable::from_variable_index(ix as u64))

Check warning on line 1509 in src/dag/resolvers/mt/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/mod.rs
.to(|x| storage.get_value_unchecked(x));

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
log!("Test: per item value: ix {}, value {}", ix, act);
}

Expand Down Expand Up @@ -1542,7 +1542,7 @@ mod test {

Check warning on line 1542 in src/dag/resolvers/mt/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/mod.rs
storage.wait_till_resolved();

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
log!("Test: total value result: \n - {}", unsafe {
(*storage.common.values.get())
.variables
Expand All @@ -1564,7 +1564,7 @@ mod test {
let act = Place::from_variable(Variable::from_variable_index(ix as u64))

Check warning on line 1564 in src/dag/resolvers/mt/mod.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/mod.rs
.to(|x| storage.get_value_unchecked(x));

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
log!("Test: per item value: ix {}, value {}", ix, act);
}

Expand Down
2 changes: 1 addition & 1 deletion src/dag/resolvers/mt/registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Registrar {
}

Check warning on line 116 in src/dag/resolvers/mt/registrar.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/registrar.rs

pub(crate) fn is_empty(&self) -> bool {
if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
log!(
"CRR: total remaining resolvers: {}",
self.vars.values().map(|x| x.len()).sum::<usize>()
Expand Down
28 changes: 14 additions & 14 deletions src/dag/resolvers/mt/resolution_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>
comms,

Check warning on line 163 in src/dag/resolvers/mt/resolution_window.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/resolution_window.rs

track_list: Vec::new(),
execution_list: if cfg!(cr_paranoia_mode) { 1 << 26 } else { 0 }
execution_list: if cfg!(feature="cr_paranoia_mode") { 1 << 26 } else { 0 }
.to(|x| Vec::with_capacity(x).op(|v| v.resize(x, 0))),
phantom: PhantomData,
};
Expand Down Expand Up @@ -207,7 +207,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>

Check warning on line 207 in src/dag/resolvers/mt/resolution_window.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/resolution_window.rs
data[data_ix].push(order_ix.into(), task.order_info.value);

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
self.execution_list[order_ix] += 1;

if self.execution_list[order_ix] > 1 {
Expand Down Expand Up @@ -238,7 +238,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>
}

Check warning on line 238 in src/dag/resolvers/mt/resolution_window.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/era-boojum/era-boojum/src/dag/resolvers/mt/resolution_window.rs
}

if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA) && true {
if (cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA) && true {
log!("RW: Batch! {} tasks.", count);
}

Expand All @@ -264,7 +264,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>
.for_each(|x| {
x.state = ResolverState::Done;

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
unsafe {
let r = self.common.resolvers.u_deref().get(x.order_info.value);

Expand All @@ -291,7 +291,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>
}
});

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
if self
.exec_order_buffer
.iter()
Expand Down Expand Up @@ -343,7 +343,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>

drop(awaiters);

if cfg!(cr_paranoia_mode) && count > 0 {
if cfg!(feature="cr_paranoia_mode") && count > 0 {
log!(
"RW: Shifted by {}, new range is: {}..{}, buffer len: {}",
count,
Expand Down Expand Up @@ -412,7 +412,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>

self.stats.total_consumption = extend_to as u64;

if crate::dag::resolvers::mt::PARANOIA || cfg!(cr_paranoia_mode) {
if crate::dag::resolvers::mt::PARANOIA || cfg!(feature="cr_paranoia_mode") {
log!(
"RW: Extended range by {}, new range {}..{}",
extend_to,
Expand Down Expand Up @@ -474,7 +474,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>
}
}

if crate::dag::resolvers::mt::PARANOIA || cfg!(cr_paranoia_mode) {
if crate::dag::resolvers::mt::PARANOIA || cfg!(feature="cr_paranoia_mode") {
log!("[{:?}] RW: Exit conditions met.", std::time::Instant::now())
}

Expand All @@ -484,7 +484,7 @@ impl<V: SmallField + 'static, T: TrackId + 'static, Cfg: RWConfig<T> + 'static>

self.stats.total_time = start_instant.elapsed();

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
log!("CR {:#?}", self.stats);
log!("CR {:#?}", unsafe { &*self.channel.stats.get() });

Expand Down Expand Up @@ -554,7 +554,7 @@ impl<V: SmallField, T: TrackId + 'static, Cfg: RWConfig<T>, const SIZE: usize>
// here, as this is an unsynchronizd access.
let resolver = this.common.resolvers.u_deref().get(*resolver_ix);

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
this.invoke(resolver, *order_ix);

Expand Down Expand Up @@ -590,7 +590,7 @@ impl<V: SmallField, T: TrackId + 'static, Cfg: RWConfig<T>, const SIZE: usize>
});
}

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
log!(
"{}\n{:#?}\n{:#?}",
std::thread::current().name().unwrap_or_default(),
Expand Down Expand Up @@ -629,7 +629,7 @@ impl<V: SmallField, T: TrackId + 'static, Cfg: RWConfig<T>, const SIZE: usize>
.map(|x| {
let (vs, md) = self.common.values.u_deref().get_item_ref(*x);

if cfg!(cr_paranoia_mode) || true {
if cfg!(feature="cr_paranoia_mode") || true {
if Cfg::ASSERT_TRACKED_VALUES {
assert!(md.is_tracked());
}
Expand Down Expand Up @@ -678,7 +678,7 @@ impl<V: SmallField, T: TrackId + 'static, Cfg: RWConfig<T>, const SIZE: usize>

let mut track = false;

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
if let Some(x) = self
.debug_track
.iter()
Expand Down Expand Up @@ -831,7 +831,7 @@ impl LockStepChannel {
fn execute(&self) {
use std::sync::atomic::Ordering::*;

if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA) && false {
if (cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA) && false {
log!("RW: batch sent {:#?}", unsafe { self.data.u_deref() });
}

Expand Down
14 changes: 7 additions & 7 deletions src/dag/resolvers/mt/sorters/sorter_live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<F: SmallField, Cfg: CSResolverConfig, RW: ResolutionRecordWriter>
}
}

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
// This ugly block checks that the calculated parallelism is
// correct. It's a bit slower than O(n^2). Also note, that it
// checks only the last 1050 items, so it's not a full check,
Expand Down Expand Up @@ -297,7 +297,7 @@ impl<F: SmallField, Cfg: CSResolverConfig, RW: ResolutionRecordWriter> ResolverS
}

fn set_value(&mut self, key: crate::cs::Place, value: F) {
if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA)
if (cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA)
&& self.debug_track.contains(&key)
&& false
{
Expand Down Expand Up @@ -378,7 +378,7 @@ impl<F: SmallField, Cfg: CSResolverConfig, RW: ResolutionRecordWriter> ResolverS

let mut hit = false;

if (cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA) && true {
if (cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA) && true {
if let Some(x) = self.debug_track.iter().find(|x| inputs.contains(x)) {
log!("CR: added resolution with tracked input {:?}", x);

Expand Down Expand Up @@ -498,7 +498,7 @@ impl<F: SmallField, Cfg: CSResolverConfig, RW: ResolutionRecordWriter> ResolverS
outputs: &[Place],
added_at: RegistrationNum,
) -> Vec<ResolverIx> {
if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
if let Some(x) = self.debug_track.iter().find(|x| inputs.contains(x)) {
log!("CR: internalized resolution with tracked input {:?}", x);
}
Expand All @@ -519,7 +519,7 @@ impl<F: SmallField, Cfg: CSResolverConfig, RW: ResolutionRecordWriter> ResolverS

let deps = inputs.iter().map(|x| &values.get_item_ref(*x).1);

if cfg!(cr_paranoia_mode) {
if cfg!(feature="cr_paranoia_mode") {
debug_assert!(
deps.clone().all(|x| { x.is_tracked() }),
"Attempting to internalize a resolution with an untracked input. All inputs must be tracked."
Expand Down Expand Up @@ -610,14 +610,14 @@ impl<F: SmallField, Cfg: CSResolverConfig, RW: ResolutionRecordWriter> ResolverS
self.record.values_count = unsafe { self.common.values.u_deref().max_tracked + 1 } as usize;
self.record.registrations_count = self.stats.registrations_added as usize;

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
log!(
"CR: Final order written. Order len {}",
self.common.exec_order.lock().unwrap().items.len()
);
}

if cfg!(cr_paranoia_mode) || crate::dag::resolvers::mt::PARANOIA {
if cfg!(feature="cr_paranoia_mode") || crate::dag::resolvers::mt::PARANOIA {
self.guide.stats.finalize();

log!("CR {:?}", self.guide.stats);
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#![allow(dead_code)]
#![allow(dropping_references)] // Required to explicitly show that mutable references are dropped.
#![allow(incomplete_features)]
#![allow(internal_features)] // Required for core_intrinsics
#![allow(stable_features)]
#![allow(unused_unsafe)]
// Enabled features
#![feature(allocator_api)]
#![feature(const_mut_refs)]
Expand Down

0 comments on commit 05a3d79

Please sign in to comment.