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 source_module.h |
22 | * \brief Source code module |
23 | */ |
24 | |
25 | #ifndef TVM_TARGET_SOURCE_SOURCE_MODULE_H_ |
26 | #define TVM_TARGET_SOURCE_SOURCE_MODULE_H_ |
27 | |
28 | #include <tvm/relay/runtime.h> |
29 | #include <tvm/runtime/metadata.h> |
30 | #include <tvm/runtime/module.h> |
31 | #include <tvm/target/target.h> |
32 | |
33 | #include "../../relay/backend/utils.h" |
34 | #include "../../runtime/meta_data.h" |
35 | |
36 | namespace tvm { |
37 | namespace codegen { |
38 | |
39 | /*! |
40 | |
41 | * \brief Wrap the submodules that are to be wrapped in a c-source metadata module for C runtime. |
42 | * \param modules The modules to be wrapped. |
43 | * \param target the target the modules are compiled for. |
44 | * \param runtime the runtime to code generate against |
45 | * \param metadata Compiler-generated metadata exported to runtime. |
46 | * \param aot_metadata If supplied, metadata for the AOTExecutor module. |
47 | * \return The wrapped module. |
48 | */ |
49 | runtime::Module CreateCSourceCrtMetadataModule(const Array<runtime::Module>& modules, Target target, |
50 | relay::Runtime runtime, |
51 | relay::backend::ExecutorCodegenMetadata metadata, |
52 | runtime::metadata::Metadata aot_metadata); |
53 | |
54 | /*! |
55 | * \brief Create C++-runtime targeted metadata module for "c" backend. |
56 | * \param metadata Compiler-generated metadata. |
57 | */ |
58 | runtime::Module CreateCSourceCppMetadataModule(runtime::metadata::Metadata metadata); |
59 | |
60 | } // namespace codegen |
61 | } // namespace tvm |
62 | |
63 | #endif // TVM_TARGET_SOURCE_SOURCE_MODULE_H_ |
64 | |