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

[Arith] Simplify nested if_then_else #12749

Merged
merged 4 commits into from
Sep 15, 2022

Conversation

vinx13
Copy link
Member

@vinx13 vinx13 commented Sep 9, 2022

@vinx13 vinx13 force-pushed the feat/simplify_nested_if_then_else branch from 49c638c to 175eb97 Compare September 12, 2022 18:18
@vinx13
Copy link
Member Author

vinx13 commented Sep 12, 2022

@tvm-bot rerun

@vinx13 vinx13 force-pushed the feat/simplify_nested_if_then_else branch 2 times, most recently from d50e5c1 to 8876e62 Compare September 13, 2022 20:04
const PrimExpr& then_expr = op->args[1];
const PrimExpr& else_expr = op->args[2];
const CallNode* inner_call = then_expr.as<CallNode>();
if (inner_call != nullptr && inner_call->op.same_as(tir::builtin::if_then_else())) {

Choose a reason for hiding this comment

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

Overall LGTM. I wonder if this implies that only one level of nested if_then_else could exist in current TIR structure.

Copy link
Member Author

Choose a reason for hiding this comment

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

it supports multiple levels, as this mutator is recursive (then_expr here is from the recursion result)

vinx13 and others added 3 commits September 13, 2022 17:23
@vinx13 vinx13 force-pushed the feat/simplify_nested_if_then_else branch from 8876e62 to 23dca66 Compare September 14, 2022 22:12
@vinx13 vinx13 requested a review from junrushao September 15, 2022 19:59
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!

@junrushao junrushao merged commit 9b10425 into apache:main Sep 15, 2022
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
[Arith] Simplify nested if_then_else

Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants