-
Notifications
You must be signed in to change notification settings - Fork 7
Reduce the work to add a new expr: mutator cleanup #2199
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
@@ -480,19 +486,14 @@ class TORCH_CUDA_CU_API Expr : public Statement { | |||
std::vector<Val*> outputs, | |||
std::vector<Statement*> attributes); | |||
|
|||
virtual newObjectFuncType* newObjectFunc() const = 0; |
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.
Why does this "newObject" interface now return a function pointer? What's wrong with the previous version?
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.
Because of this container->removeExpr(op);
in the mutate
method. When an IR node is removed from a container, its vtable no longer exist, and op->newObject
will cause segfault.
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.
Can we just do op->newObject()
before removing 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.
And we can not swap the order of op->newObject
and container->removeExpr
because this causes some consistency check failure (an IterDomain used in multiple expr).
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.
C++ does not allow me to do the following either :(
auto fn = op->newObject;
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, makes sense.
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. Thanks for the cleanup
No description provided.