• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021-2023 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 "acl/acl_rt.h"
17 
18 /**
19  * @ingroup AscendCL
20  * @brief synchronous memory replication between host and device
21  *
22  * @param dst [IN]       destination address pointer
23  * @param destMax [IN]   Max length of the destination address memory
24  * @param src [IN]       source address pointer
25  * @param count [IN]     the length of byte to copy
26  * @param kind [IN]      memcpy type
27  *
28  * @retval ACL_SUCCESS The function is successfully executed.
29  * @retval OtherValues Failure
30  */
aclrtMemcpy(void * dst,size_t destMax,const void * src,size_t count,aclrtMemcpyKind kind)31 ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count,
32                                          aclrtMemcpyKind kind) {
33   return ACL_ERROR_NONE;
34 }
35 
36 /**
37  * @ingroup AscendCL
38  * @brief  Asynchronous memory replication between Host and Device
39  *
40  * @par Function
41  *  After calling this interface,
42  *  be sure to call the aclrtSynchronizeStream interface to ensure that
43  *  the task of memory replication has been completed
44  *
45  * @par Restriction
46  * @li For on-chip Device-to-Device memory copy,
47  *     both the source and destination addresses must be 64-byte aligned
48  *
49  * @param dst [IN]     destination address pointer
50  * @param destMax [IN] Max length of destination address memory
51  * @param src [IN]     source address pointer
52  * @param count [IN]   the number of byte to copy
53  * @param kind [IN]    memcpy type
54  * @param stream [IN]  asynchronized task stream
55  *
56  * @retval ACL_SUCCESS The function is successfully executed.
57  * @retval OtherValues Failure
58  *
59  * @see aclrtSynchronizeStream
60  */
aclrtMemcpyAsync(void * dst,size_t destMax,const void * src,size_t count,aclrtMemcpyKind kind,aclrtStream stream)61 ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst, size_t destMax, const void *src, size_t count,
62                                               aclrtMemcpyKind kind, aclrtStream stream) {
63   return ACL_ERROR_NONE;
64 }
65 
66 /**
67  * @ingroup AscendCL
68  * @brief Specify the device used for computing in the current process, and implicitly create a default context
69  *
70  * @param deviceId [IN]    the device id of the resource used by this process
71  *
72  * @retval ACL_SUCCESS The function is successfully executed.
73  * @retval OtherValues Failure
74  */
aclrtSetDevice(int32_t deviceId)75 ACL_FUNC_VISIBILITY aclError aclrtSetDevice(int32_t deviceId) { return ACL_ERROR_NONE; }
76 
77 /**
78  * @ingroup AscendCL
79  * @brief Specify the device used for computing in the current process, and implicitly create a default context
80  *
81  * @param deviceId [IN]    the device id of the resource used by this process
82  *
83  * @retval ACL_SUCCESS The function is successfully executed.
84  * @retval OtherValues Failure
85  */
aclrtResetDevice(int32_t deviceId)86 ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId) { return ACL_ERROR_NONE; }
87 
88 /**
89  * @ingroup AscendCL
90  * @brief asynchronously initialize memory and set contents to specified value
91  *
92  * @par Function
93  * The memory to be initialized is on the Host or Device side
94  * and the system uses address to recognize that
95  *
96  * @param dst [IN]      destination address pointer
97  * @param destMax [IN]      max length of the destination address memory
98  * @param value [IN]      set value
99  * @param count [IN]      the number of byte to set
100  * @param stream [IN]      asynchronized task stream
101  *
102  * @retval ACL_SUCCESS The function is successfully executed.
103  * @retval OtherValues Failure
104  *
105  * @see aclrtSynchronizeStream
106  */
aclrtMemsetAsync(void * dst,size_t destMax,int32_t value,size_t count,aclrtStream stream)107 ACL_FUNC_VISIBILITY aclError aclrtMemsetAsync(void *dst, size_t destMax, int32_t value, size_t count,
108                                               aclrtStream stream) {
109   return ACL_ERROR_NONE;
110 }
111 
112 /**
113  * @ingroup AscendCL
114  * @brief Set the timeout interval for waiting of op
115  *
116  * @param timeout [IN]    op wait timeout
117  *
118  * @retval ACL_SUCCESS The function is successfully executed.
119  * @retval OtherValues Failure
120  */
aclrtSetOpWaitTimeout(uint32_t timeout)121 ACL_FUNC_VISIBILITY aclError aclrtSetOpWaitTimeout(uint32_t timeout) { return ACL_SUCCESS; }
122 
123 /**
124  * @ingroup AscendCL
125  * @brief Set the timeout interval for executing of op
126  *
127  * @param timeout [IN]    op execute timeout
128  *
129  * @retval ACL_SUCCESS The function is successfully executed.
130  * @retval OtherValues Failure
131  */
aclrtSetOpExecuteTimeOut(uint32_t timeout)132 ACL_FUNC_VISIBILITY aclError aclrtSetOpExecuteTimeOut(uint32_t timeout) { return ACL_SUCCESS; }
133 
134 /**
135  * @ingroup AscendCL
136  * @brief Initialize memory and set contents of memory to specified value
137  *
138  * @par Function
139  *  The memory to be initialized is on the Host or device side,
140  *  and the system determines whether
141  *  it is host or device according to the address
142  *
143  * @param devPtr [IN]    Starting address of memory
144  * @param maxCount [IN]  Max length of destination address memory
145  * @param value [IN]     Set value
146  * @param count [IN]     The length of memory
147  *
148  * @retval ACL_SUCCESS The function is successfully executed.
149  * @retval OtherValues Failure
150  */
aclrtMemset(void * devPtr,size_t maxCount,int32_t value,size_t count)151 ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count) {
152   return ACL_SUCCESS;
153 }
154 
aclrtDestroyStream(aclrtStream stream)155 ACL_FUNC_VISIBILITY aclError aclrtDestroyStream(aclrtStream stream) { return ACL_SUCCESS; }
156 
aclrtSetCurrentContext(aclrtContext context)157 ACL_FUNC_VISIBILITY aclError aclrtSetCurrentContext(aclrtContext context) { return ACL_SUCCESS; }
158 
aclrtGetDeviceCount(uint32_t * count)159 ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count) { return ACL_SUCCESS; }
160 
aclrtGetCurrentContext(aclrtContext * context)161 ACL_FUNC_VISIBILITY aclError aclrtGetCurrentContext(aclrtContext *context) { return ACL_SUCCESS; }
162 
aclrtGetMemInfo(aclrtMemAttr attr,size_t * free,size_t * total)163 ACL_FUNC_VISIBILITY aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total) { return ACL_SUCCESS; }
164 
aclrtFree(void * devPtr)165 ACL_FUNC_VISIBILITY aclError aclrtFree(void *devPtr) { return ACL_SUCCESS; }
166 
aclrtSynchronizeStream(aclrtStream stream)167 ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream) { return ACL_SUCCESS; }
168 
aclrtDestroyEvent(aclrtEvent event)169 ACL_FUNC_VISIBILITY aclError aclrtDestroyEvent(aclrtEvent event) { return ACL_SUCCESS; }
170 
aclrtCreateEventWithFlag(aclrtEvent * event,uint32_t flag)171 ACL_FUNC_VISIBILITY aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag) { return ACL_SUCCESS; }
172 
aclrtCreateStreamWithConfig(aclrtStream * stream,uint32_t priority,uint32_t flag)173 ACL_FUNC_VISIBILITY aclError aclrtCreateStreamWithConfig(aclrtStream *stream, uint32_t priority, uint32_t flag) {
174   return ACL_SUCCESS;
175 }
176 
aclrtRecordEvent(aclrtEvent event,aclrtStream stream)177 ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream) { return ACL_SUCCESS; }
aclrtStreamWaitEvent(aclrtStream stream,aclrtEvent event)178 ACL_FUNC_VISIBILITY aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event) { return ACL_SUCCESS; }
179 
aclrtSynchronizeEvent(aclrtEvent event)180 ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event) { return ACL_SUCCESS; }
181 
aclrtEventElapsedTime(float * ms,aclrtEvent startEvent,aclrtEvent endEvent)182 ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent startEvent, aclrtEvent endEvent) {
183   return ACL_SUCCESS;
184 }
185 
aclrtCreateEvent(aclrtEvent * event)186 ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event) { return ACL_SUCCESS; }
187 
aclrtCreateStream(aclrtStream * stream)188 ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream) { return ACL_SUCCESS; }
189 
aclrtSynchronizeStreamWithTimeout(aclrtStream stream,int32_t timeout)190 ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStreamWithTimeout(aclrtStream stream, int32_t timeout) {
191   return ACL_SUCCESS;
192 }
aclrtDestroyContext(aclrtContext context)193 ACL_FUNC_VISIBILITY aclError aclrtDestroyContext(aclrtContext context) { return ACL_SUCCESS; }
aclrtCreateContext(aclrtContext * context,int32_t deviceId)194 ACL_FUNC_VISIBILITY aclError aclrtCreateContext(aclrtContext *context, int32_t deviceId) { return ACL_SUCCESS; }
aclrtSetStreamFailureMode(aclrtStream stream,uint64_t mode)195 ACL_FUNC_VISIBILITY aclError aclrtSetStreamFailureMode(aclrtStream stream, uint64_t mode) { return ACL_SUCCESS; }
aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback)196 ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback) { return ACL_SUCCESS; }
aclrtGetTaskIdFromExceptionInfo(const aclrtExceptionInfo * info)197 ACL_FUNC_VISIBILITY uint32_t aclrtGetTaskIdFromExceptionInfo(const aclrtExceptionInfo *info) { return ACL_SUCCESS; }
aclrtGetStreamIdFromExceptionInfo(const aclrtExceptionInfo * info)198 ACL_FUNC_VISIBILITY uint32_t aclrtGetStreamIdFromExceptionInfo(const aclrtExceptionInfo *info) { return ACL_SUCCESS; }
aclrtGetThreadIdFromExceptionInfo(const aclrtExceptionInfo * info)199 ACL_FUNC_VISIBILITY uint32_t aclrtGetThreadIdFromExceptionInfo(const aclrtExceptionInfo *info) { return ACL_SUCCESS; }
aclrtGetDeviceIdFromExceptionInfo(const aclrtExceptionInfo * info)200 ACL_FUNC_VISIBILITY uint32_t aclrtGetDeviceIdFromExceptionInfo(const aclrtExceptionInfo *info) { return ACL_SUCCESS; }
aclrtGetErrorCodeFromExceptionInfo(const aclrtExceptionInfo * info)201 ACL_FUNC_VISIBILITY uint32_t aclrtGetErrorCodeFromExceptionInfo(const aclrtExceptionInfo *info) { return ACL_SUCCESS; }
aclrtMalloc(void ** devPtr,size_t size,aclrtMemMallocPolicy policy)202 ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy) {
203   return ACL_SUCCESS;
204 }
aclrtStreamQuery(aclrtStream stream,aclrtStreamStatus * status)205 ACL_FUNC_VISIBILITY aclError aclrtStreamQuery(aclrtStream stream, aclrtStreamStatus *status) { return ACL_SUCCESS; }
aclrtQueryEventStatus(aclrtEvent event,aclrtEventRecordedStatus * status)206 ACL_FUNC_VISIBILITY aclError aclrtQueryEventStatus(aclrtEvent event, aclrtEventRecordedStatus *status) {
207   return ACL_SUCCESS;
208 }
aclrtUnmapMem(void * virPtr)209 ACL_FUNC_VISIBILITY aclError aclrtUnmapMem(void *virPtr) { return ACL_SUCCESS; }
aclrtReserveMemAddress(void ** virPtr,size_t size,size_t alignment,void * expectPtr,uint64_t flags)210 ACL_FUNC_VISIBILITY aclError aclrtReserveMemAddress(void **virPtr, size_t size, size_t alignment, void *expectPtr,
211                                                     uint64_t flags) {
212   return ACL_SUCCESS;
213 }
aclrtMallocPhysical(aclrtDrvMemHandle * handle,size_t size,const aclrtPhysicalMemProp * prop,uint64_t flags)214 ACL_FUNC_VISIBILITY aclError aclrtMallocPhysical(aclrtDrvMemHandle *handle, size_t size,
215                                                  const aclrtPhysicalMemProp *prop, uint64_t flags) {
216   return ACL_SUCCESS;
217 }
aclrtMapMem(void * virPtr,size_t size,size_t offset,aclrtDrvMemHandle handle,uint64_t flags)218 ACL_FUNC_VISIBILITY aclError aclrtMapMem(void *virPtr, size_t size, size_t offset, aclrtDrvMemHandle handle,
219                                          uint64_t flags) {
220   return ACL_SUCCESS;
221 }
aclrtFreePhysical(aclrtDrvMemHandle handle)222 ACL_FUNC_VISIBILITY aclError aclrtFreePhysical(aclrtDrvMemHandle handle) { return ACL_SUCCESS; }
aclrtReleaseMemAddress(void * virPtr)223 ACL_FUNC_VISIBILITY aclError aclrtReleaseMemAddress(void *virPtr) { return ACL_SUCCESS; }
aclrtGetSocName()224 ACL_FUNC_VISIBILITY const char *aclrtGetSocName() { return "910"; }
225