1 /**
2 * Copyright 2020 Huawei Technologies Co., Ltd
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "runtime/base.h"
17 #include "runtime/context.h"
18 #include "runtime/dev.h"
19 #include "runtime/event.h"
20 #include "runtime/kernel.h"
21 #include "runtime/mem.h"
22 #include "runtime/rt_model.h"
23 #include "runtime/stream.h"
24 #include "toolchain/adx_datadump_server.h"
25
rtEventSynchronize(rtEvent_t event)26 rtError_t rtEventSynchronize(rtEvent_t event) { return RT_ERROR_NONE; }
27
rtEventCreateWithFlag(rtEvent_t * event,uint32_t flag)28 rtError_t rtEventCreateWithFlag(rtEvent_t *event, uint32_t flag) { return RT_ERROR_NONE; }
29
rtEventElapsedTime(float * time,rtEvent_t start,rtEvent_t end)30 rtError_t rtEventElapsedTime(float *time, rtEvent_t start, rtEvent_t end) { return RT_ERROR_NONE; }
31
rtMalloc(void ** devPtr,uint64_t size,rtMemType_t type)32 rtError_t rtMalloc(void **devPtr, uint64_t size, rtMemType_t type) { return RT_ERROR_NONE; }
33
rtMemcpy(void * dst,uint64_t destMax,const void * src,uint64_t count,rtMemcpyKind_t kind)34 rtError_t rtMemcpy(void *dst, uint64_t destMax, const void *src, uint64_t count, rtMemcpyKind_t kind) {
35 return RT_ERROR_NONE;
36 }
37
rtMemset(void * devPtr,uint64_t destMax,uint32_t value,uint64_t count)38 rtError_t rtMemset(void *devPtr, uint64_t destMax, uint32_t value, uint64_t count) { return RT_ERROR_NONE; }
39
rtGetDeviceCount(int32_t * count)40 rtError_t rtGetDeviceCount(int32_t *count) { return RT_ERROR_NONE; }
41
rtSetDevice(int32_t device)42 rtError_t rtSetDevice(int32_t device) { return RT_ERROR_NONE; }
43
rtDeviceReset(int32_t device)44 rtError_t rtDeviceReset(int32_t device) { return RT_ERROR_NONE; }
45
rtCtxCreate(rtContext_t * ctx,uint32_t flags,int32_t device)46 rtError_t rtCtxCreate(rtContext_t *ctx, uint32_t flags, int32_t device) { return RT_ERROR_NONE; }
47
rtCtxSetCurrent(rtContext_t ctx)48 rtError_t rtCtxSetCurrent(rtContext_t ctx) { return RT_ERROR_NONE; }
49
rtCtxDestroy(rtContext_t ctx)50 rtError_t rtCtxDestroy(rtContext_t ctx) { return RT_ERROR_NONE; }
51
rtStreamCreate(rtStream_t * stream,int32_t priority)52 rtError_t rtStreamCreate(rtStream_t *stream, int32_t priority) { return RT_ERROR_NONE; }
53
rtStreamDestroy(rtStream_t stream)54 rtError_t rtStreamDestroy(rtStream_t stream) { return RT_ERROR_NONE; }
55
rtDevBinaryRegister(const rtDevBinary_t * bin,void ** handle)56 rtError_t rtDevBinaryRegister(const rtDevBinary_t *bin, void **handle) { return RT_ERROR_NONE; }
57
rtFunctionRegister(void * binHandle,const void * stubFunc,const char * stubName,const void * devFunc,uint32_t funcMode)58 rtError_t rtFunctionRegister(void *binHandle, const void *stubFunc, const char *stubName, const void *devFunc,
59 uint32_t funcMode) {
60 return RT_ERROR_NONE;
61 }
62
rtSetSocVersion(const char * version)63 RTS_API rtError_t rtSetSocVersion(const char *version) { return RT_ERROR_NONE; }
64
rtGetSocVersion(char * version,const uint32_t maxLen)65 rtError_t rtGetSocVersion(char *version, const uint32_t maxLen) { return RT_ERROR_NONE; }
66
rtKernelLaunch(const void * stubFunc,uint32_t blockDim,void * args,uint32_t argsSize,rtSmDesc_t * smDesc,rtStream_t stream)67 rtError_t rtKernelLaunch(const void *stubFunc, uint32_t blockDim, void *args, uint32_t argsSize, rtSmDesc_t *smDesc,
68 rtStream_t stream) {
69 return RT_ERROR_NONE;
70 }
71
rtStreamSynchronize(rtStream_t stream)72 rtError_t rtStreamSynchronize(rtStream_t stream) { return RT_ERROR_NONE; }
73
rtKernelLaunchEx(void * args,uint32_t argsSize,uint32_t flags,rtStream_t stream_)74 rtError_t rtKernelLaunchEx(void *args, uint32_t argsSize, uint32_t flags, rtStream_t stream_) { return RT_ERROR_NONE; }
75
rtFree(void * devPtr)76 rtError_t rtFree(void *devPtr) {
77 delete[] reinterpret_cast<uint8_t *>(devPtr);
78 return RT_ERROR_NONE;
79 }
80
rtModelExecute(rtModel_t model,rtStream_t stream,uint32_t flag)81 rtError_t rtModelExecute(rtModel_t model, rtStream_t stream, uint32_t flag) { return RT_ERROR_NONE; }
82
rtMemAllocManaged(void ** ptr,uint64_t size,uint32_t flag)83 rtError_t rtMemAllocManaged(void **ptr, uint64_t size, uint32_t flag) { return RT_ERROR_NONE; }
84
rtMemcpyAsync(void * dst,uint64_t destMax,const void * src,uint64_t count,rtMemcpyKind_t kind,rtStream_t stream)85 rtError_t rtMemcpyAsync(void *dst, uint64_t destMax, const void *src, uint64_t count, rtMemcpyKind_t kind,
86 rtStream_t stream) {
87 return RT_ERROR_NONE;
88 }
89
rtLabelSwitch(void * ptr,rtCondition_t condition,uint32_t value,rtLabel_t trueLabel,rtStream_t stream)90 rtError_t rtLabelSwitch(void *ptr, rtCondition_t condition, uint32_t value, rtLabel_t trueLabel, rtStream_t stream) {
91 return RT_ERROR_NONE;
92 }
93
rtStreamSwitch(void * ptr,rtCondition_t condition,int64_t value,rtStream_t true_stream,rtStream_t stream)94 rtError_t rtStreamSwitch(void *ptr, rtCondition_t condition, int64_t value, rtStream_t true_stream, rtStream_t stream) {
95 return RT_ERROR_NONE;
96 }
rtStreamSwitchEx(void * ptr,rtCondition_t condition,void * value_ptr,rtStream_t true_stream,rtStream_t stream,rtSwitchDataType_t dataType)97 rtError_t rtStreamSwitchEx(void *ptr, rtCondition_t condition, void *value_ptr, rtStream_t true_stream,
98 rtStream_t stream, rtSwitchDataType_t dataType) {
99 return RT_ERROR_NONE;
100 }
101
rtKernelFusionEnd(rtStream_t stream)102 rtError_t rtKernelFusionEnd(rtStream_t stream) { return RT_ERROR_NONE; }
103
rtKernelFusionStart(rtStream_t stream)104 rtError_t rtKernelFusionStart(rtStream_t stream) { return RT_ERROR_NONE; }
105
rtStreamWaitEvent(rtStream_t stream,rtEvent_t event)106 rtError_t rtStreamWaitEvent(rtStream_t stream, rtEvent_t event) { return RT_ERROR_NONE; }
107
rtEventReset(rtEvent_t event,rtStream_t stream)108 rtError_t rtEventReset(rtEvent_t event, rtStream_t stream) { return RT_ERROR_NONE; }
109
rtEventRecord(rtEvent_t event,rtStream_t stream)110 rtError_t rtEventRecord(rtEvent_t event, rtStream_t stream) { return RT_ERROR_NONE; }
111
rtLabelGoto(rtLabel_t label,rtStream_t stream)112 rtError_t rtLabelGoto(rtLabel_t label, rtStream_t stream) { return RT_ERROR_NONE; }
113
rtLabelSet(rtLabel_t label,rtStream_t stream)114 rtError_t rtLabelSet(rtLabel_t label, rtStream_t stream) { return RT_ERROR_NONE; }
115
rtStreamActive(rtStream_t active_stream,rtStream_t stream)116 rtError_t rtStreamActive(rtStream_t active_stream, rtStream_t stream) { return RT_ERROR_NONE; }
117
rtModelUnbindStream(rtModel_t model,rtStream_t stream)118 rtError_t rtModelUnbindStream(rtModel_t model, rtStream_t stream) { return RT_ERROR_NONE; }
119
rtLabelDestroy(rtLabel_t label)120 rtError_t rtLabelDestroy(rtLabel_t label) { return RT_ERROR_NONE; }
121
rtModelDestroy(rtModel_t model)122 rtError_t rtModelDestroy(rtModel_t model) { return RT_ERROR_NONE; }
123
rtEventDestroy(rtEvent_t event)124 rtError_t rtEventDestroy(rtEvent_t event) { return RT_ERROR_NONE; }
125
rtMemFreeManaged(void * ptr)126 rtError_t rtMemFreeManaged(void *ptr) { return RT_ERROR_NONE; }
127
rtModelCreate(rtModel_t * model,uint32_t flag)128 rtError_t rtModelCreate(rtModel_t *model, uint32_t flag) { return RT_ERROR_NONE; }
129
rtModelBindStream(rtModel_t model,rtStream_t stream,uint32_t flag)130 rtError_t rtModelBindStream(rtModel_t model, rtStream_t stream, uint32_t flag) { return RT_ERROR_NONE; }
131
rtStreamCreateWithFlags(rtStream_t * stream,int32_t priority,uint32_t flags)132 rtError_t rtStreamCreateWithFlags(rtStream_t *stream, int32_t priority, uint32_t flags) { return RT_ERROR_NONE; }
133
rtEventCreate(rtEvent_t * event)134 rtError_t rtEventCreate(rtEvent_t *event) { return RT_ERROR_NONE; }
135
rtLabelCreate(rtLabel_t * label)136 rtError_t rtLabelCreate(rtLabel_t *label) { return RT_ERROR_NONE; }
137
rtModelLoadComplete(rtModel_t model)138 rtError_t rtModelLoadComplete(rtModel_t model) { return RT_ERROR_NONE; }
139
rtCtxGetCurrent(rtContext_t * ctx)140 rtError_t rtCtxGetCurrent(rtContext_t *ctx) { return RT_ERROR_NONE; }
141
rtGetStreamId(rtStream_t stream,int32_t * streamId)142 rtError_t rtGetStreamId(rtStream_t stream, int32_t *streamId) { return RT_ERROR_NONE; }
143
rtGetFunctionByName(const char * stubName,void ** stubFunc)144 rtError_t rtGetFunctionByName(const char *stubName, void **stubFunc) { return RT_ERROR_NONE; }
145
rtSetTaskGenCallback(rtTaskGenCallback callback)146 rtError_t rtSetTaskGenCallback(rtTaskGenCallback callback) { return RT_ERROR_NONE; }
147
rtProfilerStart(uint64_t profConfig,int32_t numsDev,uint32_t * deviceList)148 RTS_API rtError_t rtProfilerStart(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList) { return RT_ERROR_NONE; }
149
rtProfilerStop(uint64_t profConfig,int32_t numsDev,uint32_t * deviceList)150 RTS_API rtError_t rtProfilerStop(uint64_t profConfig, int32_t numsDev, uint32_t *deviceList) { return RT_ERROR_NONE; }
151
AdxDataDumpServerInit()152 int AdxDataDumpServerInit() { return 0; }
153
AdxDataDumpServerUnInit()154 int AdxDataDumpServerUnInit() { return 0; }
155
rtGetTaskIdAndStreamID(uint32_t * taskid,uint32_t * streamid)156 RTS_API rtError_t rtGetTaskIdAndStreamID(uint32_t *taskid, uint32_t *streamid) { return RT_ERROR_NONE; }
157
rtSetTaskFailCallback(rtTaskFailCallback callback)158 RTS_API rtError_t rtSetTaskFailCallback(rtTaskFailCallback callback) { return RT_ERROR_NONE; }
159
rtRegDeviceStateCallback(const char * regName,rtDeviceStateCallback callback)160 RTS_API rtError_t rtRegDeviceStateCallback(const char *regName, rtDeviceStateCallback callback) {
161 return RT_ERROR_NONE;
162 }
163
rtSetMsprofReporterCallback(MsprofReporterCallback callback)164 RTS_API rtError_t rtSetMsprofReporterCallback(MsprofReporterCallback callback) { return RT_ERROR_NONE; }
165
rtRegTaskFailCallbackByModule(const char * moduleName,rtTaskFailCallback callback)166 RTS_API rtError_t rtRegTaskFailCallbackByModule(const char *moduleName, rtTaskFailCallback callback) {
167 return RT_ERROR_NONE;
168 }
169
rtRegisterAllKernel(const rtDevBinary_t * bin,void ** module)170 RTS_API rtError_t rtRegisterAllKernel(const rtDevBinary_t *bin, void **module) { return RT_ERROR_NONE; }
171
rtDevBinaryUnRegister(void * handle)172 RTS_API rtError_t rtDevBinaryUnRegister(void *handle) { return RT_ERROR_NONE; }
173
rtMemsetAsync(void * ptr,uint64_t destMax,uint32_t value,uint64_t count,rtStream_t stream)174 RTS_API rtError_t rtMemsetAsync(void *ptr, uint64_t destMax, uint32_t value, uint64_t count, rtStream_t stream) {
175 return RT_ERROR_NONE;
176 }
177
rtLabelListCpy(rtLabel_t * label,uint32_t labelNumber,void * dst,uint32_t dstMax)178 RTS_API rtError_t rtLabelListCpy(rtLabel_t *label, uint32_t labelNumber, void *dst, uint32_t dstMax) {
179 return RT_ERROR_NONE;
180 }
181
rtModelGetTaskId(rtModel_t model,uint32_t * taskid,uint32_t * streamid)182 RTS_API rtError_t rtModelGetTaskId(rtModel_t model, uint32_t *taskid, uint32_t *streamid) { return RT_ERROR_NONE; }
183
rtModelGetId(rtModel_t model,uint32_t * modelId)184 RTS_API rtError_t rtModelGetId(rtModel_t model, uint32_t *modelId) { return RT_ERROR_NONE; }
185
rtLabelCreateEx(rtLabel_t * label,rtStream_t stream)186 RTS_API rtError_t rtLabelCreateEx(rtLabel_t *label, rtStream_t stream) { return RT_ERROR_NONE; }
187
rtCpuKernelLaunchWithFlag(const void * soName,const void * kernelName,uint32_t blockDim,const void * args,uint32_t argsSize,rtSmDesc_t * smDesc,rtStream_t stream,uint32_t flags)188 RTS_API rtError_t rtCpuKernelLaunchWithFlag(const void *soName, const void *kernelName, uint32_t blockDim,
189 const void *args, uint32_t argsSize, rtSmDesc_t *smDesc, rtStream_t stream,
190 uint32_t flags) {
191 return RT_ERROR_NONE;
192 }
193
rtLabelSwitchByIndex(void * ptr,uint32_t max,void * labelInfoPtr,rtStream_t stream)194 RTS_API rtError_t rtLabelSwitchByIndex(void *ptr, uint32_t max, void *labelInfoPtr, rtStream_t stream) {
195 return RT_ERROR_NONE;
196 }
197
rtProfilerTrace(uint64_t id,bool notify,uint32_t flags,rtStream_t stream)198 RTS_API rtError_t rtProfilerTrace(uint64_t id, bool notify, uint32_t flags, rtStream_t stream) { return RT_ERROR_NONE; }
199
rtProfilerTraceEx(uint64_t id,uint64_t modelId,uint16_t tagId,rtStream_t stream)200 RTS_API rtError_t rtProfilerTraceEx(uint64_t id, uint64_t modelId, uint16_t tagId, rtStream_t stream) { return RT_ERROR_NONE; }
201
rtKernelLaunchWithFlag(const void * stubFunc,uint32_t blockDim,void * args,uint32_t argsSize,rtSmDesc_t * smDesc,rtStream_t stream,uint32_t flags)202 RTS_API rtError_t rtKernelLaunchWithFlag(const void *stubFunc, uint32_t blockDim, void *args, uint32_t argsSize,
203 rtSmDesc_t *smDesc, rtStream_t stream, uint32_t flags) {
204 return RT_ERROR_NONE;
205 }
206
rtMemGetInfoEx(rtMemInfoType_t memInfoType,size_t * free,size_t * total)207 RTS_API rtError_t rtMemGetInfoEx(rtMemInfoType_t memInfoType, size_t *free, size_t *total) { return RT_ERROR_NONE; }
208
rtProfRegisterCtrlCallback(uint32_t moduleId,rtProfCtrlHandle callback)209 RTS_API rtError_t rtProfRegisterCtrlCallback(uint32_t moduleId, rtProfCtrlHandle callback) { return RT_ERROR_NONE; }
210