-
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
Relay C++ Build Module #3082
Relay C++ Build Module #3082
Conversation
ping reviewers... |
Sorry about the slow review, been a busy week! Thanks for rewriting so much code into C++, my feedback is mostly stylistic. Can you review @MarisaKirisame? |
1 similar comment
Sorry about the slow review, been a busy week! Thanks for rewriting so much code into C++, my feedback is mostly stylistic. Can you review @MarisaKirisame? |
General feedback: I would suggest a pass over the code to revise the \brief comments - try to include the purpose of the class/function. |
fe80f40
to
cbdd452
Compare
@jroesch Updated. |
c7fc5e7
to
05c828d
Compare
@jroesch @MarisaKirisame @tqchen Could one of you review this PR again? |
Updated. |
fdb9f8d
to
532cbd3
Compare
@antinucleon Looks good to me, one last question when will we replace the Python code currently in |
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.
lgtm
@jroesch We have to wait AutoTVM is ported to C++, then we are able to replace Python build_module. |
Why can't we just expose the necessary Python functions and call them from C++? |
std::unordered_set<std::string> disabled_pass; | ||
OptPassLevel OPT_PASS_LEVEL; | ||
inline bool pass_enabled(const std::string& pass_name) const { | ||
if (disabled_pass.count(pass_name)) { |
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.
CHECK_GT(add_pass.count(pass_name), 0);
inside this if.
This will catch corner case where a pass_name is both enabled and disabled.
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.
Disabled pass priority is higher than adding extra pass: see https://discuss.tvm.ai/t/relay-alter-op-layout-pass-regression/1870/2. I don't know any use case which people will enable some extra passes and disable at the same time.
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.
Exactly, if there is no such use case, better just do not allow it, so in case ppl enable and disable by accident, there will be an immediate error.
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.
My point is: There is no use case to both enable and disable a pass, but we may need O3 but disable some passes.
@jroesch For fully migrating to C++, we have to do step by step, as the python module is not typed and fixing all these case need quite a lot of work. |
Ok sounds good. We can do it incrementally. |
* [Relay] C++ Build module * asdf
* [Relay] C++ Build module * asdf
Currently most schedules are written in Python. I tested on CPU environment this building module is able to pass a dense + relu test with Python schedules. To fully replace Python build module, port some AutoTVM feature to C++ is necessary.