Skip to content

Legalize - Use Non-recursive Rewriter. - #5296

Merged
tqchen merged 2 commits into
apache:masterfrom
anijain2305:legalize_iterative
Apr 10, 2020
Merged

Legalize - Use Non-recursive Rewriter.#5296
tqchen merged 2 commits into
apache:masterfrom
anijain2305:legalize_iterative

Conversation

@anijain2305

Copy link
Copy Markdown
Contributor

One of my pre-quantized model parsing was seeing segfault because of stack overflow. Switching to non-recursive mutation resolves the issue, and I can compile the model successfully. Thanks for this work!

@mbrookhart@tqchen

@tqchen

Copy link
Copy Markdown
Member

@mbrookhart can you help to review the PR

@mbrookhartmbrookhart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks!

Comment threadsrc/relay/transforms/legalize.cc Outdated
Expr Rewrite_(const CallNode* call_node, const Expr& post) override {
// Get the new_call node without any changes to current call node.
Expr new_e = ExprMutator::VisitExpr_(call_node);
Expr new_e = post;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we just rename post to new_e and remove this line?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I could not directly rename, as new_e was supposed to be the new expr and post is a cont. But, I have cleaned up the code, so that new_e is not needed anymore.

@tmoreau89tmoreau89 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

great to see the non-recursive rewriter being used!

@FrozenGene

Copy link
Copy Markdown
Member

@LiangHao151941 I think you could benefit this in your pr #4828

@tqchen
tqchen merged commit 7d670b0 into apache:masterApr 10, 2020
@tqchen

Copy link
Copy Markdown
Member

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Apr 16, 2020
* Legalize - Use Non-recursive Rewriter.
* Cleanup.
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Apr 17, 2020
* Legalize - Use Non-recursive Rewriter.
* Cleanup.
dpankratz pushed a commit to dpankratz/incubator-tvm that referenced this pull request Apr 24, 2020
* Legalize - Use Non-recursive Rewriter.
* Cleanup.
Sign up for freeto 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.

6 participants

@anijain2305@tqchen@FrozenGene@masahi@mbrookhart@tmoreau89