areusch commented on a change in pull request #9395:
URL: https://github.com/apache/tvm/pull/9395#discussion_r745233508



##########
File path: tests/cpp/target/source/interface_c_test.cc
##########
@@ -69,7 +69,29 @@ TEST(InterfaceAPI, ContainsRunFunction) {
                << "  struct tvmgen_ultimate_cat_spotter_outputs* outputs\n"
                << ");\n";
 
-  runtime::Module test_module = InterfaceCCreate("ultimate_cat_spotter", 
{"input"}, {"output"});
+  runtime::Module test_module = InterfaceCCreate("ultimate_cat_spotter", 
{"input"}, {"output"}, {});
+  std::string header_source = test_module->GetSource();
+
+  ASSERT_THAT(header_source, HasSubstr(run_function.str()));
+}
+
+TEST(InterfaceAPI, ContainsRunFunctionWithDevices) {
+  std::stringstream run_function;
+
+  run_function << "/*!\n"
+               << " * \\brief entrypoint function for TVM module 
\"ultimate_cat_spotter\"\n"
+               << " * \\param inputs Input tensors for the module \n"

Review comment:
       should "ultimate_cat_spotter" be repeated? :)

##########
File path: src/target/target_kind.cc
##########
@@ -373,6 +373,8 @@ TVM_REGISTER_TARGET_KIND("hybrid", kDLCPU)  // line break
 
 TVM_REGISTER_TARGET_KIND("composite", 
kDLCPU).add_attr_option<Array<Target>>("devices");
 
+TVM_REGISTER_TARGET_KIND("ethos-u", kDLCPU).set_attr<Bool>("c_device_api", 
Bool(true));

Review comment:
       what about a target like Ethos-N, which could in theory be used from 
either C or C++ runtimes? should we just call this attribute `use_device_api`?

##########
File path: apps/microtvm/ethosu/src/tvm_ethosu_runtime.c
##########
@@ -0,0 +1,34 @@
+/*
+ * 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_ethosu_runtime.h"
+
+#include <ethosu_driver.h>
+
+int32_t TVMEthosULaunch(struct ethosu_driver* driver, void* cms_data, size_t 
cms_data_size,
+                        uint64_t* base_addrs, size_t* base_addrs_size, int 
num_tensors) {
+  int32_t result =
+      ethosu_invoke(driver, cms_data, cms_data_size, base_addrs, 
base_addrs_size, num_tensors);
+
+  // Map errors in invoke to TVM errors
+  if (result != 0) {
+    return -1;

Review comment:
       does it make sense to just return the error code here? e.g. curious if 
the above comment is a TODO or a descriptor




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to