-
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
[CORE][Relay] Swap and remove compile_engine with te_compiler followup of #8775 #9282
Conversation
…ile-engine-for-real
669485a
to
cd021b7
Compare
try: | ||
mod_name = mangle_module_name(mod_name) | ||
key = _get_cache_key(source_func, target) | ||
print(key) |
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.
A stray print!
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.
Fixed
ret.append(dim) | ||
return ret | ||
|
||
|
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.
What is this replaced with?
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.
Oops, now I see this was just moved. Nevermind
""" | ||
# pylint: disable=broad-except, import-outside-toplevel | ||
try: | ||
mod_name = mangle_module_name(mod_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.
Why do name mangling here instead of in TECompilerLower?
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.
This is directly taken from the original compile_engine
. I agree we can move it to C++ through te_compiler, but I see a few other usages of it within the codebase.
Overall, LGTM, I just have a few nitpicks. I took a quick look at what is failing and it looks like there are some issues with the registration, but once those are resolved this looks like it is good to go in! Thanks! |
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.
Mostly this looks good, just found a few bits to tidy
@@ -721,7 +723,7 @@ def compile_and_run( | |||
|
|||
def generate_ref_data(mod, input_data, params=None, target="llvm"): | |||
"""Generate reference data through executing the relay module""" | |||
compile_engine.get().clear() | |||
te_compiler.get().clear() |
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.
Do we even need this anymore for AOT?
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.
Indeed, i think is not required anymore. It was transilient from compile engine.
1baaa7d
to
5100263
Compare
Thanks, just pushed the fixes. |
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 thank you Michalis.
@@ -142,7 +142,7 @@ def _traverse_expr(node): | |||
params.append(free_var) | |||
call = relay.Call(node.op, params, node.attrs) | |||
mod = tvm.IRModule.from_expr(relay.Function(params, call)) | |||
relay.backend.compile_engine.get().clear() | |||
relay.backend.te_compiler.get().clear() |
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.
I didn't realize there were so many uses of the dreaded global. Could you please file a JIRA issue to remove them? I suspect simply creating locally would be fine and this has been done just for 'efficiency'. If not we have bigger problems.
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.
Just filled a ticket on it. I did locally for a few test with no issues. So, after this on is merged. I can sent a followup PR unifying all usages.
3ea3f4a
to
3f08424
Compare
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.
@icemelon please also take a look, as this may affect our use cases.
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, thanks so much!
I will wait some time for Haichen before merging. |
Thanks! We can do some followups as @mbs-octoml suggested. |
@jroesch should we merge this one? |
…p of apache#8775 (apache#9282) * Remove compile_engine.h for real * Fix format * RM compile_engine.cc * Swap compile engine with TECompiler * Cleanup on compile engine py leftovers * [WIP] Exposing legacy compile engine capabilities through TE Compiler * Swap usages for depreciated compile engine with TE compiler * Track and replace usages of compile engine refactor them to TE compiler * [Docs] Log helper mod * Remove depreciated function for lookup compile engine cachce * Fix typos * Debug misc cleanups * Register global pass for using te compiler for auto scheduler * Fix tests using the legacy compile engine * Fix broken autotuner tests and minor cleanups * Swap compile engine with te_compiler in rst config * PR nits * Fix failed test Co-authored-by: Jared Roesch <[email protected]>
…p of apache#8775 (apache#9282) * Remove compile_engine.h for real * Fix format * RM compile_engine.cc * Swap compile engine with TECompiler * Cleanup on compile engine py leftovers * [WIP] Exposing legacy compile engine capabilities through TE Compiler * Swap usages for depreciated compile engine with TE compiler * Track and replace usages of compile engine refactor them to TE compiler * [Docs] Log helper mod * Remove depreciated function for lookup compile engine cachce * Fix typos * Debug misc cleanups * Register global pass for using te compiler for auto scheduler * Fix tests using the legacy compile engine * Fix broken autotuner tests and minor cleanups * Swap compile engine with te_compiler in rst config * PR nits * Fix failed test Co-authored-by: Jared Roesch <[email protected]>
This is a follow-up work for #8775 to address the pending comments to remove the
compile_engine
.As this is an intermediate step towards completely moving away from the engine, we exposed the following legacy functions from the compile engine to ensure backwards compatibility atm:
Now, compile_engine.py has been replaced with te_compiler.py and deprecated funcs, such as LowerShapeFuncs kept private within the te_compiler.cc.
@jroesch @mbs-octoml @electriclilies @comaniac @junrushao1994