tvm
metadata_types.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 
20 // LINT_C_FILE
21 
27 #ifndef TVM_RUNTIME_METADATA_TYPES_H_
28 #define TVM_RUNTIME_METADATA_TYPES_H_
29 
30 #include <inttypes.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
40 struct TVMMetadata {
42  int64_t version;
47  const struct TVMTensorInfo* inputs;
49  int64_t num_inputs;
54  const struct TVMTensorInfo* outputs;
56  int64_t num_outputs;
70  const char* mod_name;
71 };
72 
79 struct TVMTensorInfo {
81  const char* name;
83  const int64_t* shape;
85  int64_t num_shape;
87  DLDataType dtype;
88 };
89 
96  const char* name_hint;
98  int64_t byte_offset;
100  int64_t data_len;
102  const void* data_bytes;
103 };
104 
105 #ifdef __cplusplus
106 } // extern "C"
107 #endif
108 
109 #endif // TVM_RUNTIME_METADATA_TYPES_H_
Describes one constant argument to run_model.
Definition: metadata_types.h:94
const void * data_bytes
data bytes of serialized NDArray
Definition: metadata_types.h:102
int64_t byte_offset
Offset in bytes of the constant.
Definition: metadata_types.h:98
const char * name_hint
Name of the constant.
Definition: metadata_types.h:96
int64_t data_len
length of the data_bytes field
Definition: metadata_types.h:100
Top-level metadata structure. Holds all other metadata types.
Definition: metadata_types.h:40
const struct TVMConstantInfo * constant_pools
Constant pools needed by the AOT main function.
Definition: metadata_types.h:66
int64_t num_outputs
Number of elements in outputs array.
Definition: metadata_types.h:56
const char * mod_name
Name of the model, as passed to tvm.relay.build.
Definition: metadata_types.h:70
const struct TVMTensorInfo * workspace_pools
Workspace Memory Pools needed by the AOT main function. The order of the elements is the same as in t...
Definition: metadata_types.h:61
int64_t num_workspace_pools
Number of elements in workspace_pools array.
Definition: metadata_types.h:63
const struct TVMTensorInfo * inputs
Inputs to the AOT run_model function. The order of the elements is the same as in the arguments to ru...
Definition: metadata_types.h:47
int64_t version
Version identifier for this metadata.
Definition: metadata_types.h:42
const struct TVMTensorInfo * outputs
Outputs of the AOT run_model function. The order of the elements is the same as in the arguments to r...
Definition: metadata_types.h:54
int64_t num_inputs
Number of elements in inputs array.
Definition: metadata_types.h:49
int64_t num_constant_pools
Number of elements in constant_pools array.
Definition: metadata_types.h:68
Describes one tensor argument to run_model. NOTE: while TIR allows for other types of arguments,...
Definition: metadata_types.h:79
int64_t num_shape
Rank of this tensor.
Definition: metadata_types.h:85
DLDataType dtype
Data type of one element of this tensor.
Definition: metadata_types.h:87
const char * name
Name of the tensor, as specified in the Relay program.
Definition: metadata_types.h:81
const int64_t * shape
Shape of the tensor.
Definition: metadata_types.h:83