-
Notifications
You must be signed in to change notification settings - Fork 7
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
Extension Inference for functions relies on builder #702
Comments
May be best to do this after #692 where the builder changes to pass |
github-merge-queue bot
pushed a commit
that referenced
this issue
Dec 12, 2023
* Make each Value able to report its ExtensionSet needed at runtime (and hence, also each CustomConst) * Also give OpTrait a method for the extension-delta. This is the delta of the FunctionType, *for dataflow ops*, but can be defined for other optypes too - specifically (here), Const ops and also Case. Use this in both inference and for `NodeType::io_extensions()` * Input extensions of every Const node can now be the empty set (i.e. the default-for-ModuleOp `pure`), as the relevant extension will be added in the delta - thus, drop separate extension parameter in builder (add_constant, add_load_const, etc.). LoadConstant ops can now also have an empty delta and open input-extensions as these can be figured out from the Const. This is thus a step towards fixing #702... * Also note slight issue in replace::test::cfg, pending #388 * Add `ExtensionSet::union_over(impl IntoIterator<Item=Self>) -> Self` utility method This should ease the way towards solving the rest of #702 and moreover to removing `new_auto` - we should be able to constrain the input-extensions for any ModuleOp to `pure` in inference and thus *every* node can be created open rather than a mix, but those are all for follow-up PRs.
22 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When defining a function, the builder fixes solutions for the extensions of the Input and Output child of the FuncDefn:
hugr/src/builder/build_traits.rs
Lines 103 to 107 in 762839d
hugr/src/builder/dataflow.rs
Lines 53 to 58 in 41e15da
input_extensions
)The relationship between Input and Output is not modelled by inference - they should have a Plus constraint, but Plus constraints are only generated here:
hugr/src/extension/infer.rs
Lines 317 to 330 in 41e15da
hugr/src/hugr/validate.rs
Lines 205 to 212 in 41e15da
(note FuncDefns are explicitly excluded, because
validate_io_children
would use the wrong delta for them).Thus, it should be possible to construct a Hugr (not using the builder) where the body of the function adds extension-requirements not specified in the function delta, and to get this past validation (possibly past inference too, but otherwise by hand-specifying extensions). Step 1, obviously, produce that test case ;-)
The text was updated successfully, but these errors were encountered: