-
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
Initial Implementation of TIRToRuntime Target hook #9190
Conversation
This is the initial implementation which wires in a test case for TIRToRuntime, in order to get this working I re-used `CodegenCHost` as it implements all of the `Op`s required from the lowered `PrimFunc`. Currently, the `IRModule` is non-unified but in future work it should definitely do so, I wanted to implement the basics here to get the infra in place.
aac882b
to
34ded72
Compare
src/driver/driver_api.cc
Outdated
@@ -34,6 +34,8 @@ | |||
#include <mutex> | |||
#include <stack> | |||
|
|||
#include "../relay/backend/te_compiler.h" |
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'm not sure it is needed in this file.
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.
Ah, good spot, this was when I was trying to bundle building a unified IRModule
into this PR - I'll fix 😸
Thanks @Mousius. It looks good to me. |
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 Just a nit -- if CI is green prob not even worth worrying about. Thanks!
// can be used alongside the default host codegen based on device type | ||
// this is so the correct code generator is used later instead of overriding the target. | ||
// We need better support for inserting multiple kDLCPU targets as our current options | ||
// are kDeviceKernelLaunch or not |
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.
sigh. we'll get there.
@@ -401,12 +401,21 @@ std::pair<IRModule, IRModule> SplitDevHostFuncs(IRModule mod_mixed, const Target | |||
auto opt_mixed = transform::Sequential(mixed_pass_list); | |||
mod_mixed = opt_mixed(std::move(mod_mixed)); | |||
|
|||
// We make an assumption here that the overriden host target |
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.
Heads up that @mikepapadim is working here in #9103
} // namespace contrib | ||
} // namespace relay | ||
|
||
TVM_REGISTER_TARGET_KIND("example_target_hook", kDLCPU) |
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.
nit: example_target_kind
And maybe a comment -- 'here we register blah blah'.
@mbaret could you take a look, @mbs-octoml seems happy so I'm happy 😸 will look to follow up in a later PR on the minor nit. |
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 @Mousius, @mbs-octoml this is merged |
* Initial Implementation of TIRToRuntime Target hook This is the initial implementation which wires in a test case for TIRToRuntime, in order to get this working I re-used `CodegenCHost` as it implements all of the `Op`s required from the lowered `PrimFunc`. Currently, the `IRModule` is non-unified but in future work it should definitely do so, I wanted to implement the basics here to get the infra in place. * Fix heterogeneous compute with multiple kDLCPU targets * Remove rogue te_compiler.h include
* Initial Implementation of TIRToRuntime Target hook This is the initial implementation which wires in a test case for TIRToRuntime, in order to get this working I re-used `CodegenCHost` as it implements all of the `Op`s required from the lowered `PrimFunc`. Currently, the `IRModule` is non-unified but in future work it should definitely do so, I wanted to implement the basics here to get the infra in place. * Fix heterogeneous compute with multiple kDLCPU targets * Remove rogue te_compiler.h include
* Initial Implementation of TIRToRuntime Target hook This is the initial implementation which wires in a test case for TIRToRuntime, in order to get this working I re-used `CodegenCHost` as it implements all of the `Op`s required from the lowered `PrimFunc`. Currently, the `IRModule` is non-unified but in future work it should definitely do so, I wanted to implement the basics here to get the infra in place. * Fix heterogeneous compute with multiple kDLCPU targets * Remove rogue te_compiler.h include
This is the initial implementation which wires in a test case for TIRToRuntime, in order to get this working I re-used
CodegenCHost
as it implements all of theOp
s required from the loweredPrimFunc
.Currently, the
IRModule
is non-unified but in future work it should definitely do so, I wanted to implement the basics here to get the infra in place.The example now shows how to register the target, and customize the pipeline with minimal additional work involved 😸