You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/04 17:43:23 UTC

[GitHub] [tvm] Mousius opened a new pull request #9190: Initial Implementation of TIRToRuntime Target hook

Mousius opened a new pull request #9190:
URL: https://github.com/apache/tvm/pull/9190


   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.
   
   The example now shows how to register the target, and customize the pipeline with minimal additional work involved :smile_cat: 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] areusch commented on pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#issuecomment-933957506


   cc @mbs-octoml @electriclilies @mikepapadim 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Mousius commented on pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
Mousius commented on pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#issuecomment-939995919


   @mbaret could you take a look, @mbs-octoml  seems happy so I'm happy :smile_cat: will look to follow up in a later PR on the minor nit.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Mousius commented on a change in pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
Mousius commented on a change in pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#discussion_r723003966



##########
File path: src/driver/driver_api.cc
##########
@@ -34,6 +34,8 @@
 #include <mutex>
 #include <stack>
 
+#include "../relay/backend/te_compiler.h"

Review comment:
       Ah, good spot, this was when I was trying to bundle building a unified `IRModule` into this PR - I'll fix :smile_cat: 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbaret merged pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
mbaret merged pull request #9190:
URL: https://github.com/apache/tvm/pull/9190


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Hzfengsy commented on pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
Hzfengsy commented on pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#issuecomment-935927187


   Thanks @Mousius. It looks good to me. 
   However, I'm not the export of this part. So, sorry I can not approve it. Let's wait for reviews from other committers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Hzfengsy edited a comment on pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
Hzfengsy edited a comment on pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#issuecomment-935927187


   Thanks @Mousius. It looks good to me. 
   However, I'm not the expert of this part. So, sorry I can not approve it. Let's wait for reviews from other committers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] Hzfengsy commented on a change in pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
Hzfengsy commented on a change in pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#discussion_r722882511



##########
File path: src/driver/driver_api.cc
##########
@@ -34,6 +34,8 @@
 #include <mutex>
 #include <stack>
 
+#include "../relay/backend/te_compiler.h"

Review comment:
       I'm not sure it is needed in this file.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbs-octoml commented on a change in pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
mbs-octoml commented on a change in pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#discussion_r725135145



##########
File path: src/relay/backend/contrib/example_target_hooks/target.cc
##########
@@ -0,0 +1,39 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <tvm/relay/transform.h>
+#include <tvm/target/target.h>
+
+namespace tvm {
+
+namespace relay {
+namespace contrib {
+namespace example_target_hooks {
+tvm::transform::Pass RelayToTIR();
+runtime::Module TIRToRuntime(IRModule mod, Target target);
+}  // namespace example_target_hooks
+}  // namespace contrib
+}  // namespace relay
+
+TVM_REGISTER_TARGET_KIND("example_target_hook", kDLCPU)

Review comment:
       nit: example_target_kind
   And maybe a comment -- 'here we register blah blah'.

##########
File path: src/driver/driver_api.cc
##########
@@ -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

Review comment:
       Heads up that @mikepapadim is working here in #9103

##########
File path: src/driver/driver_api.cc
##########
@@ -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
+  // 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

Review comment:
       sigh. we'll get there.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [tvm] mbaret commented on pull request #9190: Initial Implementation of TIRToRuntime Target hook

Posted by GitBox <gi...@apache.org>.
mbaret commented on pull request #9190:
URL: https://github.com/apache/tvm/pull/9190#issuecomment-940046316


   Thanks @Mousius, @mbs-octoml this is merged


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org