Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

End2End Lowering #23

Merged
merged 13 commits into from
Oct 22, 2021
Merged

End2End Lowering #23

merged 13 commits into from
Oct 22, 2021

Conversation

ZihengJiang
Copy link
Contributor

@ZihengJiang ZihengJiang commented Oct 19, 2021

End2End MVP working now.

  • Transform the dataflow program to non-dataflow format for lowering;
  • Lower call_dps to explicit memory form;
  • Support alloc_storage and alloc_tensor for dynamic shape;
  • Fix the mutator issue with a temporary solution;

Co-Authored-By: Yuchen Jin yuchenj@cs.washington.edu

@ZihengJiang ZihengJiang marked this pull request as draft October 19, 2021 23:02
@ZihengJiang ZihengJiang marked this pull request as ready for review October 21, 2021 04:27
Copy link
Collaborator

@altanh altanh left a comment

Choose a reason for hiding this comment

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

mostly LGTM, thanks for the work! some small bugs and nits + thoughts for future

include/tvm/relax/expr_functor.h Show resolved Hide resolved
@@ -356,6 +360,7 @@ Var ExprMutator::VisitVarBinding(const VarBinding& binding) {
// new_var->checked_type_ = new_value->checked_type_;
// }

Var new_var = binding->var;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not this->Mutate(binding->var)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Because the lhs of the binding is defining a Var (not reuse it), so we do not need to mutate it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what if someone wants to write a simple mutator pass that renames each var from x -> my_x?

@@ -380,7 +385,9 @@ Var ExprMutator::VisitVarBinding(const VarBinding& binding) {
void ExprMutator::VisitMatchShape(const MatchShape& binding) {
Expr new_value = this->Mutate(binding->value);
Expr new_pattern = this->Mutate(ShapeExpr(binding->pattern));
Var new_var = Downcast<Var>(this->Mutate(binding->var));
Var new_var = binding->var;
Copy link
Collaborator

Choose a reason for hiding this comment

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

same question

src/relax/transform/memory_rewrite.cc Outdated Show resolved Hide resolved
src/relax/transform/memory_rewrite.cc Show resolved Hide resolved
tests/python/relax/test_transform.py Outdated Show resolved Hide resolved
tests/python/relax/test_transform.py Outdated Show resolved Hide resolved
tests/python/relax/test_transform.py Show resolved Hide resolved
tests/python/relax/test_vm.py Outdated Show resolved Hide resolved
tests/python/relax/test_vm.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@altanh altanh left a comment

Choose a reason for hiding this comment

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

LGTM just except for the VisitVar in VarBinding 👌

@YuchenJin YuchenJin merged commit 8e6ad55 into relax Oct 22, 2021
@YuchenJin YuchenJin deleted the e2e-lowering branch October 22, 2021 21:56
@YuchenJin
Copy link
Collaborator

YuchenJin commented Oct 22, 2021

Merged, Thanks @altanh for the review!

tqchen pushed a commit that referenced this pull request Oct 30, 2021
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
YuchenJin added a commit that referenced this pull request Nov 10, 2021
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
YuchenJin added a commit that referenced this pull request Jan 27, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
YuchenJin added a commit that referenced this pull request Mar 2, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit to yongwww/relax that referenced this pull request Mar 14, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit to yongwww/relax that referenced this pull request Mar 22, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit to yongwww/relax that referenced this pull request Mar 23, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit to yongwww/relax that referenced this pull request Apr 6, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Apr 8, 2022
yongwww pushed a commit to yongwww/relax that referenced this pull request Apr 12, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit that referenced this pull request May 10, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit that referenced this pull request May 11, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
YuchenJin added a commit that referenced this pull request Jun 1, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
jinhongyii pushed a commit to jinhongyii/relax that referenced this pull request Jun 5, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit to yongwww/relax that referenced this pull request Jun 12, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit to yongwww/relax that referenced this pull request Jul 15, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
yongwww pushed a commit that referenced this pull request Aug 14, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Oct 14, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
YuchenJin added a commit that referenced this pull request Nov 18, 2022
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Nov 22, 2022
* [BugFix] Normalize in mutator when visiting VarBinding and MatchShape

* Graph memory planning

* Fixes

* Translate memory op to vm builtin op

* Naive test

* Fix importer, use no `iterable`
jinhongyii pushed a commit to jinhongyii/relax that referenced this pull request Dec 10, 2022
* [BugFix] Normalize in mutator when visiting VarBinding and MatchShape

* Graph memory planning

* Fixes

* Translate memory op to vm builtin op

* Naive test

* Fix importer, use no `iterable`
vinx13 pushed a commit to vinx13/relax that referenced this pull request Dec 14, 2022
* [BugFix] Normalize in mutator when visiting VarBinding and MatchShape

* Graph memory planning

* Fixes

* Translate memory op to vm builtin op

* Naive test

* Fix importer, use no `iterable`
YuchenJin added a commit that referenced this pull request Jan 13, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
YuchenJin added a commit that referenced this pull request Jan 14, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit to junrushao/relax that referenced this pull request Jan 25, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit to junrushao/relax that referenced this pull request Jan 26, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit to junrushao/relax that referenced this pull request Jan 29, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit to junrushao/relax that referenced this pull request Feb 5, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit to junrushao/relax that referenced this pull request Feb 6, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Feb 9, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
junrushao pushed a commit that referenced this pull request Feb 9, 2023
* call_dps lowering.

* Improve shape lowering.

* Support alloc_storage for dynamic shape.

* implementt ToNonDF to transform program to non-dataflow format.

* Fix the mutator issue.

* Update build api, an issue occurred.

* vm tests can pass.

* Support shape tuple in executable seriablization.

* Fix for test.

* Minor fixes.

* Address comments.

* Add mutate binding var back.

* Visit binding var and fix tests.

Co-authored-by: YuchenJin <yuchenj@cs.washington.edu>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants