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

ExprMutator refactor & Normalizer #32

Merged
merged 14 commits into from
Nov 10, 2021
Merged

ExprMutator refactor & Normalizer #32

merged 14 commits into from
Nov 10, 2021

Conversation

YuchenJin
Copy link
Collaborator

Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

@YuchenJin YuchenJin marked this pull request as draft November 4, 2021 18:17
include/tvm/relax/utils.h 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.

quick round of review 👀

include/tvm/ir/expr.h Show resolved Hide resolved
include/tvm/relax/block_builder.h Show resolved Hide resolved
include/tvm/relax/block_builder.h Outdated Show resolved Hide resolved
include/tvm/relax/block_builder.h Outdated Show resolved Hide resolved
@@ -179,17 +179,10 @@ class ExprMutator : public ExprFunctor<Expr(const Expr&)> {
public:
ExprMutator() {
name_table_ = std::make_shared<NameTable>();
// TODO (@yuchen, @altanh): should block builder expose name_table_ instead?
Copy link
Collaborator

Choose a reason for hiding this comment

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

adding my offline thought here: I think to maximize the benefit of using NameTable (which is to prevent confusing name clashes for easier debugging), we would ideally have a single NameTable that persists across the entire compilation flow. One option is to embed it in the IRModule, or alternatively the PassContext.

src/relax/ir/expr_functor.cc Outdated Show resolved Hide resolved
src/relax/ir/expr_functor.cc Outdated Show resolved Hide resolved
src/relax/transform/to_anf.cc Show resolved Hide resolved
src/relax/transform/to_non_dataflow.cc Show resolved Hide resolved
src/relax/transform/to_non_dataflow.cc Outdated Show resolved Hide resolved
include/tvm/relax/block_builder.h Outdated Show resolved Hide resolved
src/relax/ir/expr_functor.cc Show resolved Hide resolved
src/relax/ir/expr_functor.cc Outdated Show resolved Hide resolved
include/tvm/relax/block_builder.h Outdated Show resolved Hide resolved
include/tvm/relax/block_builder.h Outdated Show resolved Hide resolved
include/tvm/relax/utils.h Outdated Show resolved Hide resolved
src/relax/ir/block_builder.cc Outdated Show resolved Hide resolved
@@ -231,8 +454,10 @@ bool BlockBuilderNode::CanProveShapeEqual(const Expr& lhs, const Expr& rhs) {

// TODO(@altanh, @yuchen): emit expr in ssa form
Expr BlockBuilderNode::Normalize(const Expr& expr) {
if (expr.as<CallNode>()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Have a fast path for normalize, directly check if it is var, or call with var arguments

Copy link
Collaborator

Choose a reason for hiding this comment

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

going to add a TODO instead since this isn't urgent

src/relax/ir/expr_functor.cc Outdated Show resolved Hide resolved
src/relax/transform/call_dps_rewrite.cc Outdated Show resolved Hide resolved
@YuchenJin YuchenJin marked this pull request as ready for review November 8, 2021 15:59
template <typename T>
T WithShapeAndType(T expr, Optional<ObjectRef> shape, Type type) {
// make sure to not "forget" DataflowVars
if (!std::is_same<T, DataflowVar>::value && static_cast<ObjectRef>(expr).as<DataflowVarNode>()) {
if (!std::is_same<T, DataflowVar>::value &&
static_cast<ObjectRef>(expr).as<DataflowVarNode>()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

while this is indeed more efficient, let us just use runtime polymorphism in this case and define the implementation in cc file.
Var WithShapeAndType(Var expr, Optional shape, Type type) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

the reason I did this was because we'll need a function like this for filling in the shapes and types of arbitrary exprs during forward inference (will add in subsequent PR). Is there a problem with this approach?

Copy link
Contributor

@tqchen tqchen Nov 8, 2021

Choose a reason for hiding this comment

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

I see, I believe the usages of the two can be slightly different.

  • In this case Var WithShapeAndType(Var var, Optional<ObjectRef> shape, Type type), we will recreate the Var of the same type as Var if the shape and type does not equals to the result.
  • In the forward inference case, we can directly mutate the fields in the expr by leveraging idempotent property(and shape is undefined), but will not recreate a new Var if the fields mismatches.

So it might be good to split them into two functions

Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm from my understanding we would want the same behavior for general exprs. For example if we are running shape inference on add(x, x) and the shape of x changes, then we want to update the shape_ field of the add call node (which we can do by directly mutating if it's undefined, or creating a copy with the shape field mutated, which this function does).

Copy link
Contributor

Choose a reason for hiding this comment

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

Because of the immutable property, we cannot mutate the x.shape_ the original call add. In the mutator, if shape of x changes, then we the mutator must return a new value xx, and in VisitExpr of add, it detects that args[0] changes and there is a need to create a new Call node, this new call node do not have shape_ field and the shape needed to be populated during normalization

Copy link
Collaborator

Choose a reason for hiding this comment

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

that makes sense to me, I was thinking in the context where the new Call node is made using CopyOnWrite()->args = {xx, xx} style (which would carry over the old shape). It's unfortunate if every node needs to be manually reconstructed I feel like

Copy link
Contributor

@tqchen tqchen Nov 8, 2021

Choose a reason for hiding this comment

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

I see, in that case it is still helpful to copy on write and reset the shape/type fields as well, then pass to the function. Since otherwise the extra comparison will generate another Call node(other from the COW one). Alternatively, we can just pass in a flag saying please ignore and force override the fields. Either case, the semantics of the function is different enough that it deserves a separate function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

it's definitely a trade off between having users write

call.CopyOnWrite()->args = ...
call->shape_ = NullOpt;
call->checked_type_ = Type();
return call;

or trusting that the flag will not be used incorrectly and cause non-idempotent mutation, or just having an extra copy. In the interest of getting the PR merged I'll just make this Var like you said

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, instead write return Call(old_op->op, new_args, old_op->span) is not as bad

Copy link
Contributor

Choose a reason for hiding this comment

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

certainly, let us add this as a discussion item in our meeting agenda

@@ -440,6 +449,7 @@ class ExternFunc : public Expr {
public:
TVM_DLL ExternFunc(String global_symbol, Span span = Span());
TVM_DEFINE_OBJECT_REF_METHODS(ExternFunc, Expr, ExternFuncNode);
TVM_DEFINE_OBJECT_REF_COW_METHOD(ExternFuncNode);
Copy link
Contributor

Choose a reason for hiding this comment

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

note for future iterations, perhaps it is worth to remove COW because the shape changing pattern issue

Copy link
Contributor

@tqchen tqchen left a comment

Choose a reason for hiding this comment

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

did a careful read, some final nits and we are good to go

include/tvm/relax/expr_functor.h Show resolved Hide resolved
include/tvm/relax/utils.h Outdated Show resolved Hide resolved
src/relax/ir/block_builder.cc Show resolved Hide resolved
src/relax/ir/expr_functor.cc Outdated Show resolved Hide resolved
src/relax/ir/expr_functor.cc Outdated Show resolved Hide resolved
src/relax/ir/expr_functor.cc Show resolved Hide resolved
src/relax/ir/expr_functor.cc Show resolved Hide resolved
@YuchenJin YuchenJin changed the title [WIP] ExprMutator refactor & Normalizer ExprMutator refactor & Normalizer Nov 9, 2021
@YuchenJin YuchenJin merged commit ae9daf4 into relax Nov 10, 2021
YuchenJin added a commit that referenced this pull request Nov 10, 2021
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
YuchenJin added a commit that referenced this pull request Jan 27, 2022
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
YuchenJin added a commit that referenced this pull request Mar 2, 2022
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit that referenced this pull request Oct 14, 2022
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
YuchenJin added a commit that referenced this pull request Nov 18, 2022
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
MasterJH5574 pushed a commit to MasterJH5574/tlc-relax that referenced this pull request Nov 28, 2022
* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK
jinhongyii pushed a commit to jinhongyii/relax that referenced this pull request Dec 10, 2022
* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK
vinx13 pushed a commit to vinx13/relax that referenced this pull request Dec 14, 2022
* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK
@tqchen tqchen deleted the ah/normalize branch December 18, 2022 20:13
MasterJH5574 pushed a commit to MasterJH5574/tlc-relax that referenced this pull request Dec 24, 2022
* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Dec 24, 2022
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Dec 30, 2022
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
vinx13 pushed a commit to vinx13/relax that referenced this pull request Jan 9, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Jan 13, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
YuchenJin added a commit that referenced this pull request Jan 13, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
YuchenJin added a commit that referenced this pull request Jan 14, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Jan 16, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
junrushao pushed a commit to junrushao/relax that referenced this pull request Jan 25, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit to junrushao/relax that referenced this pull request Jan 26, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit to junrushao/relax that referenced this pull request Jan 29, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
vinx13 pushed a commit to vinx13/relax that referenced this pull request Jan 31, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
vinx13 pushed a commit to vinx13/relax that referenced this pull request Jan 31, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
junrushao pushed a commit to junrushao/relax that referenced this pull request Feb 5, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit to junrushao/relax that referenced this pull request Feb 6, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
vinx13 pushed a commit to vinx13/relax that referenced this pull request Feb 8, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit that referenced this pull request Feb 8, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit that referenced this pull request Feb 9, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
junrushao pushed a commit that referenced this pull request Feb 9, 2023
* fixes

* revert checked_type visitor and fix relax usage

* ExprNormalizer

* fix that annoying bug and get tests passing

* Memoization fix for the ExprMutator; separate VisitVarDef from use.

* rebase.

* rebase.

* address part of comments.

* address more comments

* address more comments and add doc

* address more comments

* fix potential mutation bug

* always assign normalized shape if can

* address comments

Co-authored-by: Altan Haan <[email protected]>
MasterJH5574 added a commit to MasterJH5574/tlc-relax that referenced this pull request Feb 12, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
vinx13 pushed a commit to vinx13/relax that referenced this pull request Feb 13, 2023
 (tlc-pack#57)

* [FIX][Pass] concurrent modification in RemoveUnusedVars (tlc-pack#32)

* [Pass] Fix concurrent modification in RemoveUnusedVars

When running RemoveUnusedVars (i.e. remove_all_unused), in some cases the map users will raise Concurrent modification error. This commit fixed it by changing the logic to "iterate the map first and update it later".

* change the algorithm by store keys first

* Add an ICHECK before getting map value

* change the information of the ICHECK

* fix find include path (tlc-pack#42)

Co-authored-by: Hongyi Jin <[email protected]>

* [BUG] ExternFunc is not considered in attach_global_symbol.cc (tlc-pack#48)

* [Cherry-Pick] Minor fix for TaskScheduler and VerifyGPUCode (tlc-pack#54)

* [Fix] Task scheduler error prompt upon build/run failure (#13601)

* [Fix] Use proper target in VerifyGPUCode (#13548)

Previously, the VerifyGPUCode post-processor uses hardcoded target `Target("cuda")` for applying pass LowerIntrin. This is a bit problematic since the actual target can be other GPU target (e.g., Metal). Therefore, this PR changes the hardcoded target to be the actual target.

Co-authored-by: Chaosfan <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
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