-
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
[TIR] HoistExpression, generalization of HoistIfThenElse #11592
Conversation
This feels like it should definitely be part of RewriteSimplify, but that will require making CanInlineLet be a virtual function.
This is a generalized form of HoistIfThenElse, which can also hoist Let bindings, or portions of conditional expressions. This will be used in upcoming changes to separate compute loops into a slow loop that handles edge cases and a fast branchless loop.
Current failures in Once #11646 is merged, will rebase this PR on top of it. |
Merged from main now that #11646 is merged. Previous CI failures were due to inconsistent simplification of |
Didn't correctly reproduce previous behavior. In addition to preventing hoisting of expressions that use a block variable (e.g. threadIdx.x), should also prevent hoisting of expressions across a "thread_extent" AttrStmt.
* [TIR][Arith] Use non-inlined bindings when proving conditional * [TIR][Arith] Recognize Var when used as a literal constraint * [TIR][Arith] Added simplification of constrained if_then_else op This feels like it should definitely be part of RewriteSimplify, but that will require making CanInlineLet be a virtual function. * [TIR] Implemented HoistExpression transformation This is a generalized form of HoistIfThenElse, which can also hoist Let bindings, or portions of conditional expressions. This will be used in upcoming changes to separate compute loops into a slow loop that handles edge cases and a fast branchless loop. * [TIR] Expressed HoistIfThenElse as special case of HoistExpression * Lint fixes * Fixed breakage in tvmc unit test that relied on pass type * More accurate handling of kUsingBlockVar Didn't correctly reproduce previous behavior. In addition to preventing hoisting of expressions that use a block variable (e.g. threadIdx.x), should also prevent hoisting of expressions across a "thread_extent" AttrStmt. * Updated comment for HoistExpression pass * Fix linting error
* [TIR][Arith] Use non-inlined bindings when proving conditional * [TIR][Arith] Recognize Var when used as a literal constraint * [TIR][Arith] Added simplification of constrained if_then_else op This feels like it should definitely be part of RewriteSimplify, but that will require making CanInlineLet be a virtual function. * [TIR] Implemented HoistExpression transformation This is a generalized form of HoistIfThenElse, which can also hoist Let bindings, or portions of conditional expressions. This will be used in upcoming changes to separate compute loops into a slow loop that handles edge cases and a fast branchless loop. * [TIR] Expressed HoistIfThenElse as special case of HoistExpression * Lint fixes * Fixed breakage in tvmc unit test that relied on pass type * More accurate handling of kUsingBlockVar Didn't correctly reproduce previous behavior. In addition to preventing hoisting of expressions that use a block variable (e.g. threadIdx.x), should also prevent hoisting of expressions across a "thread_extent" AttrStmt. * Updated comment for HoistExpression pass * Fix linting error
* [TIR][Arith] Use non-inlined bindings when proving conditional * [TIR][Arith] Recognize Var when used as a literal constraint * [TIR][Arith] Added simplification of constrained if_then_else op This feels like it should definitely be part of RewriteSimplify, but that will require making CanInlineLet be a virtual function. * [TIR] Implemented HoistExpression transformation This is a generalized form of HoistIfThenElse, which can also hoist Let bindings, or portions of conditional expressions. This will be used in upcoming changes to separate compute loops into a slow loop that handles edge cases and a fast branchless loop. * [TIR] Expressed HoistIfThenElse as special case of HoistExpression * Lint fixes * Fixed breakage in tvmc unit test that relied on pass type * More accurate handling of kUsingBlockVar Didn't correctly reproduce previous behavior. In addition to preventing hoisting of expressions that use a block variable (e.g. threadIdx.x), should also prevent hoisting of expressions across a "thread_extent" AttrStmt. * Updated comment for HoistExpression pass * Fix linting error
This is a generalized form of
HoistIfThenElse
, which can also hoistLet
bindings and independent portions of conditional expressions, in addition to hoisting an entire conditional expression. This will be used in upcoming changes to separate compute loops into a slow loop that handles edge cases and a fast branchless loop.