-
Notifications
You must be signed in to change notification settings - Fork 2
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
track #12
base: master
Are you sure you want to change the base?
track #12
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,23 @@ class ConstantFolder : public ExprMutator { | |
} | ||
} | ||
|
||
bool inside_primitive = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you group this variable with any other field declarations? |
||
Expr VisitExpr_(const FunctionNode* op) final { | ||
if (op->HasNonzeroAttr(attr::kPrimitive)) { | ||
CHECK_EQ(inside_primitive, false); | ||
inside_primitive = true; | ||
auto ret = ExprMutator::VisitExpr_(op); | ||
inside_primitive = false; | ||
return ret; | ||
} else { | ||
return ExprMutator::VisitExpr_(op); | ||
} | ||
} | ||
|
||
Expr VisitExpr_(const CallNode* call) final { | ||
if (inside_primitive) { | ||
return GetRef<Expr>(call); | ||
} | ||
static auto op_stateful = Op::GetAttrMap<TOpIsStateful>("TOpIsStateful"); | ||
|
||
std::unordered_set<std::string> skip_list{"zeros_like", "ones_like", "full_like", "full"}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,7 @@ | |
*/ | ||
#include <tvm/ir/type_functor.h> | ||
#include <tvm/relay/analysis.h> | ||
#include <tvm/relay/feature.h> | ||
#include <tvm/relay/expr_functor.h> | ||
#include <tvm/relay/feature.h> | ||
#include <tvm/relay/interpreter.h> | ||
|
@@ -776,8 +777,9 @@ class PartialEvaluator : public ExprFunctor<PStatic(const Expr& e, LetList* ll)> | |
|
||
Func VisitFuncStatic(const Function& func, const Expr& var) { | ||
CHECK(IsAtomic(var)); | ||
// todo: figure out primitive semantic | ||
if (func->HasNonzeroAttr(attr::kPrimitive)) { | ||
return ConstEvaluateFunc(func); | ||
// return ConstEvaluateFunc(func); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this dead code if you don't do anything in the body? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is debug stuff. i havent clean up yet |
||
} | ||
std::vector<std::pair<Var, PStatic> > free_vars; | ||
for (const auto& v : FreeVars(func)) { | ||
|
@@ -1200,7 +1202,7 @@ namespace transform { | |
Pass PartialEval() { | ||
runtime::TypedPackedFunc<IRModule(IRModule, PassContext)> pass_func = | ||
[=](IRModule m, PassContext pc) { return relay::PartialEval(m); }; | ||
return CreateModulePass(pass_func, 1, "PartialEval", {}); | ||
return CreateModulePass(pass_func, 1, "PartialEvaluate", {}); | ||
} | ||
|
||
TVM_REGISTER_GLOBAL("relay._transform.PartialEvaluate").set_body_typed(PartialEval); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just lift this comment on to the function and expand it instead of removing it?