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

Turn dynamic to static #1419

Merged
merged 45 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
36b9acb
added dynamic_to_static pass, and added functions to turn dynamic gua…
paili0628 Apr 21, 2023
187af46
added dynamic-to-static pass
paili0628 Apr 21, 2023
ff5153e
separate new infer-static-timing pass from old one
paili0628 Apr 24, 2023
73b8c66
fmt
paili0628 Apr 24, 2023
7c36f4c
fixed bug and changed pass name to group-static-promotion
paili0628 Apr 25, 2023
2896efa
fmt
paili0628 Apr 25, 2023
6bcf051
Merge branch 'master' into turn-dynamic-to-static
paili0628 May 4, 2023
4fae216
addressed comments
paili0628 May 5, 2023
9d6b48b
fmt
paili0628 May 5, 2023
c3b6553
clippy
paili0628 May 5, 2023
9d1f78f
fixed error message
paili0628 May 5, 2023
dde5217
got rid of infer-static-timing pass
paili0628 May 5, 2023
9eec4d5
modify group-static-promotion pass
paili0628 May 15, 2023
efe050c
Merge branch 'master' into turn-dynamic-to-static
paili0628 May 15, 2023
38aaff6
merge conflict
paili0628 May 15, 2023
f9be373
temp
paili0628 May 15, 2023
cf11b28
err
paili0628 May 15, 2023
80e2c2e
modified static-group-promotion, fixed test cases
paili0628 May 16, 2023
708138a
fmt and rename
paili0628 May 16, 2023
3d11fbe
added group promotion tests
calebmkim May 16, 2023
836814f
clippY
calebmkim May 16, 2023
d8d29ac
deleted @static attributes tests
calebmkim May 16, 2023
2e4fca2
rename tests
calebmkim May 16, 2023
75a3b05
deleted all infer-static test cases
paili0628 May 16, 2023
dd67f75
make changes
calebmkim May 16, 2023
7888f29
Merge branch 'turn-dynamic-to-static' of github.com:cucapra/calyx int…
calebmkim May 16, 2023
5033fc7
Merge branch 'master' into turn-dynamic-to-static
paili0628 May 16, 2023
86026d7
fixed non-frontend tests
paili0628 May 16, 2023
570ca55
changed frontend tests
calebmkim May 16, 2023
cf70245
Merge branch 'turn-dynamic-to-static' of github.com:cucapra/calyx int…
calebmkim May 16, 2023
b14e265
redid dahlia test cases
calebmkim May 16, 2023
349cd8e
implemented From<> without &
calebmkim May 16, 2023
97dd316
simplify-with-control uses static groups
calebmkim May 16, 2023
cb0fb84
fixed bug
calebmkim May 16, 2023
f0a6ca2
improved test cases
calebmkim May 16, 2023
aa74069
removed debugging stmts
calebmkim May 16, 2023
4aa5991
rewrite compiler test cases, add go-done port to static-promotion
calebmkim May 16, 2023
910371a
attribute promotion, some small static promotion fixes
calebmkim May 16, 2023
3fcadb1
overwrite tests .expect files
calebmkim May 16, 2023
ede26a7
code cleaning
paili0628 May 16, 2023
7c2a27f
further code cleaning
paili0628 May 16, 2023
8fbaa87
clippy
paili0628 May 16, 2023
8b09251
changed test cases
calebmkim May 17, 2023
f515eb5
skip sync-dot-product-opt.futil
paili0628 May 17, 2023
433e0de
Merge branch 'master' into turn-dynamic-to-static
calebmkim May 17, 2023
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
33 changes: 33 additions & 0 deletions calyx-ir/src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,39 @@ where
}
}

impl<Nothing> Guard<Nothing> {
/// Turns a normal guard into a static guard
pub fn into_static_guard(&self) -> Guard<StaticTiming> {
paili0628 marked this conversation as resolved.
Show resolved Hide resolved
match self {
Guard::Or(left, right) => {
let l = left.into_static_guard();
let r = right.into_static_guard();
Guard::Or(Box::new(l), Box::new(r))
}
Guard::And(left, right) => {
let l = left.into_static_guard();
let r = right.into_static_guard();
Guard::And(Box::new(l), Box::new(r))
}
Guard::Not(c) => {
let inside = c.into_static_guard();
Guard::Not(Box::new(inside))
}
Guard::True => Guard::True,
Guard::CompOp(pc, left, right) => {
Guard::CompOp(pc.clone(), Rc::clone(left), Rc::clone(right))
}
Guard::Port(p) => Guard::Port(Rc::clone(p)),
Guard::Info(_) => {
unreachable!(
"Compilation error: Guards should not be of the
paili0628 marked this conversation as resolved.
Show resolved Hide resolved
info variant type"
)
}
}
}
}

impl<T> Guard<T> {
/// Returns true if this is a `Guard::True`.
pub fn is_true(&self) -> bool {
Expand Down
12 changes: 12 additions & 0 deletions calyx-ir/src/structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,18 @@ impl<T> Assignment<T> {
}
}

impl<Nothing> Assignment<Nothing> {
paili0628 marked this conversation as resolved.
Show resolved Hide resolved
/// Turns a normal assignment into a static assignment
pub fn into_static(&self) -> Assignment<StaticTiming> {
Assignment {
dst: Rc::clone(&self.dst),
src: Rc::clone(&self.src),
guard: Box::new(self.guard.into_static_guard()),
attributes: self.attributes.clone(),
}
}
}

impl<StaticTiming> Assignment<StaticTiming> {
/// Apply function `f` to each port contained within the assignment and
/// replace the port with the generated value if not None.
Expand Down
12 changes: 7 additions & 5 deletions calyx-opt/src/default_passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ use crate::passes::{
Canonicalize, CellShare, ClkInsertion, CollapseControl, CombProp,
CompileEmpty, CompileInvoke, CompileRef, CompileStatic, CompileSync,
ComponentInliner, DeadAssignmentRemoval, DeadCellRemoval, DeadGroupRemoval,
Externalize, GoInsertion, GroupToInvoke, GroupToSeq, HoleInliner,
InferShare, InferStaticTiming, LowerGuards, MergeAssign, MergeStaticPar,
Papercut, ParToSeq, RegisterUnsharing, RemoveCombGroups, RemoveIds,
ResetInsertion, StaticParConv, SynthesisPapercut, TopDownCompileControl,
TopDownStaticTiming, UnrollBounded, WellFormed, WireInliner,
Externalize, GoInsertion, GroupStaticPromotion, GroupToInvoke, GroupToSeq,
HoleInliner, InferShare, InferStaticTiming, LowerGuards, MergeAssign,
MergeStaticPar, Papercut, ParToSeq, RegisterUnsharing, RemoveCombGroups,
RemoveIds, ResetInsertion, StaticParConv, SynthesisPapercut,
TopDownCompileControl, TopDownStaticTiming, UnrollBounded, WellFormed,
WireInliner,
};
use crate::traversal::Named;
use crate::{pass_manager::PassManager, register_alias};
Expand Down Expand Up @@ -35,6 +36,7 @@ impl PassManager {
pm.register_pass::<InferShare>()?;
pm.register_pass::<CellShare>()?;
pm.register_pass::<InferStaticTiming>()?;
pm.register_pass::<GroupStaticPromotion>()?;
pm.register_pass::<MergeStaticPar>()?;
pm.register_pass::<StaticParConv>()?;

Expand Down
Loading