areusch commented on a change in pull request #7785:
URL: https://github.com/apache/tvm/pull/7785#discussion_r620537842
##########
File path: src/relay/backend/build_module.cc
##########
@@ -131,14 +164,14 @@ class RelayBuildModule : public runtime::ModuleNode {
PackedFunc GetFunction(const std::string& name, const ObjectPtr<Object>&
sptr_to_self) final {
if (name == "get_graph_json") {
return PackedFunc(
- [sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { *rv =
this->GetGraphJSON(); });
+ [sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { *rv =
this->GetJSON(); });
Review comment:
should we keep this as GetGraphJSON?
##########
File path: src/target/source/source_module.cc
##########
@@ -191,17 +192,36 @@ class CSourceCrtMetadataModuleNode : public
runtime::ModuleNode {
<< "}\n";
}
+ void GenerateAOTDescriptor() {
+ code_ << "#include
\"tvm/runtime/crt/internal/aot_executor/aot_executor.h\"\n";
Review comment:
maybe should promote the tvm_model_t to a non-internal header though? I
think we consider the operator code as external to CRT
##########
File path: src/target/source/codegen_source_base.h
##########
@@ -155,7 +156,8 @@ runtime::Module CSourceModuleCreate(const String& code,
const String& fmt,
*/
runtime::Module CreateMetadataModule(
const std::unordered_map<std::string, runtime::NDArray>& params,
runtime::Module target_module,
- const Array<runtime::Module>& ext_modules, Target target);
+ const Array<runtime::Module>& ext_modules, Target target,
Review comment:
given this is just invoked from build_module.cc, maybe we should make
metadata have no default?
##########
File path: python/tvm/relay/build_module.py
##########
@@ -213,7 +218,7 @@ def _build_module_no_factory(mod, target=None,
target_host=None, params=None, mo
return build(mod, target, params=params, mod_name=mod_name).module
-def build(ir_mod, target=None, target_host=None, params=None,
mod_name="default"):
+def build(ir_mod, target=None, target_host=None, params=None,
mod_name="default", executor="graph"):
Review comment:
cc @tqchen @joresch would be great to get feedback on API changes here.
##########
File path: python/tvm/relay/backend/executor_factory.py
##########
@@ -14,21 +14,125 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-"""Graph executor factory."""
+"""Executor factory modules."""
+from abc import abstractmethod
import warnings
+
+from tvm import tir
+
from ..._ffi.base import string_types
from ..._ffi.registry import get_global_func
from ...runtime import ndarray
-class GraphExecutorFactoryModule:
+class ExecutorFactoryModule:
+ """Common interface for executor factory modules
+ This class describes the common API of different
+ factory modules
+ """
+
+ @abstractmethod
+ def get_internal_repr(self):
+ """Common function to return the internal representation
Review comment:
can you address this one?
--
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]