areusch commented on a change in pull request #7938:
URL: https://github.com/apache/tvm/pull/7938#discussion_r627602572
##########
File path: python/tvm/micro/model_library_format.py
##########
@@ -27,6 +27,8 @@
from ..relay.backend import executor_factory
from ..relay import param_dict
+MAIN_FUNC_NAME_STR = "run"
Review comment:
how come it's named MAIN_FUNC_STR? would be good to clarify this
constant, i think, and explain our intentions in a comment.
AOT_RUN_FUNCTION_NAME or something? would you guys be updating this after
https://discuss.tvm.apache.org/t/mini-rfc-name-mangling-in-aot/9907 lands?
in the non-AOT case, there isn't a corresponding function to look to, so
it's confusing why we name it "run" as opposed to model name. also, can we
update `kMainFunc` to match?
##########
File path: src/relay/backend/graph_executor_codegen.cc
##########
@@ -577,10 +748,14 @@ class GraphExecutorCodegen : public
backend::MemoizedExprTranslator<std::vector<
Map<Expr, Array<IntegerArray>> storage_device_map_;
/*! \brief lowered funcs */
std::unordered_map<std::string, IRModule> lowered_funcs_;
+ /*! \brief lowered funcs */
+ Map<String, FunctionInfo> function_metadata_;
/*! \brief name map */
std::unordered_map<std::string, size_t> name_map_;
/*! \brief compile engine */
CompileEngine compile_engine_;
+ /*! \brief main function name */
Review comment:
can you add a comment to keep in sync with MAIN_FUNC_STR in
python/tvm/micro/model_library_format.py? and vice versa there?
##########
File path: src/relay/backend/utils.cc
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+/*!
+ * \file relay/backend/util.cc
+ * \brief Relay backend utilities.
+ */
+
+#include "utils.h"
+
+namespace tvm {
+namespace relay {
+namespace backend {
+
+void FunctionInfo::SetWorkspaceSize(Target tgt, tvm::Integer size) {
+ (*this)->workspace_sizes.Set(tgt, size);
+}
+
+TVM_REGISTER_NODE_TYPE(FunctionInfoNode);
+TVM_REGISTER_GLOBAL("relay.backend.FunctionInfo").set_body_typed([]() { return
FunctionInfo(); });
Review comment:
so since Map is not mutable from Python, I wonder if it would make sense
to also make FunctionInfo immutable in Python? I think the main question I have
is: what should the API look like? it's easier to figure that out given an
example of how it's used. i don't disagree with having a function like this,
but since there isn't a way to use it now, someone could come and propose an
API change and we wouldn't have any reasoning why to push back.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]