PandA-2024.02
c_backend_api.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 
28 #ifndef TVM_RUNTIME_C_BACKEND_API_H_
29 #define TVM_RUNTIME_C_BACKEND_API_H_
30 
31 #include "c_runtime_api.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 // Backend related functions.
48 TVM_DLL int TVMBackendGetFuncFromEnv(void* mod_node,
49  const char* func_name,
50  TVMFunctionHandle *out);
58 TVM_DLL int TVMBackendRegisterSystemLibSymbol(const char* name, void* ptr);
59 
74 TVM_DLL void* TVMBackendAllocWorkspace(int device_type,
75  int device_id,
76  uint64_t nbytes,
77  int dtype_code_hint,
78  int dtype_bits_hint);
79 
90 TVM_DLL int TVMBackendFreeWorkspace(int device_type,
91  int device_id,
92  void* ptr);
93 
97 typedef struct {
101  void* sync_handle;
103  int32_t num_task;
105 
112 typedef int (*FTVMParallelLambda)(
113  int task_id, TVMParallelGroupEnv* penv, void* cdata);
114 
126  void* cdata,
127  int num_task);
128 
136 
137 
149 TVM_DLL int TVMBackendRunOnce(void** handle,
150  int (*f)(void*),
151  void *cdata,
152  int nbytes);
153 
154 #ifdef __cplusplus
155 } // TVM_EXTERN_C
156 #endif
157 #endif // TVM_RUNTIME_C_BACKEND_API_H_
TVM_DLL int TVMBackendRegisterSystemLibSymbol(const char *name, void *ptr)
Backend function to register system-wide library symbol.
TVM_DLL int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void *cdata, int num_task)
Backend function for running parallel jobs.
Environment for TVM parallel task.
Definition: c_backend_api.h:97
TVM_DLL int TVMBackendRunOnce(void **handle, int(*f)(void *), void *cdata, int nbytes)
Simple static initialization function. Run f once and set handle to be not null. This function is mai...
TVM_DLL int TVMBackendFreeWorkspace(int device_type, int device_id, void *ptr)
Backend function to free temporal workspace.
void * TVMFunctionHandle
Handle to packed function handle.
TVM_DLL int TVMBackendParallelBarrier(int task_id, TVMParallelGroupEnv *penv)
BSP barrrier between parallel threads.
unsigned int num_task
int(* FTVMParallelLambda)(int task_id, TVMParallelGroupEnv *penv, void *cdata)
The callback function to execute a parallel lambda.
void * sync_handle
Auxiliary used for synchronization.
#define TVM_DLL
Definition: c_runtime_api.h:59
TVM_DLL void * TVMBackendAllocWorkspace(int device_type, int device_id, uint64_t nbytes, int dtype_code_hint, int dtype_bits_hint)
Backend function to allocate temporal workspace.
TVM_DLL int TVMBackendGetFuncFromEnv(void *mod_node, const char *func_name, TVMFunctionHandle *out)
Backend function for modules to get function from its environment mod_node (its imports and global fu...
int32_t num_task
total amount of task

Generated on Mon Feb 12 2024 13:02:50 for PandA-2024.02 by doxygen 1.8.13