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

Detransitize the differential dataflow computation #23

Merged
merged 14 commits into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from 12 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
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly
5 changes: 4 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)] // arg_enum! uses deprecated stuff

use crate::intern;
use crate::output::Output;
use crate::tab_delim;
Expand All @@ -10,6 +12,7 @@ arg_enum! {
#[derive(Debug, Clone, Copy)]
pub enum Algorithm {
Naive,
TimelyOpt,
}
}

Expand Down Expand Up @@ -45,7 +48,7 @@ pub fn main(opt: Opt) -> Result<(), Error> {
let verbose = opt.verbose | opt.stats;
let algorithm = opt.algorithm;
let all_facts = tab_delim::load_tab_delimited_facts(tables, &Path::new(&facts_dir))?;
timed(|| Output::compute(all_facts, algorithm, verbose))
timed(|| Output::compute(&all_facts, algorithm, verbose))
};

match result {
Expand Down
2 changes: 1 addition & 1 deletion src/facts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use abomonation_derive::Abomonation;

/// The "facts" which are the basis of the NLL borrow analysis.
#[derive(Default)]
#[derive(Clone, Default)]
crate struct AllFacts {
/// `borrow_region(R, B, P)` -- the region R may refer to data
/// from borrow B starting at the point P (this is usually the
Expand Down
10 changes: 6 additions & 4 deletions src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ use std::path::PathBuf;

mod dump;
mod tracking;
mod timely;
mod naive;
mod timely_opt;


#[derive(Clone, Debug)]
crate struct Output {
borrow_live_at: FxHashMap<Point, Vec<Loan>>,
crate borrow_live_at: FxHashMap<Point, Vec<Loan>>,

dump_enabled: bool,

Expand All @@ -36,9 +37,10 @@ crate struct Output {
}

impl Output {
crate fn compute(all_facts: AllFacts, algorithm: Algorithm, dump_enabled: bool) -> Self {
crate fn compute(all_facts: &AllFacts, algorithm: Algorithm, dump_enabled: bool) -> Self {
match algorithm {
Algorithm::Naive => timely::timely_dataflow(dump_enabled, all_facts),
Algorithm::Naive => naive::compute(dump_enabled, all_facts.clone()),
Algorithm::TimelyOpt => timely_opt::compute(dump_enabled, all_facts.clone()),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/output/timely.rs → src/output/naive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::sync::Mutex;
use timely;
use timely::dataflow::operators::*;

pub(super) fn timely_dataflow(dump_enabled: bool, all_facts: AllFacts) -> Output {
pub(super) fn compute(dump_enabled: bool, all_facts: AllFacts) -> Output {
let result = Arc::new(Mutex::new(Output::new(dump_enabled)));

// Use a channel to send `all_facts` to one worker (and only one)
Expand Down
Loading