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

[new] Infer extension requirements #330

Merged
merged 85 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
dbac242
[broken] Add unification module
croyzor Jul 25, 2023
02af3dd
[broken] towards compiling unification
croyzor Jul 27, 2023
edc304e
[cosmetic] Renumber variables in unification test
croyzor Aug 1, 2023
664d318
[doc] Add a couple of comments
croyzor Aug 1, 2023
689cb85
[fix] Give variables unique names
croyzor Aug 1, 2023
11517f3
[new] Flesh out unification implementation
croyzor Aug 1, 2023
3fde309
[new] Repeat unification until we stop making progress
croyzor Aug 1, 2023
07fd0a1
[cosmetic] cargo fmt
croyzor Aug 2, 2023
649b405
[cleanup] Remove hugr param from UnificationContext
croyzor Aug 2, 2023
e919030
[refactor] Clippy
croyzor Aug 2, 2023
2b67370
[cleanup] Remove unused error
croyzor Aug 2, 2023
685a802
[doc] Add a couple more comments
croyzor Aug 2, 2023
a25b32a
[new] Add method for getting I/O nodes from a HugrView
croyzor Aug 4, 2023
98dd7a0
[new] Add resource inference as a hugr method & builder step
croyzor Aug 4, 2023
638bc36
[doc] Add a couple of comments
croyzor Aug 4, 2023
8547391
[refactor] Make gen_union_constraints it's own function
croyzor Aug 4, 2023
0c39a2d
[new] I/O Constraints
croyzor Aug 4, 2023
d3c9cdf
[fix] Check if metas have been shunted before using them
croyzor Aug 4, 2023
f90c710
[refactor] Make result gathering its own function
croyzor Aug 4, 2023
8c239af
[cosmetic] Cargo fmt
croyzor Aug 4, 2023
ae707a4
[fix] I/O constraints should be generated first
croyzor Aug 7, 2023
fa629f8
[refactor] Count names seperately from constraints
croyzor Aug 10, 2023
75ad62b
[new] The rest of the owl
croyzor Aug 10, 2023
88d0882
[doc] Documentation; privatisation
croyzor Aug 16, 2023
78bf7d2
[cleanup] Cleanup and compile
croyzor Aug 16, 2023
599c563
[tests] Remove failing "reverse" test for now
croyzor Aug 18, 2023
6bd9ec1
[tests] Update validation tests
croyzor Aug 21, 2023
fa729ca
[tests] Weaken constraints of missing_lift_node
croyzor Aug 21, 2023
6190ad4
[tests] Name dangling_src test
croyzor Aug 21, 2023
50ea46c
[fix] Handle new metas created by `coalesce`
croyzor Aug 21, 2023
53e6f70
[fix] Only add equality constraints for edges with *dataflow*
croyzor Aug 21, 2023
98af2d5
[refactor] Don't bother validating in builder
croyzor Aug 21, 2023
38f5e44
[cleanup] Debugging
croyzor Aug 21, 2023
aa6b74a
[new] Return ResourceError when possible
croyzor Aug 21, 2023
f380c02
[cleanup] Cargo fmt, remove comment
croyzor Aug 21, 2023
fe76fcc
[tests] Do the harder `from_graph` case
croyzor Aug 21, 2023
01c25d9
[cleanup] Fix imports
croyzor Aug 21, 2023
7005b29
[cleanup] Unused variables and stuff
croyzor Aug 21, 2023
3361285
[fix] Skip using ModuleBuilder in `lift_node`
croyzor Aug 22, 2023
6a0183f
[cleanup] Remove `Exactly` constraint
croyzor Aug 22, 2023
8713250
[doc] Add missing docstrings
croyzor Aug 22, 2023
8859b55
[cosmetic] Clippy suggestions
croyzor Aug 22, 2023
c2b4636
[cosmetic] Rename module unify -> infer
croyzor Aug 22, 2023
148edd3
Merge remote-tracking branch 'origin/main' into new/resource-inference
croyzor Aug 22, 2023
a3bf5bd
[cosmetic] Cargo fmt
croyzor Aug 22, 2023
5015657
[tests] Remove; Rename; Comment
croyzor Aug 22, 2023
f9e508d
[cleanup] Remove `Ord` impl for Constraint
croyzor Aug 22, 2023
29b22c8
[cleanup] Remove redundant comment
croyzor Aug 22, 2023
42237b7
[doc] Update a couple of comments
croyzor Aug 22, 2023
3f43d73
Merge remote-tracking branch 'origin/main' into new/resource-inference
croyzor Aug 22, 2023
3746de4
[cleanup] Remove debugging printlns
croyzor Aug 22, 2023
35fe1a3
[cosmetic] Rename coalesce -> merge_equal_metas
croyzor Aug 22, 2023
35d9a6b
[doc] More comments
croyzor Aug 22, 2023
5767300
[cleanup] Remove redundant variable
croyzor Aug 22, 2023
dad7361
assert -> dbg_assert
croyzor Aug 22, 2023
06492f7
is_some -> if let
croyzor Aug 22, 2023
38815c3
Fix comment grammar
croyzor Aug 22, 2023
4116b71
assert -> debug_assert
croyzor Aug 22, 2023
ff49e34
dbg_assert -> debug_assert
croyzor Aug 22, 2023
ec00202
Merge remote-tracking branch 'origin/main' into new/resource-inference
croyzor Aug 22, 2023
6f3ff29
[cleanup] Remove dead code/comments
croyzor Aug 23, 2023
df84772
[tests] Check solutions more in tests
croyzor Aug 23, 2023
4789506
[refactor] Simplify merge_equal_metas
croyzor Aug 23, 2023
9f1ce81
[refactor] Make a dedicated struct for `Meta`
croyzor Aug 23, 2023
5b51ba1
[refactor] Address review comments
croyzor Aug 24, 2023
90e0d93
[tests] Add test of resolve
croyzor Aug 24, 2023
ce3c309
[doc] update comment
croyzor Aug 24, 2023
679ba38
[tests] Only run inference once in dangling_src test
croyzor Aug 24, 2023
70082c1
[fix] Be more strict about what variables are
croyzor Aug 24, 2023
4b606f8
[doc] Comment
croyzor Aug 24, 2023
d600c94
[refactor] Clippy suggestions
croyzor Aug 24, 2023
90017e1
Merge remote-tracking branch 'origin/main' into new/resource-inference
croyzor Aug 24, 2023
b046589
[fix] Add deleted line
croyzor Aug 24, 2023
90b6961
Clippy
croyzor Aug 24, 2023
fe5c9ec
feat: Extension validation can take a closure of solutions (#456)
croyzor Aug 25, 2023
9912edd
[new] Solve `Plus` constraints in the other direction
croyzor Aug 25, 2023
f4567f9
[tests] Check solution in `from_graph` test
croyzor Aug 25, 2023
63aa47b
[tests] Delete redundant test
croyzor Aug 25, 2023
7a5a85d
[refactor] Privatise `EqGraph`
croyzor Aug 25, 2023
3ddce12
[doc] Redo module comment
croyzor Aug 25, 2023
92ff411
[refactor] Add new `ExtensionError` constructors without port info
croyzor Aug 25, 2023
c43fcfc
Remove meta from set of variables after it's been shunted
croyzor Aug 25, 2023
41b40bc
[refactor] Remove redundant clone
croyzor Aug 25, 2023
f9d4f88
[refactor] Remove redundant clone
croyzor Aug 25, 2023
18ad400
Merge remote-tracking branch 'origin/main' into new/resource-inference
croyzor Aug 25, 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
5 changes: 3 additions & 2 deletions src/builder/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ impl DFGBuilder<Hugr> {
}

impl HugrBuilder for DFGBuilder<Hugr> {
fn finish_hugr(self) -> Result<Hugr, ValidationError> {
self.base.validate()?;
fn finish_hugr(mut self) -> Result<Hugr, ValidationError> {
let closure = self.base.infer_extensions()?;
self.base.validate_with_extension_closure(closure)?;
Ok(self.base)
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ use crate::types::type_param::{check_type_arg, TypeArgError};
use crate::types::type_param::{TypeArg, TypeParam};
use crate::types::CustomType;

mod infer;
pub use infer::{infer_extensions, ExtensionSolution, InferExtensionError};

mod op_def;
pub use op_def::{CustomSignatureFunc, OpDef};
mod type_def;
Expand Down
Loading