tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
page_allocator.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 
25 #ifndef TVM_RUNTIME_CRT_PAGE_ALLOCATOR_H_
26 #define TVM_RUNTIME_CRT_PAGE_ALLOCATOR_H_
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stdlib.h>
35 
36 extern int vleak_size;
37 
39 
49  tvm_crt_error_t (*Allocate)(MemoryManagerInterface* interface, size_t num_bytes, DLDevice dev,
50  void** out_ptr);
51 
60  tvm_crt_error_t (*Free)(MemoryManagerInterface* interface, void* ptr, DLDevice dev);
61 
64 };
65 
76  size_t memory_pool_size_bytes, size_t page_size_bytes_log2);
77 
78 #ifdef __cplusplus
79 } // extern "C"
80 #endif
81 
82 #endif // TVM_RUNTIME_CRT_PAGE_ALLOCATOR_H_
Defines integral error codes returned by the CRT.
tvm_crt_error_t
Definition: error_codes.h:50
int vleak_size
tvm_crt_error_t PageMemoryManagerCreate(MemoryManagerInterface **manager, uint8_t *memory_pool, size_t memory_pool_size_bytes, size_t page_size_bytes_log2)
Definition: page_allocator.h:40
tvm_crt_error_t(* Allocate)(MemoryManagerInterface *interface, size_t num_bytes, DLDevice dev, void **out_ptr)
Allocate a chunk of memory.
Definition: page_allocator.h:49
int vleak_size
Used in testing; the number of allocated objects.
Definition: page_allocator.h:63
tvm_crt_error_t(* Free)(MemoryManagerInterface *interface, void *ptr, DLDevice dev)
Free a chunk of previously-used memory.
Definition: page_allocator.h:60