Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix: FuncDefns don't require that their extensions match their children #688
fix: FuncDefns don't require that their extensions match their children #688
Changes from 3 commits
f2963a4
64fbfc3
d416543
3f87b8d
72d8013
bbbdb17
7671d02
97a55a8
0cdd1ee
417ffc1
cfd51f8
31d2d54
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
if "should_always be empty" is true, then you could add a constraint::equals to something with an empty solution (we might want one such variable per hugr). But I don't think we are insisting on "should always be empty" right now(?)
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 think it's the default, but we don't insist. OTOH I think it might be sane if we did insist, and I'd be happy to make that change in this PR
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.
We might have to change EdgeKind::Static not to require equality of extensions at both ends. But we should probably do that anyway - ATM all calls will have to have the same input-extensions, as you can't
lift
the static inputThere 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.
Ok, if #693 doesn't fly, we need an alternative approach for dealing with functions. Maybe splitting EdgeKind::Static into EdgeKind::Function and EdgeKind::Const (as suggested here) would be a good way to go anyway....
What about resurrecting PR #693, and giving the LoadConstant node a nonzero delta built from the constant being loaded? No, that would leave the input-extensions for the LoadConstant undefined :-(.
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 raise an issue "All calls to a function must have the same input_extensions" - I think that's a fair description of the problem (and it sounds like a problem to me)?
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.
Raised #695
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 that true? parent's output is equal to (its input, probably empty, maybe not necessarily) plus delta
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.
Sorry, yes, well, the "its input_extensions should always be empty" bit is as above, but the point to make is that the parent's output is equal to its input, because these do not include the delta of the function itself.
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.
Removed the stuff about empty input_extensions, since it isn't true
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.
ok, that is neater than I realized, nice
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.
Hang on. (Hang on!) Don't we need an additional constraint, then, that the (input-extensions to the) Output node are Plus of (the delta of the FuncDefn's declared FunctionType and the Input node)?
Could add a test of a FuncDefn that declares delta is {A} and then has a body that Lift's only by {B}, say - that should be rejected, but is it?
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've added a test for this "funcdefn_signature_mismatch"
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.
struggling to see how the test does what you say here - sorry! - can you put a comment or two inside the method?
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 fixed it but it doesn't pass! It's really requires us to be ignoring "Static" edges for functions, so I'll re-add it when I open the PR fixing #695
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.
The problem here is that the FunctionType has zero delta? Whereas if you did
.with_extension_delta(...XB_T...)
it'd pass? (Might be worth doing both ways via a loop / helper fn just to show the difference between working and not working)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.
Added a comment explaining this