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

Move assumption/assertion generation to its own pass #496

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

UnsignedByte
Copy link
Collaborator

This PR divests core assumption/assertion generation (about event constraints, param constraints, and range constraints) from astconv. This cleans up astconv a bit and also adds the important ability for the IR to generate its own assertions necessary for discharging. This will be useful in scheduling and is also necessary if we want to be able to discharge after monomorphization properly.

@UnsignedByte
Copy link
Collaborator Author

@rachitnigam There is some finicky stuff here caused by the fact that Visitor does an std::mem::take on the component being visited, so in order to deal with recursive components we do some special checks.

pub type PortInfo =
(/*lens=*/ Vec<usize>, /*gen_ports=*/ Vec<PortIdx>);
/// A mapping from a bundle with a list of dimensions to the list of generated ports.
type PortInfo = (/*lens=*/ Vec<usize>, /*gen_ports=*/ Vec<PortIdx>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're extracting these into separate types, might as well give the fields real names?

@@ -4,9 +4,9 @@ use fil_ir::{self as ir, AddCtx, Ctx, ExprIdx, PropIdx};

/// Generates default assumptions to the Filament program for assumptions using custom functions
#[derive(Default)]
pub struct Assume;
pub struct FunAssumptions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I don't love the name. Can we use something like InferAssumes which implies some relationship between existing assumptions and created ones?

Time, TimeIdx, TimeSub,
};

impl<C> Foreign<Expr, C>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this exactly used for and can we give this a better name/trait wrapper?

Copy link
Member

@rachitnigam rachitnigam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems cool! I'm curious if this basically brings us back to the old world where the well-formed pass would add all of the assumptions and they could be discharged later?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants