-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[IR] Fix a primitive check error #5991
Conversation
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.
LGTM :-)
include/tvm/ir/op.h
Outdated
@@ -146,6 +146,7 @@ class OpNode : public RelayExprNode { | |||
// Internal function to compute if it is primitive op | |||
bool IsPrimitiveOp_() const { | |||
const auto& fn_ty = this->op_type; | |||
if (fn_ty.get() == 0) return false; |
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 am not too sure about the change. We should not use 0
in the case of nullptr.
Ideally all Op should have a Type. So instead, we might want to do CHECK(fn_ty != nullptr) here and make sure we register a type for every Op
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.
Thanks for pointing out.
I think I was trying to hash an Op with Type undefined, which led me to return false
here. Otherwise, I would crash into a segfault error.
This is updated accordingly as suggested.
Thanks @liangfu , @junrushao1994 @zhiics |
* fix primitive check error * assuming every Op has Type defined * CHECK_NE -> CHECK Co-authored-by: Liangfu Chen <[email protected]>
* fix primitive check error * assuming every Op has Type defined * CHECK_NE -> CHECK Co-authored-by: Liangfu Chen <[email protected]>
This PR is trying to fix an error that raised when hashing a Relay Op.
@zhiics @jroesch please review.