tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aot_executor.h
Go to the documentation of this file.
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 
24 #ifndef TVM_RUNTIME_CRT_AOT_EXECUTOR_H_
25 #define TVM_RUNTIME_CRT_AOT_EXECUTOR_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include <dlpack/dlpack.h>
32 #include <tvm/runtime/crt/internal/common/ndarray.h>
34 
35 typedef struct TVMMetadata TVMMetadata;
36 
37 typedef struct TVMAotExecutor {
43  DLDevice device;
45  TVMNDArray* args;
46  int64_t num_args;
48 
58 int TVMAotExecutor_Create(TVMModuleHandle module_handle, const DLDevice device,
59  TVMAotExecutor** executor, const char* module_name);
60 
68 int TVMAotExecutor_Release(TVMAotExecutor* executor, const DLDevice device);
69 
77 
85 
93 int TVMAotExecutor_GetInputIndex(TVMAotExecutor* executor, const char* name);
94 
103 int TVMAotExecutor_GetInputName(TVMAotExecutor* executor, int index, const char** name);
104 
112 
113 #ifdef __cplusplus
114 } // extern "C"
115 #endif
116 
117 #endif // TVM_RUNTIME_CRT_AOT_EXECUTOR_H_
int TVMAotExecutor_Release(TVMAotExecutor *executor, const DLDevice device)
Release the AoT executor created by TVMAotExecutor_Create().
struct TVMAotExecutor TVMAotExecutor
int TVMAotExecutor_GetNumOutputs(TVMAotExecutor *executor)
Return the number of outputs.
int TVMAotExecutor_GetNumInputs(TVMAotExecutor *executor)
Return the number of inputs.
int TVMAotExecutor_GetInputName(TVMAotExecutor *executor, int index, const char **name)
Return a pointer to name of input with the specified input index.
int TVMAotExecutor_Run(TVMAotExecutor *executor)
Run the generated program.
int TVMAotExecutor_Create(TVMModuleHandle module_handle, const DLDevice device, TVMAotExecutor **executor, const char *module_name)
Allocate a new AotExecutor with TVMPlatformMemoryAllocate and initialize it.
int TVMAotExecutor_GetInputIndex(TVMAotExecutor *executor, const char *name)
Return the input index of the specified input name.
void * TVMModuleHandle
Handle to TVM runtime modules.
Definition: c_runtime_api.h:227
Defines types which can be used in metadata here which are also shared between C and C++ code bases.
Definition: aot_executor.h:37
TVMModuleHandle module_handle
The code module that contains the compiled model.
Definition: aot_executor.h:41
const TVMMetadata * metadata
The top-level metadata structure supplied by the generated code.
Definition: aot_executor.h:39
DLDevice device
The device type.
Definition: aot_executor.h:43
int64_t num_args
Definition: aot_executor.h:46
TVMNDArray * args
List of allocated arguments, input(s), output(s), and pool(s)
Definition: aot_executor.h:45
Top-level metadata structure. Holds all other metadata types.
Definition: metadata_types.h:40