-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Relay] Fix IncompleteType Alpha Equality Checking #1901
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
Conversation
|
Good catch. Be sure to change the test for it as well. |
|
I am not completely sure this should be the semantics for every alpha equal checking, as the same incomplete type appearing in similar locations naturally has certain meanings. |
|
@tqchen I don't quite understand. Do you have specific examples where this is not the desired behavior? Both @MarisaKirisame and I have cases where this PR gives us the desired behavior. |
|
The question is that whether the following two code alpha-equals to each other, note that first one have shares ```?a`` among two type annotations and that could potentially represents a type constraint. |
|
Apologies for my inattentive reading, I thought the initial change was adding a check for kind, not eliminating the pointer equality check. I agree that two different type vars should not be considered alpha-equal simply because they have the same kind (perhaps we could do the same thing as with ordinary vars as in #1900?) |
|
@joshpoll I had been using incompletetypenode to signal 'infer for me'. |
|
If we can use None instead of IncompleteType nodes, what is the purpose of the latter? Are they not meant to be specified by users but only used internally by the type checker? If that's the case, perhaps we should make a stronger/clearer distinction between these two types of nodes. |
|
Looks like using None for a function return type causes a nullptr exception during alpha equality checking? |
|
As long as we allow nullptrs in function return types and in variable types, I think I can fully switch my annotations to None instead of IncompleteType. I can close this PR and submit a new one with changes to alpha equality that add more type |
|
Supporting None sounds good |
|
I think we still need to revise the semantics of alpha equality for IncompleteTypes, though, like Steven suggested, since with just pointer equality two structurally identical expressions aren't alpha equal. |
Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from others in the community.