-
Notifications
You must be signed in to change notification settings - Fork 46
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
@one_hot
attribute
#2042
@one_hot
attribute
#2042
Conversation
calyx-frontend/src/attributes.rs
Outdated
/// keys: A, D | ||
/// Then self gets: A->15 B->5. (D is ignored since it's not inpresent in other | ||
/// and C is ignored since it's not keys.) | ||
pub fn mirror_attributes<A>(&mut self, other: Self, keys: Vec<A>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can call this copy_to
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to copy_from
since technically we are copying attributes from other to self.
ir::Control::enable(init_group), | ||
while_loop, | ||
]); | ||
let while_seq = ir::Control::Seq(ir::Seq { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an ir::Control::seq
method to construct this nest of Seq { Seq { ... } }
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is, but it gives the seq
ir::Attributes::default()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Couple of comments!
Support for a
@one_hot
attribute that can be attached tostatic
control and tells the compiler to construct a one-hot FSM.(Not a guarantee, since promotion and other optimizations that rewrite control could subsume the attribute).
Also add a pass called
static-fsm-opts
which attaches the@one_hot
attribute, based on a "cutoff", i.e., if the number of cycles is less than the cutoff, then do one hot encoding, but switch to binary encoding if cycle count is greater than cutoff.I can imagine this pass being responsible for attaching all sorts of attributes as we implement more FSM optimizations.(Also did some minor changes to optimization passes so that we copy over the
@one_hot
attribute).