1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20/*!
21 * \file metadata_module.h
22 * \brief Declares functions that build MetadataModules for C++ and C runtimes.
23 */
24
25#ifndef TVM_TARGET_METADATA_MODULE_H_
26#define TVM_TARGET_METADATA_MODULE_H_
27
28#include <tvm/relay/executor.h>
29#include <tvm/relay/runtime.h>
30#include <tvm/runtime/module.h>
31#include <tvm/runtime/ndarray.h>
32#include <tvm/target/target.h>
33
34#include <string>
35#include <unordered_map>
36
37#include "../relay/backend/utils.h"
38
39namespace tvm {
40namespace codegen {
41
42/*!
43 * \brief Create a metadata module wrapper. The helper is used by different
44 * codegens, such as graph executor codegen and the vm compiler.
45 *
46 * \param params The metadata for initialization of all modules.
47 * \param target_module the internal module that is compiled by tvm.
48 * \param ext_modules The external modules that needs to be imported inside the metadata
49 * module(s).
50 * \param target The target that all the modules are compiled for
51 * \param runtime The runtime to codegen for
52 * \param metadata Module metadata
53 * \return The created metadata module that manages initialization of metadata.
54 */
55runtime::Module CreateMetadataModule(
56 const std::unordered_map<std::string, runtime::NDArray>& params, runtime::Module target_module,
57 const Array<runtime::Module>& ext_modules, Target target, tvm::relay::Runtime runtime,
58 tvm::relay::Executor executor, relay::backend::ExecutorCodegenMetadata metadata);
59
60} // namespace codegen
61} // namespace tvm
62
63#endif // TVM_TARGET_METADATA_MODULE_H_
64