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

[IR] Fix a primitive check error #5991

Merged
merged 3 commits into from
Jul 14, 2020
Merged

Conversation

liangfu
Copy link
Member

@liangfu liangfu commented Jul 3, 2020

This PR is trying to fix an error that raised when hashing a Relay Op.

@zhiics @jroesch please review.

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :-)

@@ -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;
Copy link
Member

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

Copy link
Member Author

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.

@tqchen tqchen self-assigned this Jul 6, 2020
@tqchen tqchen added the status: need update need update based on feedbacks label Jul 6, 2020
include/tvm/ir/op.h Outdated Show resolved Hide resolved
@tqchen tqchen merged commit e4a0aa5 into apache:master Jul 14, 2020
@tqchen
Copy link
Member

tqchen commented Jul 14, 2020

Thanks @liangfu , @junrushao1994 @zhiics

@tqchen tqchen added status: accepted and removed status: need update need update based on feedbacks labels Jul 14, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jul 14, 2020
* fix primitive check error

* assuming every Op has Type defined

* CHECK_NE -> CHECK

Co-authored-by: Liangfu Chen <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jul 14, 2020
* fix primitive check error

* assuming every Op has Type defined

* CHECK_NE -> CHECK

Co-authored-by: Liangfu Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants