tvm
Loading...
Searching...
No Matches
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 <tvm/runtime/base.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
51TVM_RUNTIME_DLL void* TVMBackendAllocWorkspace(int device_type, int device_id, uint64_t nbytes,
52 int dtype_code_hint, int dtype_bits_hint);
53
64TVM_RUNTIME_DLL int TVMBackendFreeWorkspace(int device_type, int device_id, void* ptr);
65
69typedef struct {
75 int32_t num_task;
77
84typedef int (*FTVMParallelLambda)(int task_id, TVMParallelGroupEnv* penv, void* cdata);
85
96TVM_RUNTIME_DLL int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void* cdata, int num_task);
97
105
106#ifdef __cplusplus
107} // TVM_EXTERN_C
108#endif
109#endif // TVM_RUNTIME_C_BACKEND_API_H_
TVM_RUNTIME_DLL int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void *cdata, int num_task)
Backend function for running parallel jobs.
TVM_RUNTIME_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_RUNTIME_DLL int TVMBackendParallelBarrier(int task_id, TVMParallelGroupEnv *penv)
BSP barrrier between parallel threads.
int(* FTVMParallelLambda)(int task_id, TVMParallelGroupEnv *penv, void *cdata)
The callback function to execute a parallel lambda.
Definition c_backend_api.h:84
TVM_RUNTIME_DLL int TVMBackendFreeWorkspace(int device_type, int device_id, void *ptr)
Backend function to free temporal workspace.
#define TVM_RUNTIME_DLL
Definition base.h:92
Environment for TVM parallel task.
Definition c_backend_api.h:69
void * sync_handle
Auxiliary used for synchronization.
Definition c_backend_api.h:73
int32_t num_task
total amount of task
Definition c_backend_api.h:75