已合并
[2.12.0][refactor]CANN ACL headers decouple #36008
Dring创建于 5月19日
[2.12.0][refactor]CANN ACL headers decouple #36008
已合并
Dring创建于 5月19日
30 个文件变更+85-11117
M.gitmodules+9-0
@@ -21,3 +21,12 @@
21 path = third_party/torch-mlir21 path = third_party/torch-mlir
22 url = https://gitee.com/mirrors_llvm/torch-mlir.git22 url = https://gitee.com/mirrors_llvm/torch-mlir.git
23 update = none23 update = none
24+[submodule "third_party/acl_src/runtime"]
25+ path = third_party/acl_src/runtime
26+ url = https://gitcode.com/cann/runtime.git
27+[submodule "third_party/acl_src/ge"]
28+ path = third_party/acl_src/ge
29+ url = https://gitcode.com/cann/ge.git
30+[submodule "third_party/acl_src/graph-autofusion"]
31+ path = third_party/acl_src/graph-autofusion
32+ url = https://gitcode.com/cann/graph-autofusion.git
Mgenerate_code.sh+32-0
@@ -13,6 +13,38 @@ IFS='.' read -ra version_parts <<< "$pytorch_version"
13 13 
14pytorch_dir="v${version_parts[0]}r${version_parts[1]}"14pytorch_dir="v${version_parts[0]}r${version_parts[1]}"
15 15 
16+# Fetch ACL headers from submodule paths
17+ACL_DEST="$CDIR/third_party/acl/inc/acl"
18+echo " --- Fetching ACL headers from submodules..."
19+ 
20+ACL_SRC="$CDIR/third_party/acl_src"
21+ 
22+# Copy runtime headers (lower priority, copied first)
23+if [ -d "$ACL_SRC/runtime/include/external/acl" ]; then
24+ mkdir -p "$ACL_DEST"
25+ cp -r "$ACL_SRC/runtime/include/external/acl/"* "$ACL_DEST/"
26+ echo " --- Copied runtime acl headers"
27+fi
28+ 
29+# Copy ge headers (higher priority, overwrites runtime)
30+if [ -d "$ACL_SRC/ge/inc/external/acl" ]; then
31+ mkdir -p "$ACL_DEST"
32+ cp -r "$ACL_SRC/ge/inc/external/acl/"* "$ACL_DEST/"
33+ echo " --- Copied ge acl headers"
34+fi
35+ 
36+# Copy super_kernel.h from graph-autofusion
37+SUPER_KERNEL_SRC="$ACL_SRC/graph-autofusion/super_kernel/include/super_kernel/super_kernel.h"
38+if [ -f "$SUPER_KERNEL_SRC" ]; then
39+ cp "$SUPER_KERNEL_SRC" "$ACL_DEST/super_kernel.h"
40+ echo " --- Copied super_kernel.h"
41+fi
42+ 
43+# Clean up submodule working directories
44+rm -rf "$ACL_SRC"
45+echo " --- Cleaned up acl_src submodule directories"
46+echo " --- ACL headers fetched successfully"
47+ 
16file=$CDIR/third_party/op-plugin/gencode.sh48file=$CDIR/third_party/op-plugin/gencode.sh
17 49 
18if [ -f "${file}" ]; then50if [ -f "${file}" ]; then
Dthird_party/acl/inc/acl/acl.h+0-18
@@ -1,18 +0,0 @@
1-/**
2-* @file acl.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_ACL_H_
12-#define INC_EXTERNAL_ACL_ACL_H_
13- 
14-#include "acl_rt.h"
15-#include "acl_op.h"
16-#include "acl_mdl.h"
17- 
18-#endif // INC_EXTERNAL_ACL_ACL_H_
Dthird_party/acl/inc/acl/acl_base.h+0-747
@@ -1,747 +0,0 @@
1-/**
2-* @file acl_base.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_ACL_BASE_H_
12-#define INC_EXTERNAL_ACL_ACL_BASE_H_
13- 
14-#include <stdint.h>
15-#include <stddef.h>
16-#include "error_codes/rt_error_codes.h"
17-#include "../ge/ge_error_codes.h"
18- 
19-#ifdef __cplusplus
20-extern "C" {
21-#endif
22- 
23-#if defined(_MSC_VER)
24-#ifdef FUNC_VISIBILITY
25-#define ACL_FUNC_VISIBILITY _declspec(dllexport)
26-#else
27-#define ACL_FUNC_VISIBILITY
28-#endif
29-#else
30-#ifdef FUNC_VISIBILITY
31-#define ACL_FUNC_VISIBILITY __attribute__((visibility("default")))
32-#else
33-#define ACL_FUNC_VISIBILITY
34-#endif
35-#endif
36- 
37-#ifdef __GNUC__
38-#define ACL_DEPRECATED __attribute__((deprecated))
39-#define ACL_DEPRECATED_MESSAGE(message) __attribute__((deprecated(message)))
40-#elif defined(_MSC_VER)
41-#define ACL_DEPRECATED __declspec(deprecated)
42-#define ACL_DEPRECATED_MESSAGE(message) __declspec(deprecated(message))
43-#else
44-#define ACL_DEPRECATED
45-#define ACL_DEPRECATED_MESSAGE(message)
46-#endif
47- 
48-typedef void *aclrtStream;
49-typedef void *aclrtEvent;
50-typedef void *aclrtContext;
51-typedef void *aclrtNotify;
52-typedef void *aclrtLabel;
53-typedef void *aclrtLabelList;
54-typedef void *aclrtMbuf;
55-typedef int aclError;
56-typedef uint16_t aclFloat16;
57-typedef struct aclDataBuffer aclDataBuffer;
58-typedef struct aclTensorDesc aclTensorDesc;
59-typedef void *aclrtAllocatorDesc;
60-typedef void *aclrtAllocator;
61-typedef void *aclrtAllocatorBlock;
62-typedef void *aclrtAllocatorAddr;
63-typedef void *aclrtTaskGrp;
64- 
65-static const int ACL_ERROR_NONE = 0;
66-static const int ACL_SUCCESS = 0;
67- 
68-static const int ACL_ERROR_INVALID_PARAM = 100000;
69-static const int ACL_ERROR_UNINITIALIZE = 100001;
70-static const int ACL_ERROR_REPEAT_INITIALIZE = 100002;
71-static const int ACL_ERROR_INVALID_FILE = 100003;
72-static const int ACL_ERROR_WRITE_FILE = 100004;
73-static const int ACL_ERROR_INVALID_FILE_SIZE = 100005;
74-static const int ACL_ERROR_PARSE_FILE = 100006;
75-static const int ACL_ERROR_FILE_MISSING_ATTR = 100007;
76-static const int ACL_ERROR_FILE_ATTR_INVALID = 100008;
77-static const int ACL_ERROR_INVALID_DUMP_CONFIG = 100009;
78-static const int ACL_ERROR_INVALID_PROFILING_CONFIG = 100010;
79-static const int ACL_ERROR_INVALID_MODEL_ID = 100011;
80-static const int ACL_ERROR_DESERIALIZE_MODEL = 100012;
81-static const int ACL_ERROR_PARSE_MODEL = 100013;
82-static const int ACL_ERROR_READ_MODEL_FAILURE = 100014;
83-static const int ACL_ERROR_MODEL_SIZE_INVALID = 100015;
84-static const int ACL_ERROR_MODEL_MISSING_ATTR = 100016;
85-static const int ACL_ERROR_MODEL_INPUT_NOT_MATCH = 100017;
86-static const int ACL_ERROR_MODEL_OUTPUT_NOT_MATCH = 100018;
87-static const int ACL_ERROR_MODEL_NOT_DYNAMIC = 100019;
88-static const int ACL_ERROR_OP_TYPE_NOT_MATCH = 100020;
89-static const int ACL_ERROR_OP_INPUT_NOT_MATCH = 100021;
90-static const int ACL_ERROR_OP_OUTPUT_NOT_MATCH = 100022;
91-static const int ACL_ERROR_OP_ATTR_NOT_MATCH = 100023;
92-static const int ACL_ERROR_OP_NOT_FOUND = 100024;
93-static const int ACL_ERROR_OP_LOAD_FAILED = 100025;
94-static const int ACL_ERROR_UNSUPPORTED_DATA_TYPE = 100026;
95-static const int ACL_ERROR_FORMAT_NOT_MATCH = 100027;
96-static const int ACL_ERROR_BIN_SELECTOR_NOT_REGISTERED = 100028;
97-static const int ACL_ERROR_KERNEL_NOT_FOUND = 100029;
98-static const int ACL_ERROR_BIN_SELECTOR_ALREADY_REGISTERED = 100030;
99-static const int ACL_ERROR_KERNEL_ALREADY_REGISTERED = 100031;
100-static const int ACL_ERROR_INVALID_QUEUE_ID = 100032;
101-static const int ACL_ERROR_REPEAT_SUBSCRIBE = 100033;
102-static const int ACL_ERROR_STREAM_NOT_SUBSCRIBE = 100034;
103-static const int ACL_ERROR_THREAD_NOT_SUBSCRIBE = 100035;
104-static const int ACL_ERROR_WAIT_CALLBACK_TIMEOUT = 100036;
105-static const int ACL_ERROR_REPEAT_FINALIZE = 100037;
106-static const int ACL_ERROR_NOT_STATIC_AIPP = 100038;
107-static const int ACL_ERROR_COMPILING_STUB_MODE = 100039;
108-static const int ACL_ERROR_GROUP_NOT_SET = 100040;
109-static const int ACL_ERROR_GROUP_NOT_CREATE = 100041;
110-static const int ACL_ERROR_PROF_ALREADY_RUN = 100042;
111-static const int ACL_ERROR_PROF_NOT_RUN = 100043;
112-static const int ACL_ERROR_DUMP_ALREADY_RUN = 100044;
113-static const int ACL_ERROR_DUMP_NOT_RUN = 100045;
114-static const int ACL_ERROR_PROF_REPEAT_SUBSCRIBE = 148046;
115-static const int ACL_ERROR_PROF_API_CONFLICT = 148047;
116-static const int ACL_ERROR_INVALID_MAX_OPQUEUE_NUM_CONFIG = 148048;
117-static const int ACL_ERROR_INVALID_OPP_PATH = 148049;
118-static const int ACL_ERROR_OP_UNSUPPORTED_DYNAMIC = 148050;
119-static const int ACL_ERROR_RELATIVE_RESOURCE_NOT_CLEARED = 148051;
120-static const int ACL_ERROR_UNSUPPORTED_JPEG = 148052;
121-static const int ACL_ERROR_INVALID_BUNDLE_MODEL_ID = 148053;
122- 
123-static const int ACL_ERROR_BAD_ALLOC = 200000;
124-static const int ACL_ERROR_API_NOT_SUPPORT = 200001;
125-static const int ACL_ERROR_INVALID_DEVICE = 200002;
126-static const int ACL_ERROR_MEMORY_ADDRESS_UNALIGNED = 200003;
127-static const int ACL_ERROR_RESOURCE_NOT_MATCH = 200004;
128-static const int ACL_ERROR_INVALID_RESOURCE_HANDLE = 200005;
129-static const int ACL_ERROR_FEATURE_UNSUPPORTED = 200006;
130-static const int ACL_ERROR_PROF_MODULES_UNSUPPORTED = 200007;
131- 
132-static const int ACL_ERROR_STORAGE_OVER_LIMIT = 300000;
133- 
134-static const int ACL_ERROR_INTERNAL_ERROR = 500000;
135-static const int ACL_ERROR_FAILURE = 500001;
136-static const int ACL_ERROR_GE_FAILURE = 500002;
137-static const int ACL_ERROR_RT_FAILURE = 500003;
138-static const int ACL_ERROR_DRV_FAILURE = 500004;
139-static const int ACL_ERROR_PROFILING_FAILURE = 500005;
140- 
141-#define ACL_TENSOR_SHAPE_RANGE_NUM 2
142-#define ACL_TENSOR_VALUE_RANGE_NUM 2
143-#define ACL_UNKNOWN_RANK 0xFFFFFFFFFFFFFFFE
144- 
145-typedef enum {
146- ACL_DT_UNDEFINED = -1,
147- ACL_FLOAT = 0,
148- ACL_FLOAT16 = 1,
149- ACL_INT8 = 2,
150- ACL_INT32 = 3,
151- ACL_UINT8 = 4,
152- ACL_INT16 = 6,
153- ACL_UINT16 = 7,
154- ACL_UINT32 = 8,
155- ACL_INT64 = 9,
156- ACL_UINT64 = 10,
157- ACL_DOUBLE = 11,
158- ACL_BOOL = 12,
159- ACL_STRING = 13,
160- ACL_COMPLEX64 = 16,
161- ACL_COMPLEX128 = 17,
162- ACL_BF16 = 27,
163- ACL_INT4 = 29,
164- ACL_UINT1 = 30,
165- ACL_COMPLEX32 = 33,
166- ACL_HIFLOAT8 = 34,
167- ACL_FLOAT8_E5M2 = 35,
168- ACL_FLOAT8_E4M3FN = 36,
169- ACL_FLOAT8_E8M0 = 37,
170- ACL_FLOAT6_E3M2 = 38,
171- ACL_FLOAT6_E2M3 = 39,
172- ACL_FLOAT4_E2M1 = 40,
173- ACL_FLOAT4_E1M2 = 41,
174-} aclDataType;
175- 
176-typedef enum {
177- ACL_FORMAT_UNDEFINED = -1,
178- ACL_FORMAT_NCHW = 0,
179- ACL_FORMAT_NHWC = 1,
180- ACL_FORMAT_ND = 2,
181- ACL_FORMAT_NC1HWC0 = 3,
182- ACL_FORMAT_FRACTAL_Z = 4,
183- ACL_FORMAT_NC1HWC0_C04 = 12,
184- ACL_FORMAT_HWCN = 16,
185- ACL_FORMAT_NDHWC = 27,
186- ACL_FORMAT_FRACTAL_NZ = 29,
187- ACL_FORMAT_NCDHW = 30,
188- ACL_FORMAT_NDC1HWC0 = 32,
189- ACL_FRACTAL_Z_3D = 33,
190- ACL_FORMAT_NC = 35,
191- ACL_FORMAT_NCL = 47,
192- ACL_FORMAT_FRACTAL_NZ_C0_16 = 50,
193- ACL_FORMAT_FRACTAL_NZ_C0_32 = 51,
194- ACL_FORMAT_FRACTAL_NZ_C0_2 = 52,
195- ACL_FORMAT_FRACTAL_NZ_C0_4 = 53,
196- ACL_FORMAT_FRACTAL_NZ_C0_8 = 54,
197-} aclFormat;
198- 
199-typedef enum {
200- ACL_DEBUG = 0,
201- ACL_INFO = 1,
202- ACL_WARNING = 2,
203- ACL_ERROR = 3,
204-} aclLogLevel;
205- 
206-typedef enum {
207- ACL_MEMTYPE_DEVICE = 0,
208- ACL_MEMTYPE_HOST = 1,
209- ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT = 2
210-} aclMemType;
211- 
212-typedef enum {
213- ACL_OPT_DETERMINISTIC = 0,
214- ACL_OPT_ENABLE_DEBUG_KERNEL = 1,
215- ACL_OPT_STRONG_CONSISTENCY = 2
216-} aclSysParamOpt;
217- 
218-typedef enum {
219- ACL_CANN_ATTR_UNDEFINED = -1,
220- ACL_CANN_ATTR_INF_NAN = 0,
221- ACL_CANN_ATTR_BF16 = 1,
222- ACL_CANN_ATTR_JIT_COMPILE = 2
223-} aclCannAttr;
224- 
225-typedef enum {
226- ACL_DEVICE_INFO_UNDEFINED = -1,
227- ACL_DEVICE_INFO_AI_CORE_NUM = 0,
228- ACL_DEVICE_INFO_VECTOR_CORE_NUM = 1,
229- ACL_DEVICE_INFO_L2_SIZE = 2
230-} aclDeviceInfo;
231- 
232-/**
233- * @ingroup AscendCL
234- * @brief Converts data of type aclFloat16 to data of type float
235- *
236- * @param value [IN] Data to be converted
237- *
238- * @retval Transformed data
239- */
240-ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value);
241- 
242-/**
243- * @ingroup AscendCL
244- * @brief Converts data of type float to data of type aclFloat16
245- *
246- * @param value [IN] Data to be converted
247- *
248- * @retval Transformed data
249- */
250-ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value);
251- 
252-/**
253- * @ingroup AscendCL
254- * @brief create data of aclDataBuffer
255- *
256- * @param data [IN] pointer to data
257- * @li Need to be managed by the user,
258- * call aclrtMalloc interface to apply for memory,
259- * call aclrtFree interface to release memory
260- *
261- * @param size [IN] size of data in bytes
262- *
263- * @retval pointer to created instance. nullptr if run out of memory
264- *
265- * @see aclrtMalloc | aclrtFree
266- */
267-ACL_FUNC_VISIBILITY aclDataBuffer *aclCreateDataBuffer(void *data, size_t size);
268- 
269-/**
270- * @ingroup AscendCL
271- * @brief destroy data of aclDataBuffer
272- *
273- * @par Function
274- * Only the aclDataBuffer type data is destroyed here.
275- * The memory of the data passed in when the aclDataDataBuffer interface
276- * is called to create aclDataBuffer type data must be released by the user
277- *
278- * @param dataBuffer [IN] pointer to the aclDataBuffer
279- *
280- * @retval ACL_SUCCESS The function is successfully executed.
281- * @retval OtherValues Failure
282- *
283- * @see aclCreateDataBuffer
284- */
285-ACL_FUNC_VISIBILITY aclError aclDestroyDataBuffer(const aclDataBuffer *dataBuffer);
286- 
287-/**
288- * @ingroup AscendCL
289- * @brief update new data of aclDataBuffer
290- *
291- * @param dataBuffer [OUT] pointer to aclDataBuffer
292- * @li The old data need to be released by the user, otherwise it may occur memory leak leakage
293- * call aclGetDataBufferAddr interface to get old data address
294- * call aclrtFree interface to release memory
295- *
296- * @param data [IN] pointer to new data
297- * @li Need to be managed by the user,
298- * call aclrtMalloc interface to apply for memory,
299- * call aclrtFree interface to release memory
300- *
301- * @param size [IN] size of data in bytes
302- *
303- * @retval ACL_SUCCESS The function is successfully executed.
304- * @retval OtherValues Failure
305- *
306- * @see aclrtMalloc | aclrtFree | aclGetDataBufferAddr
307- */
308-ACL_FUNC_VISIBILITY aclError aclUpdateDataBuffer(aclDataBuffer *dataBuffer, void *data, size_t size);
309- 
310-/**
311- * @ingroup AscendCL
312- * @brief get data address from aclDataBuffer
313- *
314- * @param dataBuffer [IN] pointer to the data of aclDataBuffer
315- *
316- * @retval data address
317- */
318-ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer);
319- 
320-/**
321- * @ingroup AscendCL
322- * @brief get data size of aclDataBuffer
323- *
324- * @param dataBuffer [IN] pointer to the data of aclDataBuffer
325- *
326- * @retval data size
327- */
328-ACL_DEPRECATED_MESSAGE("aclGetDataBufferSize is deprecated, use aclGetDataBufferSizeV2 instead")
329-ACL_FUNC_VISIBILITY uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer);
330- 
331-/**
332- * @ingroup AscendCL
333- * @brief get data size of aclDataBuffer to replace aclGetDataBufferSize
334- *
335- * @param dataBuffer [IN] pointer to the data of aclDataBuffer
336- *
337- * @retval data size
338- */
339-ACL_FUNC_VISIBILITY size_t aclGetDataBufferSizeV2(const aclDataBuffer *dataBuffer);
340- 
341-/**
342- * @ingroup AscendCL
343- * @brief get size of aclDataType
344- *
345- * @param dataType [IN] aclDataType data the size to get
346- *
347- * @retval size of the aclDataType
348- */
349-ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType);
350- 
351-// interfaces of tensor desc
352-/**
353- * @ingroup AscendCL
354- * @brief create data aclTensorDesc
355- *
356- * @param dataType [IN] Data types described by tensor
357- * @param numDims [IN] the number of dimensions of the shape
358- * @param dims [IN] the size of the specified dimension
359- * @param format [IN] tensor format
360- *
361- * @retval aclTensorDesc pointer.
362- * @retval nullptr if param is invalid or run out of memory
363- */
364-ACL_FUNC_VISIBILITY aclTensorDesc *aclCreateTensorDesc(aclDataType dataType,
365- int numDims,
366- const int64_t *dims,
367- aclFormat format);
368- 
369-/**
370- * @ingroup AscendCL
371- * @brief destroy data aclTensorDesc
372- *
373- * @param desc [IN] pointer to the data of aclTensorDesc to destroy
374- */
375-ACL_FUNC_VISIBILITY void aclDestroyTensorDesc(const aclTensorDesc *desc);
376- 
377-/**
378- * @ingroup AscendCL
379- * @brief set tensor shape range for aclTensorDesc
380- *
381- * @param desc [OUT] pointer to the data of aclTensorDesc
382- * @param dimsCount [IN] the number of dimensions of the shape
383- * @param dimsRange [IN] the range of dimensions of the shape
384- *
385- * @retval ACL_SUCCESS The function is successfully executed.
386- * @retval OtherValues Failure
387- */
388-ACL_FUNC_VISIBILITY aclError aclSetTensorShapeRange(aclTensorDesc* desc,
389- size_t dimsCount,
390- int64_t dimsRange[][ACL_TENSOR_SHAPE_RANGE_NUM]);
391- 
392-/**
393- * @ingroup AscendCL
394- * @brief set value range for aclTensorDesc
395- *
396- * @param desc [OUT] pointer to the data of aclTensorDesc
397- * @param valueCount [IN] the number of value
398- * @param valueRange [IN] the range of value
399- *
400- * @retval ACL_SUCCESS The function is successfully executed.
401- * @retval OtherValues Failure
402- */
403-ACL_FUNC_VISIBILITY aclError aclSetTensorValueRange(aclTensorDesc* desc,
404- size_t valueCount,
405- int64_t valueRange[][ACL_TENSOR_VALUE_RANGE_NUM]);
406-/**
407- * @ingroup AscendCL
408- * @brief get data type specified by the tensor description
409- *
410- * @param desc [IN] pointer to the instance of aclTensorDesc
411- *
412- * @retval data type specified by the tensor description.
413- * @retval ACL_DT_UNDEFINED if description is null
414- */
415-ACL_FUNC_VISIBILITY aclDataType aclGetTensorDescType(const aclTensorDesc *desc);
416- 
417-/**
418- * @ingroup AscendCL
419- * @brief get data format specified by the tensor description
420- *
421- * @param desc [IN] pointer to the instance of aclTensorDesc
422- *
423- * @retval data format specified by the tensor description.
424- * @retval ACL_FORMAT_UNDEFINED if description is null
425- */
426-ACL_FUNC_VISIBILITY aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc);
427- 
428-/**
429- * @ingroup AscendCL
430- * @brief get tensor size specified by the tensor description
431- *
432- * @param desc [IN] pointer to the instance of aclTensorDesc
433- *
434- * @retval data size specified by the tensor description.
435- * @retval 0 if description is null
436- */
437-ACL_FUNC_VISIBILITY size_t aclGetTensorDescSize(const aclTensorDesc *desc);
438- 
439-/**
440- * @ingroup AscendCL
441- * @brief get element count specified by the tensor description
442- *
443- * @param desc [IN] pointer to the instance of aclTensorDesc
444- *
445- * @retval element count specified by the tensor description.
446- * @retval 0 if description is null
447- */
448-ACL_FUNC_VISIBILITY size_t aclGetTensorDescElementCount(const aclTensorDesc *desc);
449- 
450-/**
451- * @ingroup AscendCL
452- * @brief get number of dims specified by the tensor description
453- *
454- * @param desc [IN] pointer to the instance of aclTensorDesc
455- *
456- * @retval number of dims specified by the tensor description.
457- * @retval 0 if description is null
458- * @retval ACL_UNKNOWN_RANK if the tensor dim is -2
459- */
460-ACL_FUNC_VISIBILITY size_t aclGetTensorDescNumDims(const aclTensorDesc *desc);
461- 
462-/**
463- * @ingroup AscendCL
464- * @brief Get the size of the specified dim in the tensor description
465- *
466- * @param desc [IN] pointer to the instance of aclTensorDesc
467- * @param index [IN] index of dims, start from 0.
468- *
469- * @retval dim specified by the tensor description and index.
470- * @retval -1 if description or index is invalid
471- */
472-ACL_DEPRECATED_MESSAGE("aclGetTensorDescDim is deprecated, use aclGetTensorDescDimV2 instead")
473-ACL_FUNC_VISIBILITY int64_t aclGetTensorDescDim(const aclTensorDesc *desc, size_t index);
474- 
475-/**
476- * @ingroup AscendCL
477- * @brief Get the size of the specified dim in the tensor description
478- *
479- * @param desc [IN] pointer to the instance of aclTensorDesc
480- * @param index [IN] index of dims, start from 0.
481- * @param dimSize [OUT] size of the specified dim.
482- *
483- * @retval ACL_SUCCESS The function is successfully executed.
484- * @retval OtherValues Failure
485- */
486-ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimV2(const aclTensorDesc *desc, size_t index, int64_t *dimSize);
487- 
488-/**
489- * @ingroup AscendCL
490- * @brief Get the range of the specified dim in the tensor description
491- *
492- * @param desc [IN] pointer to the instance of aclTensorDesc
493- * @param index [IN] index of dims, start from 0.
494- * @param dimRangeNum [IN] number of dimRange.
495- * @param dimRange [OUT] range of the specified dim.
496- *
497- * @retval ACL_SUCCESS The function is successfully executed.
498- * @retval OtherValues Failure
499- */
500-ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimRange(const aclTensorDesc *desc,
501- size_t index,
502- size_t dimRangeNum,
503- int64_t *dimRange);
504- 
505-/**
506- * @ingroup AscendCL
507- * @brief set tensor description name
508- *
509- * @param desc [OUT] pointer to the instance of aclTensorDesc
510- * @param name [IN] tensor description name
511- */
512-ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *name);
513- 
514-/**
515- * @ingroup AscendCL
516- * @brief get tensor description name
517- *
518- * @param desc [IN] pointer to the instance of aclTensorDesc
519- *
520- * @retval tensor description name.
521- * @retval empty string if description is null
522- */
523-ACL_FUNC_VISIBILITY const char *aclGetTensorDescName(aclTensorDesc *desc);
524- 
525-/**
526- * @ingroup AscendCL
527- * @brief Convert the format in the source aclTensorDesc according to
528- * the specified dstFormat to generate a new target aclTensorDesc.
529- * The format in the source aclTensorDesc remains unchanged.
530- *
531- * @param srcDesc [IN] pointer to the source tensor desc
532- * @param dstFormat [IN] destination format
533- * @param dstDesc [OUT] pointer to the pointer to the destination tensor desc
534- *
535- * @retval ACL_SUCCESS The function is successfully executed.
536- * @retval OtherValues Failure
537- */
538-ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat,
539- aclTensorDesc **dstDesc);
540- 
541-/**
542- * @ingroup AscendCL
543- * @brief Set the storage format specified by the tensor description
544- *
545- * @param desc [OUT] pointer to the instance of aclTensorDesc
546- * @param format [IN] the storage format
547- *
548- * @retval ACL_SUCCESS The function is successfully executed.
549- * @retval OtherValues Failure
550- */
551-ACL_DEPRECATED_MESSAGE("aclSetTensorStorageFormat is deprecated, use aclSetTensorFormat instead")
552-ACL_FUNC_VISIBILITY aclError aclSetTensorStorageFormat(aclTensorDesc *desc, aclFormat format);
553- 
554-/**
555- * @ingroup AscendCL
556- * @brief Set the storage shape specified by the tensor description
557- *
558- * @param desc [OUT] pointer to the instance of aclTensorDesc
559- * @param numDims [IN] the number of dimensions of the shape
560- * @param dims [IN] the size of the specified dimension
561- *
562- * @retval ACL_SUCCESS The function is successfully executed.
563- * @retval OtherValues Failure
564- */
565-ACL_DEPRECATED_MESSAGE("aclSetTensorStorageShape is deprecated, use aclSetTensorShape instead")
566-ACL_FUNC_VISIBILITY aclError aclSetTensorStorageShape(aclTensorDesc *desc, int numDims, const int64_t *dims);
567- 
568-/**
569- * @ingroup AscendCL
570- * @brief Set the format specified by the tensor description
571- *
572- * @param desc [OUT] pointer to the instance of aclTensorDesc
573- * @param format [IN] the storage format
574- *
575- * @retval ACL_SUCCESS The function is successfully executed.
576- * @retval OtherValues Failure
577- */
578-ACL_FUNC_VISIBILITY aclError aclSetTensorFormat(aclTensorDesc *desc, aclFormat format);
579- 
580-/**
581- * @ingroup AscendCL
582- * @brief Set the shape specified by the tensor description
583- *
584- * @param desc [OUT] pointer to the instance of aclTensorDesc
585- * @param numDims [IN] the number of dimensions of the shape
586- * @param dims [IN] the size of the specified dimension
587- *
588- * @retval ACL_SUCCESS The function is successfully executed.
589- * @retval OtherValues Failure
590- */
591-ACL_FUNC_VISIBILITY aclError aclSetTensorShape(aclTensorDesc *desc, int numDims, const int64_t *dims);
592- 
593-/**
594- * @ingroup AscendCL
595- * @brief Set the original format specified by the tensor description
596- *
597- * @param desc [OUT] pointer to the instance of aclTensorDesc
598- * @param format [IN] the storage format
599- *
600- * @retval ACL_SUCCESS The function is successfully executed.
601- * @retval OtherValues Failure
602- */
603-ACL_FUNC_VISIBILITY aclError aclSetTensorOriginFormat(aclTensorDesc *desc, aclFormat format);
604- 
605-/**
606- * @ingroup AscendCL
607- * @brief Set the original shape specified by the tensor description
608- *
609- * @param desc [OUT] pointer to the instance of aclTensorDesc
610- * @param numDims [IN] the number of dimensions of the shape
611- * @param dims [IN] the size of the specified dimension
612- *
613- * @retval ACL_SUCCESS The function is successfully executed.
614- * @retval OtherValues Failure
615- */
616-ACL_FUNC_VISIBILITY aclError aclSetTensorOriginShape(aclTensorDesc *desc, int numDims, const int64_t *dims);
617- 
618-/**
619- * @ingroup AscendCL
620- * @brief get op description info
621- *
622- * @param desc [IN] pointer to tensor description
623- * @param index [IN] index of tensor
624- *
625- * @retval null for failed.
626- * @retval OtherValues success.
627-*/
628-ACL_FUNC_VISIBILITY aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, size_t index);
629- 
630-/**
631- * @ingroup AscendCL
632- * @brief get address of tensor
633- *
634- * @param desc [IN] pointer to tensor description
635- *
636- * @retval null for failed
637- * @retval OtherValues success
638-*/
639-ACL_FUNC_VISIBILITY void *aclGetTensorDescAddress(const aclTensorDesc *desc);
640- 
641-/**
642- * @ingroup AscendCL
643- * @brief Set the dynamic input name specified by the tensor description
644- *
645- * @param desc [OUT] pointer to the instance of aclTensorDesc
646- * @param dynamicInputName [IN] pointer to the dynamic input name
647- *
648- * @retval ACL_SUCCESS The function is successfully executed.
649- * @retval OtherValues Failure
650- */
651-ACL_FUNC_VISIBILITY aclError aclSetTensorDynamicInput(aclTensorDesc *desc, const char *dynamicInputName);
652- 
653-/**
654- * @ingroup AscendCL
655- * @brief Set const data specified by the tensor description
656- *
657- * @param desc [OUT] pointer to the instance of aclTensorDesc
658- * @param dataBuffer [IN] pointer to the const databuffer
659- * @param length [IN] the length of const databuffer
660- *
661- * @retval ACL_SUCCESS The function is successfully executed.
662- * @retval OtherValues Failure
663- */
664-ACL_FUNC_VISIBILITY aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length);
665- 
666-/**
667- * @ingroup AscendCL
668- * @brief Set tensor memory type specified by the tensor description
669- *
670- * @param desc [OUT] pointer to the instance of aclTensorDesc
671- * @param memType [IN] ACL_MEMTYPE_DEVICE means device, ACL_MEMTYPE_HOST or
672- * ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT means host
673- *
674- * @retval ACL_SUCCESS The function is successfully executed.
675- * @retval OtherValues Failure
676- */
677-ACL_FUNC_VISIBILITY aclError aclSetTensorPlaceMent(aclTensorDesc *desc, aclMemType memType);
678- 
679-/**
680- * @ingroup AscendCL
681- * @brief an interface for users to output APP logs
682- *
683- * @param logLevel [IN] the level of current log
684- * @param func [IN] the function where the log is located
685- * @param file [IN] the file where the log is located
686- * @param line [IN] Number of source lines where the log is located
687- * @param fmt [IN] the format of current log
688- * @param ... [IN] the value of current log
689- */
690-ACL_FUNC_VISIBILITY void aclAppLog(aclLogLevel logLevel, const char *func, const char *file, uint32_t line,
691- const char *fmt, ...);
692- 
693-/**
694- * @ingroup AscendCL
695- * @brief get soc name
696- *
697- * @retval null for failed
698- * @retval OtherValues success
699-*/
700-ACL_FUNC_VISIBILITY const char *aclrtGetSocName();
701- 
702-#define ACL_APP_LOG(level, fmt, ...) \
703- aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
704- 
705-/**
706- * @ingroup AscendCL
707- * @brief Get a list of the available CANN attributes in current environment
708- *
709- * @param cannAttrList [OUT] list of the available CANN attributes
710- * @param num [OUT] the number of the available CANN attributes
711- *
712- * @retval ACL_SUCCESS The function is successfully executed.
713- * @retval OtherValues Failure
714- */
715-ACL_FUNC_VISIBILITY aclError aclGetCannAttributeList(const aclCannAttr **cannAttrList, size_t *num);
716- 
717-/**
718- * @ingroup AscendCL
719- * @brief Check whether the specified CANN attribute is available in current
720- * environment
721- *
722- * @param cannAttr [IN] CANN attributes to query
723- * @param num [OUT] 0/1: 0 represents unavailable , 1 available
724- *
725- * @retval ACL_SUCCESS The function is successfully executed.
726- * @retval OtherValues Failure
727- */
728-ACL_FUNC_VISIBILITY aclError aclGetCannAttribute(aclCannAttr cannAttr, int32_t *value);
729- 
730-/**
731- * @ingroup AscendCL
732- * @brief Get capability value of the specified device
733- *
734- * @param deviceId [IN] device id
735- * @param deviceInfo [IN] device capability to query
736- * @param value [OUT] returned device capability value
737- *
738- * @retval ACL_SUCCESS The function is successfully executed.
739- * @retval OtherValues Failure
740- */
741-ACL_FUNC_VISIBILITY aclError aclGetDeviceCapability(uint32_t deviceId, aclDeviceInfo deviceInfo, int64_t *value);
742- 
743-#ifdef __cplusplus
744-}
745-#endif
746- 
747-#endif // INC_EXTERNAL_ACL_ACL_BASE_H_
Dthird_party/acl/inc/acl/acl_mdl.h+0-1668
@@ -1,1668 +0,0 @@
1-/**
2-* @file acl_mdl.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2023. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_ACL_MODEL_H_
12-#define INC_EXTERNAL_ACL_ACL_MODEL_H_
13- 
14-#include <stddef.h>
15-#include <stdint.h>
16- 
17-#include "acl_base.h"
18-#include "acl_rt.h"
19- 
20-#ifdef __cplusplus
21-extern "C" {
22-#endif
23- 
24-#define ACL_DIM_ENDPOINTS 2
25-#define ACL_MAX_DIM_CNT 128
26-#define ACL_MAX_TENSOR_NAME_LEN 128
27-#define ACL_MAX_BATCH_NUM 128
28-#define ACL_MAX_HW_NUM 128
29-#define ACL_MAX_SHAPE_COUNT 128
30-#define ACL_INVALID_NODE_INDEX 0xFFFFFFFF
31- 
32-#define ACL_MDL_LOAD_FROM_FILE 1
33-#define ACL_MDL_LOAD_FROM_FILE_WITH_MEM 2
34-#define ACL_MDL_LOAD_FROM_MEM 3
35-#define ACL_MDL_LOAD_FROM_MEM_WITH_MEM 4
36-#define ACL_MDL_LOAD_FROM_FILE_WITH_Q 5
37-#define ACL_MDL_LOAD_FROM_MEM_WITH_Q 6
38- 
39-#define ACL_DYNAMIC_TENSOR_NAME "ascend_mbatch_shape_data"
40-#define ACL_DYNAMIC_AIPP_NAME "ascend_dynamic_aipp_data"
41-#define ACL_ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES "_datadump_original_op_names"
42- 
43-/* used for ACL_MDL_WORKSPACE_MEM_OPTIMIZE */
44-#define ACL_WORKSPACE_MEM_OPTIMIZE_DEFAULT 0
45-#define ACL_WORKSPACE_MEM_OPTIMIZE_INPUTOUTPUT 1
46- 
47-// for model stream
48-#define ACL_MODEL_STREAM_FLAG_HEAD 0x00000000U // first stream
49-#define ACL_MODEL_STREAM_FLAG_DEFAULT 0x7FFFFFFFU
50- 
51-typedef struct aclmdlDataset aclmdlDataset;
52-typedef struct aclmdlDesc aclmdlDesc;
53-typedef struct aclmdlAIPP aclmdlAIPP;
54-typedef struct aclAippExtendInfo aclAippExtendInfo;
55-typedef struct aclmdlConfigHandle aclmdlConfigHandle;
56-typedef struct aclmdlExecConfigHandle aclmdlExecConfigHandle;
57-typedef void *aclmdlRI;
58- 
59-typedef enum {
60- ACL_YUV420SP_U8 = 1,
61- ACL_XRGB8888_U8 = 2,
62- ACL_RGB888_U8 = 3,
63- ACL_YUV400_U8 = 4,
64- ACL_NC1HWC0DI_FP16 = 5,
65- ACL_NC1HWC0DI_S8 = 6,
66- ACL_ARGB8888_U8 = 7,
67- ACL_YUYV_U8 = 8,
68- ACL_YUV422SP_U8 = 9,
69- ACL_AYUV444_U8 = 10,
70- ACL_RAW10 = 11,
71- ACL_RAW12 = 12,
72- ACL_RAW16 = 13,
73- ACL_RAW24 = 14,
74- ACL_AIPP_RESERVED = 0xFFFF,
75-} aclAippInputFormat;
76- 
77-typedef enum {
78- ACL_MDL_PRIORITY_INT32 = 0,
79- ACL_MDL_LOAD_TYPE_SIZET,
80- ACL_MDL_PATH_PTR, /**< pointer to model load path with deep copy */
81- ACL_MDL_MEM_ADDR_PTR, /**< pointer to model memory with shallow copy */
82- ACL_MDL_MEM_SIZET,
83- ACL_MDL_WEIGHT_ADDR_PTR, /**< pointer to weight memory of model with shallow copy */
84- ACL_MDL_WEIGHT_SIZET,
85- ACL_MDL_WORKSPACE_ADDR_PTR, /**< pointer to worksapce memory of model with shallow copy */
86- ACL_MDL_WORKSPACE_SIZET,
87- ACL_MDL_INPUTQ_NUM_SIZET,
88- ACL_MDL_INPUTQ_ADDR_PTR, /**< pointer to inputQ with shallow copy */
89- ACL_MDL_OUTPUTQ_NUM_SIZET,
90- ACL_MDL_OUTPUTQ_ADDR_PTR, /**< pointer to outputQ with shallow copy */
91- ACL_MDL_WORKSPACE_MEM_OPTIMIZE,
92- ACL_MDL_WEIGHT_PATH_PTR, /**< pointer to weight path with deep copy */
93- ACL_MDL_MODEL_DESC_PTR, /**< pointer to model desc of model with shallow copy */
94- ACL_MDL_MODEL_DESC_SIZET,
95- ACL_MDL_KERNEL_PTR, /**< pointer to kernel bin of model with shallow copy */
96- ACL_MDL_KERNEL_SIZET,
97- ACL_MDL_KERNEL_ARGS_PTR, /**< pointer to kernel args of model with shallow copy */
98- ACL_MDL_KERNEL_ARGS_SIZET,
99- ACL_MDL_STATIC_TASK_PTR, /**< pointer to static task desc of model with shallow copy */
100- ACL_MDL_STATIC_TASK_SIZET,
101- ACL_MDL_DYNAMIC_TASK_PTR, /**< pointer to dynamic task desc of model with shallow copy */
102- ACL_MDL_DYNAMIC_TASK_SIZET,
103- ACL_MDL_MEM_MALLOC_POLICY_SIZET,
104- ACL_MDL_FIFO_PTR, /**< pointer to fifo memory of model with shallow copy */
105- ACL_MDL_FIFO_SIZET
106-} aclmdlConfigAttr;
107- 
108-typedef enum {
109- ACL_MDL_STREAM_SYNC_TIMEOUT = 0,
110- ACL_MDL_EVENT_SYNC_TIMEOUT,
111- ACL_MDL_WORK_ADDR_PTR, /**< param */
112- ACL_MDL_WORK_SIZET, /**< param */
113- ACL_MDL_MPAIMID_SIZET, /**< param reserved */
114- ACL_MDL_AICQOS_SIZET, /**< param reserved */
115- ACL_MDL_AICOST_SIZET, /**< param reserved */
116- ACL_MDL_MEC_TIMETHR_SIZET /**< param reserved */
117-} aclmdlExecConfigAttr;
118- 
119-typedef enum {
120- ACL_DATA_WITHOUT_AIPP = 0,
121- ACL_DATA_WITH_STATIC_AIPP,
122- ACL_DATA_WITH_DYNAMIC_AIPP,
123- ACL_DYNAMIC_AIPP_NODE
124-} aclmdlInputAippType;
125- 
126-typedef struct aclmdlIODims {
127- char name[ACL_MAX_TENSOR_NAME_LEN]; /**< tensor name */
128- size_t dimCount; /**< dim array count */
129- int64_t dims[ACL_MAX_DIM_CNT]; /**< dim data array */
130-} aclmdlIODims;
131- 
132-typedef struct aclmdlIODimsRange {
133- size_t rangeCount; /**< dim range array count */
134- int64_t range[ACL_MAX_DIM_CNT][ACL_DIM_ENDPOINTS]; /**< range data array */
135-} aclmdlIODimsRange;
136- 
137-typedef struct aclAippDims {
138- aclmdlIODims srcDims; /**< input dims before model transform */
139- size_t srcSize; /**< input size before model transform */
140- aclmdlIODims aippOutdims; /**< aipp output dims */
141- size_t aippOutSize; /**< aipp output size */
142-} aclAippDims;
143- 
144-typedef struct aclmdlBatch {
145- size_t batchCount; /**< batch array count */
146- uint64_t batch[ACL_MAX_BATCH_NUM]; /**< batch data array */
147-} aclmdlBatch;
148- 
149-typedef struct aclmdlHW {
150- size_t hwCount; /**< height&width array count */
151- uint64_t hw[ACL_MAX_HW_NUM][2]; /**< height&width data array */
152-} aclmdlHW;
153- 
154-typedef struct aclAippInfo {
155- aclAippInputFormat inputFormat;
156- int32_t srcImageSizeW;
157- int32_t srcImageSizeH;
158- int8_t cropSwitch;
159- int32_t loadStartPosW;
160- int32_t loadStartPosH;
161- int32_t cropSizeW;
162- int32_t cropSizeH;
163- int8_t resizeSwitch;
164- int32_t resizeOutputW;
165- int32_t resizeOutputH;
166- int8_t paddingSwitch;
167- int32_t leftPaddingSize;
168- int32_t rightPaddingSize;
169- int32_t topPaddingSize;
170- int32_t bottomPaddingSize;
171- int8_t cscSwitch;
172- int8_t rbuvSwapSwitch;
173- int8_t axSwapSwitch;
174- int8_t singleLineMode;
175- int32_t matrixR0C0;
176- int32_t matrixR0C1;
177- int32_t matrixR0C2;
178- int32_t matrixR1C0;
179- int32_t matrixR1C1;
180- int32_t matrixR1C2;
181- int32_t matrixR2C0;
182- int32_t matrixR2C1;
183- int32_t matrixR2C2;
184- int32_t outputBias0;
185- int32_t outputBias1;
186- int32_t outputBias2;
187- int32_t inputBias0;
188- int32_t inputBias1;
189- int32_t inputBias2;
190- int32_t meanChn0;
191- int32_t meanChn1;
192- int32_t meanChn2;
193- int32_t meanChn3;
194- float minChn0;
195- float minChn1;
196- float minChn2;
197- float minChn3;
198- float varReciChn0;
199- float varReciChn1;
200- float varReciChn2;
201- float varReciChn3;
202- aclFormat srcFormat;
203- aclDataType srcDatatype;
204- size_t srcDimNum;
205- size_t shapeCount;
206- aclAippDims outDims[ACL_MAX_SHAPE_COUNT];
207- aclAippExtendInfo *aippExtend; /**< reserved parameters, current version needs to be null */
208-} aclAippInfo;
209- 
210-typedef struct aclmdlExeOMDesc {
211- size_t workSize;
212- size_t weightSize;
213- size_t modelDescSize;
214- size_t kernelSize;
215- size_t kernelArgsSize;
216- size_t staticTaskSize;
217- size_t dynamicTaskSize;
218- size_t fifoTaskSize;
219- size_t reserved[8];
220-} aclmdlExeOMDesc;
221- 
222-typedef enum {
223- ACL_MODEL_RI_CAPTURE_MODE_GLOBAL = 0,
224- ACL_MODEL_RI_CAPTURE_MODE_THREAD_LOCAL,
225- ACL_MODEL_RI_CAPTURE_MODE_RELAXED,
226-} aclmdlRICaptureMode;
227- 
228-typedef enum {
229- ACL_MODEL_RI_CAPTURE_STATUS_NONE = 0,
230- ACL_MODEL_RI_CAPTURE_STATUS_ACTIVE,
231- ACL_MODEL_RI_CAPTURE_STATUS_INVALIDATED,
232-} aclmdlRICaptureStatus;
233- 
234-/**
235- * @ingroup AscendCL
236- * @brief Create data of type aclmdlDesc
237- *
238- * @retval the aclmdlDesc pointer
239- */
240-ACL_FUNC_VISIBILITY aclmdlDesc *aclmdlCreateDesc();
241- 
242-/**
243- * @ingroup AscendCL
244- * @brief destroy data of type aclmdlDesc
245- *
246- * @param modelDesc [IN] Pointer to almdldlDesc to be destroyed
247- *
248- * @retval ACL_SUCCESS The function is successfully executed.
249- * @retval OtherValues Failure
250- */
251-ACL_FUNC_VISIBILITY aclError aclmdlDestroyDesc(aclmdlDesc *modelDesc);
252- 
253-/**
254- * @ingroup AscendCL
255- * @brief Get aclmdlDesc data of the model according to the model ID
256- *
257- * @param modelDesc [OUT] aclmdlDesc pointer
258- * @param modelId [IN] model id
259- *
260- * @retval ACL_SUCCESS The function is successfully executed.
261- * @retval OtherValues Failure
262- */
263-ACL_FUNC_VISIBILITY aclError aclmdlGetDesc(aclmdlDesc *modelDesc, uint32_t modelId);
264- 
265-/**
266- * @ingroup AscendCL
267- * @brief Get aclmdlDesc data of the model according to the model path
268- *
269- * @param modelDesc [OUT] aclmdlDesc pointer
270- * @param modelPath [IN] model path
271- *
272- * @retval ACL_SUCCESS The function is successfully executed.
273- * @retval OtherValues Failure
274- */
275-ACL_FUNC_VISIBILITY aclError aclmdlGetDescFromFile(aclmdlDesc *modelDesc, const char *modelPath);
276- 
277-/**
278- * @ingroup AscendCL
279- * @brief Get aclmdlDesc data of the model according to the model and modelSize
280- *
281- * @param modelDesc [OUT] aclmdlDesc pointer
282- * @param model [IN] model pointer
283- * @param modelSize [IN] model size
284- *
285- * @retval ACL_SUCCESS The function is successfully executed.
286- * @retval OtherValues Failure
287- */
288-ACL_FUNC_VISIBILITY aclError aclmdlGetDescFromMem(aclmdlDesc *modelDesc, const void *model, size_t modelSize);
289- 
290-/**
291- * @ingroup AscendCL
292- * @brief Get the number of the inputs of
293- * the model according to data of aclmdlDesc
294- *
295- * @param modelDesc [IN] aclmdlDesc pointer
296- *
297- * @retval input size with aclmdlDesc
298- */
299-ACL_FUNC_VISIBILITY size_t aclmdlGetNumInputs(aclmdlDesc *modelDesc);
300- 
301-/**
302- * @ingroup AscendCL
303- * @brief Get the number of the output of
304- * the model according to data of aclmdlDesc
305- *
306- * @param modelDesc [IN] aclmdlDesc pointer
307- *
308- * @retval output size with aclmdlDesc
309- */
310-ACL_FUNC_VISIBILITY size_t aclmdlGetNumOutputs(aclmdlDesc *modelDesc);
311- 
312-/**
313- * @ingroup AscendCL
314- * @brief Get the size of the specified input according to
315- * the data of type aclmdlDesc
316- *
317- * @param modelDesc [IN] aclmdlDesc pointer
318- * @param index [IN] the size of the number of inputs to be obtained,
319- * the index value starts from 0
320- *
321- * @retval Specify the size of the input
322- */
323-ACL_FUNC_VISIBILITY size_t aclmdlGetInputSizeByIndex(aclmdlDesc *modelDesc, size_t index);
324- 
325-/**
326- * @ingroup AscendCL
327- * @brief Get the size of the specified output according to
328- * the data of type aclmdlDesc
329- *
330- * @param modelDesc [IN] aclmdlDesc pointer
331- * @param index [IN] the size of the number of outputs to be obtained,
332- * the index value starts from 0
333- *
334- * @retval Specify the size of the output
335- */
336-ACL_FUNC_VISIBILITY size_t aclmdlGetOutputSizeByIndex(aclmdlDesc *modelDesc, size_t index);
337- 
338-/**
339- * @ingroup AscendCL
340- * @brief Create config handle of execute
341- *
342- * @retval the aclmdlCreateExecConfigHandle pointer
343- */
344-ACL_FUNC_VISIBILITY aclmdlExecConfigHandle *aclmdlCreateExecConfigHandle();
345- 
346-/**
347- * @ingroup AscendCL
348- * @brief Destroy config handle of model execute
349- *
350- * @param handle [IN] Pointer to aclmdlExecConfigHandle to be destroyed
351- *
352- * @retval ACL_SUCCESS The function is successfully executed.
353- * @retval OtherValues Failure
354- */
355-ACL_FUNC_VISIBILITY aclError aclmdlDestroyExecConfigHandle(const aclmdlExecConfigHandle *handle);
356- 
357-/**
358- * @ingroup AscendCL
359- * @brief Create data of type aclmdlDataset
360- *
361- * @retval the aclmdlDataset pointer
362- */
363-ACL_FUNC_VISIBILITY aclmdlDataset *aclmdlCreateDataset();
364- 
365-/**
366- * @ingroup AscendCL
367- * @brief destroy data of type aclmdlDataset
368- *
369- * @param dataset [IN] Pointer to aclmdlDataset to be destroyed
370- *
371- * @retval ACL_SUCCESS The function is successfully executed.
372- * @retval OtherValues Failure
373- */
374-ACL_FUNC_VISIBILITY aclError aclmdlDestroyDataset(const aclmdlDataset *dataset);
375- 
376-/**
377- * @ingroup AscendCL
378- * @brief Add aclDataBuffer to aclmdlDataset
379- *
380- * @param dataset [OUT] aclmdlDataset address of aclDataBuffer to be added
381- * @param dataBuffer [IN] aclDataBuffer address to be added
382- *
383- * @retval ACL_SUCCESS The function is successfully executed.
384- * @retval OtherValues Failure
385- */
386-ACL_FUNC_VISIBILITY aclError aclmdlAddDatasetBuffer(aclmdlDataset *dataset, aclDataBuffer *dataBuffer);
387- 
388-/**
389- * @ingroup AscendCL
390- * @brief Set aclTensorDesc to aclmdlDataset
391- *
392- * @param dataset [OUT] aclmdlDataset address of aclDataBuffer to be added
393- * @param tensorDesc [IN] aclTensorDesc address to be added
394- * @param index [IN] index of tensorDesc which to be added
395- *
396- * @retval ACL_SUCCESS The function is successfully executed.
397- * @retval OtherValues Failure
398- */
399-ACL_FUNC_VISIBILITY aclError aclmdlSetDatasetTensorDesc(aclmdlDataset *dataset,
400- aclTensorDesc *tensorDesc,
401- size_t index);
402- 
403-/**
404- * @ingroup AscendCL
405- * @brief Get aclTensorDesc from aclmdlDataset
406- *
407- * @param dataset [IN] aclmdlDataset pointer;
408- * @param index [IN] index of tensorDesc
409- *
410- * @retval Get address of aclTensorDesc when executed successfully.
411- * @retval Failure return NULL
412- */
413-ACL_FUNC_VISIBILITY aclTensorDesc *aclmdlGetDatasetTensorDesc(const aclmdlDataset *dataset, size_t index);
414- 
415-/**
416- * @ingroup AscendCL
417- * @brief Get the number of aclDataBuffer in aclmdlDataset
418- *
419- * @param dataset [IN] aclmdlDataset pointer
420- *
421- * @retval the number of aclDataBuffer
422- */
423-ACL_FUNC_VISIBILITY size_t aclmdlGetDatasetNumBuffers(const aclmdlDataset *dataset);
424- 
425-/**
426- * @ingroup AscendCL
427- * @brief Get the aclDataBuffer in aclmdlDataset by index
428- *
429- * @param dataset [IN] aclmdlDataset pointer
430- * @param index [IN] the index of aclDataBuffer
431- *
432- * @retval Get successfully, return the address of aclDataBuffer
433- * @retval Failure return NULL
434- */
435-ACL_FUNC_VISIBILITY aclDataBuffer *aclmdlGetDatasetBuffer(const aclmdlDataset *dataset, size_t index);
436- 
437-/**
438- * @ingroup AscendCL
439- * @brief Load offline model data from files
440- * and manage memory internally by the system
441- *
442- * @par Function
443- * After the system finishes loading the model,
444- * the model ID returned is used as a mark to identify the model
445- * during subsequent operations
446- *
447- * @param modelPath [IN] Storage path for offline model files
448- * @param modelId [OUT] Model ID generated after
449- * the system finishes loading the model
450- *
451- * @retval ACL_SUCCESS The function is successfully executed.
452- * @retval OtherValues Failure
453- */
454-ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFile(const char *modelPath, uint32_t *modelId);
455- 
456-/**
457- * @ingroup AscendCL
458- * @brief Load offline bundle model data from file
459- * and manage memory internally by the system
460- *
461- * @par Function
462- * After the system finishes loading the bundle model,
463- * the bundle model ID returned is used as a mark to identify the bundle model
464- * during subsequent operations
465- *
466- * @param modelPath [IN] Storage path for offline bundle model file
467- * @param bundleId [OUT] Bundle model id generated after
468- * the system finishes loading the bundle model
469- *
470- * @retval ACL_SUCCESS The function is successfully executed.
471- * @retval OtherValues Failure
472- */
473-ACL_FUNC_VISIBILITY aclError aclmdlBundleLoadFromFile(const char *modelPath, uint32_t *bundleId);
474- 
475-/**
476- * @ingroup AscendCL
477- * @brief Load offline bundle model data from memory and manage the memory of
478- * model running internally by the system
479- *
480- * @par Function
481- * After the system finishes loading the bundle model,
482- * the bundle model ID returned is used as a mark to identify the bundle model
483- * during subsequent operations
484- *
485- * @param model [IN] Bundle model data stored in memory
486- * @param modelSize [IN] model data size
487- * @param bundleId [OUT] Bundle model id generated after
488- * the system finishes loading the model
489- *
490- * @retval ACL_SUCCESS The function is successfully executed.
491- * @retval OtherValues Failure
492- */
493-ACL_FUNC_VISIBILITY aclError aclmdlBundleLoadFromMem(const void *model, size_t modelSize, uint32_t *bundleId);
494- 
495-/**
496- * @ingroup AscendCL
497- * @brief unload bundle model with bundle model id
498- *
499- * @param bundleId [IN] bundle model id to be unloaded
500- *
501- * @retval ACL_SUCCESS The function is successfully executed.
502- * @retval OtherValues Failure
503- */
504-ACL_FUNC_VISIBILITY aclError aclmdlBundleUnload(uint32_t bundleId);
505- 
506-/**
507- * @ingroup AscendCL
508- * @brief get bundle model inner model nums
509- *
510- * @param bundleId [IN] bundle id acquired by aclmdlBundleLoadFromFile or aclmdlBundleLoadFromMem
511- * @param modelNum [OUT] the pointer to model num
512- *
513- * @retval ACL_SUCCESS The function is successfully executed.
514- * @retval OtherValues Failure
515- *
516- */
517-ACL_FUNC_VISIBILITY aclError aclmdlBundleGetModelNum(uint32_t bundleId, size_t *modelNum);
518- 
519-/**
520- * @ingroup AscendCL
521- * @brief get inner model id by index
522- *
523- * @param bundleId [IN] bundle id acquired by aclmdlBundleLoadFromFile or aclmdlBundleLoadFromMem
524- * @param index [IN] index of bundle models
525- * @param modelId [OUT] the pointer to inner model id which to be executed
526- *
527- * @retval ACL_SUCCESS The function is successfully executed.
528- * @retval OtherValues Failure
529- *
530- */
531-ACL_FUNC_VISIBILITY aclError aclmdlBundleGetModelId(uint32_t bundleId, size_t index, uint32_t *modelId);
532- 
533-/**
534- * @ingroup AscendCL
535- * @brief Load offline model data from memory and manage the memory of
536- * model running internally by the system
537- *
538- * @par Function
539- * After the system finishes loading the model,
540- * the model ID returned is used as a mark to identify the model
541- * during subsequent operations
542- *
543- * @param model [IN] Model data stored in memory
544- * @param modelSize [IN] model data size
545- * @param modelId [OUT] Model ID generated after
546- * the system finishes loading the model
547- *
548- * @retval ACL_SUCCESS The function is successfully executed.
549- * @retval OtherValues Failure
550- */
551-ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMem(const void *model, size_t modelSize, uint32_t *modelId);
552- 
553-/**
554- * @ingroup AscendCL
555- * @brief Load offline model data from a file,
556- * and the user manages the memory of the model run by itself
557- *
558- * @par Function
559- * After the system finishes loading the model,
560- * the model ID returned is used as a mark to identify the model
561- * during subsequent operations.
562- * @param modelPath [IN] Storage path for offline model files
563- * @param modelId [OUT] Model ID generated after finishes loading the model
564- * @param workPtr [IN] A pointer to the working memory
565- * required by the model on the Device,can be null
566- * @param workSize [IN] The amount of working memory required by the model
567- * @param weightPtr [IN] Pointer to model weight memory on Device
568- * @param weightSize [IN] The amount of weight memory required by the model
569- *
570- * @retval ACL_SUCCESS The function is successfully executed.
571- * @retval OtherValues Failure
572- */
573-ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithMem(const char *modelPath,
574- uint32_t *modelId, void *workPtr, size_t workSize,
575- void *weightPtr, size_t weightSize);
576- 
577-/**
578- * @ingroup AscendCL
579- * @brief Load offline model data from memory,
580- * and the user can manage the memory of model running
581- *
582- * @par Function
583- * After the system finishes loading the model,
584- * the model ID returned is used as a mark to identify the model
585- * during subsequent operations
586- * @param model [IN] Model data stored in memory
587- * @param modelSize [IN] model data size
588- * @param modelId [OUT] Model ID generated after finishes loading the model
589- * @param workPtr [IN] A pointer to the working memory
590- * required by the model on the Device,can be null
591- * @param workSize [IN] work memory size
592- * @param weightPtr [IN] Pointer to model weight memory on Device,can be null
593- * @param weightSize [IN] The amount of weight memory required by the model
594- *
595- * @retval ACL_SUCCESS The function is successfully executed.
596- * @retval OtherValues Failure
597- */
598-ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithMem(const void *model, size_t modelSize,
599- uint32_t *modelId, void *workPtr, size_t workSize,
600- void *weightPtr, size_t weightSize);
601- 
602-/**
603- * @ingroup AscendCL
604- * @brief load model from file with async queue
605- *
606- * @param modelPath [IN] model path
607- * @param modelId [OUT] return model id if load success
608- * @param inputQ [IN] input queue pointer
609- * @param inputQNum [IN] input queue num
610- * @param outputQ [IN] output queue pointer
611- * @param outputQNum [IN] output queue num
612- *
613- * @retval ACL_SUCCESS The function is successfully executed.
614- * @retval OtherValues Failure
615- */
616-ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithQ(const char *modelPath, uint32_t *modelId, const uint32_t *inputQ,
617- size_t inputQNum, const uint32_t *outputQ, size_t outputQNum);
618- 
619-/**
620- * @ingroup AscendCL
621- * @brief load model from memory with async queue
622- *
623- * @param model [IN] model memory which user manages
624- * @param modelSize [IN] model size
625- * @param modelId [OUT] return model id if load success
626- * @param inputQ [IN] input queue pointer
627- * @param inputQNum [IN] input queue num
628- * @param outputQ [IN] output queue pointer
629- * @param outputQNum [IN] output queue num
630- *
631- * @retval ACL_SUCCESS The function is successfully executed.
632- * @retval OtherValues Failure
633- */
634-ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithQ(const void *model, size_t modelSize, uint32_t *modelId,
635- const uint32_t *inputQ, size_t inputQNum,
636- const uint32_t *outputQ, size_t outputQNum);
637- 
638-/**
639- * @ingroup AscendCL
640- * @brief Execute model synchronous inference until the inference result is returned
641- *
642- * @param modelId [IN] ID of the model to perform inference
643- * @param input [IN] Input data for model inference
644- * @param output [OUT] Output data for model inference
645- *
646- * @retval ACL_SUCCESS The function is successfully executed.
647- * @retval OtherValues Failure
648- */
649-ACL_FUNC_VISIBILITY aclError aclmdlExecute(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output);
650- 
651-/**
652- * @ingroup AscendCL
653- * @brief Execute model synchronous inference until the inference result is returned
654- *
655- * @param modelId [IN] ID of the model to perform inference
656- * @param input [IN] Input data for model inference
657- * @param output [OUT] Output data for model inference
658- * @param stream [IN] stream
659- * @param handle [IN] config of model execute
660- *
661- * @retval ACL_SUCCESS The function is successfully executed.
662- * @retval OtherValues Failure
663- */
664-ACL_FUNC_VISIBILITY aclError aclmdlExecuteV2(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output,
665- aclrtStream stream, const aclmdlExecConfigHandle *handle);
666- 
667-/**
668- * @ingroup AscendCL
669- * @brief Execute model asynchronous inference until the inference result is returned
670- *
671- * @param modelRI [IN] runtime instance of the model to perform inference
672- * @param stream [IN] stream
673- *
674- * @retval ACL_SUCCESS The function is successfully executed.
675- * @retval OtherValues Failure
676- */
677-ACL_FUNC_VISIBILITY aclError aclmdlRIExecuteAsync(aclmdlRI modelRI, aclrtStream stream);
678- 
679-/**
680- * @ingroup AscendCL
681- * @brief unload model with model id
682- *
683- * @param modelId [IN] model id to be unloaded
684- * @retval ACL_ERROR_NONE The function is successfully executed.
685- * @retval OtherValues Failure
686- */
687-ACL_FUNC_VISIBILITY aclError aclmdlUnload(uint32_t modelId);
688- 
689-/**
690- * @ingroup AscendCL
691- * @brief destroy the model
692- *
693- * @param modelRI [IN] runtime instance of the model to be destroyed
694- *
695- * @retval ACL_SUCCESS The function is successfully executed.
696- * @retval OtherValues Failure
697- */
698-ACL_FUNC_VISIBILITY aclError aclmdlRIDestroy(aclmdlRI modelRI);
699- 
700-/**
701- * @ingroup AscendCL
702- * @brief Execute model asynchronous inference until the inference result is returned
703- *
704- * @param modelId [IN] ID of the model to perform inference
705- * @param input [IN] Input data for model inference
706- * @param output [OUT] Output data for model inference
707- * @param stream [IN] stream
708- * @param handle [IN] config of model execute
709- *
710- * @retval ACL_SUCCESS The function is successfully executed.
711- * @retval OtherValues Failure
712- */
713-ACL_FUNC_VISIBILITY aclError aclmdlExecuteAsyncV2(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output,
714- aclrtStream stream, const aclmdlExecConfigHandle *handle);
715-/**
716- * @ingroup AscendCL
717- * @brief Execute model asynchronous inference until the inference result is returned
718- *
719- * @param modelId [IN] ID of the model to perform inference
720- * @param input [IN] Input data for model inference
721- * @param output [OUT] Output data for model inference
722- * @param stream [IN] stream
723- *
724- * @retval ACL_SUCCESS The function is successfully executed.
725- * @retval OtherValues Failure
726- *
727- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
728- * aclmdlLoadFromMemWithMem
729- */
730-ACL_FUNC_VISIBILITY aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input,
731- aclmdlDataset *output, aclrtStream stream);
732- 
733-/**
734- * @ingroup AscendCL
735- * @brief unload model with model id
736- *
737- * @param modelId [IN] model id to be unloaded
738- *
739- * @retval ACL_SUCCESS The function is successfully executed.
740- * @retval OtherValues Failure
741- */
742-ACL_FUNC_VISIBILITY aclError aclmdlUnload(uint32_t modelId);
743- 
744-/**
745- * @ingroup AscendCL
746- * @brief Get the weight memory size and working memory size
747- * required for model execution according to the model file
748- *
749- * @param fileName [IN] Model path to get memory information
750- * @param workSize [OUT] The amount of working memory for model executed
751- * @param weightSize [OUT] The amount of weight memory for model executed
752- *
753- * @retval ACL_SUCCESS The function is successfully executed.
754- * @retval OtherValues Failure
755- */
756-ACL_FUNC_VISIBILITY aclError aclmdlQuerySize(const char *fileName, size_t *workSize, size_t *weightSize);
757- 
758-/**
759- * @ingroup AscendCL
760- * @brief Get the size of each partition and working memory size
761- * required for model execution according to the model file
762- *
763- * @param fileName [IN] Model path to get memory information
764- * @param aclmdlExeOMDesc [OUT] The size of each partition and working memory size
765- *
766- * @retval ACL_SUCCESS The function is successfully executed.
767- * @retval OtherValues Failure
768- */
769-ACL_FUNC_VISIBILITY aclError aclmdlQueryExeOMDesc(const char *fileName, aclmdlExeOMDesc *mdlPartitionSize);
770- 
771-/**
772- * @ingroup AscendCL
773- * @brief Obtain the weights required for
774- * model execution according to the model data in memory
775- *
776- * @par Restriction
777- * The execution and weight memory is Device memory,
778- * and requires user application and release.
779- * @param model [IN] model memory which user manages
780- * @param modelSize [IN] model data size
781- * @param workSize [OUT] The amount of working memory for model executed
782- * @param weightSize [OUT] The amount of weight memory for model executed
783- *
784- * @retval ACL_SUCCESS The function is successfully executed.
785- * @retval OtherValues Failure
786- */
787-ACL_FUNC_VISIBILITY aclError aclmdlQuerySizeFromMem(const void *model, size_t modelSize, size_t *workSize,
788- size_t *weightSize);
789- 
790-/**
791- * @ingroup AscendCL
792- * @brief In dynamic batch scenarios,
793- * it is used to set the number of images processed
794- * at one time during model inference
795- *
796- * @param modelId [IN] model id
797- * @param dataset [IN|OUT] data for model inference
798- * @param index [IN] index of dynamic tensor
799- * @param batchSize [IN] Number of images processed at a time during model
800- *
801- * @retval ACL_SUCCESS The function is successfully executed.
802- * @retval OtherValues Failure
803- *
804- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
805- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName
806- */
807-ACL_FUNC_VISIBILITY aclError aclmdlSetDynamicBatchSize(uint32_t modelId, aclmdlDataset *dataset, size_t index,
808- uint64_t batchSize);
809- 
810-/**
811- * @ingroup AscendCL
812- * @brief Sets the H and W of the specified input of the model
813- *
814- * @param modelId [IN] model id
815- * @param dataset [IN|OUT] data for model inference
816- * @param index [IN] index of dynamic tensor
817- * @param height [IN] model height
818- * @param width [IN] model width
819- *
820- * @retval ACL_SUCCESS The function is successfully executed.
821- * @retval OtherValues Failure
822- *
823- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
824- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName
825- */
826-ACL_FUNC_VISIBILITY aclError aclmdlSetDynamicHWSize(uint32_t modelId, aclmdlDataset *dataset, size_t index,
827- uint64_t height, uint64_t width);
828- 
829-/**
830- * @ingroup AscendCL
831- * @brief Sets the dynamic dims of the specified input of the model
832- *
833- * @param modelId [IN] model id
834- * @param dataset [IN|OUT] data for model inference
835- * @param index [IN] index of dynamic dims
836- * @param dims [IN] value of dynamic dims
837- *
838- * @retval ACL_SUCCESS The function is successfully executed.
839- * @retval OtherValues Failure
840- *
841- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
842- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName
843- */
844-ACL_FUNC_VISIBILITY aclError aclmdlSetInputDynamicDims(uint32_t modelId, aclmdlDataset *dataset, size_t index,
845- const aclmdlIODims *dims);
846- 
847-/**
848- * @ingroup AscendCL
849- * @brief get input dims info
850- *
851- * @param modelDesc [IN] model description
852- * @param index [IN] input tensor index
853- * @param dims [OUT] dims info
854- *
855- * @retval ACL_SUCCESS The function is successfully executed.
856- * @retval OtherValues Failure
857- *
858- * @see aclmdlGetInputDimsV2
859- */
860-ACL_FUNC_VISIBILITY aclError aclmdlGetInputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
861- 
862-/**
863- * @ingroup AscendCL
864- * @brief get input dims info(version 2), especially for static aipp
865- * it is the same with aclmdlGetInputDims while model without static aipp
866- *
867- * @param modelDesc [IN] model description
868- * @param index [IN] input tensor index
869- * @param dims [OUT] dims info
870- *
871- * @retval ACL_SUCCESS The function is successfully executed.
872- * @retval OtherValues Failure
873- *
874- * @see aclmdlGetInputDims
875- */
876-ACL_FUNC_VISIBILITY aclError aclmdlGetInputDimsV2(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
877- 
878-/**
879- * @ingroup AscendCL
880- * @brief get input dims range info
881- *
882- * @param modelDesc [IN] model description
883- * @param index [IN] input tensor index
884- * @param dimsRange [OUT] dims range info
885- *
886- * @retval ACL_SUCCESS The function is successfully executed.
887- * @retval OtherValues Failure
888- */
889-ACL_FUNC_VISIBILITY aclError aclmdlGetInputDimsRange(const aclmdlDesc *modelDesc, size_t index,
890- aclmdlIODimsRange *dimsRange);
891- 
892-/**
893- * @ingroup AscendCL
894- * @brief get output dims info
895- *
896- * @param modelDesc [IN] model description
897- * @param index [IN] output tensor index
898- * @param dims [OUT] dims info
899- *
900- * @retval ACL_SUCCESS The function is successfully executed.
901- * @retval OtherValues Failure
902- */
903-ACL_FUNC_VISIBILITY aclError aclmdlGetOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
904- 
905-/**
906- * @ingroup AscendCL
907- * @brief get current output dims info
908- *
909- * @par Function
910- * The following use cases are supported:
911- * @li Get current output shape when model is dynamic and
912- * dynamic shape info is set
913- * @li Get max output shape when model is dynamic and
914- * dynamic shape info is not set
915- * @li Get actual output shape when model is static
916- *
917- * @param modelDesc [IN] model description
918- * @param index [IN] output tensor index
919- * @param dims [OUT] dims info
920- *
921- * @retval ACL_SUCCESS The function is successfully executed.
922- * @retval OtherValues Failure
923- */
924-ACL_FUNC_VISIBILITY aclError aclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims);
925- 
926-/**
927- * @ingroup AscendCL
928- * @brief get attr value by op name
929- *
930- * @param modelDesc [IN] model description
931- * @param opName [IN] op name
932- * @param attr [IN] attr name
933- *
934- * @retval the attr value
935- */
936-ACL_FUNC_VISIBILITY const char *aclmdlGetOpAttr(aclmdlDesc *modelDesc, const char *opName, const char *attr);
937- 
938-/**
939- * @ingroup AscendCL
940- * @brief get input name by index
941- *
942- * @param modelDesc [IN] model description
943- * @param index [IN] intput tensor index
944- *
945- * @retval input tensor name,the same life cycle with modelDesc
946- */
947-ACL_FUNC_VISIBILITY const char *aclmdlGetInputNameByIndex(const aclmdlDesc *modelDesc, size_t index);
948- 
949-/**
950- * @ingroup AscendCL
951- * @brief get output name by index
952- *
953- * @param modelDesc [IN] model description
954- * @param index [IN] output tensor index
955- *
956- * @retval output tensor name,the same life cycle with modelDesc
957- */
958-ACL_FUNC_VISIBILITY const char *aclmdlGetOutputNameByIndex(const aclmdlDesc *modelDesc, size_t index);
959- 
960-/**
961- * @ingroup AscendCL
962- * @brief get input format by index
963- *
964- * @param modelDesc [IN] model description
965- * @param index [IN] intput tensor index
966- *
967- * @retval input tensor format
968- */
969-ACL_FUNC_VISIBILITY aclFormat aclmdlGetInputFormat(const aclmdlDesc *modelDesc, size_t index);
970- 
971-/**
972- * @ingroup AscendCL
973- * @brief get output format by index
974- *
975- * @param modelDesc [IN] model description
976- * @param index [IN] output tensor index
977- *
978- * @retval output tensor format
979- */
980-ACL_FUNC_VISIBILITY aclFormat aclmdlGetOutputFormat(const aclmdlDesc *modelDesc, size_t index);
981- 
982-/**
983- * @ingroup AscendCL
984- * @brief get input data type by index
985- *
986- * @param modelDesc [IN] model description
987- * @param index [IN] intput tensor index
988- *
989- * @retval input tensor data type
990- */
991-ACL_FUNC_VISIBILITY aclDataType aclmdlGetInputDataType(const aclmdlDesc *modelDesc, size_t index);
992- 
993-/**
994- * @ingroup AscendCL
995- * @brief get output data type by index
996- *
997- * @param modelDesc [IN] model description
998- * @param index [IN] output tensor index
999- *
1000- * @retval output tensor data type
1001- */
1002-ACL_FUNC_VISIBILITY aclDataType aclmdlGetOutputDataType(const aclmdlDesc *modelDesc, size_t index);
1003- 
1004-/**
1005- * @ingroup AscendCL
1006- * @brief get input tensor index by name
1007- *
1008- * @param modelDesc [IN] model description
1009- * @param name [IN] intput tensor name
1010- * @param index [OUT] intput tensor index
1011- *
1012- * @retval ACL_SUCCESS The function is successfully executed.
1013- * @retval OtherValues Failure
1014- */
1015-ACL_FUNC_VISIBILITY aclError aclmdlGetInputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index);
1016- 
1017-/**
1018- * @ingroup AscendCL
1019- * @brief get output tensor index by name
1020- *
1021- * @param modelDesc [IN] model description
1022- * @param name [IN] output tensor name
1023- * @param index [OUT] output tensor index
1024- *
1025- * @retval ACL_SUCCESS The function is successfully executed.
1026- * @retval OtherValues Failure
1027- */
1028-ACL_FUNC_VISIBILITY aclError aclmdlGetOutputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index);
1029- 
1030-/**
1031- * @ingroup AscendCL
1032- * @brief get dynamic batch info
1033- *
1034- * @param modelDesc [IN] model description
1035- * @param batch [OUT] dynamic batch info
1036- *
1037- * @retval ACL_SUCCESS The function is successfully executed.
1038- * @retval OtherValues Failure
1039- */
1040-ACL_FUNC_VISIBILITY aclError aclmdlGetDynamicBatch(const aclmdlDesc *modelDesc, aclmdlBatch *batch);
1041- 
1042-/**
1043- * @ingroup AscendCL
1044- * @brief get dynamic height&width info
1045- *
1046- * @param modelDesc [IN] model description
1047- * @param index [IN] input tensor index
1048- * @param hw [OUT] dynamic height&width info
1049- *
1050- * @retval ACL_SUCCESS The function is successfully executed.
1051- * @retval OtherValues Failure
1052- */
1053-ACL_FUNC_VISIBILITY aclError aclmdlGetDynamicHW(const aclmdlDesc *modelDesc, size_t index, aclmdlHW *hw);
1054- 
1055-/**
1056- * @ingroup AscendCL
1057- * @brief get dynamic gear count
1058- *
1059- * @param modelDesc [IN] model description
1060- * @param index [IN] unused, must be -1
1061- * @param gearCount [OUT] dynamic gear count
1062- *
1063- * @retval ACL_SUCCESS The function is successfully executed.
1064- * @retval OtherValues Failure
1065- */
1066-ACL_FUNC_VISIBILITY aclError aclmdlGetInputDynamicGearCount(const aclmdlDesc *modelDesc, size_t index,
1067- size_t *gearCount);
1068- 
1069-/**
1070- * @ingroup AscendCL
1071- * @brief get dynamic dims info
1072- *
1073- * @param modelDesc [IN] model description
1074- * @param index [IN] unused, must be -1
1075- * @param dims [OUT] value of dynamic dims
1076- * @param gearCount [IN] dynamic gear count
1077- *
1078- * @retval ACL_SUCCESS The function is successfully executed.
1079- * @retval OtherValues Failure
1080- */
1081-ACL_FUNC_VISIBILITY aclError aclmdlGetInputDynamicDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims,
1082- size_t gearCount);
1083- 
1084-/**
1085- * @ingroup AscendCL
1086- * @brief Create data of type aclmdlAIPP
1087- *
1088- * @param batchSize [IN] batchsizes of model
1089- *
1090- * @retval the aclmdlAIPP pointer
1091- */
1092-ACL_FUNC_VISIBILITY aclmdlAIPP *aclmdlCreateAIPP(uint64_t batchSize);
1093- 
1094-/**
1095- * @ingroup AscendCL
1096- * @brief destroy data of type aclmdlAIPP
1097- *
1098- * @param aippParmsSet [IN] Pointer for aclmdlAIPP to be destroyed
1099- *
1100- * @retval ACL_SUCCESS The function is successfully executed.
1101- * @retval OtherValues Failure
1102- */
1103-ACL_FUNC_VISIBILITY aclError aclmdlDestroyAIPP(const aclmdlAIPP *aippParmsSet);
1104- 
1105-/**
1106- * @ingroup AscendCL
1107- * @brief Get dynamic aipp data need size according to batchSize
1108- *
1109- * @param batchSize [IN] batchsizes of model
1110- * @param size [OUT] Pointer of aipp data need size according to batchSize
1111- *
1112- * @retval ACL_SUCCESS The function is successfully executed.
1113- * @retval OtherValues Failure
1114- */
1115-ACL_FUNC_VISIBILITY aclError aclmdlGetAippDataSize(uint64_t batchSize, size_t *size);
1116- 
1117-/**
1118- * @ingroup AscendCL
1119- * @brief set InputFormat of type aclmdlAIPP
1120- *
1121- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1122- * @param inputFormat [IN] The inputFormat of aipp
1123- *
1124- * @retval ACL_SUCCESS The function is successfully executed.
1125- * @retval OtherValues Failure
1126- *
1127- * @see aclmdlCreateAIPP
1128- */
1129-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPInputFormat(aclmdlAIPP *aippParmsSet, aclAippInputFormat inputFormat);
1130- 
1131-/**
1132- * @ingroup AscendCL
1133- * @brief set cscParms of type aclmdlAIPP
1134- *
1135- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1136- * @param csc_switch [IN] Csc switch
1137- * @param cscMatrixR0C0 [IN] Csc_matrix_r0_c0
1138- * @param cscMatrixR0C1 [IN] Csc_matrix_r0_c1
1139- * @param cscMatrixR0C2 [IN] Csc_matrix_r0_c2
1140- * @param cscMatrixR1C0 [IN] Csc_matrix_r1_c0
1141- * @param cscMatrixR1C1 [IN] Csc_matrix_r1_c1
1142- * @param cscMatrixR1C2 [IN] Csc_matrix_r1_c2
1143- * @param cscMatrixR2C0 [IN] Csc_matrix_r2_c0
1144- * @param cscMatrixR2C1 [IN] Csc_matrix_r2_c1
1145- * @param cscMatrixR2C2 [IN] Csc_matrix_r2_c2
1146- * @param cscOutputBiasR0 [IN] Output Bias for RGB to YUV, element of row 0, unsigned number
1147- * @param cscOutputBiasR1 [IN] Output Bias for RGB to YUV, element of row 1, unsigned number
1148- * @param cscOutputBiasR2 [IN] Output Bias for RGB to YUV, element of row 2, unsigned number
1149- * @param cscInputBiasR0 [IN] Input Bias for YUV to RGB, element of row 0, unsigned number
1150- * @param cscInputBiasR1 [IN] Input Bias for YUV to RGB, element of row 1, unsigned number
1151- * @param cscInputBiasR2 [IN] Input Bias for YUV to RGB, element of row 2, unsigned number
1152- *
1153- * @retval ACL_SUCCESS The function is successfully executed.
1154- * @retval OtherValues Failure
1155- *
1156- * @see aclmdlCreateAIPP
1157-*/
1158-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, int8_t cscSwitch,
1159- int16_t cscMatrixR0C0, int16_t cscMatrixR0C1, int16_t cscMatrixR0C2,
1160- int16_t cscMatrixR1C0, int16_t cscMatrixR1C1, int16_t cscMatrixR1C2,
1161- int16_t cscMatrixR2C0, int16_t cscMatrixR2C1, int16_t cscMatrixR2C2,
1162- uint8_t cscOutputBiasR0, uint8_t cscOutputBiasR1,
1163- uint8_t cscOutputBiasR2, uint8_t cscInputBiasR0,
1164- uint8_t cscInputBiasR1, uint8_t cscInputBiasR2);
1165- 
1166-/**
1167- * @ingroup AscendCL
1168- * @brief set rb/ub swap switch of type aclmdlAIPP
1169- *
1170- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1171- * @param rbuvSwapSwitch [IN] rb/ub swap switch
1172- *
1173- * @retval ACL_SUCCESS The function is successfully executed.
1174- * @retval OtherValues Failure
1175- *
1176- * @see aclmdlCreateAIPP
1177-*/
1178-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPRbuvSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t rbuvSwapSwitch);
1179- 
1180-/**
1181- * @ingroup AscendCL
1182- * @brief set RGBA->ARGB, YUVA->AYUV swap switch of type aclmdlAIPP
1183- *
1184- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1185- * @param axSwapSwitch [IN] RGBA->ARGB, YUVA->AYUV swap switch
1186- *
1187- * @retval ACL_SUCCESS The function is successfully executed.
1188- * @retval OtherValues Failure
1189- *
1190- * @see aclmdlCreateAIPP
1191-*/
1192-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPAxSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t axSwapSwitch);
1193- 
1194-/**
1195- * @ingroup AscendCL
1196- * @brief set source image of type aclmdlAIPP
1197- *
1198- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1199- * @param srcImageSizeW [IN] Source image width
1200- * @param srcImageSizeH [IN] Source image height
1201- *
1202- * @retval ACL_SUCCESS The function is successfully executed.
1203- * @retval OtherValues Failure
1204- *
1205- * @see aclmdlCreateAIPP
1206-*/
1207-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPSrcImageSize(aclmdlAIPP *aippParmsSet, int32_t srcImageSizeW,
1208- int32_t srcImageSizeH);
1209- 
1210-/**
1211- * @ingroup AscendCL
1212- * @brief set resize switch of type aclmdlAIPP
1213- *
1214- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1215- * @param scfSwitch [IN] Resize switch
1216- * @param scfInputSizeW [IN] Input width of scf
1217- * @param scfInputSizeH [IN] Input height of scf
1218- * @param scfOutputSizeW [IN] Output width of scf
1219- * @param scfOutputSizeH [IN] Output height of scf
1220- * @param batchIndex [IN] Batch parameter index
1221- *
1222- * @retval ACL_SUCCESS The function is successfully executed.
1223- * @retval OtherValues Failure
1224- *
1225- * @see aclmdlCreateAIPP
1226-*/
1227-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPScfParams(aclmdlAIPP *aippParmsSet,
1228- int8_t scfSwitch,
1229- int32_t scfInputSizeW,
1230- int32_t scfInputSizeH,
1231- int32_t scfOutputSizeW,
1232- int32_t scfOutputSizeH,
1233- uint64_t batchIndex);
1234- 
1235-/**
1236- * @ingroup AscendCL
1237- * @brief set cropParams of type aclmdlAIPP
1238- *
1239- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1240- * @param cropSwitch [IN] Crop switch
1241- * @param cropStartPosW [IN] The start horizontal position of cropping
1242- * @param cropStartPosH [IN] The start vertical position of cropping
1243- * @param cropSizeW [IN] Crop width
1244- * @param cropSizeH [IN] Crop height
1245- * @param batchIndex [IN] Batch parameter index
1246- *
1247- * @retval ACL_SUCCESS The function is successfully executed.
1248- * @retval OtherValues Failure
1249- *
1250- * @see aclmdlCreateAIPP
1251-*/
1252-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet,
1253- int8_t cropSwitch,
1254- int32_t cropStartPosW,
1255- int32_t cropStartPosH,
1256- int32_t cropSizeW,
1257- int32_t cropSizeH,
1258- uint64_t batchIndex);
1259- 
1260-/**
1261- * @ingroup AscendCL
1262- * @brief set paddingParams of type aclmdlAIPP
1263- *
1264- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1265- * @param paddingSwitch [IN] Padding switch
1266- * @param paddingSizeTop [IN] Top padding size
1267- * @param paddingSizeBottom [IN] Bottom padding size
1268- * @param paddingSizeLeft [IN] Left padding size
1269- * @param paddingSizeRight [IN] Right padding size
1270- * @param batchIndex [IN] Batch parameter index
1271- *
1272- * @retval ACL_SUCCESS The function is successfully executed.
1273- * @retval OtherValues Failure
1274- *
1275- * @see aclmdlCreateAIPP
1276-*/
1277-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPaddingParams(aclmdlAIPP *aippParmsSet, int8_t paddingSwitch,
1278- int32_t paddingSizeTop, int32_t paddingSizeBottom,
1279- int32_t paddingSizeLeft, int32_t paddingSizeRight,
1280- uint64_t batchIndex);
1281- 
1282-/**
1283- * @ingroup AscendCL
1284- * @brief set DtcPixelMean of type aclmdlAIPP
1285- *
1286- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1287- * @param dtcPixelMeanChn0 [IN] Mean value of channel 0
1288- * @param dtcPixelMeanChn1 [IN] Mean value of channel 1
1289- * @param dtcPixelMeanChn2 [IN] Mean value of channel 2
1290- * @param dtcPixelMeanChn3 [IN] Mean value of channel 3
1291- * @param batchIndex [IN] Batch parameter index
1292- *
1293- * @retval ACL_SUCCESS The function is successfully executed.
1294- * @retval OtherValues Failure
1295- *
1296- * @see aclmdlCreateAIPP
1297-*/
1298-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMean(aclmdlAIPP *aippParmsSet,
1299- int16_t dtcPixelMeanChn0,
1300- int16_t dtcPixelMeanChn1,
1301- int16_t dtcPixelMeanChn2,
1302- int16_t dtcPixelMeanChn3,
1303- uint64_t batchIndex);
1304- 
1305-/**
1306- * @ingroup AscendCL
1307- * @brief set DtcPixelMin of type aclmdlAIPP
1308- *
1309- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1310- * @param dtcPixelMinChn0 [IN] Min value of channel 0
1311- * @param dtcPixelMinChn1 [IN] Min value of channel 1
1312- * @param dtcPixelMinChn2 [IN] Min value of channel 2
1313- * @param dtcPixelMinChn3 [IN] Min value of channel 3
1314- * @param batchIndex [IN] Batch parameter index
1315- *
1316- * @retval ACL_SUCCESS The function is successfully executed.
1317- * @retval OtherValues Failure
1318- *
1319- * @see aclmdlCreateAIPP
1320-*/
1321-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet,
1322- float dtcPixelMinChn0,
1323- float dtcPixelMinChn1,
1324- float dtcPixelMinChn2,
1325- float dtcPixelMinChn3,
1326- uint64_t batchIndex);
1327- 
1328-/**
1329- * @ingroup AscendCL
1330- * @brief set PixelVarReci of type aclmdlAIPP
1331- *
1332- * @param aippParmsSet [OUT] Pointer for aclmdlAIPP
1333- * @param dtcPixelVarReciChn0 [IN] sfr_dtc_pixel_variance_reci_ch0
1334- * @param dtcPixelVarReciChn1 [IN] sfr_dtc_pixel_variance_reci_ch1
1335- * @param dtcPixelVarReciChn2 [IN] sfr_dtc_pixel_variance_reci_ch2
1336- * @param dtcPixelVarReciChn3 [IN] sfr_dtc_pixel_variance_reci_ch3
1337- * @param batchIndex [IN] Batch parameter index
1338- *
1339- * @retval ACL_SUCCESS The function is successfully executed.
1340- * @retval OtherValues Failure
1341- *
1342- * @see aclmdlCreateAIPP
1343-*/
1344-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet,
1345- float dtcPixelVarReciChn0,
1346- float dtcPixelVarReciChn1,
1347- float dtcPixelVarReciChn2,
1348- float dtcPixelVarReciChn3,
1349- uint64_t batchIndex);
1350- 
1351-/**
1352- * @ingroup AscendCL
1353- * @brief set aipp parameters to model
1354- *
1355- * @param modelId [IN] model id
1356- * @param dataset [IN] Pointer of dataset
1357- * @param index [IN] index of input for aipp data(ACL_DYNAMIC_AIPP_NODE)
1358- * @param aippParmsSet [IN] Pointer for aclmdlAIPP
1359- *
1360- * @retval ACL_SUCCESS The function is successfully executed.
1361- * @retval OtherValues Failure
1362- *
1363- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
1364- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP
1365-*/
1366-ACL_FUNC_VISIBILITY aclError aclmdlSetInputAIPP(uint32_t modelId,
1367- aclmdlDataset *dataset,
1368- size_t index,
1369- const aclmdlAIPP *aippParmsSet);
1370- 
1371-/**
1372- * @ingroup AscendCL
1373- * @brief set aipp parameters to model
1374- *
1375- * @param modelId [IN] model id
1376- * @param dataset [IN] Pointer of dataset
1377- * @param index [IN] index of input for data which linked dynamic aipp(ACL_DATA_WITH_DYNAMIC_AIPP)
1378- * @param aippParmsSet [IN] Pointer for aclmdlAIPP
1379- *
1380- * @retval ACL_SUCCESS The function is successfully executed.
1381- * @retval OtherValues Failure
1382- *
1383- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
1384- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP
1385-*/
1386-ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPByInputIndex(uint32_t modelId,
1387- aclmdlDataset *dataset,
1388- size_t index,
1389- const aclmdlAIPP *aippParmsSet);
1390- 
1391-/**
1392- * @ingroup AscendCL
1393- * @brief get input aipp type
1394- *
1395- * @param modelId [IN] model id
1396- * @param index [IN] index of input
1397- * @param type [OUT] aipp type for input.refrer to aclmdlInputAippType(enum)
1398- * @param dynamicAttachedDataIndex [OUT] index for dynamic attached data(ACL_DYNAMIC_AIPP_NODE)
1399- * valid when type is ACL_DATA_WITH_DYNAMIC_AIPP, invalid value is ACL_INVALID_NODE_INDEX
1400- *
1401- * @retval ACL_SUCCESS The function is successfully executed.
1402- * @retval OtherValues Failure
1403- *
1404- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
1405- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP
1406-*/
1407-ACL_FUNC_VISIBILITY aclError aclmdlGetAippType(uint32_t modelId,
1408- size_t index,
1409- aclmdlInputAippType *type,
1410- size_t *dynamicAttachedDataIndex);
1411- 
1412-/**
1413- * @ingroup AscendCL
1414- * @brief get static aipp parameters from model
1415- *
1416- * @param modelId [IN] model id
1417- * @param index [IN] index of tensor
1418- * @param aippInfo [OUT] Pointer for static aipp info
1419- *
1420- * @retval ACL_SUCCESS The function is successfully executed.
1421- * @retval ACL_ERROR_MODEL_AIPP_NOT_EXIST The tensor of index is not configured with aipp
1422- * @retval OtherValues Failure
1423- *
1424- * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem |
1425- * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName
1426-*/
1427-ACL_FUNC_VISIBILITY aclError aclmdlGetFirstAippInfo(uint32_t modelId, size_t index, aclAippInfo *aippInfo);
1428- 
1429-/**
1430- * @ingroup AscendCL
1431- * @brief get op description info
1432- *
1433- * @param deviceId [IN] device id
1434- * @param streamId [IN] stream id
1435- * @param taskId [IN] task id
1436- * @param opName [OUT] pointer to op name
1437- * @param opNameLen [IN] the length of op name
1438- * @param inputDesc [OUT] pointer to input description
1439- * @param numInputs [OUT] the number of input tensor
1440- * @param outputDesc [OUT] pointer to output description
1441- * @param numOutputs [OUT] the number of output tensor
1442- *
1443- * @retval ACL_SUCCESS The function is successfully executed
1444- * @retval OtherValues Failure
1445-*/
1446-ACL_FUNC_VISIBILITY aclError aclmdlCreateAndGetOpDesc(uint32_t deviceId, uint32_t streamId,
1447- uint32_t taskId, char *opName, size_t opNameLen, aclTensorDesc **inputDesc, size_t *numInputs,
1448- aclTensorDesc **outputDesc, size_t *numOutputs);
1449- 
1450-/**
1451- * @ingroup AscendCL
1452- * @brief init dump
1453- *
1454- * @retval ACL_SUCCESS The function is successfully executed.
1455- * @retval OtherValues Failure
1456-*/
1457-ACL_FUNC_VISIBILITY aclError aclmdlInitDump();
1458- 
1459-/**
1460- * @ingroup AscendCL
1461- * @brief set param of dump
1462- *
1463- * @param dumpCfgPath [IN] the path of dump config
1464- *
1465- * @retval ACL_SUCCESS The function is successfully executed.
1466- * @retval OtherValues Failure
1467-*/
1468-ACL_FUNC_VISIBILITY aclError aclmdlSetDump(const char *dumpCfgPath);
1469- 
1470-/**
1471- * @ingroup AscendCL
1472- * @brief finalize dump.
1473- *
1474- * @retval ACL_SUCCESS The function is successfully executed.
1475- * @retval OtherValues Failure
1476-*/
1477-ACL_FUNC_VISIBILITY aclError aclmdlFinalizeDump();
1478- 
1479-/**
1480- * @ingroup AscendCL
1481- * @brief load model with config
1482- *
1483- * @param handle [IN] pointer to model config handle
1484- * @param modelId [OUT] pointer to model id
1485- *
1486- * @retval ACL_SUCCESS The function is successfully executed.
1487- * @retval OtherValues Failure
1488-*/
1489-ACL_FUNC_VISIBILITY aclError aclmdlLoadWithConfig(const aclmdlConfigHandle *handle, uint32_t *modelId);
1490- 
1491-/**
1492- * @ingroup AscendCL
1493- * @brief create model config handle of type aclmdlConfigHandle
1494- *
1495- * @retval the aclmdlConfigHandle pointer
1496- *
1497- * @see aclmdlDestroyConfigHandle
1498-*/
1499-ACL_FUNC_VISIBILITY aclmdlConfigHandle *aclmdlCreateConfigHandle();
1500- 
1501-/**
1502- * @ingroup AscendCL
1503- * @brief destroy data of type aclmdlConfigHandle
1504- *
1505- * @param handle [IN] pointer to model config handle
1506- *
1507- * @retval ACL_SUCCESS The function is successfully executed.
1508- * @retval OtherValues Failure
1509- *
1510- * @see aclmdlCreateConfigHandle
1511- */
1512-ACL_FUNC_VISIBILITY aclError aclmdlDestroyConfigHandle(aclmdlConfigHandle *handle);
1513- 
1514-/**
1515- * @ingroup AscendCL
1516- * @brief set config for model load
1517- *
1518- * @param handle [OUT] pointer to model config handle
1519- * @param attr [IN] config attr in model config handle to be set
1520- * @param attrValue [IN] pointer to model config value
1521- * @param valueSize [IN] memory size of attrValue
1522- *
1523- * @retval ACL_SUCCESS The function is successfully executed.
1524- * @retval OtherValues Failure
1525- */
1526-ACL_FUNC_VISIBILITY aclError aclmdlSetConfigOpt(aclmdlConfigHandle *handle, aclmdlConfigAttr attr,
1527- const void *attrValue, size_t valueSize);
1528- 
1529-/**
1530- * @ingroup AscendCL
1531- * @brief set config for model execute
1532- *
1533- * @param handle [OUT] pointer to model execute config handle
1534- * @param attr [IN] config attr in model execute config handle to be set
1535- * @param attrValue [IN] pointer to model execute config value
1536- * @param valueSize [IN] memory size of attrValue
1537- *
1538- * @retval ACL_SUCCESS The function is successfully executed.
1539- * @retval OtherValues Failure
1540- */
1541-ACL_FUNC_VISIBILITY aclError aclmdlSetExecConfigOpt(aclmdlExecConfigHandle *handle, aclmdlExecConfigAttr attr,
1542- const void *attrValue, size_t valueSize);
1543- 
1544-/**
1545- * @ingroup AscendCL
1546- * @brief get real tensor name from modelDesc
1547- *
1548- * @param modelDesc [IN] pointer to modelDesc
1549- * @param name [IN] tensor name
1550- *
1551- * @retval the pointer of real tensor name
1552- * @retval Failure return NULL
1553- */
1554-ACL_FUNC_VISIBILITY const char *aclmdlGetTensorRealName(const aclmdlDesc *modelDesc, const char *name);
1555- 
1556-/**
1557- * @ingroup AscendCL
1558- * @brief recover all hccl tasks on target device
1559- *
1560- * @param deviceId [IN] the device id
1561- * @retval ACL_SUCCESS The function is successfully executed.
1562- * @retval ACL_ERROR_INVALID_FILE Failure
1563- */
1564-ACL_FUNC_VISIBILITY aclError aclRecoverAllHcclTasks(int32_t deviceId);
1565- 
1566-/**
1567- * @ingroup AscendCL
1568- * @brief begin capture
1569- * @param stream [IN] set the stream to be captured
1570- * @param mode [IN] capture mode
1571- * @retval ACL_SUCCESS The function is successfully executed.
1572- * @retval OtherValues Failure
1573- */
1574-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureBegin(aclrtStream stream, aclmdlRICaptureMode mode);
1575- 
1576-/**
1577- * @ingroup AscendCL
1578- * @brief obtain the capture information of a stream
1579- * @param stream [IN] stream to be queried
1580- * @param status [OUT] return the stream status
1581- * @param modelRI [OUT] return the model runtime instance
1582- * @retval ACL_SUCCESS The function is successfully executed.
1583- * @retval OtherValues Failure
1584- */
1585-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureGetInfo(aclrtStream stream, aclmdlRICaptureStatus *status, aclmdlRI *modelRI);
1586- 
1587-/**
1588- * @ingroup AscendCL
1589- * @brief end the stream capture and obtain the corresponding model
1590- * @param stream [IN] stream to be ended
1591- * @param modelRI [OUT] return the model runtime instance
1592- * @retval ACL_SUCCESS The function is successfully executed.
1593- * @retval OtherValues Failure
1594- */
1595-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureEnd(aclrtStream stream, aclmdlRI *modelRI);
1596- 
1597-/**
1598- * @ingroup AscendCL
1599- * @brief print model information
1600- * @param modelRI [IN] model runtime instance
1601- * @retval ACL_SUCCESS The function is successfully executed.
1602- * @retval OtherValues Failure
1603- */
1604-ACL_FUNC_VISIBILITY aclError aclmdlRIDebugPrint(aclmdlRI modelRI);
1605- 
1606-/**
1607- * @ingroup AscendCL
1608- * @brief the start interface of the task group
1609- * @param stream [IN] capture stream
1610- * @retval ACL_SUCCESS The function is successfully executed.
1611- * @retval OtherValues Failure
1612- */
1613-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureTaskGrpBegin(aclrtStream stream);
1614- 
1615-/**
1616- * @ingroup AscendCL
1617- * @brief the end interface of the task group
1618- * @param stream [IN] capture stream
1619- * @param handle [OUT] task group handle
1620- * @retval ACL_SUCCESS The function is successfully executed.
1621- * @retval OtherValues Failure
1622- */
1623-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureTaskGrpEnd(aclrtStream stream, aclrtTaskGrp *handle);
1624- 
1625-/**
1626- * @ingroup AscendCL
1627- * @brief begin to update the task group specified by the handle
1628- * @param stream [IN] specify the stream used for task update
1629- * @param handle [IN] task group handle
1630- * @retval ACL_SUCCESS The function is successfully executed.
1631- * @retval OtherValues Failure
1632- */
1633-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureTaskUpdateBegin(aclrtStream stream, aclrtTaskGrp handle);
1634- 
1635-/**
1636- * @ingroup AscendCL
1637- * @brief end the update of the task
1638- * @param stream [IN] specify the stream used for task update
1639- * @retval ACL_SUCCESS The function is successfully executed.
1640- * @retval OtherValues Failure
1641- */
1642-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureTaskUpdateEnd(aclrtStream stream);
1643- 
1644-/**
1645- * @ingroup AscendCL
1646- * @brief dump the json content of the model
1647- * @param modelRI [IN] model runtime instance
1648- * @param path [IN] json file path
1649- * @param flags [IN] control whether to dump Kernel Args
1650- * @retval ACL_SUCCESS The function is successfully executed.
1651- * @retval OtherValues Failure
1652- */
1653-ACL_FUNC_VISIBILITY aclError aclmdlRIDebugJsonPrint(aclmdlRI modelRI, const char* path, uint32_t flags);
1654- 
1655-/**
1656- * @ingroup AscendCL
1657- * @brief Switch the capture mode for the current thread.
1658- * @param mode [IN] capture mode
1659- * @retval ACL_SUCCESS The function is successfully executed.
1660- * @retval OtherValues Failure
1661- */
1662-ACL_FUNC_VISIBILITY aclError aclmdlRICaptureThreadExchangeMode(aclmdlRICaptureMode* mode);
1663- 
1664-#ifdef __cplusplus
1665-}
1666-#endif
1667- 
1668-#endif // INC_EXTERNAL_ACL_ACL_MODEL_H_
Dthird_party/acl/inc/acl/acl_op.h+0-605
@@ -1,605 +0,0 @@
1-/**
2-* @file acl_op.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10-#ifndef INC_EXTERNAL_ACL_ACL_OP_H_
11-#define INC_EXTERNAL_ACL_ACL_OP_H_
12- 
13-#include "acl_base.h"
14-#include "acl_rt.h"
15- 
16-#ifdef __cplusplus
17-extern "C" {
18-#endif
19- 
20-typedef struct aclopHandle aclopHandle;
21-typedef struct aclopAttr aclopAttr;
22-typedef struct aclopKernelDesc aclopKernelDesc;
23- 
24-typedef void (*aclDataDeallocator)(void *data, size_t length);
25- 
26-static const int ACL_COMPILE_FLAG_BIN_SELECTOR = 1;
27- 
28-typedef enum aclEngineType {
29- ACL_ENGINE_SYS,
30- ACL_ENGINE_AICORE,
31- ACL_ENGINE_VECTOR,
32-} aclopEngineType;
33- 
34-/**
35- * @ingroup AscendCL
36- * @brief Set base directory that contains single op models
37- *
38- * @par Restriction
39- * The aclopSetModelDir interface can be called only once in a process.
40- * @param modelDir [IN] path of the directory
41- *
42- * @retval ACL_SUCCESS The function is successfully executed.
43- * @retval OtherValues Failure
44- */
45-ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir);
46- 
47-/**
48- * @ingroup AscendCL
49- * @brief load single op models from memory
50- *
51- * @par Restriction
52- * The aclopLoad interface can be called more than one times in a process.
53- * @param model [IN] address of single op models
54- * @param modelSize [IN] size of single op models
55- *
56- * @retval ACL_SUCCESS The function is successfully executed.
57- * @retval OtherValues Failure
58- */
59-ACL_FUNC_VISIBILITY aclError aclopLoad(const void *model, size_t modelSize);
60- 
61-/**
62- * @ingroup AscendCL
63- * @brief create data of type aclopAttr
64- *
65- * @retval pointer to created instance.
66- * @retval nullptr if run out of memory
67- */
68-ACL_FUNC_VISIBILITY aclopAttr *aclopCreateAttr();
69- 
70-/**
71- * @ingroup AscendCL
72- * @brief destroy data of typ aclopAttr
73- *
74- * @param attr [IN] pointer to the instance of aclopAttr
75- */
76-ACL_FUNC_VISIBILITY void aclopDestroyAttr(const aclopAttr *attr);
77- 
78-/**
79- * @ingroup AscendCL
80- * @brief set an attribute. the type of the attribute is bool
81- *
82- * @param attr [OUT] pointer to the instance of aclopAttr
83- * @param attrName [IN] attribute name
84- * @param attrValue [IN] attribute value
85- * false if attrValue is 0, true otherwise.
86- *
87- * @retval ACL_SUCCESS The function is successfully executed.
88- * @retval OtherValues Failure
89- */
90-ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrName, uint8_t attrValue);
91- 
92-/**
93- * @ingroup AscendCL
94- * @brief set an attribute. the type of the attribute is int64_t
95- *
96- * @param attr [OUT] pointer to the instance of aclopAttr
97- * @param attrName [IN] attribute name
98- * @param attrValue [IN] attribute value
99- *
100- * @retval ACL_SUCCESS The function is successfully executed.
101- * @retval OtherValues Failure
102- */
103-ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrName, int64_t attrValue);
104- 
105-/**
106- * @ingroup AscendCL
107- * @brief set an attribute. the type of the attribute is float
108- *
109- * @param attr [OUT] pointer to the instance of aclopAttr
110- * @param attrName [IN] attribute name
111- * @param attrValue [IN] attribute value
112- *
113- * @retval ACL_SUCCESS The function is successfully executed.
114- * @retval OtherValues Failure
115- */
116-ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attrName, float attrValue);
117- 
118-/**
119- * @ingroup AscendCL
120- * @brief set an attribute. the type of the attribute is string
121- *
122- * @param attr [OUT] pointer to the instance of aclopAttr
123- * @param attrName [IN] attribute name
124- * @param attrValue [IN] attribute value
125- *
126- * @retval ACL_SUCCESS The function is successfully executed.
127- * @retval OtherValues Failure
128- */
129-ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *attrName, const char *attrValue);
130- 
131-/**
132- * @ingroup AscendCL
133- * @brief set an attribute. the type of the attribute is aclDataType
134- *
135- * @param attr [OUT] pointer to the instance of aclopAttr
136- * @param attrName [IN] attribute name
137- * @param attrValue [IN] attribute value
138- *
139- * @retval ACL_SUCCESS The function is successfully executed.
140- * @retval OtherValues Failure
141- */
142-ACL_FUNC_VISIBILITY aclError aclopSetAttrDataType(aclopAttr *attr, const char *attrName, aclDataType attrValue);
143- 
144-/**
145- * @ingroup AscendCL
146- * @brief set an attribute. the type of the attribute is list of aclDataType
147- *
148- * @param attr [OUT] pointer to the instance of aclopAttr
149- * @param attrName [IN] attribute name
150- * @param numValues [IN] number of values. false if attrValue is 0, true otherwise.
151- * @param values [IN] pointer to values
152- *
153- * @retval ACL_SUCCESS The function is successfully executed.
154- * @retval OtherValues Failure
155- */
156-ACL_FUNC_VISIBILITY aclError aclopSetAttrListDataType(aclopAttr *attr, const char *attrName, int numValues,
157- const aclDataType values[]);
158- 
159-/**
160- * @ingroup AscendCL
161- * @brief set an attribute. the type of the attribute is list of bools
162- *
163- * @param attr [OUT] pointer to the instance of aclopAttr
164- * @param attrName [IN] attribute name
165- * @param numValues [IN] number of values. false if attrValue is 0, true otherwise.
166- * @param values [IN] pointer to values
167- *
168- * @retval ACL_SUCCESS The function is successfully executed.
169- * @retval OtherValues Failure
170- */
171-ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues,
172- const uint8_t *values);
173- 
174-/**
175- * @ingroup AscendCL
176- * @brief set an attribute. the type of the attribute is list of ints
177- *
178- * @param attr [OUT] pointer to the instance of aclopAttr
179- * @param attrName [IN] attribute name
180- * @param numValues [IN] number of values
181- * @param values [IN] pointer to values
182- *
183- * @retval ACL_SUCCESS The function is successfully executed.
184- * @retval OtherValues Failure
185- */
186-ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues,
187- const int64_t *values);
188- 
189-/**
190- * @ingroup AscendCL
191- * @brief set an attribute. the type of the attribute is list of floats
192- *
193- * @param attr [OUT] pointer to the instance of aclopAttr
194- * @param attrName [IN] attribute name
195- * @param numValues [IN] number of values
196- * @param values [IN] pointer to values
197- *
198- * @retval ACL_SUCCESS The function is successfully executed.
199- * @retval OtherValues Failure
200- */
201-ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues,
202- const float *values);
203- 
204-/**
205- * @ingroup AscendCL
206- * @brief set an attribute. the type of the attribute is list of strings
207- *
208- * @param attr [OUT] pointer to the instance of aclopAttr
209- * @param attrName [IN] attribute name
210- * @param numValues [IN] number of values
211- * @param values [IN] pointer to values
212- *
213- * @retval ACL_SUCCESS The function is successfully executed.
214- * @retval OtherValues Failure
215- */
216-ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues,
217- const char **values);
218- 
219-/**
220- * @ingroup AscendCL
221- * @brief set an attribute. the type of the attribute is list of list of ints
222- *
223- * @param attr [OUT] pointer to the instance of aclopAttr
224- * @param attrName [IN] attribute name
225- * @param numLists [IN] number of lists
226- * @param numValues [IN] pointer to number of values of each list
227- * @param values [IN] pointer to values
228- *
229- * @retval ACL_SUCCESS The function is successfully executed.
230- * @retval OtherValues Failure
231- */
232-ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr,
233- const char *attrName,
234- int numLists,
235- const int *numValues,
236- const int64_t *const values[]);
237- 
238-/**
239- * @ingroup AscendCL
240- * @brief Load and execute the specified operator asynchronously
241- *
242- * @par Restriction
243- * @li The input and output organization of each operator is different,
244- * and the application needs to organize the operator strictly
245- * according to the operator input and output parameters when calling.
246- * @li When the user calls aclopExecute,
247- * the ACL finds the corresponding task according to the optype,
248- * the description of the input tesnsor,
249- * the description of the output tesnsor, and attr, and issues the execution.
250- *
251- * @param opType [IN] type of op
252- * @param numInputs [IN] number of inputs
253- * @param inputDesc [IN] pointer to array of input tensor descriptions
254- * @param inputs [IN] pointer to array of input buffers
255- * @param numOutputs [IN] number of outputs
256- * @param outputDesc [IN] pointer to array of output tensor descriptions
257- * @param outputs [OUT] pointer to array of output buffers
258- * @param attr [IN] pointer to instance of aclopAttr.
259- * may pass nullptr if the op has no attribute
260- * @param stream [IN] stream
261- *
262- * @retval ACL_SUCCESS The function is successfully executed.
263- * @retval OtherValues Failure
264- */
265-ACL_DEPRECATED_MESSAGE("aclopExecute is deprecated, use aclopExecuteV2 instead")
266-ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType,
267- int numInputs,
268- const aclTensorDesc *const inputDesc[],
269- const aclDataBuffer *const inputs[],
270- int numOutputs,
271- const aclTensorDesc *const outputDesc[],
272- aclDataBuffer *const outputs[],
273- const aclopAttr *attr,
274- aclrtStream stream);
275- 
276-/**
277- * @ingroup AscendCL
278- * @brief Load and execute the specified operator
279- * The difference with aclopExecute is that aclopExecuteV2 will refresh outputDesc
280- *
281- * @par Restriction
282- * @li The input and output organization of each operator is different,
283- * and the application needs to organize the operator strictly
284- * according to the operator input and output parameters when calling.
285- * @li When the user calls aclopExecuteV2,
286- * the ACL finds the corresponding task according to the optype,
287- * the description of the input tesnsor,
288- * the description of the output tesnsor, and attr, and issues the execution.
289- *
290- * @param opType [IN] type of op
291- * @param numInputs [IN] number of inputs
292- * @param inputDesc [IN] pointer to array of input tensor descriptions
293- * @param inputs [IN] pointer to array of input buffers
294- * @param numOutputs [IN] number of outputs
295- * @param outputDesc [IN|OUT] pointer to array of output tensor descriptions
296- * @param outputs [OUT] pointer to array of output buffers
297- * @param attr [IN] pointer to instance of aclopAttr.
298- * may pass nullptr if the op has no attribute
299- * @param stream [IN] stream
300- *
301- * @retval ACL_SUCCESS The function is successfully executed.
302- * @retval OtherValues Failure
303- */
304-ACL_FUNC_VISIBILITY aclError aclopExecuteV2(const char *opType,
305- int numInputs,
306- aclTensorDesc *inputDesc[],
307- aclDataBuffer *inputs[],
308- int numOutputs,
309- aclTensorDesc *outputDesc[],
310- aclDataBuffer *outputs[],
311- aclopAttr *attr,
312- aclrtStream stream);
313- 
314-/**
315- * @ingroup AscendCL
316- * @brief create a instance of aclopHandle.
317- *
318- * @param opType [IN] type of op
319- * @param numInputs [IN] number of inputs
320- * @param inputDesc [IN] pointer to array of input tensor descriptions
321- * @param numOutputs [IN] number of outputs
322- * @param outputDesc [IN] pointer to array of output tensor descriptions
323- * @param opAttr [IN] pointer to instance of aclopAttr.
324- * may pass nullptr if the op has no attribute
325- * @param handle [OUT] pointer to the pointer to the handle
326- *
327- * @retval ACL_SUCCESS The function is successfully executed.
328- * @retval OtherValues Failure
329- */
330-ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType,
331- int numInputs,
332- const aclTensorDesc *const inputDesc[],
333- int numOutputs,
334- const aclTensorDesc *const outputDesc[],
335- const aclopAttr *opAttr,
336- aclopHandle **handle);
337- 
338-/**
339- * @ingroup AscendCL
340- * @brief destroy aclopHandle instance
341- *
342- * @param handle [IN] pointer to the instance of aclopHandle
343- */
344-ACL_FUNC_VISIBILITY void aclopDestroyHandle(aclopHandle *handle);
345- 
346-/**
347- * @ingroup AscendCL
348- * @brief execute an op with the handle.
349- * can save op model matching cost compared with aclopExecute
350- *
351- * @param handle [IN] pointer to the instance of aclopHandle.
352- * The aclopCreateHandle interface has been called
353- * in advance to create aclopHandle type data.
354- * @param numInputs [IN] number of inputs
355- * @param inputs [IN] pointer to array of input buffers.
356- * The aclCreateDataBuffer interface has been called
357- * in advance to create aclDataBuffer type data.
358- * @param numOutputs [IN] number of outputs
359- * @param outputs [OUT] pointer to array of output buffers
360- * @param stream [IN] stream
361- *
362- * @retval ACL_SUCCESS The function is successfully executed.
363- * @retval OtherValues Failure
364- *
365- * @see aclopCreateHandle | aclCreateDataBuffer
366- */
367-ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle,
368- int numInputs,
369- const aclDataBuffer *const inputs[],
370- int numOutputs,
371- aclDataBuffer *const outputs[],
372- aclrtStream stream);
373- 
374-/**
375- * @ingroup AscendCL
376- * @brief cast data type
377- *
378- * @param srcDesc [IN] source tensor desc
379- * @param srcBuffer [IN] source tensor buffer
380- * @param dstDesc [IN] destination tensor desc
381- * @param dstBuffer [OUT] destination tensor buffer
382- * @param truncate [IN] do not truncate if value is 0, truncate otherwise
383- * @param stream [IN] stream
384- *
385- * @retval ACL_SUCCESS The function is successfully executed.
386- * @retval OtherValues Failure
387- */
388-ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc,
389- const aclDataBuffer *srcBuffer,
390- const aclTensorDesc *dstDesc,
391- aclDataBuffer *dstBuffer,
392- uint8_t truncate,
393- aclrtStream stream);
394- 
395-/**
396- * @ingroup AscendCL
397- * @brief create a handle for casting datatype
398- *
399- * @param srcDesc [IN] source tensor desc
400- * @param dstDesc [IN] destination tensor desc
401- * @param truncate [IN] do not truncate if value is 0, truncate otherwise
402- * @param handle [OUT] pointer to the pointer to the handle
403- *
404- * @retval ACL_SUCCESS The function is successfully executed.
405- * @retval OtherValues Failure
406- */
407-ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc,
408- aclTensorDesc *dstDesc,
409- uint8_t truncate,
410- aclopHandle **handle);
411- 
412- 
413-/**
414- * @ingroup AscendCL
415- * @brief create kernel
416- *
417- * @param opType [IN] op type
418- * @param kernelId [IN] kernel id
419- * @param kernelName [IN] kernel name
420- * @param binData [IN] kernel bin data
421- * @param binSize [IN] kernel bin size
422- * @param enginetype [IN] enigne type
423- * @param deallocator [IN] callback function for deallocating bin data,
424- * null if bin data to be deallocated by caller
425- *
426- * @retval ACL_SUCCESS The function is successfully executed.
427- * @retval OtherValues Failure
428- *
429- * @see aclopCompile
430- */
431-ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType,
432- const char *kernelId,
433- const char *kernelName,
434- void *binData,
435- int binSize,
436- aclopEngineType enginetype,
437- aclDataDeallocator deallocator);
438- 
439- 
440-/**
441- * @ingroup AscendCL
442- * @brief create kernel
443- *
444- * @param numInputs [IN] number of inputs
445- * @param inputDesc [IN] pointer to array of input tensor descriptions
446- * @param numOutputs [IN] number of outputs
447- * @param outputDesc [IN] pointer to array of output tensor descriptions
448- * @param opAttr [IN] pointer to instance of aclopAttr
449- * @param aclopKernelDesc [IN] pointer to instance of aclopKernelDesc
450- *
451- * @retval ACL_SUCCESS The function is successfully executed.
452- * @retval OtherValues Failure
453- */
454-typedef aclError (*aclopCompileFunc)(int numInputs,
455- const aclTensorDesc *const inputDesc[],
456- int numOutputs,
457- const aclTensorDesc *const outputDesc[],
458- const aclopAttr *opAttr,
459- aclopKernelDesc *aclopKernelDesc);
460- 
461-/**
462- * @ingroup AscendCL
463- * @brief register compile function
464- *
465- * @param opType [IN] op type
466- * @param func [IN] compile function
467- *
468- * @retval ACL_SUCCESS The function is successfully executed.
469- * @retval OtherValues Failure
470- *
471- * @see aclopUnregisterCompileFunc
472- */
473-ACL_FUNC_VISIBILITY aclError aclopRegisterCompileFunc(const char *opType, aclopCompileFunc func);
474- 
475-/**
476- * @ingroup AscendCL
477- * @brief unregister compile function
478- *
479- * @param opType [IN] op type
480- *
481- * @retval ACL_SUCCESS The function is successfully executed.
482- * @retval OtherValues Failure
483- */
484-ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType);
485- 
486-/**
487- * @ingroup AscendCL
488- * @brief set kernel args
489- *
490- * @param kernelDesc [IN] pointer to instance of aclopKernelDesc
491- * @param kernelId [IN] kernel id
492- * @param blockDim [IN] block dim
493- * @param args [IN] args
494- * @param argSize [IN] size in bytes of args
495- *
496- * @retval ACL_SUCCESS The function is successfully executed.
497- * @retval OtherValues Failure
498- */
499-ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc,
500- const char *kernelId,
501- uint32_t blockDim,
502- const void *args,
503- uint32_t argSize);
504- 
505-/**
506- * @ingroup AscendCL
507- * @brief set workspace sizes
508- *
509- * @param kernelDesc [IN] pointer to instance of aclopKernelDesc
510- * @param numWorkspaces [IN] number of workspaces
511- * @param workspaceSizes [IN] pointer to array of sizes of workspaces
512- *
513- * @retval ACL_SUCCESS The function is successfully executed.
514- * @retval OtherValues Failure
515- */
516-ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kernelDesc, int numWorkspaces,
517- size_t *workspaceSizes);
518- 
519-/**
520- * @ingroup AscendCL
521- * @brief compile op with dynamic shape
522- *
523- * @param opType [IN] op type
524- * @param numInputs [IN] number of inputs
525- * @param inputDesc [IN] pointer to array of input tensor descriptions
526- * @param numOutputs [IN] number of outputs
527- * @param outputDesc [IN] pointer to array of output tensor descriptions
528- * @param attr [IN] pointer to instance of aclopAttr.
529- * may pass nullptr if the op has no attribute
530- *
531- * @retval ACL_SUCCESS The function is successfully executed.
532- * @retval OtherValues Failure
533- */
534-ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType,
535- int numInputs,
536- const aclTensorDesc *const inputDesc[],
537- int numOutputs,
538- const aclTensorDesc *const outputDesc[],
539- const aclopAttr *attr);
540- 
541-/**
542- * @ingroup AscendCL
543- * @brief set max op queue num
544- *
545- * @param maxOpNum [IN] number of max op queue
546- *
547- * @retval ACL_SUCCESS The function is successfully executed.
548- * @retval OtherValues Failure
549- */
550-ACL_FUNC_VISIBILITY aclError aclopSetMaxOpQueueNum(uint64_t maxOpNum);
551- 
552-/**
553- * @ingroup AscendCL
554- * @brief inferShape the specified operator synchronously
555- *
556- * @param opType [IN] type of op
557- * @param numInputs [IN] number of inputs
558- * @param inputDesc [IN] pointer to array of input tensor descriptions
559- * @param inputs [IN] pointer to array of input buffers
560- * @param numOutputs [IN] number of outputs
561- * @param outputDesc [OUT] pointer to array of output tensor descriptions
562- * @param attr [IN] pointer to instance of aclopAttr.
563- * may pass nullptr if the op has no attribute
564- *
565- * @retval ACL_SUCCESS The function is successfully executed.
566- * @retval OtherValues Failure
567- */
568-ACL_FUNC_VISIBILITY aclError aclopInferShape(const char *opType,
569- int numInputs,
570- aclTensorDesc *inputDesc[],
571- aclDataBuffer *inputs[],
572- int numOutputs,
573- aclTensorDesc *outputDesc[],
574- aclopAttr *attr);
575- 
576-#define ACL_OP_DUMP_OP_AICORE_ARGS 0x00000001U
577- 
578-/**
579- * @ingroup AscendCL
580- * @brief Enable the dump function of the corresponding dump type.
581- *
582- * @param dumpType [IN] type of dump
583- * @param path [IN] dump path
584- *
585- * @retval ACL_SUCCESS The function is successfully executed.
586- * @retval OtherValues Failure
587- */
588-ACL_FUNC_VISIBILITY aclError aclopStartDumpArgs(uint32_t dumpType, const char *path);
589- 
590-/**
591- * @ingroup AscendCL
592- * @brief Disable the dump function of the corresponding dump type.
593- *
594- * @param dumpType [IN] type of dump
595- *
596- * @retval ACL_SUCCESS The function is successfully executed.
597- * @retval OtherValues Failure
598- */
599-ACL_FUNC_VISIBILITY aclError aclopStopDumpArgs(uint32_t dumpType);
600- 
601-#ifdef __cplusplus
602-}
603-#endif
604- 
605-#endif // INC_EXTERNAL_ACL_ACL_OP_H_
Dthird_party/acl/inc/acl/acl_op_compiler.h+0-236
@@ -1,236 +0,0 @@
1-/**
2-* @file acl_op_compiler.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10-#ifndef INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_
11-#define INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_
12- 
13-#include "acl_base.h"
14-#include "acl_op.h"
15- 
16-#ifdef __cplusplus
17-extern "C" {
18-#endif
19- 
20-typedef enum aclCompileType {
21- ACL_COMPILE_SYS,
22- ACL_COMPILE_UNREGISTERED
23-} aclopCompileType;
24- 
25-typedef enum {
26- ACL_PRECISION_MODE,
27- ACL_AICORE_NUM,
28- ACL_AUTO_TUNE_MODE, // The auto_tune_mode has been discarded
29- ACL_OP_SELECT_IMPL_MODE,
30- ACL_OPTYPELIST_FOR_IMPLMODE,
31- ACL_OP_DEBUG_LEVEL,
32- ACL_DEBUG_DIR,
33- ACL_OP_COMPILER_CACHE_MODE,
34- ACL_OP_COMPILER_CACHE_DIR,
35- ACL_OP_PERFORMANCE_MODE,
36- ACL_OP_JIT_COMPILE,
37- ACL_OP_DETERMINISTIC,
38- ACL_CUSTOMIZE_DTYPES,
39- ACL_OP_PRECISION_MODE,
40- ACL_ALLOW_HF32,
41- ACL_PRECISION_MODE_V2,
42- ACL_OP_DEBUG_OPTION
43-} aclCompileOpt;
44- 
45-typedef enum aclCompileFlag {
46- ACL_OP_COMPILE_DEFAULT,
47- ACL_OP_COMPILE_FUZZ
48-} aclOpCompileFlag;
49- 
50-typedef struct aclGraphDumpOption aclGraphDumpOption;
51- 
52-/**
53- * @ingroup AscendCL
54- * @brief compile op
55- *
56- * @param opType [IN] op type
57- * @param numInputs [IN] number of inputs
58- * @param inputDesc [IN] pointer to array of input tensor descriptions
59- * @param numOutputs [IN] number of outputs
60- * @param outputDesc [IN] pointer to array of output tensor descriptions
61- * @param attr [IN] pointer to instance of aclopAttr.
62- * may pass nullptr if the op has no attribute
63- * @param engineType [IN] engine type
64- * @param compileFlag [IN] compile flag
65- * @param opPath [IN] path of op
66- *
67- * @retval ACL_SUCCESS The function is successfully executed.
68- * @retval OtherValues Failure
69- */
70-ACL_FUNC_VISIBILITY aclError aclopCompile(const char *opType,
71- int numInputs,
72- const aclTensorDesc *const inputDesc[],
73- int numOutputs,
74- const aclTensorDesc *const outputDesc[],
75- const aclopAttr *attr,
76- aclopEngineType engineType,
77- aclopCompileType compileFlag,
78- const char *opPath);
79- 
80-/**
81- * @ingroup AscendCL
82- * @brief compile and execute op
83- *
84- * @param opType [IN] op type
85- * @param numInputs [IN] number of inputs
86- * @param inputDesc [IN] pointer to array of input tensor descriptions
87- * @param inputs [IN] pointer to array of input buffers
88- * @param numOutputs [IN] number of outputs
89- * @param outputDesc [IN] pointer to array of output tensor descriptions
90- * @param outputs [IN] pointer to array of outputs buffers
91- * @param attr [IN] pointer to instance of aclopAttr.
92- * may pass nullptr if the op has no attribute
93- * @param engineType [IN] engine type
94- * @param compileFlag [IN] compile flag
95- * @param opPath [IN] path of op
96- * @param stream [IN] stream handle
97- *
98- * @retval ACL_SUCCESS The function is successfully executed.
99- * @retval OtherValues Failure
100- */
101-ACL_FUNC_VISIBILITY aclError aclopCompileAndExecute(const char *opType,
102- int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[],
103- int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[],
104- const aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag,
105- const char *opPath, aclrtStream stream);
106- 
107- 
108-/**
109- * @ingroup AscendCL
110- * @brief compile and execute op
111- *
112- * @param opType [IN] op type
113- * @param numInputs [IN] number of inputs
114- * @param inputDesc [IN] pointer to array of input tensor descriptions
115- * @param inputs [IN] pointer to array of input buffers
116- * @param numOutputs [IN] number of outputs
117- * @param outputDesc [IN|OUT] pointer to array of output tensor descriptions
118- * @param outputs [IN] pointer to array of outputs buffers
119- * @param attr [IN] pointer to instance of aclopAttr.
120- * may pass nullptr if the op has no attribute
121- * @param engineType [IN] engine type
122- * @param compileFlag [IN] compile flag
123- * @param opPath [IN] path of op
124- * @param stream [IN] stream handle
125- *
126- * @retval ACL_SUCCESS The function is successfully executed.
127- * @retval OtherValues Failure
128- */
129-ACL_FUNC_VISIBILITY aclError aclopCompileAndExecuteV2(const char *opType,
130- int numInputs, aclTensorDesc *inputDesc[], aclDataBuffer *inputs[],
131- int numOutputs, aclTensorDesc *outputDesc[], aclDataBuffer *outputs[],
132- aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag,
133- const char *opPath, aclrtStream stream);
134- 
135-/**
136- * @ingroup AscendCL
137- * @brief set compile option
138- *
139- * @param aclCompileOpt [IN] compile option
140- * @param value [IN] pointer for the option value
141- *
142- * @retval ACL_SUCCESS The function is successfully executed.
143- * @retval OtherValues Failure
144- */
145-ACL_FUNC_VISIBILITY aclError aclSetCompileopt(aclCompileOpt opt, const char *value);
146- 
147-/**
148- * @ingroup AscendCL
149- * @brief get compile option value size
150- *
151- * @param aclCompileOpt [IN] compile option
152- *
153- * @retval size of compile option value
154- */
155-ACL_FUNC_VISIBILITY size_t aclGetCompileoptSize(aclCompileOpt opt);
156- 
157-/**
158- * @ingroup AscendCL
159- * @brief get compile option
160- *
161- * @param aclCompileOpt [IN] compile option
162- * @param value [OUT] pointer for the option value
163- * @param length [IN] length of value
164- *
165- * @retval ACL_SUCCESS The function is successfully executed.
166- * @retval OtherValues Failure
167- */
168-ACL_FUNC_VISIBILITY aclError aclGetCompileopt(aclCompileOpt opt, char *value, size_t length);
169- 
170-/**
171- * @ingroup AscendCL
172- * @brief set compile flag
173- *
174- * @param flag [IN] compile flag, ACL_OP_COMPILE_DEFAULT means compile with default mode
175- * ACL_OP_COMPILE_FUZZ means compile with fuzz mode
176- *
177- * @retval ACL_SUCCESS The function is successfully executed.
178- * @retval OtherValues Failure
179- */
180-ACL_FUNC_VISIBILITY aclError aclopSetCompileFlag(aclOpCompileFlag flag);
181- 
182-/**
183- * @ingroup AscendCL
184- * @brief generate graph and dump
185- *
186- * @param opType [IN] op type
187- * @param numInputs [IN] number of inputs
188- * @param inputDesc [IN] pointer to array of input tensor descriptions
189- * @param inputs [IN] pointer to array of input buffers
190- * @param numOutputs [IN] number of outputs
191- * @param outputDesc [IN] pointer to array of output tensor descriptions
192- * @param outputs [IN] pointer to array of outputs buffers
193- * @param attr [IN] pointer to instance of aclopAttr.
194- * may pass nullptr if the op has no attribute
195- * @param engineType [IN] engine type
196- * @param graphDumpPath [IN] dump path, if the suffix is ".txt", it means file path, else it means directory path
197- * @param graphDumpOpt [IN] dump option, nullptr is supported
198- *
199- * @retval ACL_SUCCESS The function is successfully executed.
200- * @retval OtherValues Failure
201- */
202-ACL_FUNC_VISIBILITY aclError aclGenGraphAndDumpForOp(const char *opType,
203- int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[],
204- int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[],
205- const aclopAttr *attr, aclopEngineType engineType,
206- const char *graphDumpPath, const aclGraphDumpOption *graphDumpOpt);
207- 
208-/**
209- * @ingroup AscendCL
210- * @brief Create the graph dump option
211- *
212- * @retval null for failed
213- * @retval OtherValues success
214- *
215- * @see aclDestroyGraphDumpOpt
216- */
217-ACL_FUNC_VISIBILITY aclGraphDumpOption *aclCreateGraphDumpOpt();
218- 
219-/**
220- * @ingroup AscendCL
221- * @brief Destroy graph dump option
222- *
223- * @param graphDumpOpt [IN] pointer to the graph dump option
224- *
225- * @retval ACL_SUCCESS The function is successfully executed.
226- * @retval OtherValues Failure
227- *
228- * @see aclCreateGraphDumpOpt
229- */
230-ACL_FUNC_VISIBILITY aclError aclDestroyGraphDumpOpt(const aclGraphDumpOption *graphDumpOpt);
231- 
232-#ifdef __cplusplus
233-}
234-#endif
235- 
236-#endif // INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_
Dthird_party/acl/inc/acl/acl_prof.h+0-489
@@ -1,489 +0,0 @@
1-/**
2-* @file acl_prof.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_PROF_H_
12-#define INC_EXTERNAL_ACL_PROF_H_
13- 
14-#if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER))
15-#define MSVP_PROF_API __declspec(dllexport)
16-#else
17-#define MSVP_PROF_API __attribute__((visibility("default")))
18-#endif
19- 
20-#include "acl_base.h"
21- 
22-#ifdef __cplusplus
23-extern "C" {
24-#endif
25- 
26-#define ACL_PROF_ACL_API 0x00000001ULL
27-#define ACL_PROF_TASK_TIME 0x00000002ULL
28-#define ACL_PROF_AICORE_METRICS 0x00000004ULL
29-#define ACL_PROF_AICPU 0x00000008ULL
30-#define ACL_PROF_L2CACHE 0x00000010ULL
31-#define ACL_PROF_HCCL_TRACE 0x00000020ULL
32-#define ACL_PROF_TRAINING_TRACE 0x00000040ULL
33-#define ACL_PROF_MSPROFTX 0x00000080ULL
34-#define ACL_PROF_RUNTIME_API 0x00000100ULL
35-#define ACL_PROF_TASK_TIME_L0 0x00000800ULL
36-#define ACL_PROF_TASK_MEMORY 0x00001000ULL
37-#define ACL_PROF_OP_ATTR 0x00004000ULL
38- 
39-/**
40- * @deprecated please use aclprofGetOpTypeLen and aclprofGetOpTNameLen instead
41- */
42-#define ACL_PROF_MAX_OP_NAME_LEN 257
43-#define ACL_PROF_MAX_OP_TYPE_LEN 65
44- 
45-typedef enum {
46- ACL_AICORE_ARITHMETIC_UTILIZATION = 0,
47- ACL_AICORE_PIPE_UTILIZATION = 1,
48- ACL_AICORE_MEMORY_BANDWIDTH = 2,
49- ACL_AICORE_L0B_AND_WIDTH = 3,
50- ACL_AICORE_RESOURCE_CONFLICT_RATIO = 4,
51- ACL_AICORE_MEMORY_UB = 5,
52- ACL_AICORE_L2_CACHE = 6,
53- ACL_AICORE_PIPE_EXECUTE_UTILIZATION = 7,
54- ACL_AICORE_MEMORY_ACCESS = 8,
55- ACL_AICORE_NONE = 0xFF
56-} aclprofAicoreMetrics;
57- 
58-typedef enum {
59- ACL_STEP_START = 0, // step start
60- ACL_STEP_END = 1 // step end
61-} aclprofStepTag;
62- 
63-typedef enum {
64- ACL_PROF_ARGS_MIN = 0,
65- ACL_PROF_STORAGE_LIMIT,
66- ACL_PROF_AIV_METRICS,
67- ACL_PROF_SYS_HARDWARE_MEM_FREQ,
68- ACL_PROF_LLC_MODE,
69- ACL_PROF_SYS_IO_FREQ,
70- ACL_PROF_SYS_INTERCONNECTION_FREQ,
71- ACL_PROF_DVPP_FREQ,
72- ACL_PROF_HOST_SYS,
73- ACL_PROF_HOST_SYS_USAGE,
74- ACL_PROF_HOST_SYS_USAGE_FREQ,
75- ACL_PROF_ARGS_MAX
76-} aclprofConfigType;
77- 
78-typedef struct aclprofConfig aclprofConfig;
79-typedef struct aclprofStopConfig aclprofStopConfig;
80-typedef struct aclprofAicoreEvents aclprofAicoreEvents;
81-typedef struct aclprofSubscribeConfig aclprofSubscribeConfig;
82-typedef struct aclprofStepInfo aclprofStepInfo;
83- 
84-/**
85- * @ingroup AscendCL
86- * @brief profiling initialize
87- *
88- * @param profilerResultPath [IN] path of profiling result
89- * @param length [IN] length of profilerResultPath
90- *
91- * @retval ACL_SUCCESS The function is successfully executed.
92- * @retval OtherValues Failure
93- *
94- * @see aclprofFinalize
95- */
96-MSVP_PROF_API aclError aclprofInit(const char *profilerResultPath, size_t length);
97- 
98-/**
99- * @ingroup AscendCL
100- * @brief set config value
101- *
102- * @param configType [IN] config type
103- * @param val [IN] pointer to config
104- * @param valLen [IN] length of config
105- *
106- * @retval ACL_SUCCESS The function is successfully executed.
107- * @retval OtherValues Failure
108- *
109- * @see aclprofSetConfig
110- */
111-MSVP_PROF_API aclError aclprofSetConfig(aclprofConfigType configType, const char *config, size_t configLength);
112- 
113-/**
114- * @ingroup AscendCL
115- * @brief profiling finalize
116- *
117- * @retval ACL_SUCCESS The function is successfully executed.
118- * @retval OtherValues Failure
119- *
120- * @see aclprofInit
121- */
122-MSVP_PROF_API aclError aclprofFinalize();
123- 
124-/**
125- * @ingroup AscendCL
126- * @brief Start profiling modules by profilerConfig
127- *
128- * @param profilerConfig [IN] config of profiling
129- *
130- * @retval ACL_SUCCESS The function is successfully executed.
131- * @retval OtherValues Failure
132- *
133- * @see aclprofStop
134- */
135-MSVP_PROF_API aclError aclprofStart(const aclprofConfig *profilerConfig);
136- 
137-/**
138- * @ingroup AscendCL
139- * @brief Create data of type aclprofConfig
140- *
141- * @param deviceIdList [IN] list of device id
142- * @param deviceNums [IN] number of devices
143- * @param aicoreMetrics [IN] type of aicore metrics
144- * @param aicoreEvents [IN] pointer to aicore events, only support NULL now
145- * @param dataTypeConfig [IN] config modules need profiling
146- *
147- * @retval the aclprofConfig pointer
148- *
149- * @see aclprofDestroyConfig
150- */
151-MSVP_PROF_API aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdList, uint32_t deviceNums,
152- aclprofAicoreMetrics aicoreMetrics, const aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig);
153- 
154-/**
155- * @ingroup AscendCL
156- * @brief Destroy data of type aclprofConfig
157- *
158- * @param profilerConfig [IN] config of profiling
159- *
160- * @retval ACL_SUCCESS The function is successfully executed.
161- * @retval OtherValues Failure
162- *
163- * @see aclprofCreateConfig
164- */
165-MSVP_PROF_API aclError aclprofDestroyConfig(const aclprofConfig *profilerConfig);
166- 
167-/**
168- * @ingroup AscendCL
169- * @brief stop profiling modules by stopProfilingConfig
170- *
171- * @param profilerConfig [IN] pointer to stop config of profiling
172- *
173- * @retval ACL_SUCCESS The function is successfully executed.
174- * @retval OtherValues Failure
175- *
176- * @see aclprofStart
177- */
178-MSVP_PROF_API aclError aclprofStop(const aclprofConfig *profilerConfig);
179- 
180-/**
181- * @ingroup AscendCL
182- * @brief subscribe profiling data of model
183- *
184- * @param modelId [IN] the model id subscribed
185- * @param profSubscribeConfig [IN] pointer to config of model subscribe
186- *
187- * @retval ACL_SUCCESS The function is successfully executed.
188- * @retval OtherValues Failure
189- *
190- * @see aclprofModelUnSubscribe
191- */
192-MSVP_PROF_API aclError aclprofModelSubscribe(uint32_t modelId,
193- const aclprofSubscribeConfig *profSubscribeConfig);
194- 
195-/**
196- * @ingroup AscendCL
197- * @brief unsubscribe profiling data of model
198- *
199- * @param modelId [IN] the model id unsubscribed
200- *
201- * @retval ACL_SUCCESS The function is successfully executed.
202- * @retval OtherValues Failure
203- *
204- * @see aclprofModelSubscribe
205- */
206-MSVP_PROF_API aclError aclprofModelUnSubscribe(uint32_t modelId);
207- 
208-/**
209- * @ingroup AscendCL
210- * @brief create subscribe config
211- *
212- * @param timeInfoSwitch [IN] switch whether get time info from model
213- * @param aicoreMetrics [IN] aicore metrics
214- * @param fd [IN] pointer to write pipe
215- *
216- * @retval the aclprofSubscribeConfig pointer
217- *
218- * @see aclprofDestroySubscribeConfig
219- */
220-MSVP_PROF_API aclprofSubscribeConfig *aclprofCreateSubscribeConfig(int8_t timeInfoSwitch,
221- aclprofAicoreMetrics aicoreMetrics, void *fd);
222- 
223-/**
224- * @ingroup AscendCL
225- * @brief destroy subscribe config
226- *
227- * @param profSubscribeConfig [IN] subscribe config
228- *
229- * @retval ACL_SUCCESS The function is successfully executed.
230- * @retval OtherValues Failure
231- *
232- * @see aclprofCreateSubscribeConfig
233- */
234-MSVP_PROF_API aclError aclprofDestroySubscribeConfig(const aclprofSubscribeConfig *profSubscribeConfig);
235- 
236-/**
237- * @ingroup AscendCL
238- * @brief create subscribe config
239- *
240- * @param opDescSize [OUT] size of op desc
241- *
242- * @retval ACL_SUCCESS The function is successfully executed.
243- * @retval OtherValues Failure
244- */
245-MSVP_PROF_API aclError aclprofGetOpDescSize(size_t *opDescSize);
246- 
247-/**
248- * @ingroup AscendCL
249- * @brief get op number from subscription data
250- *
251- * @param opInfo [IN] pointer to subscription data
252- * @param opInfoLen [IN] memory size of subscription data
253- * @param opNumber [OUT] op number of subscription data
254- *
255- * @retval ACL_SUCCESS The function is successfully executed.
256- * @retval OtherValues Failure
257- */
258-MSVP_PROF_API aclError aclprofGetOpNum(const void *opInfo, size_t opInfoLen, uint32_t *opNumber);
259- 
260-/**
261- * @ingroup AscendCL
262- * @brief get length op type from subscription data
263- *
264- * @param opInfo [IN] pointer to subscription data
265- * @param opInfoLen [IN] memory size of subscription data
266- * @param index [IN] index of op array in opInfo
267- * @param opTypeLen [OUT] actual length of op type string
268- *
269- * @retval ACL_SUCCESS The function is successfully executed.
270- * @retval OtherValues Failure
271- */
272-MSVP_PROF_API aclError aclprofGetOpTypeLen(const void *opInfo, size_t opInfoLen, uint32_t index,
273- size_t *opTypeLen);
274- 
275-/**
276- * @ingroup AscendCL
277- * @brief get op type from subscription data
278- *
279- * @param opInfo [IN] pointer to subscription data
280- * @param opInfoLen [IN] memory size of subscription data
281- * @param index [IN] index of op array in opInfo
282- * @param opType [OUT] obtained op type string
283- * @param opTypeLen [IN] obtained length of op type string
284- *
285- * @retval ACL_SUCCESS The function is successfully executed.
286- * @retval OtherValues Failure
287- */
288-MSVP_PROF_API aclError aclprofGetOpType(const void *opInfo, size_t opInfoLen, uint32_t index,
289- char *opType, size_t opTypeLen);
290- 
291-/**
292- * @ingroup AscendCL
293- * @brief get length op name from subscription data
294- *
295- * @param opInfo [IN] pointer to subscription data
296- * @param opInfoLen [IN] memory size of subscription data
297- * @param index [IN] index of op array in opInfo
298- * @param opNameLen [OUT] actual length of op name string
299- *
300- * @retval ACL_SUCCESS The function is successfully executed.
301- * @retval OtherValues Failure
302- */
303-MSVP_PROF_API aclError aclprofGetOpNameLen(const void *opInfo, size_t opInfoLen, uint32_t index,
304- size_t *opNameLen);
305- 
306-/**
307- * @ingroup AscendCL
308- * @brief get op type from subscription data
309- *
310- * @param opInfo [IN] pointer to subscription data
311- * @param opInfoLen [IN] memory size of subscription data
312- * @param index [IN] index of op array in opInfo
313- * @param opName [OUT] obtained op name string
314- * @param opNameLen [IN] obtained length of op name string
315- *
316- * @retval ACL_SUCCESS The function is successfully executed.
317- * @retval OtherValues Failure
318- */
319-MSVP_PROF_API aclError aclprofGetOpName(const void *opInfo, size_t opInfoLen, uint32_t index,
320- char *opName, size_t opNameLen);
321- 
322-/**
323- * @ingroup AscendCL
324- * @brief get start time of specified op from subscription data
325- *
326- * @param opInfo [IN] pointer to subscription data
327- * @param opInfoLen [IN] memory size of subscription data
328- * @param index [IN] index of op array in opInfo
329- *
330- * @retval start time(us) of specified op with timestamp
331- * @retval 0 for failed
332- */
333-MSVP_PROF_API uint64_t aclprofGetOpStart(const void *opInfo, size_t opInfoLen, uint32_t index);
334- 
335-/**
336- * @ingroup AscendCL
337- * @brief get end time of specified op from subscription data
338- *
339- * @param opInfo [IN] pointer to subscription data
340- * @param opInfoLen [IN] memory size of subscription data
341- * @param index [IN] index of op array in opInfo
342- *
343- * @retval end time(us) of specified op with timestamp
344- * @retval 0 for failed
345- */
346-MSVP_PROF_API uint64_t aclprofGetOpEnd(const void *opInfo, size_t opInfoLen, uint32_t index);
347- 
348-/**
349- * @ingroup AscendCL
350- * @brief get excution time of specified op from subscription data
351- *
352- * @param opInfo [IN] pointer to subscription data
353- * @param opInfoLen [IN] memory size of subscription data
354- * @param index [IN] index of op array in opInfo
355- *
356- * @retval execution time(us) of specified op with timestamp
357- * @retval 0 for failed
358- */
359-MSVP_PROF_API uint64_t aclprofGetOpDuration(const void *opInfo, size_t opInfoLen, uint32_t index);
360- 
361-/**
362- * @ingroup AscendCL
363- * @brief get model id from subscription data
364- *
365- * @param opInfo [IN] pointer to subscription data
366- * @param opInfoLen [IN] memory size of subscription data
367- *
368- * @retval model id of subscription data
369- * @retval 0 for failed
370- */
371-MSVP_PROF_API size_t aclprofGetModelId(const void *opInfo, size_t opInfoLen, uint32_t index);
372- 
373-/**
374- * @ingroup AscendCL
375- * @brief
376- *
377- * @param stepInfo [IN] pointer to stepInfo data
378- * @param aclprofstepTag [IN] start or end flag
379- * @param stream [IN] steam info
380- *
381- * @retval 0 for failed
382- */
383-MSVP_PROF_API aclError aclprofGetStepTimestamp(aclprofStepInfo* stepInfo, aclprofStepTag tag, aclrtStream stream);
384- 
385- /**
386- * @ingroup AscendCL
387- * @brief create pointer to aclprofStepInfo data
388- *
389- *
390- * @retval aclprofStepInfo pointer
391- */
392-MSVP_PROF_API aclprofStepInfo* aclprofCreateStepInfo();
393- 
394- /**
395- * @ingroup AscendCL
396- * @brief destroy aclprofStepInfo pointer
397- *
398- *
399- * @retval void
400- */
401-MSVP_PROF_API void aclprofDestroyStepInfo(aclprofStepInfo* stepinfo);
402- 
403-/**
404-* @ingroup AscendCL
405-* @brief create pointer to aclprofstamp
406-*
407-*
408-* @retval aclprofStamp pointer
409-*/
410-MSVP_PROF_API void *aclprofCreateStamp();
411- 
412-/**
413-* @ingroup AscendCL
414-* @brief destory stamp pointer
415-*
416-*
417-* @retval void
418-*/
419-MSVP_PROF_API void aclprofDestroyStamp(void *stamp);
420- 
421-/**
422-* @ingroup AscendCL
423-* @brief Record push timestamp
424-*
425-* @retval ACL_SUCCESS The function is successfully executed.
426-* @retval OtherValues Failure
427-*/
428-MSVP_PROF_API aclError aclprofPush(void *stamp);
429- 
430-/**
431-* @ingroup AscendCL
432-* @brief Record pop timestamp
433-*
434-*
435-* @retval ACL_SUCCESS The function is successfully executed.
436-* @retval OtherValues Failure
437-*/
438-MSVP_PROF_API aclError aclprofPop();
439- 
440-/**
441-* @ingroup AscendCL
442-* @brief Record range start timestamp
443-*
444-* @retval ACL_SUCCESS The function is successfully executed.
445-* @retval OtherValues Failure
446-*/
447-MSVP_PROF_API aclError aclprofRangeStart(void *stamp, uint32_t *rangeId);
448- 
449-/**
450-* @ingroup AscendCL
451-* @brief Record range end timestamp
452-*
453-* @retval ACL_SUCCESS The function is successfully executed.
454-* @retval OtherValues Failure
455-*/
456-MSVP_PROF_API aclError aclprofRangeStop(uint32_t rangeId);
457- 
458-/**
459-* @ingroup AscendCL
460-* @brief set message to stamp
461-*
462-*
463-* @retval void
464-*/
465-MSVP_PROF_API aclError aclprofSetStampTraceMessage(void *stamp, const char *msg, uint32_t msgLen);
466- 
467-/**
468-* @ingroup AscendCL
469-* @brief Record mark timestamp
470-*
471-* @retval ACL_SUCCESS The function is successfully executed.
472-* @retval OtherValues Failure
473-*/
474-MSVP_PROF_API aclError aclprofMark(void *stamp);
475- 
476-/**
477-* @ingroup AscendCL
478-* @brief Record markEx timestamp
479-*
480-* @retval ACL_SUCCESS The function is successfully executed.
481-* @retval OtherValues Failure
482-*/
483-MSVP_PROF_API aclError aclprofMarkEx(const char *msg, size_t msgLen, aclrtStream stream);
484- 
485-#ifdef __cplusplus
486-}
487-#endif
488- 
489-#endif // INC_EXTERNAL_ACL_PROF_H_
Dthird_party/acl/inc/acl/acl_rt.h+0-2399
@@ -1,2399 +0,0 @@
1-/**
2-* @file acl_rt.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_ACL_RT_H_
12-#define INC_EXTERNAL_ACL_ACL_RT_H_
13- 
14-#include <stdint.h>
15-#include <stddef.h>
16-#include "acl_base.h"
17- 
18-#ifdef __cplusplus
19-extern "C" {
20-#endif
21- 
22-// Current version is 1.15.0
23-#define ACL_MAJOR_VERSION 1
24-#define ACL_MINOR_VERSION 15
25-#define ACL_PATCH_VERSION 0
26-#define ACL_EVENT_SYNC 0x00000001U
27-#define ACL_EVENT_CAPTURE_STREAM_PROGRESS 0x00000002U
28-#define ACL_EVENT_TIME_LINE 0x00000008U
29-#define ACL_EVENT_EXTERNAL 0x00000020U
30-#define ACL_EVENT_IPC 0x00000040U
31- 
32-// for create stream
33-#define ACL_STREAM_FAST_LAUNCH 0x00000001U
34-#define ACL_STREAM_FAST_SYNC 0x00000002U
35-#define ACL_STREAM_PERSISTENT 0x00000004U
36-#define ACL_STREAM_HUGE 0x00000008U
37-#define ACL_STREAM_CPU_SCHEDULE 0x00000010U
38- 
39-#define ACL_STREAM_WAIT_VALUE_GEQ 0x00000000U
40-#define ACL_STREAM_WAIT_VALUE_EQ 0x00000001U
41-#define ACL_STREAM_WAIT_VALUE_AND 0x00000002U
42-#define ACL_STREAM_WAIT_VALUE_NOR 0x00000003U
43- 
44-#define ACL_CONTINUE_ON_FAILURE 0x00000000U
45-#define ACL_STOP_ON_FAILURE 0x00000001U
46- 
47-// for device get capability
48-#define ACL_DEV_FEATURE_SUPPORT 0x00000001
49-#define ACL_DEV_FEATURE_NOT_SUPPORT 0x00000000
50- 
51-#define ACL_RT_NOTIFY_EXPORT_FLAG_DEFAULT 0x0UL
52-#define ACL_RT_NOTIFY_EXPORT_FLAG_DISABLE_PID_VALIDATION 0x02UL
53- 
54-#define MAX_MODULE_NUM 128
55-#define ACL_RT_NOTIFY_IMPORT_FLAG_DEFAULT 0x0UL
56-#define ACL_RT_NOTIFY_IMPORT_FLAG_ENABLE_PEER_ACCESS 0x02UL
57- 
58-#define ACL_RT_IPC_MEM_EXPORT_FLAG_DEFAULT 0x0UL
59-#define ACL_RT_IPC_MEM_EXPORT_FLAG_DISABLE_PID_VALIDATION 0x1UL
60- 
61-#define ACL_RT_IPC_MEM_IMPORT_FLAG_DEFAULT 0x0UL
62-#define ACL_RT_IPC_MEM_IMPORT_FLAG_ENABLE_PEER_ACCESS 0x1UL
63- 
64-#define ACL_RT_VMM_EXPORT_FLAG_DEFAULT 0x0UL
65-#define ACL_RT_VMM_EXPORT_FLAG_DISABLE_PID_VALIDATION 0x1UL
66- 
67-#define ACL_HOST_REG_MAPPED 0x2UL
68-#define ACL_HOST_REG_PINNED 0X10000000UL
69- 
70-#define ACL_VALUE_WAIT_EQ 0x1
71- 
72-#define ACL_IPC_EVENT_HANDLE_SIZE 64U
73- 
74-constexpr int32_t DEVICE_UTILIZATION_NOT_SUPPORT = -1;
75- 
76-typedef enum aclrtRunMode {
77- ACL_DEVICE,
78- ACL_HOST,
79-} aclrtRunMode;
80- 
81-typedef enum aclrtTsId {
82- ACL_TS_ID_AICORE = 0,
83- ACL_TS_ID_AIVECTOR = 1,
84- ACL_TS_ID_RESERVED = 2,
85-} aclrtTsId;
86- 
87-typedef enum aclrtEventStatus {
88- ACL_EVENT_STATUS_COMPLETE = 0,
89- ACL_EVENT_STATUS_NOT_READY = 1,
90- ACL_EVENT_STATUS_RESERVED = 2,
91-} aclrtEventStatus;
92- 
93-typedef enum aclrtEventRecordedStatus {
94- ACL_EVENT_RECORDED_STATUS_NOT_READY = 0,
95- ACL_EVENT_RECORDED_STATUS_COMPLETE = 1,
96-} aclrtEventRecordedStatus;
97- 
98-typedef enum aclrtEventWaitStatus {
99- ACL_EVENT_WAIT_STATUS_COMPLETE = 0,
100- ACL_EVENT_WAIT_STATUS_NOT_READY = 1,
101- ACL_EVENT_WAIT_STATUS_RESERVED = 0xFFFF,
102-} aclrtEventWaitStatus;
103- 
104-typedef enum aclrtStreamStatus {
105- ACL_STREAM_STATUS_COMPLETE = 0,
106- ACL_STREAM_STATUS_NOT_READY = 1,
107- ACL_STREAM_STATUS_RESERVED = 0xFFFF,
108-} aclrtStreamStatus;
109- 
110-typedef enum aclrtCallbackBlockType {
111- ACL_CALLBACK_NO_BLOCK,
112- ACL_CALLBACK_BLOCK,
113-} aclrtCallbackBlockType;
114- 
115-typedef enum aclrtMemcpyKind {
116- ACL_MEMCPY_HOST_TO_HOST,
117- ACL_MEMCPY_HOST_TO_DEVICE,
118- ACL_MEMCPY_DEVICE_TO_HOST,
119- ACL_MEMCPY_DEVICE_TO_DEVICE,
120- ACL_MEMCPY_DEFAULT,
121- ACL_MEMCPY_HOST_TO_BUF_TO_DEVICE,
122- ACL_MEMCPY_INNER_DEVICE_TO_DEVICE,
123- ACL_MEMCPY_INTER_DEVICE_TO_DEVICE,
124-} aclrtMemcpyKind;
125- 
126-typedef enum aclrtMemMallocPolicy {
127- ACL_MEM_MALLOC_HUGE_FIRST,
128- ACL_MEM_MALLOC_HUGE_ONLY,
129- ACL_MEM_MALLOC_NORMAL_ONLY,
130- ACL_MEM_MALLOC_HUGE_FIRST_P2P,
131- ACL_MEM_MALLOC_HUGE_ONLY_P2P,
132- ACL_MEM_MALLOC_NORMAL_ONLY_P2P,
133- ACL_MEM_MALLOC_HUGE1G_ONLY,
134- ACL_MEM_MALLOC_HUGE1G_ONLY_P2P,
135- ACL_MEM_TYPE_LOW_BAND_WIDTH = 0x0100,
136- ACL_MEM_TYPE_HIGH_BAND_WIDTH = 0x1000,
137- ACL_MEM_ACCESS_USER_SPACE_READONLY = 0x100000,
138-} aclrtMemMallocPolicy;
139- 
140-typedef enum {
141- ACL_HOST_REGISTER_MAPPED = 0,
142-} aclrtHostRegisterType;
143- 
144-typedef enum {
145- ACL_RT_MEM_ATTR_RSV = 0,
146- ACL_RT_MEM_ATTR_MODULE_ID,
147- ACL_RT_MEM_ATTR_DEVICE_ID,
148- ACL_RT_MEM_ATTR_VA_FLAG,
149-} aclrtMallocAttrType;
150- 
151-typedef union {
152- uint16_t moduleId;
153- uint32_t deviceId;
154- uint32_t vaFlag;
155- uint8_t rsv[8];
156-} aclrtMallocAttrValue;
157- 
158-typedef struct {
159- aclrtMallocAttrType attr;
160- aclrtMallocAttrValue value;
161-} aclrtMallocAttribute;
162- 
163-typedef struct {
164- aclrtMallocAttribute* attrs;
165- size_t numAttrs;
166-} aclrtMallocConfig;
167- 
168-typedef enum aclrtMemAttr {
169- ACL_DDR_MEM,
170- ACL_HBM_MEM,
171- ACL_DDR_MEM_HUGE,
172- ACL_DDR_MEM_NORMAL,
173- ACL_HBM_MEM_HUGE,
174- ACL_HBM_MEM_NORMAL,
175- ACL_DDR_MEM_P2P_HUGE,
176- ACL_DDR_MEM_P2P_NORMAL,
177- ACL_HBM_MEM_P2P_HUGE,
178- ACL_HBM_MEM_P2P_NORMAL,
179- ACL_HBM_MEM_HUGE1G,
180- ACL_HBM_MEM_P2P_HUGE1G,
181-} aclrtMemAttr;
182- 
183-typedef enum aclrtGroupAttr {
184- ACL_GROUP_AICORE_INT,
185- ACL_GROUP_AIV_INT,
186- ACL_GROUP_AIC_INT,
187- ACL_GROUP_SDMANUM_INT,
188- ACL_GROUP_ASQNUM_INT,
189- ACL_GROUP_GROUPID_INT
190-} aclrtGroupAttr;
191- 
192-typedef enum aclrtFloatOverflowMode {
193- ACL_RT_OVERFLOW_MODE_SATURATION = 0,
194- ACL_RT_OVERFLOW_MODE_INFNAN,
195- ACL_RT_OVERFLOW_MODE_UNDEF,
196-} aclrtFloatOverflowMode;
197- 
198-typedef enum {
199- ACL_RT_STREAM_WORK_ADDR_PTR = 0, /**< pointer to model work addr */
200- ACL_RT_STREAM_WORK_SIZE, /**< pointer to model work size */
201- ACL_RT_STREAM_FLAG,
202- ACL_RT_STREAM_PRIORITY,
203-} aclrtStreamConfigAttr;
204- 
205-typedef struct aclrtStreamConfigHandle {
206- void* workptr;
207- size_t workSize;
208- size_t flag;
209- uint32_t priority;
210-} aclrtStreamConfigHandle;
211- 
212-typedef struct aclrtUtilizationExtendInfo aclrtUtilizationExtendInfo;
213- 
214-typedef struct aclrtUtilizationInfo {
215- int32_t cubeUtilization;
216- int32_t vectorUtilization;
217- int32_t aicpuUtilization;
218- int32_t memoryUtilization;
219- aclrtUtilizationExtendInfo *utilizationExtend; /**< reserved parameters, current version needs to be null */
220-} aclrtUtilizationInfo;
221- 
222-typedef struct tagRtGroupInfo aclrtGroupInfo;
223- 
224-typedef struct rtExceptionInfo aclrtExceptionInfo;
225- 
226-typedef enum aclrtMemLocationType {
227- ACL_MEM_LOCATION_TYPE_HOST = 0, /**< reserved enum, current version not support */
228- ACL_MEM_LOCATION_TYPE_DEVICE,
229- ACL_MEM_LOCATION_TYPE_UNREGISTERED,
230-} aclrtMemLocationType;
231- 
232-typedef struct aclrtMemLocation {
233- uint32_t id;
234- aclrtMemLocationType type;
235-} aclrtMemLocation;
236- 
237-typedef struct aclrtPtrAttributes {
238- aclrtMemLocation location;
239- uint32_t pageSize;
240- uint32_t rsv[4];
241-} aclrtPtrAttributes;
242- 
243-typedef struct aclrtMemUsageInfo {
244- char name[32];
245- uint64_t curMemSize;
246- uint64_t memPeakSize;
247- size_t reserved[8];
248-} aclrtMemUsageInfo;
249- 
250-typedef enum aclrtMemAllocationType {
251- ACL_MEM_ALLOCATION_TYPE_PINNED = 0,
252-} aclrtMemAllocationType;
253- 
254-typedef enum aclrtMemHandleType {
255- ACL_MEM_HANDLE_TYPE_NONE = 0,
256-} aclrtMemHandleType;
257- 
258-typedef struct aclrtPhysicalMemProp {
259- aclrtMemHandleType handleType;
260- aclrtMemAllocationType allocationType;
261- aclrtMemAttr memAttr;
262- aclrtMemLocation location;
263- uint64_t reserve;
264-} aclrtPhysicalMemProp;
265- 
266-typedef enum aclrtMemGranularityOptions {
267- ACL_RT_MEM_ALLOC_GRANULARITY_MINIMUM,
268- ACL_RT_MEM_ALLOC_GRANULARITY_RECOMMENDED,
269- ACL_RT_MEM_ALLOC_GRANULARITY_UNDEF = 0xFFFF,
270-} aclrtMemGranularityOptions;
271- 
272-typedef void* aclrtDrvMemHandle;
273- 
274-typedef void (*aclrtCallback)(void *userData);
275- 
276-typedef void (*aclrtHostFunc)(void *args);
277- 
278-typedef void (*aclrtExceptionInfoCallback)(aclrtExceptionInfo *exceptionInfo);
279- 
280-typedef enum aclrtDeviceStatus {
281- ACL_RT_DEVICE_STATUS_NORMAL = 0,
282- ACL_RT_DEVICE_STATUS_ABNORMAL,
283- ACL_RT_DEVICE_STATUS_END = 0xFFFF,
284-} aclrtDeviceStatus;
285- 
286-typedef struct aclrtUuid {
287- char bytes[16];
288-} aclrtUuid;
289- 
290-typedef void* aclrtBinary;
291-typedef void* aclrtBinHandle;
292-typedef void* aclrtFuncHandle;
293-typedef void* aclrtArgsHandle;
294-typedef void* aclrtParamHandle;
295- 
296-#define MAX_MEM_UCE_INFO_ARRAY_SIZE 128
297-#define UCE_INFO_RESERVED_SIZE 14
298- 
299-typedef struct aclrtMemUceInfo {
300- void* addr;
301- size_t len;
302- size_t reserved[UCE_INFO_RESERVED_SIZE];
303-} aclrtMemUceInfo;
304- 
305-typedef enum {
306- ACL_RT_NO_ERROR = 0,
307- ACL_RT_ERROR_MEMORY = 1,
308- ACL_RT_ERROR_L2 = 2,
309- ACL_RT_ERROR_AICORE = 3,
310- ACL_RT_ERROR_LINK = 4,
311- ACL_RT_ERROR_OTHERS = 0xFFFF,
312-} aclrtErrorType;
313- 
314-typedef enum aclrtAicoreErrorType {
315- ACL_RT_AICORE_ERROR_UNKOWN,
316- ACL_RT_AICORE_ERROR_SW,
317- ACL_RT_AICORE_ERROR_HW_LOCAL,
318-} aclrtAicoreErrorType;
319- 
320-#define ACL_RT_MEM_UCE_INFO_MAX_NUM 20
321-typedef struct aclrtMemUceInfoArray {
322- size_t arraySize;
323- aclrtMemUceInfo memUceInfoArray[ACL_RT_MEM_UCE_INFO_MAX_NUM];
324-} aclrtMemUceInfoArray;
325- 
326-typedef union aclrtErrorInfoDetail {
327- aclrtMemUceInfoArray uceInfo;
328- aclrtAicoreErrorType aicoreErrType;
329-} aclrtErrorInfoDetail;
330- 
331-typedef struct aclrtErrorInfo {
332- uint8_t tryRepair;
333- uint8_t hasDetail;
334- uint8_t reserved[2];
335- aclrtErrorType errorType;
336- aclrtErrorInfoDetail detail;
337-} aclrtErrorInfo;
338- 
339-typedef enum aclrtCmoType {
340- ACL_RT_CMO_TYPE_PREFETCH = 0,
341- ACL_RT_CMO_TYPE_WRITEBACK,
342- ACL_RT_CMO_TYPE_INVALID,
343- ACL_RT_CMO_TYPE_FLUSH,
344-} aclrtCmoType;
345- 
346-typedef enum aclrtLastErrLevel {
347- ACL_RT_THREAD_LEVEL = 0,
348-} aclrtLastErrLevel;
349- 
350-#define ACL_RT_BINARY_MAGIC_ELF_AICORE 0x43554245U
351-#define ACL_RT_BINARY_MAGIC_ELF_VECTOR_CORE 0x41415246U
352-#define ACL_RT_BINARY_MAGIC_ELF_CUBE_CORE 0x41494343U
353- 
354-typedef enum aclrtBinaryLoadOptionType {
355- ACL_RT_BINARY_LOAD_OPT_LAZY_LOAD = 1,
356- ACL_RT_BINARY_LOAD_OPT_LAZY_MAGIC = 2,
357- ACL_RT_BINARY_LOAD_OPT_MAGIC = 2,
358- ACL_RT_BINARY_LOAD_OPT_CPU_KERNEL_MODE = 3,
359-} aclrtBinaryLoadOptionType;
360- 
361-typedef union aclrtBinaryLoadOptionValue {
362- uint32_t isLazyLoad;
363- uint32_t magic;
364- int32_t cpuKernelMode;
365- uint32_t rsv[4];
366-} aclrtBinaryLoadOptionValue;
367- 
368-typedef struct {
369- aclrtBinaryLoadOptionType type;
370- aclrtBinaryLoadOptionValue value;
371-} aclrtBinaryLoadOption;
372- 
373-typedef struct aclrtBinaryLoadOptions {
374- aclrtBinaryLoadOption *options;
375- size_t numOpt;
376-} aclrtBinaryLoadOptions;
377- 
378-typedef enum {
379- ACL_RT_ENGINE_TYPE_AIC = 0,
380- ACL_RT_ENGINE_TYPE_AIV,
381-} aclrtEngineType;
382- 
383-typedef enum aclrtLaunchKernelAttrId {
384- ACL_RT_LAUNCH_KERNEL_ATTR_SCHEM_MODE = 1,
385- ACL_RT_LAUNCH_KERNEL_ATTR_ENGINE_TYPE = 3,
386- ACL_RT_LAUNCH_KERNEL_ATTR_BLOCKDIM_OFFSET,
387- ACL_RT_LAUNCH_KERNEL_ATTR_BLOCK_TASK_PREFETCH,
388- ACL_RT_LAUNCH_KERNEL_ATTR_DATA_DUMP,
389- ACL_RT_LAUNCH_KERNEL_ATTR_TIMEOUT,
390-} aclrtLaunchKernelAttrId;
391- 
392-typedef union aclrtLaunchKernelAttrValue {
393- uint8_t schemMode;
394- uint32_t localMemorySize;
395- aclrtEngineType engineType;
396- uint32_t blockDimOffset;
397- uint8_t isBlockTaskPrefetch;
398- uint8_t isDataDump;
399- uint16_t timeout;
400- uint32_t rsv[4];
401-} aclrtLaunchKernelAttrValue;
402- 
403-typedef struct aclrtLaunchKernelAttr {
404- aclrtLaunchKernelAttrId id;
405- aclrtLaunchKernelAttrValue value;
406-} aclrtLaunchKernelAttr;
407- 
408-typedef struct aclrtLaunchKernelCfg {
409- aclrtLaunchKernelAttr *attrs;
410- size_t numAttrs;
411-} aclrtLaunchKernelCfg;
412- 
413-typedef enum {
414- ACL_STREAM_ATTR_FAILURE_MODE = 1,
415- ACL_STREAM_ATTR_FLOAT_OVERFLOW_CHECK = 2,
416- ACL_STREAM_ATTR_USER_CUSTOM_TAG = 3,
417- ACL_STREAM_ATTR_CACHE_OP_IFNO = 4,
418-} aclrtStreamAttr;
419- 
420-typedef union {
421- uint64_t failureMode;
422- uint32_t overflowSwitch;
423- uint32_t userCustomTag;
424- uint32_t cacheOpInfoSwitch;
425- uint32_t reserve[4];
426-} aclrtStreamAttrValue;
427- 
428-typedef enum {
429- ACL_DEV_ATTR_AICPU_CORE_NUM = 1, // aicpu number
430- ACL_DEV_ATTR_AICORE_CORE_NUM = 101, // aicore number
431- ACL_DEV_ATTR_CUBE_CORE_NUM = 102, // cube core number
432- ACL_DEV_ATTR_VECTOR_CORE_NUM = 201, // vector core number
433- ACL_DEV_ATTR_WARP_SIZE = 202, // number of threads in a Warp
434- ACL_DEV_ATTR_MAX_THREAD_PER_VECTOR_CORE = 203, // maximum number of concurrent threads per Vector Core
435- ACL_DEV_ATTR_LOCAL_MEM_PER_VECTOR_CORE = 204, // maximum available local memory per Vector Core, in Bytes
436- ACL_DEV_ATTR_TOTAL_GLOBAL_MEM_SIZE = 301, // total available global memory on the Device, in Bytes
437- ACL_DEV_ATTR_L2_CACHE_SIZE = 302, // L2 Cache size, in Bytes
438- ACL_DEV_ATTR_SMP_ID = 401U, // indicates whether devices are on the same OS
439- ACL_DEV_ATTR_PHY_CHIP_ID = 402U, // physical chip id
440- ACL_DEV_ATTR_SUPER_POD_DEVIDE_ID = 403U, // super pod device id
441- ACL_DEV_ATTR_SUPER_POD_SERVER_ID = 404U, // super pod server id
442- ACL_DEV_ATTR_SUPER_POD_ID = 405U, // super pod id
443- ACL_DEV_ATTR_CUST_OP_PRIVILEGE = 406U, // indicates whether the custom operator privilege is enabled
444- ACL_DEV_ATTR_MAINBOARD_ID = 407U, // mainboard id
445- ACL_DEV_ATTR_IS_VIRTUAL = 501U, // whether it is in compute power splitting mode
446-} aclrtDevAttr;
447- 
448-typedef enum {
449- ACL_FEATURE_TSCPU_TASK_UPDATE_SUPPORT_AIC_AIV = 1,
450- ACL_FEATURE_SYSTEM_MEMQ_EVENT_CROSS_DEV = 21,
451-} aclrtDevFeatureType;
452- 
453-typedef enum {
454- ACL_RT_MEMCPY_SDMA_AUTOMATIC_SUM = 10,
455- ACL_RT_MEMCPY_SDMA_AUTOMATIC_MAX = 11,
456- ACL_RT_MEMCPY_SDMA_AUTOMATIC_MIN = 12,
457- ACL_RT_MEMCPY_SDMA_AUTOMATIC_EQUAL = 13,
458-} aclrtReduceKind;
459- 
460-typedef enum {
461- ACL_RT_DEV_RES_CUBE_CORE = 0,
462- ACL_RT_DEV_RES_VECTOR_CORE,
463-} aclrtDevResLimitType;
464- 
465-typedef enum {
466- ACL_RT_EQUAL = 0,
467- ACL_RT_NOT_EQUAL,
468- ACL_RT_GREATER,
469- ACL_RT_GREATER_OR_EQUAL,
470- ACL_RT_LESS,
471- ACL_RT_LESS_OR_EQUAL
472-} aclrtCondition;
473- 
474-typedef enum {
475- ACL_RT_SWITCH_INT32 = 0,
476- ACL_RT_SWITCH_INT64 = 1,
477-} aclrtCompareDataType;
478- 
479-typedef struct {
480- aclrtCmoType cmoType;
481- uint32_t barrierId;
482-} aclrtBarrierCmoInfo;
483- 
484-#define ACL_RT_CMO_MAX_BARRIER_NUM 6U
485- 
486-typedef struct {
487- size_t barrierNum;
488- aclrtBarrierCmoInfo cmoInfo[ACL_RT_CMO_MAX_BARRIER_NUM];
489-} aclrtBarrierTaskInfo;
490- 
491-#define ACL_RT_DEVS_TOPOLOGY_HCCS 0x01ULL
492-#define ACL_RT_DEVS_TOPOLOGY_PIX 0x02ULL
493-#define ACL_RT_DEVS_TOPOLOGY_PIB 0x04ULL
494-#define ACL_RT_DEVS_TOPOLOGY_PHB 0x08ULL
495-#define ACL_RT_DEVS_TOPOLOGY_SYS 0x10ULL
496-#define ACL_RT_DEVS_TOPOLOGY_SIO 0x20ULL
497-#define ACL_RT_DEVS_TOPOLOGY_HCCS_SW 0x40ULL
498- 
499-typedef struct {
500- aclrtMemLocation dstLoc;
501- aclrtMemLocation srcLoc;
502- uint8_t rsv[16];
503-} aclrtMemcpyBatchAttr;
504- 
505-typedef struct aclrtIpcEventHandle {
506- char reserved[ACL_IPC_EVENT_HANDLE_SIZE];
507-} aclrtIpcEventHandle;
508- 
509-/**
510- * @ingroup AscendCL
511- * @brief peek at last error by level
512- *
513- * @param level [IN] error level
514- *
515- * @retval Runtime error code
516- */
517-ACL_FUNC_VISIBILITY aclError aclrtPeekAtLastError(aclrtLastErrLevel level);
518- 
519-/**
520- * @ingroup AscendCL
521- * @brief get last error by level
522- *
523- * @param level [IN] error level
524- *
525- * @retval Runtime error code
526- */
527-ACL_FUNC_VISIBILITY aclError aclrtGetLastError(aclrtLastErrLevel level);
528- 
529- 
530-/**
531- * @ingroup AscendCL
532- * @brief Set a callback function to handle exception information
533- *
534- * @param callback [IN] callback function to handle exception information
535- *
536- * @retval ACL_SUCCESS The function is successfully executed.
537- * @retval OtherValues Failure
538- */
539-ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback);
540- 
541-/**
542- * @ingroup AscendCL
543- * @brief Get task id from exception information
544- *
545- * @param info [IN] pointer of exception information
546- *
547- * @retval The task id from exception information
548- * @retval 0xFFFFFFFF if info is null
549- */
550-ACL_FUNC_VISIBILITY uint32_t aclrtGetTaskIdFromExceptionInfo(const aclrtExceptionInfo *info);
551- 
552-/**
553- * @ingroup AscendCL
554- * @brief Get stream id from exception information
555- *
556- * @param info [IN] pointer of exception information
557- *
558- * @retval The stream id from exception information
559- * @retval 0xFFFFFFFF if info is null
560- */
561-ACL_FUNC_VISIBILITY uint32_t aclrtGetStreamIdFromExceptionInfo(const aclrtExceptionInfo *info);
562- 
563-/**
564- * @ingroup AscendCL
565- * @brief Get thread id from exception information
566- *
567- * @param info [IN] pointer of exception information
568- *
569- * @retval The thread id of fail task
570- * @retval 0xFFFFFFFF if info is null
571- */
572-ACL_FUNC_VISIBILITY uint32_t aclrtGetThreadIdFromExceptionInfo(const aclrtExceptionInfo *info);
573- 
574-/**
575- * @ingroup AscendCL
576- * @brief Get device id from exception information
577- *
578- * @param info [IN] pointer of exception information
579- *
580- * @retval The thread id of fail task
581- * @retval 0xFFFFFFFF if info is null
582- */
583-ACL_FUNC_VISIBILITY uint32_t aclrtGetDeviceIdFromExceptionInfo(const aclrtExceptionInfo *info);
584- 
585-/**
586- * @ingroup AscendCL
587- * @brief Get error code from exception information
588- *
589- * @param info [IN] pointer of exception information
590- *
591- * @retval The error code from exception information
592- * @retval 0xFFFFFFFF if info is null
593- */
594-ACL_FUNC_VISIBILITY uint32_t aclrtGetErrorCodeFromExceptionInfo(const aclrtExceptionInfo *info);
595- 
596-/**
597- * @ingroup AscendCL
598- * @brief The thread that handles the callback function on the Stream
599- *
600- * @param threadId [IN] thread ID
601- * @param stream [IN] stream handle
602- *
603- * @retval ACL_SUCCESS The function is successfully executed.
604- * @retval OtherValues Failure
605- */
606-ACL_FUNC_VISIBILITY aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream stream);
607- 
608-/**
609- * @ingroup AscendCL
610- * @brief Add a callback function to be executed on the host
611- * to the task queue of the Stream
612- *
613- * @param fn [IN] Specify the callback function to be added
614- * The function prototype of the callback function is:
615- * typedef void (*aclrtCallback)(void *userData);
616- * @param userData [IN] User data to be passed to the callback function
617- * @param blockType [IN] callback block type
618- * @param stream [IN] stream handle
619- *
620- * @retval ACL_SUCCESS The function is successfully executed.
621- * @retval OtherValues Failure
622- */
623-ACL_FUNC_VISIBILITY aclError aclrtLaunchCallback(aclrtCallback fn, void *userData, aclrtCallbackBlockType blockType,
624- aclrtStream stream);
625- 
626-/**
627- * @ingroup AscendCL
628- * @brief After waiting for a specified time, trigger callback processing
629- *
630- * @par Function
631- * The thread processing callback specified by
632- * the aclrtSubscribeReport interface
633- *
634- * @param timeout [IN] timeout value
635- *
636- * @retval ACL_SUCCESS The function is successfully executed.
637- * @retval OtherValues Failure
638- *
639- * @see aclrtSubscribeReport
640- */
641-ACL_FUNC_VISIBILITY aclError aclrtProcessReport(int32_t timeout);
642- 
643-/**
644- * @ingroup AscendCL
645- * @brief Cancel thread registration,
646- * the callback function on the specified Stream
647- * is no longer processed by the specified thread
648- *
649- * @param threadId [IN] thread ID
650- * @param stream [IN] stream handle
651- *
652- * @retval ACL_SUCCESS The function is successfully executed.
653- * @retval OtherValues Failure
654- */
655-ACL_FUNC_VISIBILITY aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream);
656- 
657-/**
658- * @ingroup AscendCL
659- * @brief create context and associates it with the calling thread
660- *
661- * @par Function
662- * The following use cases are supported:
663- * @li If you don't call the aclrtCreateContext interface
664- * to explicitly create the context,
665- * the system will use the default context, which is implicitly created
666- * when the aclrtSetDevice interface is called.
667- * @li If multiple contexts are created in a process
668- * (there is no limit on the number of contexts),
669- * the current thread can only use one of them at the same time.
670- * It is recommended to explicitly specify the context of the current thread
671- * through the aclrtSetCurrentContext interface to increase.
672- * the maintainability of the program.
673- *
674- * @param context [OUT] point to the created context
675- * @param deviceId [IN] device to create context on
676- *
677- * @retval ACL_SUCCESS The function is successfully executed.
678- * @retval OtherValues Failure
679- *
680- * @see aclrtSetDevice | aclrtSetCurrentContext
681- */
682-ACL_FUNC_VISIBILITY aclError aclrtCreateContext(aclrtContext *context, int32_t deviceId);
683- 
684-/**
685- * @ingroup AscendCL
686- * @brief destroy context instance
687- *
688- * @par Function
689- * Can only destroy context created through aclrtCreateContext interface
690- *
691- * @param context [IN] the context to destroy
692- *
693- * @retval ACL_SUCCESS The function is successfully executed.
694- * @retval OtherValues Failure
695- *
696- * @see aclrtCreateContext
697- */
698-ACL_FUNC_VISIBILITY aclError aclrtDestroyContext(aclrtContext context);
699- 
700-/**
701- * @ingroup AscendCL
702- * @brief set the context of the thread
703- *
704- * @par Function
705- * The following scenarios are supported:
706- * @li If the aclrtCreateContext interface is called in a thread to explicitly
707- * create a Context (for example: ctx1), the thread's Context can be specified
708- * without calling the aclrtSetCurrentContext interface.
709- * The system uses ctx1 as the context of thread1 by default.
710- * @li If the aclrtCreateContext interface is not explicitly created,
711- * the system uses the default context as the context of the thread.
712- * At this time, the aclrtDestroyContext interface cannot be used to release
713- * the default context.
714- * @li If the aclrtSetCurrentContext interface is called multiple times to
715- * set the thread's Context, the last one prevails.
716- *
717- * @par Restriction
718- * @li If the cevice corresponding to the context set for the thread
719- * has been reset, you cannot set the context as the context of the thread,
720- * otherwise a business exception will result.
721- * @li It is recommended to use the context created in a thread.
722- * If the aclrtCreateContext interface is called in thread A to create a context,
723- * and the context is used in thread B,
724- * the user must guarantee the execution order of tasks in the same stream
725- * under the same context in two threads.
726- *
727- * @param context [IN] the current context of the thread
728- *
729- * @retval ACL_SUCCESS The function is successfully executed.
730- * @retval OtherValues Failure
731- *
732- * @see aclrtCreateContext | aclrtDestroyContext
733- */
734-ACL_FUNC_VISIBILITY aclError aclrtSetCurrentContext(aclrtContext context);
735- 
736-/**
737- * @ingroup AscendCL
738- * @brief get the context of the thread
739- *
740- * @par Function
741- * If the user calls the aclrtSetCurrentContext interface
742- * multiple times to set the context of the current thread,
743- * then the last set context is obtained
744- *
745- * @param context [OUT] the current context of the thread
746- *
747- * @retval ACL_SUCCESS The function is successfully executed.
748- * @retval OtherValues Failure
749- *
750- * @see aclrtSetCurrentContext
751- */
752-ACL_FUNC_VISIBILITY aclError aclrtGetCurrentContext(aclrtContext *context);
753- 
754-/**
755- * @ingroup AscendCL
756- * @brief get system param option value in current context
757- *
758- * @param opt[IN] system option
759- * @param value[OUT] value of system option
760- * @retval ACL_SUCCESS The function is successfully executed.
761- * @retval OtherValues Failure
762-*/
763-ACL_FUNC_VISIBILITY aclError aclrtCtxGetSysParamOpt(aclSysParamOpt opt, int64_t *value);
764- 
765-/**
766- * @ingroup AscendCL
767- * @brief set system param option value in current context
768- *
769- * @param opt[IN] system option
770- * @param value[IN] value of system option
771- * @retval ACL_SUCCESS The function is successfully executed.
772- * @retval OtherValues Failure
773-*/
774-ACL_FUNC_VISIBILITY aclError aclrtCtxSetSysParamOpt(aclSysParamOpt opt, int64_t value);
775- 
776-/**
777- * @ingroup AscendCL
778- * @brief get system param option value in current process
779- *
780- * @param opt[IN] system option
781- * @param value[OUT] value of system option
782- * @retval ACL_SUCCESS The function is successfully executed.
783- * @retval OtherValues Failure
784-*/
785-ACL_FUNC_VISIBILITY aclError aclrtGetSysParamOpt(aclSysParamOpt opt, int64_t *value);
786- 
787-/**
788- * @ingroup AscendCL
789- * @brief set system param option value in current process
790- *
791- * @param opt[IN] system option
792- * @param value[IN] value of system option
793- * @retval ACL_SUCCESS The function is successfully executed.
794- * @retval OtherValues Failure
795-*/
796-ACL_FUNC_VISIBILITY aclError aclrtSetSysParamOpt(aclSysParamOpt opt, int64_t value);
797- 
798-/**
799- * @ingroup AscendCL
800- * @brief Specify the device to use for the operation
801- * implicitly create the default context and the default stream
802- *
803- * @par Function
804- * The following use cases are supported:
805- * @li Device can be specified in the process or thread.
806- * If you call the aclrtSetDevice interface multiple
807- * times to specify the same device,
808- * you only need to call the aclrtResetDevice interface to reset the device.
809- * @li The same device can be specified for operation
810- * in different processes or threads.
811- * @li Device is specified in a process,
812- * and multiple threads in the process can share this device to explicitly
813- * create a Context (aclrtCreateContext interface).
814- * @li In multi-device scenarios, you can switch to other devices
815- * through the aclrtSetDevice interface in the process.
816- *
817- * @param deviceId [IN] the device id
818- *
819- * @retval ACL_SUCCESS The function is successfully executed.
820- * @retval OtherValues Failure
821- *
822- * @see aclrtResetDevice |aclrtCreateContext
823- */
824-ACL_FUNC_VISIBILITY aclError aclrtSetDevice(int32_t deviceId);
825- 
826-/**
827- * @ingroup AscendCL
828- * @brief Reset the current operating Device and free resources on the device,
829- * including the default context, the default stream,
830- * and all streams created under the default context,
831- * and synchronizes the interface.
832- * If the task under the default context or stream has not been completed,
833- * the system will wait for the task to complete before releasing it.
834- *
835- * @par Restriction
836- * @li The Context, Stream, and Event that are explicitly created
837- * on the device to be reset. Before resetting,
838- * it is recommended to follow the following interface calling sequence,
839- * otherwise business abnormalities may be caused.
840- * @li Interface calling sequence:
841- * call aclrtDestroyEvent interface to release Event or
842- * call aclrtDestroyStream interface to release explicitly created Stream->
843- * call aclrtDestroyContext to release explicitly created Context->
844- * call aclrtResetDevice interface
845- *
846- * @param deviceId [IN] the device id
847- *
848- * @retval ACL_SUCCESS The function is successfully executed.
849- * @retval OtherValues Failure
850- */
851-ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId);
852- 
853-/**
854- * @ingroup AscendCL
855- * @brief get target device of current thread
856- *
857- * @param deviceId [OUT] the device id
858- *
859- * @retval ACL_SUCCESS The function is successfully executed.
860- * @retval OtherValues Failure
861- */
862-ACL_FUNC_VISIBILITY aclError aclrtGetDevice(int32_t *deviceId);
863- 
864-/**
865- * @ingroup AscendCL
866- * @brief set stream failure mode
867- *
868- * @param stream [IN] the stream to set
869- * @param mode [IN] stream failure mode
870- *
871- * @retval ACL_SUCCESS The function is successfully executed.
872- * @retval OtherValues Failure
873- */
874-ACL_FUNC_VISIBILITY aclError aclrtSetStreamFailureMode(aclrtStream stream, uint64_t mode);
875- 
876-/**
877- * @ingroup AscendCL
878- * @brief get target side
879- *
880- * @param runMode [OUT] the run mode
881- *
882- * @retval ACL_SUCCESS The function is successfully executed.
883- * @retval OtherValues Failure
884- */
885-ACL_FUNC_VISIBILITY aclError aclrtGetRunMode(aclrtRunMode *runMode);
886- 
887-/**
888- * @ingroup AscendCL
889- * @brief Wait for compute device to finish
890- *
891- * @retval ACL_SUCCESS The function is successfully executed.
892- * @retval OtherValues Failure
893- */
894-ACL_FUNC_VISIBILITY aclError aclrtSynchronizeDevice(void);
895- 
896-/**
897- * @ingroup AscendCL
898- * @brief Set Scheduling TS
899- *
900- * @param tsId [IN] the ts id
901- *
902- * @retval ACL_SUCCESS The function is successfully executed.
903- * @retval OtherValues Failure
904- */
905-ACL_FUNC_VISIBILITY aclError aclrtSetTsDevice(aclrtTsId tsId);
906- 
907-/**
908- * @ingroup AscendCL
909- * @brief get total device number.
910- *
911- * @param count [OUT] the device number
912- *
913- * @retval ACL_SUCCESS The function is successfully executed.
914- * @retval OtherValues Failure
915- */
916-ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count);
917- 
918-/**
919- * @ingroup AscendCL
920- * @brief create event instance
921- *
922- * @param event [OUT] created event
923- *
924- * @retval ACL_SUCCESS The function is successfully executed.
925- * @retval OtherValues Failure
926- */
927-ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event);
928- 
929-/**
930- * @ingroup AscendCL
931- * @brief create event instance with flag
932- *
933- * @param event [OUT] created event
934- * @param flag [IN] event flag
935- *
936- * @retval ACL_SUCCESS The function is successfully executed.
937- * @retval OtherValues Failure
938- */
939-ACL_FUNC_VISIBILITY aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag);
940- 
941-/**
942- * @ingroup AscendCL
943- * @brief create event instance with flag, event can be reused naturally
944- *
945- * @param event [OUT] created event
946- * @param flag [IN] event flag
947- *
948- * @retval ACL_SUCCESS The function is successfully executed.
949- * @retval OtherValues Failure
950- */
951-ACL_FUNC_VISIBILITY aclError aclrtCreateEventExWithFlag(aclrtEvent *event, uint32_t flag);
952- 
953-/**
954- * @ingroup AscendCL
955- * @brief destroy event instance
956- *
957- * @par Function
958- * Only events created through the aclrtCreateEvent interface can be
959- * destroyed, synchronous interfaces. When destroying an event,
960- * the user must ensure that the tasks involved in the aclrtSynchronizeEvent
961- * interface or the aclrtStreamWaitEvent interface are completed before
962- * they are destroyed.
963- *
964- * @param event [IN] event to destroy
965- *
966- * @retval ACL_SUCCESS The function is successfully executed.
967- * @retval OtherValues Failure
968- *
969- * @see aclrtCreateEvent | aclrtSynchronizeEvent | aclrtStreamWaitEvent
970- */
971-ACL_FUNC_VISIBILITY aclError aclrtDestroyEvent(aclrtEvent event);
972- 
973-/**
974- * @ingroup AscendCL
975- * @brief Record an Event in the Stream
976- *
977- * @param event [IN] event to record
978- * @param stream [IN] stream handle
979- *
980- * @retval ACL_SUCCESS The function is successfully executed.
981- * @retval OtherValues Failure
982- */
983-ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream);
984- 
985-/**
986- * @ingroup AscendCL
987- * @brief Reset an event
988- *
989- * @par Function
990- * Users need to make sure to wait for the tasks in the Stream
991- * to complete before resetting the Event
992- *
993- * @param event [IN] event to reset
994- * @param stream [IN] stream handle
995- *
996- * @retval ACL_SUCCESS The function is successfully executed.
997- * @retval OtherValues Failure
998- */
999-ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream);
1000- 
1001- /**
1002- * @ingroup AscendCL
1003- * @brief Queries an event's status
1004- *
1005- * @param event [IN] event to query
1006- * @param status [OUT] event status
1007- *
1008- * @retval ACL_SUCCESS The function is successfully executed.
1009- * @retval OtherValues Failure
1010- */
1011-ACL_DEPRECATED_MESSAGE("aclrtQueryEvent is deprecated, use aclrtQueryEventStatus instead")
1012-ACL_FUNC_VISIBILITY aclError aclrtQueryEvent(aclrtEvent event, aclrtEventStatus *status);
1013- 
1014-/**
1015- * @ingroup AscendCL
1016- * @brief Queries an event's status
1017- *
1018- * @param event [IN] event to query
1019- * @param status [OUT] event recorded status
1020- *
1021- * @retval ACL_SUCCESS The function is successfully executed.
1022- * @retval OtherValues Failure
1023- */
1024-ACL_FUNC_VISIBILITY aclError aclrtQueryEventStatus(aclrtEvent event, aclrtEventRecordedStatus *status);
1025- 
1026-/**
1027-* @ingroup AscendCL
1028-* @brief Queries an event's wait-status
1029-*
1030-* @param event [IN] event to query
1031-* @param status [OUT] event wait-status
1032-*
1033-* @retval ACL_SUCCESS The function is successfully executed.
1034-* @retval OtherValues Failure
1035-*/
1036-ACL_FUNC_VISIBILITY aclError aclrtQueryEventWaitStatus(aclrtEvent event, aclrtEventWaitStatus *status);
1037- 
1038-/**
1039- * @ingroup AscendCL
1040- * @brief get an interprocess handle for a previously allocated event.
1041- *
1042- * @param [in] event event allocated with ACL_EVENT_IPC flags
1043- * @param [out] handle handle for interprocess
1044- *
1045- * @retval ACL_SUCCESS The function is successfully executed.
1046- * @retval OtherValues Failure
1047- */
1048-ACL_FUNC_VISIBILITY aclError aclrtIpcGetEventHandle(aclrtEvent event, aclrtIpcEventHandle *handle);
1049- 
1050-/**
1051- * @ingroup AscendCL
1052- * @brief opens an interprocess event handle for user in the current process.
1053- *
1054- * @param [in] handle interprocess handle to open
1055- * @param [out] event returns the imported event
1056- *
1057- * @retval ACL_SUCCESS The function is successfully executed.
1058- * @retval OtherValues Failure
1059- */
1060-ACL_FUNC_VISIBILITY aclError aclrtIpcOpenEventHandle(aclrtIpcEventHandle handle, aclrtEvent *event);
1061- 
1062-/**
1063- * @ingroup AscendCL
1064- * @brief Block Host Running, wait event to be complete
1065- *
1066- * @param event [IN] event to wait
1067- *
1068- * @retval ACL_SUCCESS The function is successfully executed.
1069- * @retval OtherValues Failure
1070- */
1071-ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event);
1072- 
1073-/**
1074- * @ingroup AscendCL
1075- * @brief computes the elapsed time between events.
1076- *
1077- * @param ms [OUT] time between start and end in ms
1078- * @param start [IN] starting event
1079- * @param end [IN] ending event
1080- *
1081- * @retval ACL_SUCCESS The function is successfully executed.
1082- * @retval OtherValues Failure
1083- *
1084- * @see aclrtCreateEvent | aclrtRecordEvent | aclrtSynchronizeStream
1085- */
1086-ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent startEvent, aclrtEvent endEvent);
1087- 
1088-/**
1089- * @ingroup AscendCL
1090- * @brief alloc memory on device, real alloc size is aligned to 32 bytes and padded with 32 bytes
1091- *
1092- * @par Function
1093- * alloc for size linear memory on device
1094- * and return a pointer to allocated memory by *devPtr
1095- *
1096- * @par Restriction
1097- * @li The memory requested by the aclrtMalloc interface needs to be released
1098- * through the aclrtFree interface.
1099- * @li Before calling the media data processing interface,
1100- * if you need to apply memory on the device to store input or output data,
1101- * you need to call acldvppMalloc to apply for memory.
1102- *
1103- * @param devPtr [OUT] pointer to pointer to allocated memory on device
1104- * @param size [IN] alloc memory size
1105- * @param policy [IN] memory alloc policy
1106- *
1107- * @retval ACL_SUCCESS The function is successfully executed.
1108- * @retval OtherValues Failure
1109- *
1110- * @see aclrtFree | acldvppMalloc | aclrtMallocCached
1111- */
1112-ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr,
1113- size_t size,
1114- aclrtMemMallocPolicy policy);
1115- 
1116-/**
1117- * @ingroup AscendCL
1118- * @brief alloc memory on device, real alloc size is aligned to 32 bytes with no padding
1119- *
1120- * @par Function
1121- * alloc for size linear memory on device
1122- * and return a pointer to allocated memory by *devPtr
1123- *
1124- * @par Restriction
1125- * @li The memory requested by the aclrtMallocAlign32 interface needs to be released
1126- * through the aclrtFree interface.
1127- *
1128- * @param devPtr [OUT] pointer to pointer to allocated memory on device
1129- * @param size [IN] alloc memory size
1130- * @param policy [IN] memory alloc policy
1131- *
1132- * @retval ACL_SUCCESS The function is successfully executed.
1133- * @retval OtherValues Failure
1134- *
1135- * @see aclrtFree | aclrtMalloc | aclrtMallocCached
1136- */
1137-ACL_FUNC_VISIBILITY aclError aclrtMallocAlign32(void **devPtr,
1138- size_t size,
1139- aclrtMemMallocPolicy policy);
1140- 
1141-/**
1142- * @ingroup AscendCL
1143- * @brief allocate memory on device with cache
1144- *
1145- * @par Function
1146- * alloc for size linear memory on device
1147- * and return a pointer to allocated memory by *devPtr
1148- *
1149- * @par Restriction
1150- * @li The memory requested by the aclrtMallocCached interface needs to be released
1151- * through the aclrtFree interface.
1152- *
1153- * @param devPtr [OUT] pointer to pointer to allocated memory on device
1154- * @param size [IN] alloc memory size
1155- * @param policy [IN] memory alloc policy
1156- *
1157- * @retval ACL_SUCCESS The function is successfully executed.
1158- * @retval OtherValues Failure
1159- *
1160- * @see aclrtFree | aclrtMalloc
1161- */
1162-ACL_FUNC_VISIBILITY aclError aclrtMallocCached(void **devPtr,
1163- size_t size,
1164- aclrtMemMallocPolicy policy);
1165- 
1166-/**
1167- * @ingroup AscendCL
1168- * @brief get memory attribute, host or device
1169- *
1170- * @param ptr [IN] memory pointer
1171- * @param attributes [OUT] a buffer to store attributes
1172- *
1173- * @retval ACL_SUCCESS The function is successfully executed.
1174- * @retval OtherValues Failure
1175- */
1176-ACL_FUNC_VISIBILITY aclError aclrtPointerGetAttributes(const void *ptr,
1177- aclrtPtrAttributes *attributes);
1178- 
1179-/**
1180- * @ingroup AscendCL
1181- * @brief register an existing host memory range
1182- *
1183- * @param ptr [IN] host pointer to memory to page-lock
1184- * @param size [IN] size in bytes of the address range to page-lock in bytes
1185- * @param flag [IN] flag for allocation request
1186- *
1187- * @retval ACL_SUCCESS The function is successfully executed.
1188- * @retval OtherValues Failure
1189- */
1190-ACL_FUNC_VISIBILITY aclError aclrtHostRegisterV2(void *ptr, uint64_t size, uint32_t flag);
1191- 
1192-/**
1193- * @ingroup AscendCL
1194- * @brief flush cache data to ddr
1195- *
1196- * @param devPtr [IN] the pointer that flush data to ddr
1197- * @param size [IN] flush size
1198- *
1199- * @retval ACL_SUCCESS The function is successfully executed.
1200- * @retval OtherValues Failure
1201- */
1202-ACL_FUNC_VISIBILITY aclError aclrtMemFlush(void *devPtr, size_t size);
1203- 
1204-/**
1205- * @ingroup AscendCL
1206- * @brief invalidate cache data
1207- *
1208- * @param devPtr [IN] pointer to invalidate cache data
1209- * @param size [IN] invalidate size
1210- *
1211- * @retval ACL_SUCCESS The function is successfully executed.
1212- * @retval OtherValues Failure
1213- */
1214-ACL_FUNC_VISIBILITY aclError aclrtMemInvalidate(void *devPtr, size_t size);
1215- 
1216-/**
1217- * @ingroup AscendCL
1218- * @brief free device memory
1219- *
1220- * @par Function
1221- * can only free memory allocated through the aclrtMalloc interface
1222- *
1223- * @param devPtr [IN] Pointer to memory to be freed
1224- *
1225- * @retval ACL_SUCCESS The function is successfully executed.
1226- * @retval OtherValues Failure
1227- *
1228- * @see aclrtMalloc
1229- */
1230-ACL_FUNC_VISIBILITY aclError aclrtFree(void *devPtr);
1231- 
1232-/**
1233- * @ingroup AscendCL
1234- * @brief alloc memory on host
1235- *
1236- * @par Restriction
1237- * @li The requested memory cannot be used in the Device
1238- * and needs to be explicitly copied to the Device.
1239- * @li The memory requested by the aclrtMallocHost interface
1240- * needs to be released through the aclrtFreeHost interface.
1241- *
1242- * @param hostPtr [OUT] pointer to pointer to allocated memory on the host
1243- * @param size [IN] alloc memory size
1244- *
1245- * @retval ACL_SUCCESS The function is successfully executed.
1246- * @retval OtherValues Failure
1247- *
1248- * @see aclrtFreeHost
1249- */
1250-ACL_FUNC_VISIBILITY aclError aclrtMallocHost(void **hostPtr, size_t size);
1251- 
1252-/**
1253- * @ingroup AscendCL
1254- * @brief allocate host memory with config
1255- *
1256- * @param ptr [OUT] pointer to allocated memory
1257- * @param size [IN] alloc memory size
1258- * @param cfg [IN] memory alloc config
1259- *
1260- * @retval ACL_SUCCESS The function is successfully executed.
1261- * @retval OtherValues Failure
1262- */
1263-ACL_FUNC_VISIBILITY aclError aclrtMallocHostWithCfg(void **ptr,
1264- uint64_t size,
1265- aclrtMallocConfig *cfg);
1266- 
1267-/**
1268- * @ingroup AscendCL
1269- * @brief free host memory
1270- *
1271- * @par Function
1272- * can only free memory allocated through the aclrtMallocHost interface
1273- *
1274- * @param hostPtr [IN] free memory pointer
1275- *
1276- * @retval ACL_SUCCESS The function is successfully executed.
1277- * @retval OtherValues Failure
1278- *
1279- * @see aclrtMallocHost
1280- */
1281-ACL_FUNC_VISIBILITY aclError aclrtFreeHost(void *hostPtr);
1282- 
1283-/**
1284- * @ingroup AscendCL
1285- * @brief synchronous memory replication between host and device
1286- *
1287- * @param dst [IN] destination address pointer
1288- * @param destMax [IN] Max length of the destination address memory
1289- * @param src [IN] source address pointer
1290- * @param count [IN] the length of byte to copy
1291- * @param kind [IN] memcpy type
1292- *
1293- * @retval ACL_SUCCESS The function is successfully executed.
1294- * @retval OtherValues Failure
1295- */
1296-ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst,
1297- size_t destMax,
1298- const void *src,
1299- size_t count,
1300- aclrtMemcpyKind kind);
1301- 
1302-/**
1303- * @ingroup AscendCL
1304- * @brief Initialize memory and set contents of memory to specified value
1305- *
1306- * @par Function
1307- * The memory to be initialized is on the Host or device side,
1308- * and the system determines whether
1309- * it is host or device according to the address
1310- *
1311- * @param devPtr [IN] Starting address of memory
1312- * @param maxCount [IN] Max length of destination address memory
1313- * @param value [IN] Set value
1314- * @param count [IN] The length of memory
1315- *
1316- * @retval ACL_SUCCESS The function is successfully executed.
1317- * @retval OtherValues Failure
1318- */
1319-ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count);
1320- 
1321-/**
1322- * @ingroup AscendCL
1323- * @brief Asynchronous memory replication between Host and Device
1324- *
1325- * @par Function
1326- * After calling this interface,
1327- * be sure to call the aclrtSynchronizeStream interface to ensure that
1328- * the task of memory replication has been completed
1329- *
1330- * @par Restriction
1331- * @li For on-chip Device-to-Device memory copy,
1332- * both the source and destination addresses must be 64-byte aligned
1333- *
1334- * @param dst [IN] destination address pointer
1335- * @param destMax [IN] Max length of destination address memory
1336- * @param src [IN] source address pointer
1337- * @param count [IN] the number of byte to copy
1338- * @param kind [IN] memcpy type
1339- * @param stream [IN] asynchronized task stream
1340- *
1341- * @retval ACL_SUCCESS The function is successfully executed.
1342- * @retval OtherValues Failure
1343- *
1344- * @see aclrtSynchronizeStream
1345- */
1346-ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst,
1347- size_t destMax,
1348- const void *src,
1349- size_t count,
1350- aclrtMemcpyKind kind,
1351- aclrtStream stream);
1352- 
1353-/**
1354- * @ingroup AscendCL
1355- * @brief Performs a batch of memory copies synchronous.
1356- * @param [in] dsts Array of destination pointers.
1357- * @param [in] destMax Array of sizes for memcpy operations.
1358- * @param [in] srcs Array of memcpy source pointers.
1359- * @param [in] sizes Array of sizes for src memcpy operations.
1360- * @param [in] numBatches Size of dsts, srcs and sizes arrays.
1361- * @param [in] attrs Array of memcpy attributes.
1362- * @param [in] attrsIndexes Array of indices to specify which copies each entry in the attrs array applies to.
1363- * The attributes specified in attrs[k] will be applied to copies starting from attrsIdxs[k]
1364- * through attrsIdxs[k+1] - 1. Also attrs[numAttrs-1] will apply to copies starting from
1365- * attrsIdxs[numAttrs-1] through count - 1.
1366- * @param [in] numAttrs Size of attrs and attrsIdxs arrays.
1367- * @param [out] failIdx Pointer to a location to return the index of the copy where a failure was encountered.
1368- * The value will be SIZE_MAX if the error doesn't pertain to any specific copy.
1369- * @retval ACL_SUCCESS The function is successfully executed.
1370- * @retval OtherValues Failure
1371- */
1372-ACL_FUNC_VISIBILITY aclError aclrtMemcpyBatch(void **dsts, size_t *destMax, void **srcs, size_t *sizes,
1373- size_t numBatches, aclrtMemcpyBatchAttr *attrs, size_t *attrsIndexes,
1374- size_t numAttrs, size_t *failIdx);
1375- 
1376- 
1377-/**
1378- * @ingroup AscendCL
1379- * @brief Performs a batch of memory copies synchronous.
1380- * @param [in] dsts Array of destination pointers.
1381- * @param [in] destMax Array of sizes for memcpy operations.
1382- * @param [in] srcs Array of memcpy source pointers.
1383- * @param [in] sizes Array of sizes for src memcpy operations.
1384- * @param [in] numBatches Size of dsts, srcs and sizes arrays.
1385- * @param [in] attrs Array of memcpy attributes.
1386- * @param [in] attrsIdxs Array of indices to specify which copies each entry in the attrs array applies to.
1387- * The attributes specified in attrs[k] will be applied to copies starting from attrsIdxs[k]
1388- * through attrsIdxs[k+1] - 1. Also attrs[numAttrs-1] will apply to copies starting from
1389- * attrsIdxs[numAttrs-1] through count - 1.
1390- * @param [in] numAttrs Size of attrs and attrsIdxs arrays.
1391- * @param [out] failIdx Pointer to a location to return the index of the copy where a failure was encountered.
1392- * The value will be SIZE_MAX if the error doesn't pertain to any specific copy.
1393- * @param [in] stream stream handle
1394- * @retval ACL_SUCCESS The function is successfully executed.
1395- * @retval OtherValues Failure
1396- */
1397-ACL_FUNC_VISIBILITY aclError aclrtMemcpyBatchAsync(void **dsts, size_t *destMax, void **srcs, size_t *sizes,
1398- size_t numBatches, aclrtMemcpyBatchAttr *attrs, size_t *attrsIndexes,
1399- size_t numAttrs, size_t *failIndex, aclrtStream stream);
1400- 
1401-/**
1402- * @ingroup AscendCL
1403- * @brief Asynchronous memory replication between Host and Device, would
1404- * be synchronous if memory is not allocated via calling acl or rts api.
1405- *
1406- * @par Function
1407- * After calling this interface and memory is allocated via calling acl or rts api,
1408- * be sure to call the aclrtSynchronizeStream interface to ensure that
1409- * the task of memory replication has been completed
1410- *
1411- * @par Restriction
1412- * @li For on-chip Device-to-Device memory copy,
1413- * both the source and destination addresses must be 64-byte aligned
1414- *
1415- * @param dst [IN] destination address pointer
1416- * @param destMax [IN] Max length of destination address memory
1417- * @param src [IN] source address pointer
1418- * @param count [IN] the number of byte to copy
1419- * @param kind [IN] memcpy type
1420- * @param stream [IN] asynchronized task stream
1421- *
1422- * @retval ACL_SUCCESS The function is successfully executed.
1423- * @retval OtherValues Failure
1424- *
1425- * @see aclrtSynchronizeStream
1426- */
1427-ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsyncWithCondition(void *dst,
1428- size_t destMax,
1429- const void *src,
1430- size_t count,
1431- aclrtMemcpyKind kind,
1432- aclrtStream stream);
1433- 
1434-/**
1435- * @ingroup AscendCL
1436- * @brief Performs a batch of memory copies synchronous.
1437- * @param [in] dsts Array of destination pointers.
1438- * @param [in] destMax Array of sizes for memcpy operations.
1439- * @param [in] srcs Array of memcpy source pointers.
1440- * @param [in] sizes Array of sizes for src memcpy operations.
1441- * @param [in] numBatches Size of dsts, srcs and sizes arrays.
1442- * @param [in] attrs Array of memcpy attributes.
1443- * @param [in] attrsIndexes Array of indices to specify which copies each entry in the attrs array applies to.
1444- * The attributes specified in attrs[k] will be applied to copies starting from attrsIdxs[k]
1445- * through attrsIdxs[k+1] - 1. Also attrs[numAttrs-1] will apply to copies starting from
1446- * attrsIdxs[numAttrs-1] through count - 1.
1447- * @param [in] numAttrs Size of attrs and attrsIdxs arrays.
1448- * @param [out] failIdx Pointer to a location to return the index of the copy where a failure was encountered.
1449- * The value will be SIZE_MAX if the error doesn't pertain to any specific copy.
1450- * @retval ACL_SUCCESS The function is successfully executed.
1451- * @retval OtherValues Failure
1452- */
1453-ACL_FUNC_VISIBILITY aclError aclrtMemcpyBatch(void **dsts, size_t *destMax, void **srcs, size_t *sizes,
1454- size_t numBatches, aclrtMemcpyBatchAttr *attrs, size_t *attrsIndexes,
1455- size_t numAttrs, size_t *failIdx);
1456- 
1457- 
1458-/**
1459- * @ingroup AscendCL
1460- * @brief Performs a batch of memory copies synchronous.
1461- * @param [in] dsts Array of destination pointers.
1462- * @param [in] destMax Array of sizes for memcpy operations.
1463- * @param [in] srcs Array of memcpy source pointers.
1464- * @param [in] sizes Array of sizes for src memcpy operations.
1465- * @param [in] numBatches Size of dsts, srcs and sizes arrays.
1466- * @param [in] attrs Array of memcpy attributes.
1467- * @param [in] attrsIdxs Array of indices to specify which copies each entry in the attrs array applies to.
1468- * The attributes specified in attrs[k] will be applied to copies starting from attrsIdxs[k]
1469- * through attrsIdxs[k+1] - 1. Also attrs[numAttrs-1] will apply to copies starting from
1470- * attrsIdxs[numAttrs-1] through count - 1.
1471- * @param [in] numAttrs Size of attrs and attrsIdxs arrays.
1472- * @param [out] failIdx Pointer to a location to return the index of the copy where a failure was encountered.
1473- * The value will be SIZE_MAX if the error doesn't pertain to any specific copy.
1474- * @param [in] stream stream handle
1475- * @retval ACL_SUCCESS The function is successfully executed.
1476- * @retval OtherValues Failure
1477- */
1478-ACL_FUNC_VISIBILITY aclError aclrtMemcpyBatchAsync(void **dsts, size_t *destMax, void **srcs, size_t *sizes,
1479- size_t numBatches, aclrtMemcpyBatchAttr *attrs, size_t *attrsIndexes,
1480- size_t numAttrs, size_t *failIndex, aclrtStream stream);
1481- 
1482-/**
1483- * @ingroup AscendCL
1484- * @brief synchronous memory replication of two-dimensional matrix between host and device
1485- *
1486- * @param dst [IN] destination address pointer
1487- * @param dpitch [IN] pitch of destination memory
1488- * @param src [IN] source address pointer
1489- * @param spitch [IN] pitch of source memory
1490- * @param width [IN] width of matrix transfer
1491- * @param height [IN] height of matrix transfer
1492- * @param kind [IN] memcpy type
1493- *
1494- * @retval ACL_SUCCESS The function is successfully executed.
1495- * @retval OtherValues Failure
1496- */
1497-ACL_FUNC_VISIBILITY aclError aclrtMemcpy2d(void *dst,
1498- size_t dpitch,
1499- const void *src,
1500- size_t spitch,
1501- size_t width,
1502- size_t height,
1503- aclrtMemcpyKind kind);
1504- 
1505-/**
1506- * @ingroup AscendCL
1507- * @brief asynchronous memory replication of two-dimensional matrix between host and device
1508- *
1509- * @param dst [IN] destination address pointer
1510- * @param dpitch [IN] pitch of destination memory
1511- * @param src [IN] source address pointer
1512- * @param spitch [IN] pitch of source memory
1513- * @param width [IN] width of matrix transfer
1514- * @param height [IN] height of matrix transfer
1515- * @param kind [IN] memcpy type
1516- * @param stream [IN] asynchronized task stream
1517- *
1518- * @retval ACL_SUCCESS The function is successfully executed.
1519- * @retval OtherValues Failure
1520- */
1521-ACL_FUNC_VISIBILITY aclError aclrtMemcpy2dAsync(void *dst,
1522- size_t dpitch,
1523- const void *src,
1524- size_t spitch,
1525- size_t width,
1526- size_t height,
1527- aclrtMemcpyKind kind,
1528- aclrtStream stream);
1529- 
1530-/**
1531-* @ingroup AscendCL
1532-* @brief Asynchronous initialize memory
1533-* and set contents of memory to specified value async
1534-*
1535-* @par Function
1536- * The memory to be initialized is on the Host or device side,
1537- * and the system determines whether
1538- * it is host or device according to the address
1539- *
1540-* @param devPtr [IN] destination address pointer
1541-* @param maxCount [IN] Max length of destination address memory
1542-* @param value [IN] set value
1543-* @param count [IN] the number of byte to set
1544-* @param stream [IN] asynchronized task stream
1545-*
1546-* @retval ACL_SUCCESS The function is successfully executed.
1547-* @retval OtherValues Failure
1548-*
1549-* @see aclrtSynchronizeStream
1550-*/
1551-ACL_FUNC_VISIBILITY aclError aclrtMemsetAsync(void *devPtr,
1552- size_t maxCount,
1553- int32_t value,
1554- size_t count,
1555- aclrtStream stream);
1556- 
1557-/**
1558- * @ingroup AscendCL
1559- * @brief Allocate an address range reservation
1560- *
1561- * @param virPtr [OUT] Resulting pointer to start of virtual address range allocated
1562- * @param size [IN] Size of the reserved virtual address range requested
1563- * @param alignment [IN] Alignment of the reserved virtual address range requested
1564- * @param expectPtr [IN] Fixed starting address range requested, must be nullptr
1565- * @param flags [IN] Flag of page type
1566- *
1567- * @retval ACL_SUCCESS The function is successfully executed.
1568- * @retval OtherValues Failure
1569- *
1570- * @see aclrtReleaseMemAddress | aclrtMallocPhysical | aclrtMapMem
1571- */
1572-ACL_FUNC_VISIBILITY aclError aclrtReserveMemAddress(void **virPtr,
1573- size_t size,
1574- size_t alignment,
1575- void *expectPtr,
1576- uint64_t flags);
1577- 
1578-/**
1579- * @ingroup AscendCL
1580- * @brief Free an address range reservation
1581- *
1582- * @param virPtr [IN] Starting address of the virtual address range to free
1583- *
1584- * @retval ACL_SUCCESS The function is successfully executed.
1585- * @retval OtherValues Failure
1586- *
1587- * @see aclrtReserveMemAddress
1588- */
1589-ACL_FUNC_VISIBILITY aclError aclrtReleaseMemAddress(void *virPtr);
1590- 
1591-/**
1592- * @ingroup AscendCL
1593- * @brief Create a memory handle representing a memory allocation of a given
1594- * size described by the given properties
1595- *
1596- * @param handle [OUT] Value of handle returned. All operations on this
1597- * allocation are to be performed using this handle.
1598- * @param size [IN] Size of the allocation requested
1599- * @param prop [IN] Properties of the allocation to create
1600- * @param flags [IN] Currently unused, must be zero
1601- *
1602- * @retval ACL_SUCCESS The function is successfully executed.
1603- * @retval OtherValues Failure
1604- *
1605- * @see aclrtFreePhysical | aclrtReserveMemAddress | aclrtMapMem
1606- */
1607-ACL_FUNC_VISIBILITY aclError aclrtMallocPhysical(aclrtDrvMemHandle *handle,
1608- size_t size,
1609- const aclrtPhysicalMemProp *prop,
1610- uint64_t flags);
1611- 
1612-/**
1613- * @ingroup AscendCL
1614- * @brief Release a memory handle representing a memory allocation which was
1615- * previously allocated through aclrtMallocPhysical
1616- *
1617- * @param handle [IN] Value of handle which was returned previously by aclrtMallocPhysical
1618- *
1619- * @retval ACL_SUCCESS The function is successfully executed.
1620- * @retval OtherValues Failure
1621- *
1622- * @see aclrtMallocPhysical
1623- */
1624-ACL_FUNC_VISIBILITY aclError aclrtFreePhysical(aclrtDrvMemHandle handle);
1625- 
1626-/**
1627- * @ingroup AscendCL
1628- * @brief Maps an allocation handle to a reserved virtual address range
1629- *
1630- * @param virPtr [IN] Address where memory will be mapped
1631- * @param size [IN] Size of the memory mapping
1632- * @param offset [IN] Offset into the memory represented by handle from which to start mapping
1633- * @param handle [IN] Handle to a shareable memory
1634- * @param flags [IN] Currently unused, must be zero
1635- *
1636- * @retval ACL_SUCCESS The function is successfully executed.
1637- * @retval OtherValues Failure
1638- *
1639- * @see aclrtUnmapMem | aclrtReserveMemAddress | aclrtMallocPhysical
1640- */
1641-ACL_FUNC_VISIBILITY aclError aclrtMapMem(void *virPtr,
1642- size_t size,
1643- size_t offset,
1644- aclrtDrvMemHandle handle,
1645- uint64_t flags);
1646- 
1647-/**
1648- * @ingroup AscendCL
1649- * @brief Unmap the backing memory of a given address range
1650- *
1651- * @param virPtr [IN] Starting address for the virtual address range to unmap
1652- *
1653- * @retval ACL_SUCCESS The function is successfully executed.
1654- * @retval OtherValues Failure
1655- *
1656- * @see aclrtMapMem
1657- */
1658-ACL_FUNC_VISIBILITY aclError aclrtUnmapMem(void *virPtr);
1659- 
1660-/**
1661- * @ingroup AscendCL
1662- * @brief create stream instance
1663- *
1664- * @param stream [OUT] the created stream
1665- *
1666- * @retval ACL_SUCCESS The function is successfully executed.
1667- * @retval OtherValues Failure
1668- */
1669-ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream);
1670- 
1671-/**
1672- * @ingroup AscendCL
1673- * @brief create stream instance with param
1674- *
1675- * @par Function
1676- * Can create fast streams through the aclrtCreateStreamWithConfig interface
1677- *
1678- * @param stream [OUT] the created stream
1679- * @param priority [IN] the priority of stream, value range:0~7
1680- * @param flag [IN] indicate the function for stream
1681- *
1682- * @retval ACL_SUCCESS The function is successfully executed.
1683- * @retval OtherValues Failure
1684- */
1685-ACL_FUNC_VISIBILITY aclError aclrtCreateStreamWithConfig(aclrtStream *stream, uint32_t priority, uint32_t flag);
1686- 
1687-/**
1688- * @ingroup AscendCL
1689- * @brief destroy stream instance
1690- *
1691- * @par Function
1692- * Can only destroy streams created through the aclrtCreateStream interface
1693- *
1694- * @par Restriction
1695- * Before calling the aclrtDestroyStream interface to destroy
1696- * the specified Stream, you need to call the aclrtSynchronizeStream interface
1697- * to ensure that the tasks in the Stream have been completed.
1698- *
1699- * @param stream [IN] the stream to destroy
1700- *
1701- * @retval ACL_SUCCESS The function is successfully executed.
1702- * @retval OtherValues Failure
1703- *
1704- * @see aclrtCreateStream | aclrtSynchronizeStream
1705- */
1706-ACL_FUNC_VISIBILITY aclError aclrtDestroyStream(aclrtStream stream);
1707- 
1708-/**
1709- * @ingroup AscendCL
1710- * @brief destroy stream instance by force
1711- *
1712- * @par Function
1713- * Can only destroy streams created through the aclrtCreateStream interface
1714- *
1715- * @param stream [IN] the stream to destroy
1716- *
1717- * @retval ACL_SUCCESS The function is successfully executed.
1718- * @retval OtherValues Failure
1719- *
1720- * @see aclrtCreateStream
1721- */
1722-ACL_FUNC_VISIBILITY aclError aclrtDestroyStreamForce(aclrtStream stream);
1723- 
1724-/**
1725- * @ingroup AscendCL
1726- * @brief block the host until all tasks
1727- * in the specified stream have completed
1728- *
1729- * @param stream [IN] the stream to wait
1730- *
1731- * @retval ACL_SUCCESS The function is successfully executed.
1732- * @retval OtherValues Failure
1733- */
1734-ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream);
1735- 
1736-/**
1737- * @ingroup AscendCL
1738- * @brief block the host until all tasks
1739- * in the specified stream have completed
1740- *
1741- * @param stream [IN] the stream to wait
1742- * @param timeout [IN] timeout value,the unit is milliseconds
1743- * -1 means waiting indefinitely, 0 means check whether synchronization is complete immediately
1744- *
1745- * @retval ACL_SUCCESS The function is successfully executed.
1746- * @retval OtherValues Failure
1747- */
1748-ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStreamWithTimeout(aclrtStream stream, int32_t timeout);
1749- 
1750-/**
1751- * @ingroup AscendCL
1752- * @brief Query a stream for completion status.
1753- *
1754- * @param stream [IN] the stream to query
1755- * @param status [OUT] stream status
1756- *
1757- * @retval ACL_SUCCESS The function is successfully executed.
1758- * @retval OtherValues Failure
1759- */
1760-ACL_FUNC_VISIBILITY aclError aclrtStreamQuery(aclrtStream stream, aclrtStreamStatus *status);
1761- 
1762-/**
1763- * @ingroup AscendCL
1764- * @brief Blocks the operation of the specified Stream until
1765- * the specified Event is completed.
1766- * Support for multiple streams waiting for the same event.
1767- *
1768- * @param stream [IN] the wait stream If using thedefault Stream, set NULL
1769- * @param event [IN] the event to wait
1770- *
1771- * @retval ACL_SUCCESS The function is successfully executed.
1772- * @retval OtherValues Failure
1773- */
1774-ACL_FUNC_VISIBILITY aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event);
1775- 
1776-/**
1777- * @ingroup AscendCL
1778- * @brief set group
1779- *
1780- * @par Function
1781- * set the task to the corresponding group
1782- *
1783- * @param groupId [IN] group id
1784- *
1785- * @retval ACL_SUCCESS The function is successfully executed.
1786- * @retval OtherValues Failure
1787- *
1788- * @see aclrtGetGroupCount | aclrtGetAllGroupInfo | aclrtGetGroupInfoDetail
1789- */
1790-ACL_FUNC_VISIBILITY aclError aclrtSetGroup(int32_t groupId);
1791- 
1792-/**
1793- * @ingroup AscendCL
1794- * @brief get the number of group
1795- *
1796- * @par Function
1797- * get the number of group. if the number of group is zero,
1798- * it means that group is not supported or group is not created.
1799- *
1800- * @param count [OUT] the number of group
1801- *
1802- * @retval ACL_SUCCESS The function is successfully executed.
1803- * @retval OtherValues Failure
1804- *
1805- */
1806-ACL_FUNC_VISIBILITY aclError aclrtGetGroupCount(uint32_t *count);
1807- 
1808-/**
1809- * @ingroup AscendCL
1810- * @brief create group information
1811- *
1812- * @retval null for failed.
1813- * @retval OtherValues success.
1814- *
1815- * @see aclrtDestroyGroupInfo
1816- */
1817-ACL_FUNC_VISIBILITY aclrtGroupInfo *aclrtCreateGroupInfo();
1818- 
1819-/**
1820- * @ingroup AscendCL
1821- * @brief destroy group information
1822- *
1823- * @param groupInfo [IN] pointer to group information
1824- *
1825- * @retval ACL_SUCCESS The function is successfully executed.
1826- * @retval OtherValues Failure
1827- *
1828- * @see aclrtCreateGroupInfo
1829- */
1830-ACL_FUNC_VISIBILITY aclError aclrtDestroyGroupInfo(aclrtGroupInfo *groupInfo);
1831- 
1832-/**
1833- * @ingroup AscendCL
1834- * @brief get all group information
1835- *
1836- * @param groupInfo [OUT] pointer to group information
1837- *
1838- * @retval ACL_SUCCESS The function is successfully executed.
1839- * @retval OtherValues Failure
1840- *
1841- * @see aclrtGetGroupCount
1842- */
1843-ACL_FUNC_VISIBILITY aclError aclrtGetAllGroupInfo(aclrtGroupInfo *groupInfo);
1844- 
1845-/**
1846- * @ingroup AscendCL
1847- * @brief get detail information of group
1848- *
1849- * @param groupInfo [IN] pointer to group information
1850- * @param groupIndex [IN] group index value
1851- * @param attr [IN] group attribute
1852- * @param attrValue [OUT] pointer to attribute value
1853- * @param valueLen [IN] length of attribute value
1854- * @param paramRetSize [OUT] pointer to real length of attribute value
1855- *
1856- * @retval ACL_SUCCESS The function is successfully executed.
1857- * @retval OtherValues Failure
1858- *
1859- * @see aclrtGetGroupCount | aclrtGetAllGroupInfo
1860- */
1861-ACL_FUNC_VISIBILITY aclError aclrtGetGroupInfoDetail(const aclrtGroupInfo *groupInfo,
1862- int32_t groupIndex,
1863- aclrtGroupAttr attr,
1864- void *attrValue,
1865- size_t valueLen,
1866- size_t *paramRetSize);
1867- 
1868-/**
1869- * @ingroup AscendCL
1870- * @brief checking whether current device and peer device support the p2p feature
1871- *
1872- * @param canAccessPeer [OUT] pointer to save the checking result
1873- * @param deviceId [IN] current device id
1874- * @param peerDeviceId [IN] peer device id
1875- *
1876- * @retval ACL_SUCCESS The function is successfully executed.
1877- * @retval OtherValues Failure
1878- *
1879- * @see aclrtDeviceEnablePeerAccess | aclrtDeviceDisablePeerAccess
1880- */
1881-ACL_FUNC_VISIBILITY aclError aclrtDeviceCanAccessPeer(int32_t *canAccessPeer, int32_t deviceId, int32_t peerDeviceId);
1882- 
1883-/**
1884- * @ingroup AscendCL
1885- * @brief enable the peer device to support the p2p feature
1886- *
1887- * @param peerDeviceId [IN] the peer device id
1888- * @param flags [IN] reserved field, now it must be zero
1889- *
1890- * @retval ACL_SUCCESS The function is successfully executed.
1891- * @retval OtherValues Failure
1892- *
1893- * @see aclrtDeviceCanAccessPeer | aclrtDeviceDisablePeerAccess
1894- */
1895-ACL_FUNC_VISIBILITY aclError aclrtDeviceEnablePeerAccess(int32_t peerDeviceId, uint32_t flags);
1896- 
1897-/**
1898- * @ingroup AscendCL
1899- * @brief disable the peer device to support the p2p function
1900- *
1901- * @param peerDeviceId [IN] the peer device id
1902- *
1903- * @retval ACL_SUCCESS The function is successfully executed.
1904- * @retval OtherValues Failure
1905- *
1906- * @see aclrtDeviceCanAccessPeer | aclrtDeviceEnablePeerAccess
1907- */
1908-ACL_FUNC_VISIBILITY aclError aclrtDeviceDisablePeerAccess(int32_t peerDeviceId);
1909- 
1910-/**
1911- * @ingroup AscendCL
1912- * @brief Obtain the free memory and total memory of specified attribute.
1913- * the specified memory include normal memory and huge memory.
1914- *
1915- * @param attr [IN] the memory attribute of specified device
1916- * @param free [OUT] the free memory of specified device
1917- * @param total [OUT] the total memory of specified device.
1918- *
1919- * @retval ACL_SUCCESS The function is successfully executed.
1920- * @retval OtherValues Failure
1921- */
1922-ACL_FUNC_VISIBILITY aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total);
1923- 
1924-/**
1925- * @ingroup AscendCL
1926- * @brief get device information.
1927- * @param [in] deviceId the device id
1928- * @param [in] attr device attr
1929- * @param [out] value the device info
1930- * @retval ACL_SUCCESS The function is successfully executed.
1931- * @retval OtherValues Failure
1932- */
1933-ACL_FUNC_VISIBILITY aclError aclrtGetDeviceInfo(uint32_t deviceId, aclrtDevAttr attr, int64_t *value);
1934- 
1935-/**
1936- * @ingroup AscendCL
1937- * @brief Set the timeout interval for waitting of op
1938- *
1939- * @param timeout [IN] op wait timeout
1940- *
1941- * @retval ACL_SUCCESS The function is successfully executed.
1942- * @retval OtherValues Failure
1943- */
1944-ACL_FUNC_VISIBILITY aclError aclrtSetOpWaitTimeout(uint32_t timeout);
1945- 
1946-/**
1947- * @ingroup AscendCL
1948- * @brief Set the timeout interval for op executing
1949- *
1950- * @param timeout [IN] op execute timeout, the unit is seconds
1951- *
1952- * @retval ACL_SUCCESS The function is successfully executed.
1953- * @retval OtherValues Failure
1954- */
1955-ACL_FUNC_VISIBILITY aclError aclrtSetOpExecuteTimeOut(uint32_t timeout);
1956- 
1957-/**
1958- * @ingroup AscendCL
1959- * @brief enable or disable overflow switch on some stream
1960- * @param stream [IN] set overflow switch on this stream
1961- * @param flag [IN] 0 : disable 1 : enable
1962- *
1963- * @retval ACL_SUCCESS The function is successfully executed.
1964- * @retval OtherValues Failure
1965- */
1966-ACL_FUNC_VISIBILITY aclError aclrtSetStreamOverflowSwitch(aclrtStream stream, uint32_t flag);
1967- 
1968-/**
1969- * @ingroup AscendCL
1970- * @brief get overflow switch on some stream
1971- * @param stream [IN] get overflow switch on this stream
1972- * @param flag [OUT] current overflow switch, 0 : disable others : enable
1973- *
1974- * @retval ACL_SUCCESS The function is successfully executed.
1975- * @retval OtherValues Failure
1976- */
1977-ACL_FUNC_VISIBILITY aclError aclrtGetStreamOverflowSwitch(aclrtStream stream, uint32_t *flag);
1978- 
1979-/**
1980- * @ingroup AscendCL
1981- * @brief Query the comprehensive usage rate of device
1982- * @param deviceId [IN] the need query's deviceId
1983- * @param utilizationInfo [IN] the need query's device unit switch
1984- * @param utilizationInfo [OUT] the usage rate of device
1985- *
1986- * @retval ACL_SUCCESS The function is successfully executed.
1987- * @retval OtherValues Failure
1988- */
1989-ACL_FUNC_VISIBILITY aclError aclrtGetDeviceUtilizationRate(int32_t deviceId, aclrtUtilizationInfo *utilizationInfo);
1990- 
1991-/**
1992- * @ingroup AscendCL
1993- * @brief set saturation mode
1994- * @param mode [IN] target saturation mode
1995- *
1996- * @retval ACL_SUCCESS The function is successfully executed.
1997- * @retval OtherValues Failure
1998- */
1999-ACL_FUNC_VISIBILITY aclError aclrtSetDeviceSatMode(aclrtFloatOverflowMode mode);
2000- 
2001-/**
2002- * @ingroup AscendCL
2003- * @brief get overflow status asynchronously
2004- *
2005- * @par Restriction
2006- * After calling the aclrtGetOverflowStatus interface,
2007- * you need to call the aclrtSynchronizeStream interface
2008- * to ensure that the tasks in the stream have been completed.
2009- * @param outputAddr [IN/OUT] output device addr to store overflow status
2010- * @param outputSize [IN] output addr size
2011- * @param outputSize [IN] stream
2012- *
2013- * @retval ACL_SUCCESS The function is successfully executed.
2014- * @retval OtherValues Failure
2015- */
2016-ACL_FUNC_VISIBILITY aclError aclrtGetOverflowStatus(void *outputAddr, size_t outputSize, aclrtStream stream);
2017- 
2018-/**
2019- * @ingroup AscendCL
2020- * @brief reset overflow status asynchronously
2021- *
2022- * @par Restriction
2023- * After calling the aclrtResetOverflowStatus interface,
2024- * you need to call the aclrtSynchronizeStream interface
2025- * to ensure that the tasks in the stream have been completed.
2026- * @param outputSize [IN] stream
2027- *
2028- * @retval ACL_SUCCESS The function is successfully executed.
2029- * @retval OtherValues Failure
2030- */
2031-ACL_FUNC_VISIBILITY aclError aclrtResetOverflowStatus(aclrtStream stream);
2032- 
2033-/**
2034-* @ingroup AscendCL
2035-* @brief cache manager operation
2036-* @param [in] src device memory address
2037-* @param [in] size memory size
2038-* @param [in] cmoType type of operation, currently, only ACL_RT_CMO_TYPE_PREFETCH is supported
2039-* @param [in] stream stream handle
2040-*
2041-* @retval ACL_SUCCESS The function is successfully executed.
2042-* @retval OtherValues Failure
2043-*/
2044-ACL_FUNC_VISIBILITY aclError aclrtCmoAsync(void *src, size_t size, aclrtCmoType cmoType, aclrtStream stream);
2045- 
2046-/**`
2047- * @ingroup AscendCL
2048- * @brief get the mem uce info
2049- * @param [in] deviceId
2050- * @param [in/out] memUceInfoArray
2051- * @param [in] arraySize
2052- * @param [out] retSize
2053- * @retval ACL_SUCCESS The function is successfully executed.
2054- * @retval OtherValues Failure
2055- */
2056-ACL_FUNC_VISIBILITY aclError aclrtGetMemUceInfo(int32_t deviceId, aclrtMemUceInfo *memUceInfoArray,
2057- size_t arraySize, size_t *retSize);
2058- 
2059-/**`
2060- * @ingroup AscendCL
2061- * @brief get the mem usage info
2062- * @param [in] deviceId
2063- * @param [in/out] memUsageInfo
2064- * @param [in] inputNum
2065- * @param [out] outputNum
2066- * @retval ACL_SUCCESS The function is successfully executed.
2067- * @retval OtherValues Failure
2068- */
2069-ACL_FUNC_VISIBILITY aclError aclrtGetMemUsageInfo(uint32_t deviceId, aclrtMemUsageInfo *memUsageInfo, size_t inputNum, size_t *outputNum);
2070- 
2071-/**
2072- * @ingroup AscendCL
2073- * @brief stop the task on specified device
2074- * @param [in] deviceId
2075- * @param [in] timeout
2076- * @retval ACL_SUCCESS The function is successfully executed.
2077- * @retval OtherValues Failure
2078- */
2079-ACL_FUNC_VISIBILITY aclError aclrtDeviceTaskAbort(int32_t deviceId, uint32_t timeout);
2080- 
2081-/**`
2082- * @ingroup AscendCL
2083- * @brief repair the mem uce
2084- * @param [in] deviceId
2085- * @param [in/out] memUceInfoArray
2086- * @param [in] arraySize
2087- * @retval ACL_SUCCESS The function is successfully executed.
2088- * @retval OtherValues Failure
2089- */
2090-ACL_FUNC_VISIBILITY aclError aclrtMemUceRepair(int32_t deviceId, aclrtMemUceInfo *memUceInfoArray, size_t arraySize);
2091- 
2092-/**`
2093- * @ingroup AscendCL
2094- * @brief abort unexecuted tasks and pause executing tasks on the stream
2095- * @param [in] stream stream to be aborted, cannot be null
2096- * @retval ACL_SUCCESS The function is successfully executed.
2097- * @retval OtherValues Failure
2098- */
2099-ACL_FUNC_VISIBILITY aclError aclrtStreamAbort(aclrtStream stream);
2100- 
2101-/**
2102- * @ingroup AscendCL
2103- * @brief Get the value of the current device's limited resources
2104- * @param [in] deviceId the device id
2105- * @param [in] type resources type
2106- * @param [out] value resources limit value
2107- * @retval ACL_SUCCESS The function is successfully executed.
2108- * @retval OtherValues Failure
2109- */
2110-ACL_FUNC_VISIBILITY aclError aclrtGetDeviceResLimit(int32_t deviceId, aclrtDevResLimitType type, uint32_t *value);
2111- 
2112-/**
2113- * @ingroup AscendCL
2114- * @brief Set the value of the current device's limited resources
2115- * @param [in] deviceId the device id
2116- * @param [in] type resource type
2117- * @param [in] value resource limit value
2118- * @retval ACL_SUCCESS The function is successfully executed.
2119- * @retval OtherValues Failure
2120- */
2121-ACL_FUNC_VISIBILITY aclError aclrtSetDeviceResLimit(int32_t deviceId, aclrtDevResLimitType type, uint32_t value);
2122- 
2123-/**
2124- * @ingroup AscendCL
2125- * @brief Reset the value of the current device's limited resources
2126- * @param [in] deviceId the device id
2127- * @retval ACL_SUCCESS The function is successfully executed.
2128- * @retval OtherValues Failure
2129- */
2130-ACL_FUNC_VISIBILITY aclError aclrtResetDeviceResLimit(int32_t deviceId);
2131- 
2132-/**
2133- * @ingroup AscendCL
2134- * @brief Get the value of the limited resources of the specified stream
2135- * @param [in] stream the stream handle
2136- * @param [in] type resource type
2137- * @param [out] value resource limit value
2138- * @retval ACL_SUCCESS The function is successfully executed.
2139- * @retval OtherValues Failure
2140- */
2141-ACL_FUNC_VISIBILITY aclError aclrtGetStreamResLimit(aclrtStream stream, aclrtDevResLimitType type, uint32_t *value);
2142- 
2143-/**
2144- * @ingroup AscendCL
2145- * @brief Reset the value of the limited resources of the specified stream
2146- * @param [in] stream the stream handle
2147- * @retval ACL_SUCCESS The function is successfully executed.
2148- * @retval OtherValues Failure
2149- */
2150-ACL_FUNC_VISIBILITY aclError aclrtResetStreamResLimit(aclrtStream stream);
2151- 
2152-/**
2153- * @ingroup AscendCL
2154- * @brief Use stream resource in current thread
2155- * @param stream [in] stream to use
2156- * @retval ACL_SUCCESS The function is successfully executed.
2157- * @retval OtherValues Failure
2158- */
2159-ACL_FUNC_VISIBILITY aclError aclrtUseStreamResInCurrentThread(aclrtStream stream);
2160- 
2161-/**
2162- * @ingroup AscendCL
2163- * @brief Not use stream resource in current thread
2164- * @param stream [in] stream to not use
2165- * @retval ACL_SUCCESS The function is successfully executed.
2166- * @retval OtherValues Failure
2167- */
2168-ACL_FUNC_VISIBILITY aclError aclrtUnuseStreamResInCurrentThread(aclrtStream stream);
2169- 
2170-/**
2171- * @ingroup AscendCL
2172- * @brief Get the value of the limited resources of the current thread
2173- * @param type [in] resource type
2174- * @param value [out] resource limit value
2175- * @retval ACL_SUCCESS The function is successfully executed.
2176- * @retval OtherValues Failure
2177- */
2178-ACL_FUNC_VISIBILITY aclError aclrtGetResInCurrentThread(aclrtDevResLimitType type, uint32_t *value);
2179- 
2180-/**
2181- * @ingroup AscendCL
2182- * @brief Set the operation execution timeout for the current thread
2183- * @param [in] timeout Desired operation timeout value (in microsecond)
2184- * @param [out] actualTimeout Pointer to a uint64_t variable to store the actual timeout value applied
2185- * @retval ACL_SUCCESS The function is successfully executed
2186- * @retval OtherValues Failure
2187- */
2188-ACL_FUNC_VISIBILITY aclError aclrtSetOpExecuteTimeOutV2(uint64_t timeout, uint64_t *actualTimeout);
2189- 
2190-/**
2191- * @ingroup AscendCL
2192- * @brief Write data to the specified memory. Asynchronous Interface.
2193- *
2194- * @param devAddr [IN] Memory address on the Device side.
2195- * @param value [IN] The data to be written into the memory.
2196- * @param flag [IN] Reserved parameter, currently fixed to 0.
2197- * @param stream [IN] stream handle
2198- *
2199- * @retval ACL_SUCCESS The function is successfully executed.
2200- * @retval OtherValues Failure
2201- */
2202-ACL_FUNC_VISIBILITY aclError aclrtValueWrite(void* devAddr, uint64_t value, uint32_t flag, aclrtStream stream);
2203- 
2204-/**
2205- * @ingroup AscendCL
2206- * @brief Unblock after the data in the specified memory meets certain conditions. Asynchronous Interface.
2207- *
2208- * @param devAddr [IN] Memory address on the Device side.
2209- * @param value [IN] The value to be compared with the data in the memory.
2210- * @param flag [IN] comparison logic.
2211- * @param stream [IN] stream handle
2212- *
2213- * @retval ACL_SUCCESS The function is successfully executed.
2214- * @retval OtherValues Failure
2215- */
2216-ACL_FUNC_VISIBILITY aclError aclrtValueWait(void* devAddr, uint64_t value, uint32_t flag, aclrtStream stream);
2217- 
2218-/**
2219- * @brief set stream attribute
2220- * @param [in] stream stream handle
2221- * @param [in] stmAttrType stream attribute type, which value can be:
2222- * ACL_STREAM_ATTR_FAILURE_MODE, ACL_STREAM_ATTR_FLOAT_OVERFLOW_CHECK
2223- * or ACL_STREAM_ATTR_USER_CUSTOM_TAG
2224- * @param [in] value stream attribute value
2225- * @retval ACL_SUCCESS The function is successfully executed.
2226- * @retval OtherValues Failure
2227- */
2228-ACL_FUNC_VISIBILITY aclError aclrtSetStreamAttribute(aclrtStream stream, aclrtStreamAttr stmAttrType,
2229- aclrtStreamAttrValue *value);
2230- 
2231-/**
2232- * @ingroup AscendCL
2233- * @brief get uuid of device by device id
2234- * @param [in] deviceId device id
2235- * @param [out] uuid 16-byte Universally Unique Identifier for
2236- * globally unique identification of an NPU device.
2237- * @retval ACL_SUCCESS The function is successfully executed
2238- * @retval OtherValues Failure
2239- */
2240-ACL_FUNC_VISIBILITY aclError aclrtDeviceGetUuid(int32_t deviceId, aclrtUuid *uuid);
2241- 
2242-/**
2243- * @ingroup AscendCL
2244- * @brief Add a callback function to be executed on the host
2245- * to the task queue of the Stream
2246- * Difference between this api and "aclrtLaunchCallback" is that
2247- * thread will be created and registered inside this interface
2248- * automatically, while "aclrtLaunchCallback" need manual registration.
2249- * For details please refer to official API document
2250- * @param [in] stream the stream to launch callback func
2251- * @param [in] func callback func to launch
2252- * The function prototype of the callback function is:
2253- * typedef void (*aclrtHostFunc)(void *args);
2254- * @param [in] args args for callback func
2255- * @retval ACL_SUCCESS The function is successfully executed.
2256- * @retval OtherValues Failure
2257- */
2258-ACL_FUNC_VISIBILITY aclError aclrtLaunchHostFunc(aclrtStream stream, aclrtHostFunc func, void *args);
2259- 
2260-/**
2261- * @ingroup AscendCL
2262- * @brief Get detailed error information of the device
2263- *
2264- * @param deviceId [IN] the device ID
2265- * @param errorInfo [OUT] the error information
2266- *
2267- * @retval ACL_SUCCESS The function is successfully executed.
2268- * @retval OtherValues Failure
2269- */
2270-ACL_FUNC_VISIBILITY aclError aclrtGetErrorVerbose(int32_t deviceId, aclrtErrorInfo *errorInfo);
2271- 
2272-/**
2273- * @ingroup AscendCL
2274- * @brief Repair device errors
2275- *
2276- * @param deviceId [IN] the device ID
2277- * @param errorInfo [IN] the error information
2278- *
2279- * @retval ACL_SUCCESS The function is successfully executed.
2280- * @retval OtherValues Failure
2281- */
2282-ACL_FUNC_VISIBILITY aclError aclrtRepairError(int32_t deviceId, const aclrtErrorInfo *errorInfo);
2283- 
2284-#define ACL_PKG_VERSION_MAX_SIZE 128
2285-#define ACL_PKG_VERSION_PARTS_MAX_SIZE 64
2286-#define ACL_IPC_HANDLE_SIZE 65
2287- 
2288-/**
2289- * @ingroup AscendCL
2290- * @brief acl initialize
2291- *
2292- * @par Restriction
2293- * This interface can be called multiple times in a process, the reference count will
2294- * increase by 1 each time when aclInit is called multiple times.
2295- * The aclFinalizeReference interface should be called the same number of times as aclInit,
2296- * or you can call aclFinalize to release all resources regardless of the reference count and reset it to 0.
2297- *
2298- * @param configPath [IN] the config path,it can be NULL
2299- * @retval ACL_SUCCESS The function is successfully executed.
2300- * @retval OtherValues Failure
2301- */
2302-ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath);
2303- 
2304-/**
2305- * @ingroup AscendCL
2306- * @brief acl finalize
2307- *
2308- * @par Restriction
2309- * This interface should be called before the process exits.
2310- * After calling aclFinalize, all allocated resources are released,
2311- * the internal reference count is reset to 0, and ACL services can no longer be used.
2312- *
2313- * @retval ACL_SUCCESS The function is successfully executed.
2314- * @retval OtherValues Failure
2315- */
2316-ACL_FUNC_VISIBILITY aclError aclFinalize();
2317- 
2318-/**
2319- * @ingroup AscendCL
2320- * @brief query ACL interface version
2321- *
2322- * @param majorVersion[OUT] ACL interface major version
2323- * @param minorVersion[OUT] ACL interface minor version
2324- * @param patchVersion[OUT] ACL interface patch version
2325- * @retval ACL_SUCCESS The function is successfully executed.
2326- * @retval OtherValues Failure
2327- */
2328-ACL_FUNC_VISIBILITY aclError aclrtGetVersion(int32_t *majorVersion, int32_t *minorVersion, int32_t *patchVersion);
2329- 
2330-/**
2331- * @ingroup AscendCL
2332- * @brief acl finalize reference
2333- *
2334- * @par Restriction
2335- * This interface decrements the internal reference count each time it is called.
2336- * Resources are only released when the reference count reaches 0.
2337- * To get the current reference count, pass a valid pointer to refCount.
2338- * To ignore the reference count, pass nullptr instead.
2339- *
2340- * @param refCount [IN/OUT] Pointer to receive current reference count after calling aclFinalizeReference; can be nullptr.
2341- * @retval ACL_SUCCESS The function is successfully executed.
2342- * @retval OtherValues Failure
2343- */
2344-ACL_FUNC_VISIBILITY aclError aclFinalizeReference(uint64_t *refCount);
2345- 
2346-/**
2347- * @ingroup AscendCL
2348- * @brief get recent error message
2349- *
2350- * @retval null for failed
2351- * @retval OtherValues success
2352-*/
2353-ACL_FUNC_VISIBILITY const char *aclGetRecentErrMsg();
2354- 
2355-/**
2356- * @ingroup AscendCL
2357- * @brief enum for CANN package name
2358- */
2359-typedef enum aclCANNPackageName {
2360- ACL_PKG_NAME_CANN,
2361- ACL_PKG_NAME_RUNTIME,
2362- ACL_PKG_NAME_COMPILER,
2363- ACL_PKG_NAME_HCCL,
2364- ACL_PKG_NAME_TOOLKIT,
2365- ACL_PKG_NAME_OPP,
2366- ACL_PKG_NAME_OPP_KERNEL,
2367- ACL_PKG_NAME_DRIVER
2368-} aclCANNPackageName;
2369- 
2370-/**
2371- * @ingroup AscendCL
2372- * @brief struct for storaging CANN package version
2373- */
2374-typedef struct aclCANNPackageVersion {
2375- char version[ACL_PKG_VERSION_MAX_SIZE];
2376- char majorVersion[ACL_PKG_VERSION_PARTS_MAX_SIZE];
2377- char minorVersion[ACL_PKG_VERSION_PARTS_MAX_SIZE];
2378- char releaseVersion[ACL_PKG_VERSION_PARTS_MAX_SIZE];
2379- char patchVersion[ACL_PKG_VERSION_PARTS_MAX_SIZE];
2380- char reserved[ACL_PKG_VERSION_MAX_SIZE];
2381-} aclCANNPackageVersion;
2382- 
2383-/**
2384- * @ingroup AscendCL
2385- * @brief query CANN package version
2386- *
2387- * @param name[IN] CANN package name
2388- * @param version[OUT] CANN package version information
2389- * @retval ACL_SUCCESS The function is successfully executed.
2390- * @retval ACL_ERROR_INVALID_FILE Failure
2391- */
2392-ACL_FUNC_VISIBILITY aclError aclsysGetCANNVersion(aclCANNPackageName name, aclCANNPackageVersion *version);
2393- 
2394-#ifdef __cplusplus
2395-}
2396-#endif
2397- 
2398-#endif // INC_EXTERNAL_ACL_ACL_RT_H_
2399- 
Dthird_party/acl/inc/acl/acl_rt_allocator.h+0-148
@@ -1,148 +0,0 @@
1-/**
2-* @file acl_rt_allocator.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10-#ifndef INC_EXTERNAL_ACL_ACL_RT_ALLOCATOR_H_
11-#define INC_EXTERNAL_ACL_ACL_RT_ALLOCATOR_H_
12- 
13-#include "acl_base.h"
14- 
15-#ifdef __cplusplus
16-extern "C" {
17-#endif
18- 
19-typedef void *aclrtAllocatorDesc;
20-typedef void *aclrtAllocator;
21-typedef void *aclrtAllocatorBlock;
22-typedef void *aclrtAllocatorAddr;
23- 
24-typedef void *(*aclrtAllocatorAllocFunc)(aclrtAllocator allocator, size_t size);
25-typedef void (*aclrtAllocatorFreeFunc)(aclrtAllocator allocator, aclrtAllocatorBlock block);
26-typedef void *(*aclrtAllocatorAllocAdviseFunc)(aclrtAllocator allocator, size_t size, aclrtAllocatorAddr addr);
27-typedef void *(*aclrtAllocatorGetAddrFromBlockFunc)(aclrtAllocatorBlock block);
28- 
29-/**
30- * @ingroup AscendCL
31- * @brief Create allocator description
32- *
33- * @retval null for failed
34- * @retval OtherValues success
35- *
36- * @see aclrtAllocatorDestroyDesc
37- */
38-ACL_FUNC_VISIBILITY aclrtAllocatorDesc aclrtAllocatorCreateDesc();
39- 
40-/**
41- * @ingroup AscendCL
42- * @brief Relese allocator description
43- *
44- * @param allocatorDesc [IN] allocator description
45- *
46- * @retval ACL_SUCCESS The function is successfully executed.
47- * @retval OtherValues Failure
48- *
49- * @see aclrtAllocatorCreateDesc
50- */
51-ACL_FUNC_VISIBILITY aclError aclrtAllocatorDestroyDesc(aclrtAllocatorDesc allocatorDesc);
52- 
53-/**
54- * @ingroup AscendCL
55- * @brief Register allocator object to allocator description
56- *
57- * @param allocatorDesc [IN] allocator description
58- * @param allocator [IN] allocator object handle
59- *
60- * @retval ACL_SUCCESS The function is successfully executed.
61- * @retval OtherValues Failure
62- */
63-ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetObjToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocator allocator);
64- 
65-/**
66- * @ingroup AscendCL
67- * @brief Register the function pointer of alloc memory to the allocator description
68- *
69- * @param allocatorDesc [IN] allocator description
70- * @param func [IN] the function pointer of alloc memory
71- *
72- * @retval ACL_SUCCESS The function is successfully executed.
73- * @retval OtherValues Failure
74- */
75-ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetAllocFuncToDesc(aclrtAllocatorDesc allocatorDesc,
76- aclrtAllocatorAllocFunc func);
77- 
78-/**
79- * @ingroup AscendCL
80- * @brief Register the function pointer of free memory to the allocator description
81- *
82- * @param allocatorDesc [IN] allocator description
83- * @param func [IN] free memory function pointer
84- *
85- * @retval ACL_SUCCESS The function is successfully executed.
86- * @retval OtherValues Failure
87- */
88-ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetFreeFuncToDesc(aclrtAllocatorDesc allocatorDesc,
89- aclrtAllocatorFreeFunc func);
90- 
91-/**
92- * @ingroup AscendCL
93- * @brief Register the function pointer of alloc suggested memory to the allocator description
94- *
95- * @param allocatorDesc [IN] allocator description
96- * @param func [IN] the function pointer of alloc suggested memory
97- *
98- * @retval ACL_SUCCESS The function is successfully executed.
99- * @retval OtherValues Failure
100- */
101-ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetAllocAdviseFuncToDesc(aclrtAllocatorDesc allocatorDesc,
102- aclrtAllocatorAllocAdviseFunc func);
103- 
104-/**
105- * @ingroup AscendCL
106- * @brief Register the function pointer of get address from block to the allocator description
107- *
108- * @param allocatorDesc [IN] allocator description
109- * @param func [IN] the function pointer of get address from block
110- *
111- * @retval ACL_SUCCESS The function is successfully executed.
112- * @retval OtherValues Failure
113- */
114-ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetGetAddrFromBlockFuncToDesc(aclrtAllocatorDesc allocatorDesc,
115- aclrtAllocatorGetAddrFromBlockFunc func);
116- 
117-/**
118- * @ingroup AscendCL
119- * @brief Register allocator description to acl by stream
120- *
121- * @param stream [IN] stream handle
122- * @param allocatorDesc [IN] allocator description
123- *
124- * @retval ACL_SUCCESS The function is successfully executed.
125- * @retval OtherValues Failure
126- *
127- * @see aclrtAllocatorUnregister
128- */
129-ACL_FUNC_VISIBILITY aclError aclrtAllocatorRegister(aclrtStream stream, aclrtAllocatorDesc allocatorDesc);
130- 
131-/**
132- * @ingroup AscendCL
133- * @brief Unregister allocator description from acl by stream
134- *
135- * @param stream [IN] stream handle
136- *
137- * @retval ACL_SUCCESS The function is successfully executed.
138- * @retval OtherValues Failure
139- *
140- * @see aclrtAllocatorRegister
141- */
142-ACL_FUNC_VISIBILITY aclError aclrtAllocatorUnregister(aclrtStream stream);
143- 
144-#ifdef __cplusplus
145-}
146-#endif
147- 
148-#endif // INC_EXTERNAL_ACL_ACL_RT_ALLOCATOR_H_
Dthird_party/acl/inc/acl/acl_sk.h+0-132
@@ -1,132 +0,0 @@
1-#ifndef ACL_SUPERKERNEL_H
2-#define ACL_SUPERKERNEL_H
3- 
4-#include <cstdint>
5-#include <cstddef>
6-#include "acl.h"
7- 
8-enum class aclskOptionType : uint32_t {
9- PRELOAD_CODE = 0,
10- SPLIT_MODE = 1,
11- STREAM_FUSION = 2,
12- DCCI_DISABLE_ON_KERNEL = 3,
13- DEBUG_SYNC_ALL = 4,
14- KERNEL_MAP = 5,
15- CONSTANT_CODEGEN = 6, // 常量化代码生成选项
16- AUTO_OP_PARALLEL = 7, // 优化多流算子排布
17- DCCI_BEFORE_KERNEL_START = 8,
18- DEBUG_OP_EXEC_TRACE = 9,
19- DEBUG_CROSS_CORE_SYNC_CHECK = 10,
20- OPT_EXTEND_OPTION = 11, // 扩展选项,预留后续使用
21- DEBUG_EXTEND_OPTION = 12, // 扩展选项,预留后续使用
22- DCCI_AFTER_KERNEL_END = 13,
23- AGGRESSIVE_OPT_STRATEGIES = 14, // value memory wait breaker policy
24- SK_OPTION_MAX = 0xFFFFFFFF
25-};
26- 
27-struct aclskPreloadOption {
28- uint32_t preloadMode;
29-};
30- 
31-struct aclskSplitModeOption {
32- uint32_t splitCnt;
33-};
34- 
35-struct aclskStreamFusionOption {
36- uint32_t streamFusion;
37-};
38- 
39-struct aclskDcciOption {
40- char** kernelNames;
41- size_t kernelCnt;
42-};
43- 
44-struct aclskDebugSyncAllOption {
45- uint32_t debugSyncAll;
46-};
47- 
48-struct aclskDebugDcciAllOption {
49- uint32_t debugDcciAll;
50-};
51- 
52-struct aclskKernelMap {
53- char* globalName;
54- char* sknlNames[4];
55-};
56- 
57-struct aclskKernelMapOption {
58- aclskKernelMap* kernelMaps;
59- size_t numKernels;
60-};
61- 
62-struct aclskAutoOpParallelOption {
63- uint32_t enableAutoOpParallel;
64-};
65- 
66-struct aclskDebugOpExecTraceOption {
67- uint32_t enableOpExecTrace;
68-};
69- 
70-struct aclskDebugCrossCoreSyncCheckOption {
71- uint32_t enableCrossCoreSyncCheck;
72-};
73- 
74-struct aclskExtendOption {
75- char* value;
76-};
77- 
78-/**
79- * aggressiveOpts.valueBreakerBypass is a bitmask-style value-memory wait policy:
80- * - ACLSK_VALUE_BREAKER_BYPASS_NONE (0b00): reject write/wait pairing relation, keep wait unfusible
81- * - ACLSK_VALUE_BREAKER_BYPASS_PAIRED_WAIT (0b01): for paired write+wait, existing rule must pass or SK exits
82- * - ACLSK_VALUE_BREAKER_BYPASS_UNPAIRED_WAIT (0b10): for waits whose writes are outside modelRI, allow wait fusion
83- */
84-enum aclskValueBreakerBypassFlag : uint32_t {
85- ACLSK_VALUE_BREAKER_BYPASS_NONE = 0b00U,
86- ACLSK_VALUE_BREAKER_BYPASS_PAIRED_WAIT = 0b01U,
87- ACLSK_VALUE_BREAKER_BYPASS_UNPAIRED_WAIT = 0b10U
88-};
89- 
90-struct aclskAggressiveOptStrategies {
91- uint32_t eventBreakerBypass;
92- uint32_t valueBreakerBypass;
93- uint32_t taskBreakerBypass;
94-};
95- 
96-/**
97- * 常量化代码生成选项
98- * enableConstant: 1 启用常量化, 0 禁用常量化
99- */
100-struct aclskConstantCodegenOption {
101- uint32_t enableConstant;
102-};
103- 
104-struct aclskOption {
105- aclskOptionType optionType;
106- union {
107- aclskPreloadOption preload;
108- aclskSplitModeOption splitMode;
109- aclskStreamFusionOption streamFusion;
110- aclskDcciOption disableKernelDcci;
111- aclskDebugSyncAllOption debugSync;
112- aclskKernelMapOption kernelMap;
113- aclskConstantCodegenOption constantCodegen;
114- aclskAutoOpParallelOption autoOpParallel;
115- aclskDcciOption dcciBeforeKernelStart;
116- aclskDebugOpExecTraceOption debugOpExecTrace;
117- aclskDebugCrossCoreSyncCheckOption debugCrossCoreSyncCheck;
118- aclskExtendOption optExtend;
119- aclskExtendOption debugExtend;
120- aclskDcciOption dcciAfterKernelEnd;
121- aclskAggressiveOptStrategies aggressiveOpts;
122- };
123-};
124- 
125-typedef struct aclskOptions {
126- aclskOption *options;
127- size_t numOptions;
128-};
129- 
130-ACL_FUNC_VISIBILITY aclError aclskOptimize(aclmdlRI model, aclskOptions *options);
131- 
132-#endif
Dthird_party/acl/inc/acl/acl_tdt.h+0-345
@@ -1,345 +0,0 @@
1-/**
2-* @file acl_tdt.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_ACL_TDT_H_
12-#define INC_EXTERNAL_ACL_ACL_TDT_H_
13- 
14-#include "acl/acl_base.h"
15- 
16-#ifdef __cplusplus
17-extern "C" {
18-#endif
19- 
20-enum acltdtTensorType {
21- ACL_TENSOR_DATA_UNDEFINED = -1,
22- ACL_TENSOR_DATA_TENSOR,
23- ACL_TENSOR_DATA_END_OF_SEQUENCE,
24- ACL_TENSOR_DATA_ABNORMAL,
25- ACL_TENSOR_DATA_SLICE_TENSOR,
26- ACL_TENSOR_DATA_END_TENSOR
27-};
28- 
29-typedef struct acltdtDataItem acltdtDataItem;
30-typedef struct acltdtDataset acltdtDataset;
31-typedef struct acltdtChannelHandle acltdtChannelHandle;
32- 
33-/**
34- * @ingroup AscendCL
35- * @brief Get tensor type from item
36- *
37- * @param dataItem [IN] pointer to the data item
38- *
39- * @retval Tensor type.
40- * @retval ACL_DT_UNDEFINED if dataItem is null
41- */
42-ACL_FUNC_VISIBILITY acltdtTensorType acltdtGetTensorTypeFromItem(const acltdtDataItem *dataItem);
43- 
44-/**
45- * @ingroup AscendCL
46- * @brief Get data type from item
47- *
48- * @param dataItem [IN] pointer to the data item
49- *
50- * @retval Data type.
51- * @retval ACL_DT_UNDEFINED if dataItem is null
52- */
53-ACL_FUNC_VISIBILITY aclDataType acltdtGetDataTypeFromItem(const acltdtDataItem *dataItem);
54- 
55-/**
56- * @ingroup AscendCL
57- * @brief Get data address from item
58- *
59- * @param dataItem [IN] pointer to data item
60- *
61- * @retval null for failed
62- * @retval OtherValues success
63-*/
64-ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataItem);
65- 
66-/**
67- * @ingroup AscendCL
68- * @brief Get data size from item
69- *
70- * @param dataItem [IN] pointer to data item
71- *
72- * @retval 0 for failed
73- * @retval OtherValues success
74-*/
75-ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataItem);
76- 
77-/**
78- * @ingroup AscendCL
79- * @brief Get dim's number from item
80- *
81- * @param dataItem [IN] pointer to data item
82- *
83- * @retval 0 for failed
84- * @retval OtherValues success
85-*/
86-ACL_FUNC_VISIBILITY size_t acltdtGetDimNumFromItem(const acltdtDataItem *dataItem);
87- 
88-/**
89- * @ingroup AscendCL
90- * @brief Get slice info from item
91- *
92- * @param dataItem [IN] pointer to data item
93- * @param sliceNum [OUT] pointer to the sliceNum of dataItem
94- * @param sliceId [OUT] pointer to the sliceId of dataItem
95- *
96- * @retval ACL_SUCCESS The function is successfully executed.
97- * @retval OtherValues Failure
98-*/
99-ACL_FUNC_VISIBILITY aclError acltdtGetSliceInfoFromItem(const acltdtDataItem *dataItem, size_t *sliceNum,
100- size_t* sliceId);
101- 
102-/**
103- * @ingroup AscendCL
104- * @brief Get dims from item
105- *
106- * @param dataItem [IN] the struct of data item
107- * @param dims [IN|OUT] pointer to the dims of dataItem
108- * @param dimNum [IN] the size of the dims
109- *
110- * @retval ACL_SUCCESS The function is successfully executed.
111- * @retval OtherValues Failure
112- */
113-ACL_FUNC_VISIBILITY aclError acltdtGetDimsFromItem(const acltdtDataItem *dataItem, int64_t *dims, size_t dimNum);
114- 
115-/**
116- * @ingroup AscendCL
117- * @brief Create the struct of data item
118- *
119- * @param tdtType [IN] Tdt tensor type
120- * @param dims [IN] pointer of tdtDataItem's dims
121- * @param dimNum [IN] Dim number
122- * @param dataType [IN] Data type
123- * @param data [IN] Data pointer
124- * @param size [IN] Data size
125- *
126- * @retval null for failed
127- * @retval OtherValues success
128- *
129- * @see acltdtDestroyDataItem
130- */
131-ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType,
132- const int64_t *dims,
133- size_t dimNum,
134- aclDataType dataType,
135- void *data,
136- size_t size);
137- 
138-/**
139- * @ingroup AscendCL
140- * @brief Destroy the struct of data item
141- *
142- * @param dataItem [IN] pointer to the data item
143- *
144- * @retval ACL_SUCCESS The function is successfully executed.
145- * @retval OtherValues Failure
146- *
147- * @see acltdtCreateDataItem
148- */
149-ACL_FUNC_VISIBILITY aclError acltdtDestroyDataItem(acltdtDataItem *dataItem);
150- 
151-/**
152- * @ingroup AscendCL
153- * @brief Create the tdt dataset
154- *
155- * @retval null for failed
156- * @retval OtherValues success
157- *
158- * @see acltdtDestroyDataset
159- */
160-ACL_FUNC_VISIBILITY acltdtDataset *acltdtCreateDataset();
161- 
162-/**
163- * @ingroup AscendCL
164- * @brief Destroy the tdt dataset
165- *
166- * @param dataset [IN] pointer to the dataset
167- *
168- * @retval ACL_SUCCESS The function is successfully executed.
169- * @retval OtherValues Failure
170- *
171- * @see acltdtCreateDataset
172- */
173-ACL_FUNC_VISIBILITY aclError acltdtDestroyDataset(acltdtDataset *dataset);
174- 
175-/**
176- * @ingroup AscendCL
177- * @brief Get the data item
178- *
179- * @param dataset [IN] pointer to the dataset
180- * @param index [IN] index of the dataset
181- *
182- * @retval null for failed
183- * @retval OtherValues success
184- *
185- * @see acltdtAddDataItem
186- */
187-ACL_FUNC_VISIBILITY acltdtDataItem *acltdtGetDataItem(const acltdtDataset *dataset, size_t index);
188- 
189-/**
190- * @ingroup AscendCL
191- * @brief Get the data item
192- *
193- * @param dataset [OUT] pointer to the dataset
194- * @param dataItem [IN] pointer to the data item
195- *
196- * @retval ACL_SUCCESS The function is successfully executed.
197- * @retval OtherValues Failure
198- *
199- * @see acltdtGetDataItem
200- */
201-ACL_FUNC_VISIBILITY aclError acltdtAddDataItem(acltdtDataset *dataset, acltdtDataItem *dataItem);
202- 
203-/**
204- * @ingroup AscendCL
205- * @brief Get the size of dataset
206- *
207- * @param dataset [IN] pointer to the dataset
208- *
209- * @retval 0 for failed
210- * @retval OtherValues success
211- */
212-ACL_FUNC_VISIBILITY size_t acltdtGetDatasetSize(const acltdtDataset *dataset);
213- 
214-/**
215- * @ingroup AscendCL
216- * @brief Get the name of dataset
217- *
218- * @param dataset [IN] pointer to the dataset
219- *
220- * @retval null for failed
221- * @retval OtherValues success
222- */
223-ACL_FUNC_VISIBILITY const char *acltdtGetDatasetName(const acltdtDataset *dataset);
224- 
225-/**
226- * @ingroup AscendCL
227- * @brief Stop the channel
228- *
229- * @param handle [IN] pointer to the channel handle
230- *
231- * @retval ACL_SUCCESS The function is successfully executed.
232- * @retval OtherValues Failure
233- *
234- * @see acltdtCreateChannel | acltdtDestroyChannel
235- */
236-ACL_FUNC_VISIBILITY aclError acltdtStopChannel(acltdtChannelHandle *handle);
237- 
238-/**
239- * @ingroup AscendCL
240- * @brief Create the channel
241- *
242- * @param deviceId [IN] the device id
243- * @param name [IN] the name of channel
244- *
245- * @retval null for failed
246- * @retval OtherValues success
247- *
248- * @see acltdtStopChannel | acltdtDestroyChannel
249- */
250-ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannel(uint32_t deviceId, const char *name);
251- 
252-/**
253- * @ingroup AscendCL
254- * @brief Create the channel with max size
255- *
256- * @param deviceId [IN] the device id
257- * @param name [IN] the name of channel
258- * @param capacity [IN] the capacity of channel
259- *
260- * @retval null for failed
261- * @retval OtherValues success
262- *
263- * @see acltdtDestroyChannel
264- */
265-ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannelWithCapacity(uint32_t deviceId,
266- const char *name,
267- size_t capacity);
268- 
269-/**
270- * @ingroup AscendCL
271- * @brief Destroy the channel
272- *
273- * @param handle [IN] pointer to the channel handle
274- *
275- * @retval ACL_SUCCESS The function is successfully executed.
276- * @retval OtherValues Failure
277- *
278- * @see acltdtCreateChannel | acltdtStopChannel
279- */
280-ACL_FUNC_VISIBILITY aclError acltdtDestroyChannel(acltdtChannelHandle *handle);
281- 
282-/**
283- * @ingroup AscendCL
284- * @brief clean the channel
285- *
286- * @param handle [IN] pointer to the channel handle
287- *
288- * @retval ACL_SUCCESS The function is successfully executed.
289- * @retval OtherValues Failure
290- *
291- */
292-ACL_FUNC_VISIBILITY aclError acltdtCleanChannel(acltdtChannelHandle *handle);
293- 
294-/**
295- * @ingroup AscendCL
296- * @brief Send tensor to device
297- *
298- * @param handle [IN] pointer to the channel handle
299- * @param dataset [IN] pointer to the dataset
300- * @param timeout [IN] timeout/ms
301- *
302- * @retval ACL_SUCCESS The function is successfully executed.
303- * @retval OtherValues Failure
304- *
305- * @see acltdtReceiveTensor
306- */
307-ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle,
308- const acltdtDataset *dataset,
309- int32_t timeout);
310- 
311-/**
312- * @ingroup AscendCL
313- * @brief Receive tensor from device
314- *
315- * @param handle [IN] pointer to the channel handle
316- * @param dataset [OUT] pointer to the dataset
317- * @param timeout [IN] timeout/ms
318- *
319- * @retval ACL_SUCCESS The function is successfully executed.
320- * @retval OtherValues Failure
321- *
322- * @see acltdtSendTensor
323- */
324-ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle,
325- acltdtDataset *dataset,
326- int32_t timeout);
327- 
328-/**
329- * @ingroup AscendCL
330- * @brief query the size of the channel
331- *
332- * @param handle [IN] pointer to the channel handle
333- * @param size [OUT] current size of this channel
334- *
335- * @retval ACL_SUCCESS The function is successfully executed.
336- * @retval OtherValues Failure
337- *
338- */
339-ACL_FUNC_VISIBILITY aclError acltdtQueryChannelSize(const acltdtChannelHandle *handle, size_t *size);
340- 
341-#ifdef __cplusplus
342-}
343-#endif
344- 
345-#endif // INC_EXTERNAL_ACL_ACL_TDT_H_
Dthird_party/acl/inc/acl/acl_tdt_queue.h+0-611
@@ -1,611 +0,0 @@
1-/**
2-* @file acl_tdt_queue.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef INC_EXTERNAL_ACL_ACL_TDT_QUEUE_H_
12-#define INC_EXTERNAL_ACL_ACL_TDT_QUEUE_H_
13- 
14-#include "acl/acl_base.h"
15- 
16-#ifdef __cplusplus
17-extern "C" {
18-#endif
19- 
20-#define ACL_TDT_QUEUE_PERMISSION_MANAGE 1
21-#define ACL_TDT_QUEUE_PERMISSION_DEQUEUE 2
22-#define ACL_TDT_QUEUE_PERMISSION_ENQUEUE 4
23- 
24-#define ACL_TDT_QUEUE_ROUTE_UNBIND 0
25-#define ACL_TDT_QUEUE_ROUTE_BIND 1
26-#define ACL_TDT_QUEUE_ROUTE_BIND_ABNORMAL 2
27- 
28-typedef void *acltdtBuf;
29-typedef struct tagMemQueueAttr acltdtQueueAttr;
30-typedef struct acltdtQueueRouteList acltdtQueueRouteList;
31-typedef struct acltdtQueueRouteQueryInfo acltdtQueueRouteQueryInfo;
32-typedef struct acltdtQueueRoute acltdtQueueRoute;
33- 
34-typedef enum {
35- ACL_TDT_QUEUE_NAME_PTR = 0,
36- ACL_TDT_QUEUE_DEPTH_UINT32
37-} acltdtQueueAttrType;
38- 
39-typedef enum {
40- ACL_TDT_QUEUE_ROUTE_SRC_UINT32 = 0,
41- ACL_TDT_QUEUE_ROUTE_DST_UINT32,
42- ACL_TDT_QUEUE_ROUTE_STATUS_INT32
43-} acltdtQueueRouteParamType;
44- 
45-typedef enum {
46- ACL_TDT_QUEUE_ROUTE_QUERY_SRC = 0,
47- ACL_TDT_QUEUE_ROUTE_QUERY_DST = 1,
48- ACL_TDT_QUEUE_ROUTE_QUERY_SRC_AND_DST = 2,
49- ACL_TDT_QUEUE_ROUTE_QUERY_ABNORMAL = 100
50-} acltdtQueueRouteQueryMode;
51- 
52-typedef enum {
53- ACL_TDT_QUEUE_ROUTE_QUERY_MODE_ENUM = 0,
54- ACL_TDT_QUEUE_ROUTE_QUERY_SRC_ID_UINT32,
55- ACL_TDT_QUEUE_ROUTE_QUERY_DST_ID_UINT32
56-} acltdtQueueRouteQueryInfoParamType;
57- 
58-typedef enum {
59- ACL_TDT_NORMAL_MEM = 0,
60- ACL_TDT_DVPP_MEM
61-} acltdtAllocBufType;
62- 
63-/**
64- * @ingroup AscendCL
65- * @brief create queue
66- *
67- * @param attr [IN] pointer to the queue attr
68- * @param qid [OUT] pointer to the qid
69- *
70- * @retval ACL_SUCCESS The function is successfully executed.
71- * @retval OtherValues Failure
72- *
73- * @see acltdtDestroyQueue
74- */
75-ACL_FUNC_VISIBILITY aclError acltdtCreateQueue(const acltdtQueueAttr *attr, uint32_t *qid);
76- 
77-/**
78- * @ingroup AscendCL
79- * @brief destroy queue
80- *
81- * @param qid [IN] qid which to be destroyed
82- *
83- * @retval ACL_SUCCESS The function is successfully executed.
84- * @retval OtherValues Failure
85- *
86- * @see acltdtCreateQueue
87- */
88-ACL_FUNC_VISIBILITY aclError acltdtDestroyQueue(uint32_t qid);
89- 
90-/**
91- * @ingroup AscendCL
92- * @brief enqueue function
93- *
94- * @param qid [IN] qid
95- * @param buf [IN] acltdtBuf
96- * @param timeout [IN] timeout, -1 means blocking
97- *
98- * @retval ACL_SUCCESS The function is successfully executed.
99- * @retval OtherValues Failure
100- *
101- * @see acltdtDequeue
102- */
103-ACL_FUNC_VISIBILITY aclError acltdtEnqueue(uint32_t qid, acltdtBuf buf, int32_t timeout);
104- 
105-/**
106- * @ingroup AscendCL
107- * @brief dequeue function
108- *
109- * @param qid [IN] qid
110- * @param buf [OUT] pointer to the acltdtBuf
111- * @param timeout [IN] timeout, -1 means blocking
112- *
113- * @retval ACL_SUCCESS The function is successfully executed.
114- * @retval OtherValues Failure
115- *
116- * @see acltdtEnqueue
117- */
118-ACL_FUNC_VISIBILITY aclError acltdtDequeue(uint32_t qid, acltdtBuf *buf, int32_t timeout);
119- 
120-/**
121- * @ingroup AscendCL
122- * @brief enqueue function
123- *
124- * @param qid [IN] qid
125- * @param data [IN] the pointer to data buf
126- * @param dataSize [IN] the size of data buf
127- * @param userData [IN] the pointer to user data buf
128- * @param userDataSize [IN] the size of user data buf
129- * @param timeout [IN] timeout, -1 means blocking
130- * @param rsv [IN] reserved param
131- * @retval ACL_SUCCESS The function is successfully executed.
132- * @retval OtherValues Failure
133- *
134- * @see acltdtDequeueData
135- */
136-ACL_FUNC_VISIBILITY aclError acltdtEnqueueData(uint32_t qid, const void *data, size_t dataSize,
137- const void *userData, size_t userDataSize, int32_t timeout, uint32_t rsv);
138- 
139-/**
140- * @ingroup AscendCL
141- * @brief dequeue function
142- *
143- * @param qid [IN] qid
144- * @param data [IN|OUT] the pointer to data buf
145- * @param dataSize [IN] the size of data buf
146- * @param retDataSize [OUT] the return size of data buf
147- * @param userData [IN|OUT] the pointer to user data buf
148- * @param userDataSize [IN] the size of user data buf
149- * @param timeout [IN] timeout, -1 means blocking
150- * @retval ACL_SUCCESS The function is successfully executed.
151- * @retval OtherValues Failure
152- *
153- * @see acltdtEnqueueData
154- */
155-ACL_FUNC_VISIBILITY aclError acltdtDequeueData(uint32_t qid, void *data, size_t dataSize, size_t *retDataSize,
156- void *userData, size_t userDataSize, int32_t timeout);
157- 
158-/**
159- * @ingroup AscendCL
160- * @brief grant queue to other process
161- *
162- * @param qid [IN] qid
163- * @param pid [IN] pid of dst process
164- * @param permission [IN] permission of queue
165- * @param timeout [IN] timeout, -1 means blocking
166- *
167- * @retval ACL_SUCCESS The function is successfully executed.
168- * @retval OtherValues Failure
169- *
170- * @see ACL_TDT_QUEUE_PERMISSION_MANAGE | ACL_TDT_QUEUE_PERMISSION_DEQUEUE | ACL_TDT_QUEUE_PERMISSION_ENQUEUE
171- */
172-ACL_FUNC_VISIBILITY aclError acltdtGrantQueue(uint32_t qid, int32_t pid, uint32_t permission, int32_t timeout);
173- 
174-/**
175- * @ingroup AscendCL
176- * @brief attach queue in current process
177- *
178- * @param qid [IN] qid
179- * @param timeout [IN] timeout, -1 means blocking
180- * @param permission [OUT] permission of queue
181- *
182- * @retval ACL_SUCCESS The function is successfully executed.
183- * @retval OtherValues Failure
184- *
185- * @see acltdtGrantQueue
186- */
187-ACL_FUNC_VISIBILITY aclError acltdtAttachQueue(uint32_t qid, int32_t timeout, uint32_t *permission);
188- 
189-/**
190- * @ingroup AscendCL
191- * @brief bind queue routes
192- *
193- * @param qRouteList [IN|OUT] pointer to the route list
194- *
195- * @retval ACL_SUCCESS The function is successfully executed.
196- * @retval OtherValues Failure
197- */
198-ACL_FUNC_VISIBILITY aclError acltdtBindQueueRoutes(acltdtQueueRouteList *qRouteList);
199- 
200-/**
201- * @ingroup AscendCL
202- * @brief unbind queue routes
203- *
204- * @param qRouteList [IN|OUT] pointer to the route list
205- *
206- * @retval ACL_SUCCESS The function is successfully executed.
207- * @retval OtherValues Failure
208- */
209-ACL_FUNC_VISIBILITY aclError acltdtUnbindQueueRoutes(acltdtQueueRouteList *qRouteList);
210- 
211-/**
212- * @ingroup AscendCL
213- * @brief query queue routes according to query mode
214- *
215- * @param queryInfo [IN] pointer to the queue route query info
216- * @param qRouteList [IN|OUT] pointer to the route list
217- *
218- * @retval ACL_SUCCESS The function is successfully executed.
219- * @retval OtherValues Failure
220- */
221-ACL_FUNC_VISIBILITY aclError acltdtQueryQueueRoutes(const acltdtQueueRouteQueryInfo *queryInfo,
222- acltdtQueueRouteList *qRouteList);
223- 
224-/**
225- * @ingroup AscendCL
226- * @brief alloc acltdtBuf
227- *
228- * @param size [IN] alloc buf size
229- * @param type [IN] reserved parameters, need to set zero currently
230- * @param buf [OUT] pointer to the acltdtBuf
231- *
232- * @retval ACL_SUCCESS The function is successfully executed.
233- * @retval OtherValues Failure
234- *
235- * @see acltdtFreeBuf
236- */
237-ACL_FUNC_VISIBILITY aclError acltdtAllocBuf(size_t size, uint32_t type, acltdtBuf *buf);
238- 
239-/**
240- * @ingroup AscendCL
241- * @brief free acltdtBuf
242- *
243- * @param buf [IN] pointer to the acltdtBuf
244- *
245- * @retval ACL_SUCCESS The function is successfully executed.
246- * @retval OtherValues Failure
247- *
248- * @see acltdtAllocBuf
249- */
250-ACL_FUNC_VISIBILITY aclError acltdtFreeBuf(acltdtBuf buf);
251- 
252-/**
253- * @ingroup AscendCL
254- * @brief get data buf address
255- *
256- * @param buf [IN] acltdtBuf
257- * @param dataPtr [OUT] pointer to the data ptr which is acquired from acltdtBuf
258- * @param size [OUT] pointer to the size
259- *
260- * @retval ACL_SUCCESS The function is successfully executed.
261- * @retval OtherValues Failure
262- *
263- * @see acltdtAllocBuf
264- */
265-ACL_FUNC_VISIBILITY aclError acltdtGetBufData(const acltdtBuf buf, void **dataPtr, size_t *size);
266- 
267-/**
268- * @ingroup AscendCL
269- * @brief set data buf effective len
270- *
271- * @param buf [IN] acltdtBuf
272- * @param len [IN] set effective len to data buf which must be smaller than size acquired by acltdtGetBufData
273- *
274- * @retval ACL_SUCCESS The function is successfully executed.
275- * @retval OtherValues Failure
276- *
277- * @see acltdtGetBufData acltdtGetBufDataLen
278- */
279-ACL_FUNC_VISIBILITY aclError acltdtSetBufDataLen(acltdtBuf buf, size_t len);
280- 
281-/**
282- * @ingroup AscendCL
283- * @brief get data buf effective len
284- *
285- * @param buf [IN] acltdtBuf
286- * @param len [OUT] get effective len which is set by acltdtSetBufDataLen
287- *
288- * @retval ACL_SUCCESS The function is successfully executed.
289- * @retval OtherValues Failure
290- *
291- * @see acltdtSetBufDataLen
292- */
293-ACL_FUNC_VISIBILITY aclError acltdtGetBufDataLen(acltdtBuf buf, size_t *len);
294- 
295-/**
296- * @ingroup AscendCL
297- * @brief append acltdtBuf to acltdtBuf chain
298- *
299- * @param headBuf [IN] acltdtBuf chain head
300- * @param buf [IN] acltdtBuf will be appended
301- *
302- * @retval ACL_SUCCESS The function is successfully executed.
303- * @retval OtherValues Failure
304- *
305- */
306-ACL_FUNC_VISIBILITY aclError acltdtAppendBufChain(acltdtBuf headBuf, acltdtBuf buf);
307- 
308-/**
309- * @ingroup AscendCL
310- * @brief get acltdtBuf chain total size
311- *
312- * @param headBuf [IN] acltdtBuf chain head
313- * @param num [OUT] acltdtBuf chain total size
314- *
315- * @retval ACL_SUCCESS The function is successfully executed.
316- * @retval OtherValues Failure
317- *
318- * @see acltdtAppendBufChain
319- */
320-ACL_FUNC_VISIBILITY aclError acltdtGetBufChainNum(acltdtBuf headBuf, uint32_t *num);
321- 
322-/**
323- * @ingroup AscendCL
324- * @brief get acltdtBuf from acltdtBuf chain by index
325- *
326- * @param headBuf [IN] acltdtBuf chain head
327- * @param index [IN] the index which is smaller than num acquired from acltdtGetBufChainNum
328- * @param buf [OUT] the acltdtBuf from acltdtBuf on index
329- *
330- * @retval ACL_SUCCESS The function is successfully executed.
331- * @retval OtherValues Failure
332- *
333- * @see acltdtAppendBufChain acltdtGetBufChainNum
334- */
335-ACL_FUNC_VISIBILITY aclError acltdtGetBufFromChain(acltdtBuf headBuf, uint32_t index, acltdtBuf *buf);
336- 
337-/**
338- * @ingroup AscendCL
339- * @brief get private data buf address and size
340- *
341- * @param buf [IN] acltdtBuf
342- * @param dataPtr [IN/OUT] pointer to the user ptr
343- * @param size [IN] the current private data area size, less than or equal to 96B
344- * @param offset [IN] address offset, less than or equal to 96B
345- *
346- * @retval ACL_SUCCESS The function is successfully executed.
347- * @retval OtherValues Failure
348- *
349- * @see acltdtGetBufUserData
350- */
351-ACL_FUNC_VISIBILITY aclError acltdtGetBufUserData(const acltdtBuf buf, void *dataPtr, size_t size, size_t offset);
352- 
353-/**
354- * @ingroup AscendCL
355- * @brief set private data buf address and size
356- *
357- * @param buf [OUT] acltdtBuf
358- * @param dataPtr [IN] pointer to the user ptr
359- * @param size [IN] the current private data area size, less than or equal to 96B
360- * @param offset [IN] address offset, less than or equal to 96B
361- *
362- * @retval ACL_SUCCESS The function is successfully executed.
363- * @retval OtherValues Failure
364- *
365- * @see acltdtSetBufUserData
366- */
367-ACL_FUNC_VISIBILITY aclError acltdtSetBufUserData(acltdtBuf buf, const void *dataPtr, size_t size, size_t offset);
368- 
369-/**
370- * @ingroup AscendCL
371- * @brief copy buf ref
372- *
373- * @param buf [IN] acltdtBuf
374- * @param newBuf [OUT] Make a reference copy of the data area of buf and
375- * create a new buf header pointing to the same data area
376- *
377- * @retval ACL_SUCCESS The function is successfully executed.
378- * @retval OtherValues Failure
379- *
380- * @see acltdtCopyBufRef
381- */
382-ACL_FUNC_VISIBILITY aclError acltdtCopyBufRef(const acltdtBuf buf, acltdtBuf *newBuf);
383- 
384-/**
385- * @ingroup AscendCL
386- * @brief Create the queue attr
387- *
388- * @retval null for failed
389- * @retval OtherValues success
390- *
391- * @see acltdtDestroyQueueAttr
392- */
393-ACL_FUNC_VISIBILITY acltdtQueueAttr *acltdtCreateQueueAttr();
394- 
395-/**
396- * @ingroup AscendCL
397- * @brief Destroy the queue attr
398- *
399- * @param attr [IN] pointer to the queue attr
400- *
401- * @retval ACL_SUCCESS The function is successfully executed.
402- * @retval OtherValues Failure
403- *
404- * @see acltdtCreateQueueAttr
405- */
406-ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueAttr(const acltdtQueueAttr *attr);
407- 
408-/**
409- * @ingroup AscendCL
410- * @brief Set parameter for queue attr
411- *
412- * @param attr [IN|OUT] pointer to the queue attr
413- * @param type [IN] parameter type
414- * @param len [IN] parameter length
415- * @param param [IN] pointer to parameter value
416- *
417- * @retval ACL_SUCCESS for success, other for failure
418- *
419- * @see acltdtCreateQueueAttr
420- */
421-ACL_FUNC_VISIBILITY aclError acltdtSetQueueAttr(acltdtQueueAttr *attr,
422- acltdtQueueAttrType type,
423- size_t len,
424- const void *param);
425- 
426-/**
427- * @ingroup AscendCL
428- *
429- * @brief Get parameter for queue attr.
430- *
431- * @param attr [IN] pointer to the queue attr
432- * @param type [IN] parameter type
433- * @param len [IN] parameter length
434- * @param paramRetSize [OUT] pointer to parameter real length
435- * @param param [OUT] pointer to parameter value
436- *
437- * @retval ACL_SUCCESS for success, other for failure
438- *
439- * @see acltdtCreateQueueAttr
440- */
441-ACL_FUNC_VISIBILITY aclError acltdtGetQueueAttr(const acltdtQueueAttr *attr,
442- acltdtQueueAttrType type,
443- size_t len,
444- size_t *paramRetSize,
445- void *param);
446- 
447-/**
448- * @ingroup AscendCL
449- * @brief Create the queue route
450- *
451- * @param srcId [IN] src id of queue route
452- * @param dstId [IN] dst id of queue route
453- *
454- * @retval null for failed
455- * @retval OtherValues success
456- *
457- * @see acltdtDestroyQueueRoute
458- */
459-ACL_FUNC_VISIBILITY acltdtQueueRoute* acltdtCreateQueueRoute(uint32_t srcId, uint32_t dstId);
460- 
461-/**
462- * @ingroup AscendCL
463- * @brief Destroy the queue attr
464- *
465- * @param route [IN] pointer to the queue route
466- *
467- * @retval ACL_SUCCESS The function is successfully executed.
468- * @retval OtherValues Failure
469- *
470- * @see acltdtCreateQueueRoute
471- */
472-ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueRoute(const acltdtQueueRoute *route);
473- 
474-/**
475- * @ingroup AscendCL
476- *
477- * @brief Get parameter for queue route.
478- *
479- * @param route [IN] pointer to the queue route
480- * @param type [IN] parameter type
481- * @param len [IN] parameter length
482- * @param paramRetSize [OUT] pointer to parameter real length
483- * @param param [OUT] pointer to parameter value
484- *
485- * @retval ACL_SUCCESS for success, other for failure
486- *
487- * @see acltdtCreateQueueRoute
488- */
489-ACL_FUNC_VISIBILITY aclError acltdtGetQueueRouteParam(const acltdtQueueRoute *route,
490- acltdtQueueRouteParamType type,
491- size_t len,
492- size_t *paramRetSize,
493- void *param);
494- 
495-/**
496- * @ingroup AscendCL
497- * @brief Create the queue route list
498- *
499- * @retval null for failed
500- * @retval OtherValues success
501- *
502- * @see acltdtDestroyQueueRouteList
503- */
504-ACL_FUNC_VISIBILITY acltdtQueueRouteList* acltdtCreateQueueRouteList();
505- 
506-/**
507- * @ingroup AscendCL
508- * @brief Destroy the queue route list
509- *
510- * @param routeList [IN] pointer to the queue route list
511- *
512- * @retval ACL_SUCCESS The function is successfully executed.
513- * @retval OtherValues Failure
514- *
515- * @see acltdtCreateQueueRouteList
516- */
517-ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueRouteList(const acltdtQueueRouteList *routeList);
518- 
519-/**
520- * @ingroup AscendCL
521- * @brief add queue route to the route list
522- *
523- * @param routeList [IN|OUT] pointer to the queue route list
524- * @param route [IN] pointer to the queue route
525- *
526- * @retval ACL_SUCCESS The function is successfully executed.
527- * @retval OtherValues Failure
528- *
529- * @see acltdtCreateQueueRouteList | acltdtCreateQueueRoute
530- *
531- */
532-ACL_FUNC_VISIBILITY aclError acltdtAddQueueRoute(acltdtQueueRouteList *routeList, const acltdtQueueRoute *route);
533- 
534-/**
535- * @ingroup AscendCL
536- * @brief get queue route from route list
537- *
538- * @param routeList [IN] pointer to the queue route list
539- * @param index [IN] index of queue route in route list
540- * @param route [IN|OUT] pointer to the queue route
541- *
542- * @retval ACL_SUCCESS The function is successfully executed.
543- * @retval OtherValues Failure
544- *
545- * @see acltdtCreateQueueRouteList | acltdtCreateQueueRoute
546- *
547- */
548-ACL_FUNC_VISIBILITY aclError acltdtGetQueueRoute(const acltdtQueueRouteList *routeList,
549- size_t index,
550- acltdtQueueRoute *route);
551- 
552-/**
553- * @ingroup AscendCL
554- * @brief get queue route num from route list
555- *
556- * @param routeList [IN] pointer to the queue route list
557- *
558- * @retval the number of queue route
559- *
560- */
561-ACL_FUNC_VISIBILITY size_t acltdtGetQueueRouteNum(const acltdtQueueRouteList *routeList);
562- 
563-/**
564- * @ingroup AscendCL
565- * @brief Create the queue route query info
566- *
567- * @retval null for failed
568- * @retval OtherValues success
569- *
570- * @see acltdtDestroyQueueRouteQueryInfo
571- */
572-ACL_FUNC_VISIBILITY acltdtQueueRouteQueryInfo* acltdtCreateQueueRouteQueryInfo();
573- 
574-/**
575- * @ingroup AscendCL
576- * @brief Destroy the queue route query info
577- *
578- * @param info [IN] pointer to the queue route info
579- *
580- * @retval ACL_SUCCESS The function is successfully executed.
581- * @retval OtherValues Failure
582- *
583- * @see acltdtCreateQueueRouteQueryInfo
584- *
585- */
586-ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueRouteQueryInfo(const acltdtQueueRouteQueryInfo *info);
587- 
588-/**
589- * @ingroup AscendCL
590- * @brief Set parameter for queue route info
591- *
592- * @param attr [IN|OUT] pointer to the queue route info
593- * @param type [IN] parameter type
594- * @param len [IN] parameter length
595- * @param param [IN] pointer to parameter value
596- *
597- * @retval ACL_SUCCESS for success, other for failure
598- *
599- * @see acltdtCreateQueueRouteQueryInfo
600- */
601-ACL_FUNC_VISIBILITY aclError acltdtSetQueueRouteQueryInfo(acltdtQueueRouteQueryInfo *param,
602- acltdtQueueRouteQueryInfoParamType type,
603- size_t len,
604- const void *value);
605- 
606- 
607-#ifdef __cplusplus
608-}
609-#endif
610- 
611-#endif // INC_EXTERNAL_ACL_ACL_TDT_QUEUE_H_
Dthird_party/acl/inc/acl/error_codes/rt_error_codes.h+0-153
@@ -1,153 +0,0 @@
1-/**
2-* @file rt_error_codes.h
3-*
4-* Copyright (C) Huawei Technologies Co., Ltd. 2019-2020. All Rights Reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#ifndef __INC_EXTERNEL_RT_ERROR_CODES_H__
12-#define __INC_EXTERNEL_RT_ERROR_CODES_H__
13- 
14-#include <stddef.h>
15- 
16-#ifdef __cplusplus
17-extern "C" {
18-#endif
19- 
20-#define ACL_RT_SUCCESS 0 // success
21-#define ACL_ERROR_RT_PARAM_INVALID 107000 // param invalid
22-#define ACL_ERROR_RT_INVALID_DEVICEID 107001 // invalid device id
23-#define ACL_ERROR_RT_CONTEXT_NULL 107002 // current context null
24-#define ACL_ERROR_RT_STREAM_CONTEXT 107003 // stream not in current context
25-#define ACL_ERROR_RT_MODEL_CONTEXT 107004 // model not in current context
26-#define ACL_ERROR_RT_STREAM_MODEL 107005 // stream not in model
27-#define ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID 107006 // event timestamp invalid
28-#define ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL 107007 // event timestamp reversal
29-#define ACL_ERROR_RT_ADDR_UNALIGNED 107008 // memory address unaligned
30-#define ACL_ERROR_RT_FILE_OPEN 107009 // open file failed
31-#define ACL_ERROR_RT_FILE_WRITE 107010 // write file failed
32-#define ACL_ERROR_RT_STREAM_SUBSCRIBE 107011 // error subscribe stream
33-#define ACL_ERROR_RT_THREAD_SUBSCRIBE 107012 // error subscribe thread
34-#define ACL_ERROR_RT_GROUP_NOT_SET 107013 // group not set
35-#define ACL_ERROR_RT_GROUP_NOT_CREATE 107014 // group not create
36-#define ACL_ERROR_RT_STREAM_NO_CB_REG 107015 // callback not register to stream
37-#define ACL_ERROR_RT_INVALID_MEMORY_TYPE 107016 // invalid memory type
38-#define ACL_ERROR_RT_INVALID_HANDLE 107017 // invalid handle
39-#define ACL_ERROR_RT_INVALID_MALLOC_TYPE 107018 // invalid malloc type
40-#define ACL_ERROR_RT_WAIT_TIMEOUT 107019 // wait timeout
41-#define ACL_ERROR_RT_TASK_TIMEOUT 107020 // task timeout
42-#define ACL_ERROR_RT_SYSPARAMOPT_NOT_SET 107021 // not set sysparamopt
43-#define ACL_ERROR_RT_DEVICE_TASK_ABORT 107022 // device task aborting
44-#define ACL_ERROR_RT_STREAM_ABORT 107023 // stream aborting
45-#define ACL_ERROR_RT_CAPTURE_DEPENDENCY 107024 // capture dependency failure
46-#define ACL_ERROR_RT_STREAM_UNJOINED 107025 // invalid capture model
47-#define ACL_ERROR_RT_MODEL_CAPTURED 107026 // model is captured
48-#define ACL_ERROR_RT_STREAM_CAPTURED 107027 // stream is captured
49-#define ACL_ERROR_RT_EVENT_CAPTURED 107028 // event is captured
50-#define ACL_ERROR_RT_STREAM_NOT_CAPTURED 107029 // stream is not in capture status
51-#define ACL_ERROR_RT_CAPTURE_MODE_NOT_SUPPORT 107030 // stream is captured, not support current oper
52-#define ACL_ERROR_RT_STREAM_CAPTURE_IMPLICIT 107031 // a disallowed implicit dependency from defalut stream
53-#define ACL_ERROR_STREAM_CAPTURE_CONFLICT 107032 // interdependent stream cannot begin capture together
54-#define ACL_ERROR_STREAM_TASK_GROUP_STATUS 107033 // task group status error
55-#define ACL_ERROR_STREAM_TASK_GROUP_INTR 107034 // task group interrupted
56-#define ACL_ERROR_RT_TASK_ABORT_STOP 107035 // device task aborting stop before post process
57-#define ACL_ERROR_RT_STREAM_CAPTURE_UNMATCHED 107036 // the capture was not initiated in this stream
58- 
59-#define ACL_ERROR_RT_FEATURE_NOT_SUPPORT 207000 // feature not support
60-#define ACL_ERROR_RT_MEMORY_ALLOCATION 207001 // memory allocation error
61-#define ACL_ERROR_RT_MEMORY_FREE 207002 // memory free error
62-#define ACL_ERROR_RT_AICORE_OVER_FLOW 207003 // aicore over flow
63-#define ACL_ERROR_RT_NO_DEVICE 207004 // no device
64-#define ACL_ERROR_RT_RESOURCE_ALLOC_FAIL 207005 // resource alloc fail
65-#define ACL_ERROR_RT_NO_PERMISSION 207006 // no permission
66-#define ACL_ERROR_RT_NO_EVENT_RESOURCE 207007 // no event resource
67-#define ACL_ERROR_RT_NO_STREAM_RESOURCE 207008 // no stream resource
68-#define ACL_ERROR_RT_NO_NOTIFY_RESOURCE 207009 // no notify resource
69-#define ACL_ERROR_RT_NO_MODEL_RESOURCE 207010 // no model resource
70-#define ACL_ERROR_RT_NO_CDQ_RESOURCE 207011 // no cdq resource
71-#define ACL_ERROR_RT_OVER_LIMIT 207012 // over limit
72-#define ACL_ERROR_RT_QUEUE_EMPTY 207013 // queue is empty
73-#define ACL_ERROR_RT_QUEUE_FULL 207014 // queue is full
74-#define ACL_ERROR_RT_REPEATED_INIT 207015 // repeated init
75-#define ACL_ERROR_RT_AIVEC_OVER_FLOW 207016 // aivec over flow
76-#define ACL_ERROR_RT_OVER_FLOW 207017 // common over flow
77-#define ACL_ERROR_RT_DEVICE_OOM 207018 // device oom
78-#define ACL_ERROR_RT_FEATURE_NOT_SUPPORT_UPDATE_OP 207019 // not support to update this op
79- 
80-#define ACL_ERROR_RT_INTERNAL_ERROR 507000 // runtime internal error
81-#define ACL_ERROR_RT_TS_ERROR 507001 // ts internel error
82-#define ACL_ERROR_RT_STREAM_TASK_FULL 507002 // task full in stream
83-#define ACL_ERROR_RT_STREAM_TASK_EMPTY 507003 // task empty in stream
84-#define ACL_ERROR_RT_STREAM_NOT_COMPLETE 507004 // stream not complete
85-#define ACL_ERROR_RT_END_OF_SEQUENCE 507005 // end of sequence
86-#define ACL_ERROR_RT_EVENT_NOT_COMPLETE 507006 // event not complete
87-#define ACL_ERROR_RT_CONTEXT_RELEASE_ERROR 507007 // context release error
88-#define ACL_ERROR_RT_SOC_VERSION 507008 // soc version error
89-#define ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT 507009 // task type not support
90-#define ACL_ERROR_RT_LOST_HEARTBEAT 507010 // ts lost heartbeat
91-#define ACL_ERROR_RT_MODEL_EXECUTE 507011 // model execute failed
92-#define ACL_ERROR_RT_REPORT_TIMEOUT 507012 // report timeout
93-#define ACL_ERROR_RT_SYS_DMA 507013 // sys dma error
94-#define ACL_ERROR_RT_AICORE_TIMEOUT 507014 // aicore timeout
95-#define ACL_ERROR_RT_AICORE_EXCEPTION 507015 // aicore exception
96-#define ACL_ERROR_RT_AICORE_TRAP_EXCEPTION 507016 // aicore trap exception
97-#define ACL_ERROR_RT_AICPU_TIMEOUT 507017 // aicpu timeout
98-#define ACL_ERROR_RT_AICPU_EXCEPTION 507018 // aicpu exception
99-#define ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR 507019 // aicpu datadump response error
100-#define ACL_ERROR_RT_AICPU_MODEL_RSP_ERR 507020 // aicpu model operate response error
101-#define ACL_ERROR_RT_PROFILING_ERROR 507021 // profiling error
102-#define ACL_ERROR_RT_IPC_ERROR 507022 // ipc error
103-#define ACL_ERROR_RT_MODEL_ABORT_NORMAL 507023 // model abort normal
104-#define ACL_ERROR_RT_KERNEL_UNREGISTERING 507024 // kernel unregistering
105-#define ACL_ERROR_RT_RINGBUFFER_NOT_INIT 507025 // ringbuffer not init
106-#define ACL_ERROR_RT_RINGBUFFER_NO_DATA 507026 // ringbuffer no data
107-#define ACL_ERROR_RT_KERNEL_LOOKUP 507027 // kernel lookup error
108-#define ACL_ERROR_RT_KERNEL_DUPLICATE 507028 // kernel register duplicate
109-#define ACL_ERROR_RT_DEBUG_REGISTER_FAIL 507029 // debug register failed
110-#define ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL 507030 // debug unregister failed
111-#define ACL_ERROR_RT_LABEL_CONTEXT 507031 // label not in current context
112-#define ACL_ERROR_RT_PROGRAM_USE_OUT 507032 // program register num use out
113-#define ACL_ERROR_RT_DEV_SETUP_ERROR 507033 // device setup error
114-#define ACL_ERROR_RT_VECTOR_CORE_TIMEOUT 507034 // vector core timeout
115-#define ACL_ERROR_RT_VECTOR_CORE_EXCEPTION 507035 // vector core exception
116-#define ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION 507036 // vector core trap exception
117-#define ACL_ERROR_RT_CDQ_BATCH_ABNORMAL 507037 // cdq alloc batch abnormal
118-#define ACL_ERROR_RT_DIE_MODE_CHANGE_ERROR 507038 // can not change die mode
119-#define ACL_ERROR_RT_DIE_SET_ERROR 507039 // single die mode can not set die
120-#define ACL_ERROR_RT_INVALID_DIEID 507040 // invalid die id
121-#define ACL_ERROR_RT_DIE_MODE_NOT_SET 507041 // die mode not set
122-#define ACL_ERROR_RT_AICORE_TRAP_READ_OVERFLOW 507042 // aic trap read overflow
123-#define ACL_ERROR_RT_AICORE_TRAP_WRITE_OVERFLOW 507043 // aic trap write overflow
124-#define ACL_ERROR_RT_VECTOR_CORE_TRAP_READ_OVERFLOW 507044 // aiv trap read overflow
125-#define ACL_ERROR_RT_VECTOR_CORE_TRAP_WRITE_OVERFLOW 507045 // aiv trap write overflow
126-#define ACL_ERROR_RT_STREAM_SYNC_TIMEOUT 507046 // stream sync time out
127-#define ACL_ERROR_RT_EVENT_SYNC_TIMEOUT 507047 // event sync time out
128-#define ACL_ERROR_RT_FFTS_PLUS_TIMEOUT 507048 // ffts+ timeout
129-#define ACL_ERROR_RT_FFTS_PLUS_EXCEPTION 507049 // ffts+ exception
130-#define ACL_ERROR_RT_FFTS_PLUS_TRAP_EXCEPTION 507050 // ffts+ trap exception
131-#define ACL_ERROR_RT_SEND_MSG 507051 // hdc send msg fail
132-#define ACL_ERROR_RT_COPY_DATA 507052 // copy data fail
133-#define ACL_ERROR_RT_DEVICE_MEM_ERROR 507053 // device MEM ERROR
134-#define ACL_ERROR_RT_HBM_MULTI_BIT_ECC_ERROR 507054 // hbm Multi-bit ECC error
135-#define ACL_ERROR_RT_SUSPECT_DEVICE_MEM_ERROR 507055 // suspect device MEM ERROR
136-#define ACL_ERROR_RT_LINK_ERROR 507056 // link ERROR
137-#define ACL_ERROR_RT_SUSPECT_REMOTE_ERROR 507057 // suspect remote ERROR
138-#define ACL_ERROR_RT_DRV_INTERNAL_ERROR 507899 // drv internal error
139-#define ACL_ERROR_RT_AICPU_INTERNAL_ERROR 507900 // aicpu internal error
140-#define ACL_ERROR_RT_SOCKET_CLOSE 507901 // hdc disconnect
141-#define ACL_ERROR_RT_AICPU_INFO_LOAD_RSP_ERR 507902 // aicpu info load response error
142-#define ACL_ERROR_RT_STREAM_CAPTURE_INVALIDATED 507903 // capture status is invalidated
143-#define ACL_ERROR_RT_COMM_OP_RETRY_FAIL 507904 // hccl operation retry failed
144- 
145-#define ACLNN_CLEAR_DEVICE_STATE_FAIL 574007 // voltage recovery fail
146-#define ACLNN_STRESS_BIT_FAIL 574006
147-#define ACLNN_STRESS_LOW_BIT_FAIL 574008
148-#define ACLNN_STRESS_HIGH_BIT_FAIL 574009
149- 
150-#ifdef __cplusplus
151-}
152-#endif
153-#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__
Dthird_party/acl/inc/acl/ops/acl_cblas.h+0-424
@@ -1,424 +0,0 @@
1-/**
2-* @file acl_cblas.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10-#ifndef INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_
11-#define INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_
12- 
13-#include "acl/acl.h"
14- 
15-#ifdef __cplusplus
16-extern "C" {
17-#endif
18- 
19-typedef enum aclTransType {
20- ACL_TRANS_N,
21- ACL_TRANS_T,
22- ACL_TRANS_NZ,
23- ACL_TRANS_NZ_T
24-} aclTransType;
25- 
26-typedef enum aclComputeType {
27- ACL_COMPUTE_HIGH_PRECISION,
28- ACL_COMPUTE_LOW_PRECISION
29-} aclComputeType;
30- 
31-/**
32- * @ingroup AscendCL
33- * @brief perform the matrix-vector multiplication
34- *
35- * @param transA [IN] transpose type of matrix A
36- * @param m [IN] number of rows of matrix A
37- * @param n [IN] number of columns of matrix A
38- * @param alpha [IN] pointer to scalar used for multiplication.
39- * of same type as dataTypeC
40- * @param a [IN] pointer to matrix A
41- * @param lda [IN] leading dimension used to store the matrix A
42- * @param dataTypeA [IN] datatype of matrix A
43- * @param x [IN] pointer to vector x
44- * @param incx [IN] stride between consecutive elements of vector x
45- * @param dataTypeX [IN] datatype of vector x
46- * @param beta [IN] pointer to scalar used for multiplication.
47- * of same type as dataTypeC If beta == 0,
48- * then y does not have to be a valid input
49- * @param y [IN|OUT] pointer to vector y
50- * @param incy [IN] stride between consecutive elements of vector y
51- * @param dataTypeY [IN] datatype of vector y
52- * @param type [IN] computation type
53- * @param stream [IN] stream
54- *
55- * @retval ACL_SUCCESS The function is successfully executed.
56- * @retval OtherValues Failure
57-*/
58-ACL_FUNC_VISIBILITY aclError aclblasGemvEx(aclTransType transA, int m, int n,
59- const void *alpha, const void *a, int lda, aclDataType dataTypeA,
60- const void *x, int incx, aclDataType dataTypeX,
61- const void *beta, void *y, int incy, aclDataType dataTypeY,
62- aclComputeType type, aclrtStream stream);
63- 
64-/**
65- * @ingroup AscendCL
66- * @brief create a handle for performing the matrix-vector multiplication
67- *
68- * @param transA [IN] transpose type of matrix A
69- * @param m [IN] number of rows of matrix A
70- * @param n [IN] number of columns of matrix A
71- * @param dataTypeA [IN] datatype of matrix A
72- * @param dataTypeX [IN] datatype of vector x
73- * @param dataTypeY [IN] datatype of vector y
74- * @param type [IN] computation type
75- * @param handle [OUT] pointer to the pointer to the handle
76- *
77- * @retval ACL_SUCCESS The function is successfully executed.
78- * @retval OtherValues Failure
79-*/
80-ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemvEx(aclTransType transA,
81- int m,
82- int n,
83- aclDataType dataTypeA,
84- aclDataType dataTypeX,
85- aclDataType dataTypeY,
86- aclComputeType type,
87- aclopHandle **handle);
88- 
89-/**
90- * @ingroup AscendCL
91- * @brief perform the matrix-vector multiplication
92- *
93- * @param transA [IN] transpose type of matrix A
94- * @param m [IN] number of rows of matrix A
95- * @param n [IN] number of columns of matrix A
96- * @param alpha [IN] pointer to scalar used for multiplication
97- * @param a [IN] pointer to matrix A
98- * @param lda [IN] leading dimension used to store the matrix A
99- * @param x [IN] pointer to vector x
100- * @param incx [IN] stride between consecutive elements of vector x
101- * @param beta [IN] pointer to scalar used for multiplication.
102- * If beta value == 0,
103- * then y does not have to be a valid input
104- * @param y [IN|OUT] pointer to vector y
105- * @param incy [IN] stride between consecutive elements of vector y
106- * @param type [IN] computation type
107- * @param stream [IN] stream
108- * @retval ACL_SUCCESS The function is successfully executed.
109- * @retval OtherValues Failure
110- */
111-ACL_FUNC_VISIBILITY aclError aclblasHgemv(aclTransType transA,
112- int m,
113- int n,
114- const aclFloat16 *alpha,
115- const aclFloat16 *a,
116- int lda,
117- const aclFloat16 *x,
118- int incx,
119- const aclFloat16 *beta,
120- aclFloat16 *y,
121- int incy,
122- aclComputeType type,
123- aclrtStream stream);
124- 
125-/**
126- * @ingroup AscendCL
127- * @brief create a handle for performing the matrix-vector multiplication
128- *
129- * @param transA [IN] transpose type of matrix A
130- * @param m [IN] number of rows of matrix A
131- * @param n [IN] number of columns of matrix A
132- * @param type [IN] computation type
133- * @param handle [OUT] pointer to the pointer to the handle
134- *
135- * @retval ACL_SUCCESS The function is successfully executed.
136- * @retval OtherValues Failure
137- */
138-ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA,
139- int m,
140- int n,
141- aclComputeType type,
142- aclopHandle **handle);
143- 
144-/**
145- * @ingroup AscendCL
146- * @brief perform the matrix-vector multiplication
147- *
148- * @param transA [IN] transpose type of matrix A
149- * @param m [IN] number of rows of matrix A
150- * @param n [IN] number of columns of matrix A
151- * @param alpha [IN] pointer to scalar used for multiplication
152- * @param a [IN] pointer to matrix A
153- * @param lda [IN] leading dimension used to store the matrix A
154- * @param x [IN] pointer to vector x
155- * @param incx [IN] stride between consecutive elements of vector x
156- * @param beta [IN] pointer to scalar used for multiplication.
157- * If beta value == 0,
158- * then y does not have to be a valid input
159- * @param y [IN|OUT] pointer to vector y
160- * @param incy [IN] stride between consecutive elements of vector y
161- * @param type [IN] computation type
162- * @param stream [IN] stream
163- *
164- * @retval ACL_SUCCESS The function is successfully executed.
165- * @retval OtherValues Failure
166- */
167-ACL_FUNC_VISIBILITY aclError aclblasS8gemv(aclTransType transA,
168- int m,
169- int n,
170- const int32_t *alpha,
171- const int8_t *a,
172- int lda,
173- const int8_t *x,
174- int incx,
175- const int32_t *beta,
176- int32_t *y,
177- int incy,
178- aclComputeType type,
179- aclrtStream stream);
180- 
181-/**
182- * @ingroup AscendCL
183- * @brief create a handle for performing the matrix-vector multiplication
184- *
185- * @param transA [IN] transpose type of matrix A
186- * @param m [IN] number of rows of matrix A
187- * @param n [IN] number of columns of matrix A
188- * @param handle [OUT] pointer to the pointer to the handle
189- * @param type [IN] computation type
190- *
191- * @retval ACL_SUCCESS The function is successfully executed.
192- * @retval OtherValues Failure
193- */
194-ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA,
195- int m,
196- int n,
197- aclComputeType type,
198- aclopHandle **handle);
199- 
200-/**
201- * @ingroup AscendCL
202- * @brief perform the matrix-matrix multiplication
203- *
204- * @param transA [IN] transpose type of matrix A
205- * @param transB [IN] transpose type of matrix B
206- * @param transC [IN] transpose type of matrix C
207- * @param m [IN] number of rows of matrix A and matrix C
208- * @param n [IN] number of columns of matrix B and matrix C
209- * @param k [IN] number of columns of matrix A and rows of matrix B
210- * @param alpha [IN] pointer to scalar used for multiplication. of same type as dataTypeC
211- * @param matrixA [IN] pointer to matrix A
212- * @param lda [IN] leading dimension array used to store matrix A
213- * @param dataTypeA [IN] datatype of matrix A
214- * @param matrixB [IN] pointer to matrix B
215- * @param ldb [IN] leading dimension array used to store matrix B
216- * @param dataTypeB [IN] datatype of matrix B
217- * @param beta [IN] pointer to scalar used for multiplication.
218- * of same type as dataTypeC If beta == 0,
219- * then matrixC does not have to be a valid input
220- * @param matrixC [IN|OUT] pointer to matrix C
221- * @param ldc [IN] leading dimension array used to store matrix C
222- * @param dataTypeC [IN] datatype of matrix C
223- * @param type [IN] computation type
224- * @param stream [IN] stream
225- *
226- * @retval ACL_SUCCESS The function is successfully executed.
227- * @retval OtherValues Failure
228- */
229-ACL_FUNC_VISIBILITY aclError aclblasGemmEx(aclTransType transA,
230- aclTransType transB,
231- aclTransType transC,
232- int m,
233- int n,
234- int k,
235- const void *alpha,
236- const void *matrixA,
237- int lda,
238- aclDataType dataTypeA,
239- const void *matrixB,
240- int ldb,
241- aclDataType dataTypeB,
242- const void *beta,
243- void *matrixC,
244- int ldc,
245- aclDataType dataTypeC,
246- aclComputeType type,
247- aclrtStream stream);
248- 
249- 
250-/**
251- * @ingroup AscendCL
252- * @brief create a handle for performing the matrix-matrix multiplication
253- *
254- * @param transA [IN] transpose type of matrix A
255- * @param transB [IN] transpose type of matrix B
256- * @param transC [IN] transpose type of matrix C
257- * @param m [IN] number of rows of matrix A and matrix C
258- * @param n [IN] number of columns of matrix B and matrix C
259- * @param k [IN] number of columns of matrix A and rows of matrix B
260- * @param dataTypeA [IN] datatype of matrix A
261- * @param dataTypeB [IN] datatype of matrix B
262- * @param dataTypeC [IN] datatype of matrix C
263- * @param type [IN] computation type
264- * @param handle [OUT] pointer to the pointer to the handle
265- * @param type [IN] computation type
266- *
267- * @retval ACL_SUCCESS The function is successfully executed.
268- * @retval OtherValues Failure
269- */
270-ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemmEx(aclTransType transA,
271- aclTransType transB,
272- aclTransType transC,
273- int m,
274- int n,
275- int k,
276- aclDataType dataTypeA,
277- aclDataType dataTypeB,
278- aclDataType dataTypeC,
279- aclComputeType type,
280- aclopHandle **handle);
281- 
282- 
283-/**
284- * @ingroup AscendCL
285- * @brief perform the matrix-matrix multiplication
286- *
287- * @param transA [IN] transpose type of matrix A
288- * @param transB [IN] transpose type of matrix B
289- * @param transC [IN] transpose type of matrix C
290- * @param m [IN] number of rows of matrix A and matrix C
291- * @param n [IN] number of columns of matrix B and matrix C
292- * @param k [IN] number of columns of matrix A and rows of matrix B
293- * @param alpha [IN] pointer to scalar used for multiplication
294- * @param matrixA [IN] pointer to matrix A
295- * @param lda [IN] leading dimension used to store the matrix A
296- * @param matrixB [IN] pointer to matrix B
297- * @param ldb [IN] leading dimension used to store the matrix B
298- * @param beta [IN] pointer to scalar used for multiplication.
299- * If beta value == 0,
300- * then matrixC does not have to be a valid input
301- * @param matrixC [IN|OUT] pointer to matrix C
302- * @param ldc [IN] leading dimension used to store the matrix C
303- * @param type [IN] computation type
304- * @param stream [IN] stream
305- *
306- * @retval ACL_SUCCESS The function is successfully executed.
307- * @retval OtherValues Failure
308- */
309-ACL_FUNC_VISIBILITY aclError aclblasHgemm(aclTransType transA,
310- aclTransType transB,
311- aclTransType transC,
312- int m,
313- int n,
314- int k,
315- const aclFloat16 *alpha,
316- const aclFloat16 *matrixA,
317- int lda,
318- const aclFloat16 *matrixB,
319- int ldb,
320- const aclFloat16 *beta,
321- aclFloat16 *matrixC,
322- int ldc,
323- aclComputeType type,
324- aclrtStream stream);
325- 
326-/**
327- * @ingroup AscendCL
328- * @brief create a handle for performing the matrix-matrix multiplication
329- *
330- * @param transA [IN] transpose type of matrix A
331- * @param transB [IN] transpose type of matrix B
332- * @param transC [IN] transpose type of matrix C
333- * @param m [IN] number of rows of matrix A and matrix C
334- * @param n [IN] number of columns of matrix B and matrix C
335- * @param k [IN] number of columns of matrix A and rows of matrix B
336- * @param type [IN] computation type
337- * @param handle [OUT] pointer to the pointer to the handle
338- *
339- * @retval ACL_SUCCESS The function is successfully executed.
340- * @retval OtherValues Failure
341- */
342-ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemm(aclTransType transA,
343- aclTransType transB,
344- aclTransType transC,
345- int m,
346- int n,
347- int k,
348- aclComputeType type,
349- aclopHandle **handle);
350- 
351-/**
352- * @ingroup AscendCL
353- * @brief perform the matrix-matrix multiplication
354- *
355- * @param transA [IN] transpose type of matrix A
356- * @param transB [IN] transpose type of matrix B
357- * @param transC [IN] transpose type of matrix C
358- * @param m [IN] number of rows of matrix A and matrix C
359- * @param n [IN] number of columns of matrix B and matrix C
360- * @param k [IN] number of columns of matrix A and rows of matrix B
361- * @param alpha [IN] pointer to scalar used for multiplication
362- * @param matrixA [IN] pointer to matrix A
363- * @param lda [IN] leading dimension used to store the matrix A
364- * @param matrixB [IN] pointer to matrix B
365- * @param ldb [IN] leading dimension used to store the matrix B
366- * @param beta [IN] pointer to scalar used for multiplication.
367- * If beta value == 0,
368- * then matrixC does not have to be a valid input
369- * @param matrixC [IN|OUT] pointer to matrix C
370- * @param ldc [IN] leading dimension used to store the matrix C
371- * @param type [IN] computation type
372- * @param stream [IN] stream
373- *
374- * @retval ACL_SUCCESS The function is successfully executed.
375- * @retval OtherValues Failure
376- */
377-ACL_FUNC_VISIBILITY aclError aclblasS8gemm(aclTransType transA,
378- aclTransType transB,
379- aclTransType transC,
380- int m,
381- int n,
382- int k,
383- const int32_t *alpha,
384- const int8_t *matrixA,
385- int lda,
386- const int8_t *matrixB,
387- int ldb,
388- const int32_t *beta,
389- int32_t *matrixC,
390- int ldc,
391- aclComputeType type,
392- aclrtStream stream);
393- 
394- 
395-/**
396- * @ingroup AscendCL
397- * @brief create a handle for performing the matrix-matrix multiplication
398- *
399- * @param transA [IN] transpose type of matrix A
400- * @param transB [IN] transpose type of matrix B
401- * @param transC [IN] transpose type of matrix C
402- * @param m [IN] number of rows of matrix A and matrix C
403- * @param n [IN] number of columns of matrix B and matrix C
404- * @param k [IN] number of columns of matrix A and rows of matrix B
405- * @param type [IN] computation type
406- * @param handle [OUT] pointer to the pointer to the handle
407- *
408- * @retval ACL_SUCCESS The function is successfully executed.
409- * @retval OtherValues Failure
410- */
411-ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemm(aclTransType transA,
412- aclTransType transB,
413- aclTransType transC,
414- int m,
415- int n,
416- int k,
417- aclComputeType type,
418- aclopHandle **handle);
419- 
420-#ifdef __cplusplus
421-}
422-#endif
423- 
424-#endif // INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_
Dthird_party/acl/inc/acl/ops/acl_dvpp.h+0-2771
@@ -1,2771 +0,0 @@
1-/**
2-* @file acl_dvpp.h
3-*
4-* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5-*
6-* This program is distributed in the hope that it will be useful,
7-* but WITHOUT ANY WARRANTY; without even the implied warranty of
8-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9-*/
10- 
11-#if !defined(ENABLE_DVPP_INTERFACE)
12-#if defined(_MSC_VER)
13-#error message("if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE).")
14-#else
15-#error "if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE)."
16-#endif
17-#endif
18- 
19-#ifndef INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_
20-#define INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_
21- 
22-#include <stdint.h>
23-#include <stddef.h>
24-#include "acl/acl.h"
25-#include "acl/acl_base.h"
26- 
27-#ifdef __cplusplus
28-extern "C" {
29-#endif
30- 
31-typedef struct acldvppPicDesc acldvppPicDesc;
32-typedef struct acldvppBatchPicDesc acldvppBatchPicDesc;
33-typedef struct acldvppRoiConfig acldvppRoiConfig;
34-typedef struct acldvppResizeConfig acldvppResizeConfig;
35-typedef struct acldvppBorderConfig acldvppBorderConfig;
36-typedef struct acldvppLutMap acldvppLutMap;
37-typedef struct acldvppChannelDesc acldvppChannelDesc;
38-typedef struct acldvppJpegeConfig acldvppJpegeConfig;
39-typedef struct aclvdecChannelDesc aclvdecChannelDesc;
40-typedef struct acldvppStreamDesc acldvppStreamDesc;
41-typedef struct aclvdecFrameConfig aclvdecFrameConfig;
42-typedef struct aclvencChannelDesc aclvencChannelDesc;
43-typedef struct aclvencFrameConfig aclvencFrameConfig;
44-typedef struct acldvppHist acldvppHist;
45-typedef void (*aclvdecCallback)(acldvppStreamDesc *input, acldvppPicDesc *output, void *userData);
46-typedef void (*aclvencCallback)(acldvppPicDesc *input, acldvppStreamDesc *output, void *userdata);
47- 
48-// Supported Pixel Format
49-enum acldvppPixelFormat {
50- PIXEL_FORMAT_YUV_400 = 0, // 0
51- PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1, // 1
52- PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2, // 2
53- PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3, // 3
54- PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4, // 4
55- PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5, // 5
56- PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6, // 6
57- PIXEL_FORMAT_YUYV_PACKED_422 = 7, // 7
58- PIXEL_FORMAT_UYVY_PACKED_422 = 8, // 8
59- PIXEL_FORMAT_YVYU_PACKED_422 = 9, // 9
60- PIXEL_FORMAT_VYUY_PACKED_422 = 10, // 10
61- PIXEL_FORMAT_YUV_PACKED_444 = 11, // 11
62- PIXEL_FORMAT_RGB_888 = 12, // 12
63- PIXEL_FORMAT_BGR_888 = 13, // 13
64- PIXEL_FORMAT_ARGB_8888 = 14, // 14
65- PIXEL_FORMAT_ABGR_8888 = 15, // 15
66- PIXEL_FORMAT_RGBA_8888 = 16, // 16
67- PIXEL_FORMAT_BGRA_8888 = 17, // 17
68- PIXEL_FORMAT_YUV_SEMI_PLANNER_420_10BIT = 18, // 18
69- PIXEL_FORMAT_YVU_SEMI_PLANNER_420_10BIT = 19, // 19
70- PIXEL_FORMAT_YVU_PLANAR_420 = 20, // 20
71- PIXEL_FORMAT_YVU_PLANAR_422 = 21,
72- PIXEL_FORMAT_YVU_PLANAR_444 = 22,
73- PIXEL_FORMAT_RGB_444 = 23,
74- PIXEL_FORMAT_BGR_444 = 24,
75- PIXEL_FORMAT_ARGB_4444 = 25,
76- PIXEL_FORMAT_ABGR_4444 = 26,
77- PIXEL_FORMAT_RGBA_4444 = 27,
78- PIXEL_FORMAT_BGRA_4444 = 28,
79- PIXEL_FORMAT_RGB_555 = 29,
80- PIXEL_FORMAT_BGR_555 = 30,
81- PIXEL_FORMAT_RGB_565 = 31,
82- PIXEL_FORMAT_BGR_565 = 32,
83- PIXEL_FORMAT_ARGB_1555 = 33,
84- PIXEL_FORMAT_ABGR_1555 = 34,
85- PIXEL_FORMAT_RGBA_1555 = 35,
86- PIXEL_FORMAT_BGRA_1555 = 36,
87- PIXEL_FORMAT_ARGB_8565 = 37,
88- PIXEL_FORMAT_ABGR_8565 = 38,
89- PIXEL_FORMAT_RGBA_8565 = 39,
90- PIXEL_FORMAT_BGRA_8565 = 40,
91- PIXEL_FORMAT_RGB_BAYER_8BPP = 50,
92- PIXEL_FORMAT_RGB_BAYER_10BPP = 51,
93- PIXEL_FORMAT_RGB_BAYER_12BPP = 52,
94- PIXEL_FORMAT_RGB_BAYER_14BPP = 53,
95- PIXEL_FORMAT_RGB_BAYER_16BPP = 54,
96- PIXEL_FORMAT_BGR_888_PLANAR = 70,
97- PIXEL_FORMAT_HSV_888_PACKAGE = 71,
98- PIXEL_FORMAT_HSV_888_PLANAR = 72,
99- PIXEL_FORMAT_LAB_888_PACKAGE = 73,
100- PIXEL_FORMAT_LAB_888_PLANAR = 74,
101- PIXEL_FORMAT_S8C1 = 75,
102- PIXEL_FORMAT_S8C2_PACKAGE = 76,
103- PIXEL_FORMAT_S8C2_PLANAR = 77,
104- PIXEL_FORMAT_S16C1 = 78,
105- PIXEL_FORMAT_U8C1 = 79,
106- PIXEL_FORMAT_U16C1 = 80,
107- PIXEL_FORMAT_S32C1 = 81,
108- PIXEL_FORMAT_U32C1 = 82,
109- PIXEL_FORMAT_U64C1 = 83,
110- PIXEL_FORMAT_S64C1 = 84,
111- PIXEL_FORMAT_YUV_SEMIPLANAR_440 = 1000,
112- PIXEL_FORMAT_YVU_SEMIPLANAR_440 = 1001,
113- PIXEL_FORMAT_FLOAT32 = 1002,
114- PIXEL_FORMAT_BUTT = 1003,
115- PIXEL_FORMAT_UNKNOWN = 10000
116-};
117- 
118-// Stream Format
119-enum acldvppStreamFormat {
120- H265_MAIN_LEVEL = 0,
121- H264_BASELINE_LEVEL,
122- H264_MAIN_LEVEL,
123- H264_HIGH_LEVEL
124-};
125- 
126-// Supported Channel Mode
127-enum acldvppChannelMode {
128- DVPP_CHNMODE_VPC = 1,
129- DVPP_CHNMODE_JPEGD = 2,
130- DVPP_CHNMODE_JPEGE = 4,
131- DVPP_CHNMODE_PNGD = 8
132-};
133- 
134-// Supported Border Type
135-enum acldvppBorderType {
136- BORDER_CONSTANT = 0,
137- BORDER_REPLICATE,
138- BORDER_REFLECT,
139- BORDER_REFLECT_101
140-};
141- 
142-// Venc parameter type
143-enum aclvencChannelDescParamType {
144- ACL_VENC_THREAD_ID_UINT64 = 0,
145- ACL_VENC_CALLBACK_PTR,
146- ACL_VENC_PIXEL_FORMAT_UINT32,
147- ACL_VENC_ENCODE_TYPE_UINT32,
148- ACL_VENC_PIC_WIDTH_UINT32,
149- ACL_VENC_PIC_HEIGHT_UINT32,
150- ACL_VENC_KEY_FRAME_INTERVAL_UINT32,
151- ACL_VENC_BUF_ADDR_PTR,
152- ACL_VENC_BUF_SIZE_UINT32,
153- ACL_VENC_RC_MODE_UINT32,
154- ACL_VENC_SRC_RATE_UINT32,
155- ACL_VENC_MAX_BITRATE_UINT32,
156- ACL_VENC_MAX_IP_PROP_UINT32
157-};
158- 
159-// Jpeg picture format
160-enum acldvppJpegFormat {
161- ACL_JPEG_CSS_444 = 0,
162- ACL_JPEG_CSS_422 = 1,
163- ACL_JPEG_CSS_420 = 2,
164- ACL_JPEG_CSS_GRAY = 3,
165- ACL_JPEG_CSS_440 = 4,
166- ACL_JPEG_CSS_411 = 5,
167- ACL_JPEG_CSS_UNKNOWN = 1000
168-};
169- 
170-enum acldvppChannelDescParamType {
171- ACL_DVPP_CSC_MATRIX_UINT32 = 0,
172- ACL_DVPP_MODE_UINT32,
173- ACL_DVPP_CHANNEL_ID_UINT64,
174- ACL_DVPP_CHANNEL_HEIGHT_UINT32,
175- ACL_DVPP_CHANNEL_WIDTH_UINT32,
176- ACL_DVPP_JPEGD_PRECISION_MODE_ENUM
177-};
178- 
179-enum aclvdecChannelDescParamType {
180- ACL_VDEC_CSC_MATRIX_UINT32 = 0,
181- ACL_VDEC_OUT_MODE_UINT32,
182- ACL_VDEC_THREAD_ID_UINT64,
183- ACL_VDEC_CALLBACK_PTR,
184- ACL_VDEC_CHANNEL_ID_UINT32,
185- ACL_VDEC_ENCODE_TYPE_UINT32,
186- ACL_VDEC_OUT_PIC_FORMAT_UINT32,
187- ACL_VDEC_OUT_PIC_WIDTH_UINT32,
188- ACL_VDEC_OUT_PIC_HEIGHT_UINT32,
189- ACL_VDEC_REF_FRAME_NUM_UINT32,
190- ACL_VDEC_BIT_DEPTH_UINT32
191-};
192- 
193-// Csc Matrix can be used both for acldvppChannelDescParamType and aclvdecChannelDescParamType
194-enum acldvppCscMatrix {
195- ACL_DVPP_CSC_MATRIX_BT601_WIDE = 0,
196- ACL_DVPP_CSC_MATRIX_BT601_NARROW,
197- ACL_DVPP_CSC_MATRIX_BT709_WIDE,
198- ACL_DVPP_CSC_MATRIX_BT709_NARROW,
199- ACL_DVPP_CSC_MATRIX_BT2020_WIDE,
200- ACL_DVPP_CSC_MATRIX_BT2020_NARROW
201-};
202- 
203-// Jpeg precision mode
204-enum acldvppJpegdPrecisionMode {
205- ACL_YUVOUT_ALIGN_DOWN = 0,
206- ACL_YUVOUT_ALIGN_UP = 1,
207- ACL_YUVOUT_ALIGN_DOWN_COMPAT = 2
208-};
209- 
210-/**
211- * @ingroup AscendCL
212- * @brief alloc device memory for dvpp.
213- *
214- * @par Function
215- * @li It's mainly used for allocating memory to device media data processing.
216- * The requested memory meets the data processing requirements.
217- * After calling this interface to request memory,
218- * you must release the memory using the acldvppFree interface.
219- * @li When calling the acldvppMalloc interface to apply for memory,
220- * the size entered by the user is aligned upwards to 32 integer multiples,
221- * and an additional 32 bytes are applied.
222- *
223- * @par Restriction
224- * If the user uses the acldvppMalloc interface to apply for a large block of
225- * memory and divide and manage the memory by himself,
226- * when applying for memory, the user needs to align up to 32 integer
227- * times + 32 bytes (ALIGN_UP [len] +32 words) according to
228- * the actual data size of each picture Section) to manage memory.
229- *
230- * @param devPtr [OUT] memory pointer.
231- * @param size [IN] memory size.
232- *
233- * @retval ACL_SUCCESS The function is successfully executed.
234- * @retval OtherValues Failure
235- *
236- * @see acldvppFree
237- */
238-ACL_FUNC_VISIBILITY aclError acldvppMalloc(void **devPtr, size_t size);
239- 
240-/**
241- * @ingroup AscendCL
242- * @brief allocate dvpp memory with config
243- *
244- * @param devPtr [OUT] pointer to allocated memory on device
245- * @param size [IN] alloc memory size
246- * @param policy [IN] memory alloc policy
247- * @param cfg [IN] memory alloc config
248- *
249- * @retval ACL_SUCCESS The function is successfully executed.
250- * @retval OtherValues Failure
251- */
252-ACL_FUNC_VISIBILITY aclError acldvppMallocWithCfg(void **devPtr, size_t size,
253- aclrtMemMallocPolicy policy, aclrtMallocConfig *cfg);
254- 
255-/**
256- * @ingroup AscendCL
257- * @brief free device memory for dvpp.
258- *
259- * @par Function
260- * Free the memory requested through the acldvppMalloc interface
261- * @param devPtr [IN] memory pointer to free.
262- *
263- * @retval ACL_SUCCESS The function is successfully executed.
264- * @retval OtherValues Failure
265- *
266- * @see acldvppMalloc
267- */
268-ACL_FUNC_VISIBILITY aclError acldvppFree(void *devPtr);
269- 
270-/**
271- * @ingroup AscendCL
272- * @brief create DvppChannelDesc.
273- *
274- * @par Function
275- * Create a channel for image data processing.
276- * The same channel can be reused
277- * and is no longer available after destruction
278- *
279- * @retval null for failed.
280- * @retval OtherValues success.
281- */
282-ACL_FUNC_VISIBILITY acldvppChannelDesc *acldvppCreateChannelDesc();
283- 
284-/**
285- * @ingroup AscendCL
286- * @brief destroy dvppChannelDesc.
287- *
288- * @par Function
289- * Can only destroy channels created by the acldvppCreateChannel interface
290- * @param channelDesc [IN] the channel description.
291- *
292- * @retval ACL_SUCCESS The function is successfully executed.
293- * @retval OtherValues Failure
294- *
295- * @see acldvppCreateChannelDesc | acldvppDestroyChannel
296- */
297-ACL_FUNC_VISIBILITY aclError acldvppDestroyChannelDesc(acldvppChannelDesc *channelDesc);
298- 
299-/**
300- * @ingroup AscendCL
301- * @brief Get dvpp channel Id.
302- *
303- * @par Restriction
304- * Interface calling sequence:
305- * acldvppCreateChannelDesc --> acldvppCreateChannel -->
306- * acldvppGetChannelDescChannelId
307- *
308- * @param channelDesc [IN] the channel description.
309- *
310- * @retval channel id.
311- *
312- * @see acldvppCreateChannelDesc | acldvppCreateChannel
313- */
314-ACL_FUNC_VISIBILITY uint64_t acldvppGetChannelDescChannelId(const acldvppChannelDesc *channelDesc);
315- 
316-/**
317- * @ingroup AscendCL
318- * @brief Create dvpp picture description.
319- *
320- * @retval null for failed.
321- * @retval OtherValues success.
322- */
323-ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppCreatePicDesc();
324- 
325-/**
326- * @ingroup AscendCL
327- * @brief Destroy dvpp picture description.
328- *
329- * @par Function
330- * Can only destroy picture description information created
331- * through acldvppCreatePicDesc interface.
332- * @param picDesc [IN] dvpp picture description.
333- *
334- * @retval ACL_SUCCESS The function is successfully executed.
335- * @retval OtherValues Failure
336- *
337- * @see acldvppCreatePicDesc
338- */
339-ACL_FUNC_VISIBILITY aclError acldvppDestroyPicDesc(acldvppPicDesc *picDesc);
340- 
341-/**
342- * @ingroup AscendCL
343- * @brief Set dvpp picture description's data.
344- *
345- * @param picDesc [OUT] dvpp picture description.
346- * @param dataDev [IN] dvpp picture dataDev.Must be the memory
347- * requested using the acldvppMalloc interface.
348- *
349- * @retval ACL_SUCCESS The function is successfully executed.
350- * @retval OtherValues Failure
351- *
352- * @see acldvppMalloc
353- */
354-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescData(acldvppPicDesc *picDesc, void *dataDev);
355- 
356-/**
357- * @ingroup AscendCL
358- * @brief Set dvpp picture description's size.
359- *
360- * @param picDesc [OUT] dvpp picture description.
361- * @param size dvpp [IN] picture size.
362- *
363- * @retval ACL_SUCCESS The function is successfully executed.
364- * @retval OtherValues Failure
365- */
366-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescSize(acldvppPicDesc *picDesc, uint32_t size);
367- 
368-/**
369- * @ingroup AscendCL
370- * @brief Set dvpp picture description's format.
371- *
372- * @param picDesc [OUT] dvpp picture description.
373- * @param format [IN] dvpp picture format.
374- *
375- * @retval ACL_SUCCESS The function is successfully executed.
376- * @retval OtherValues Failure
377- */
378-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescFormat(acldvppPicDesc *picDesc, acldvppPixelFormat format);
379- 
380-/**
381- * @ingroup AscendCL
382- * @brief Set dvpp picture description's width.
383- *
384- * @param picDesc [OUT] dvpp picture description.
385- * @param width [IN] dvpp picture width.
386- *
387- * @retval ACL_SUCCESS The function is successfully executed.
388- * @retval OtherValues Failure
389- */
390-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidth(acldvppPicDesc *picDesc, uint32_t width);
391- 
392-/**
393- * @ingroup AscendCL
394- * @brief Set dvpp picture description's height.
395- *
396- * @param picDesc [OUT] dvpp picture description.
397- * @param height [IN] dvpp picture height.
398- *
399- * @retval ACL_SUCCESS The function is successfully executed.
400- * @retval OtherValues Failure
401- */
402-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeight(acldvppPicDesc *picDesc, uint32_t height);
403- 
404-/**
405- * @ingroup AscendCL
406- * @brief Set dvpp picture description's widthStride.
407- *
408- * @par Restriction
409- * Width alignment requirements:
410- * @li The minimum stride is 32 and the maximum is 4096 * 4
411- * (that is, an image in argb format with a width of 4096);
412- * @li For 8K scaling, widthStride is required to be aligned to 2;
413- * @li For non 8K scaling, the calculation formula for widthStride
414- * is different for different image formats:
415- * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
416- * @li yuv422packed: input image width * 2 and then align to 16
417- * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
418- * @li xrgb8888: input image width * 4, align to 16
419- * @li HFBC:input image width
420- *
421- * @param picDesc [OUT] dvpp picture description.
422- * @param widthStride [IN] dvpp picture widthStride.
423- *
424- * @retval ACL_SUCCESS The function is successfully executed.
425- * @retval OtherValues Failure
426- */
427-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidthStride(acldvppPicDesc *picDesc, uint32_t widthStride);
428- 
429-/**
430- * @ingroup AscendCL
431- * @brief Set dvpp picture description's heightStride.
432- *
433- * @par Restriction
434- * Height alignment requirements:
435- * @li The height of the input image is aligned to 2.
436- * High stride minimum 6 and maximum 4096.
437- *
438- * @param picDesc [OUT] dvpp picture description.
439- * @param heightStride [IN] dvpp picture heightStride.
440- *
441- * @retval ACL_SUCCESS The function is successfully executed.
442- * @retval OtherValues Failure
443- */
444-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeightStride(acldvppPicDesc *picDesc, uint32_t heightStride);
445- 
446-/**
447- * @ingroup AscendCL
448- * @brief Set dvpp picture description's retcode.
449- *
450- * @param picDesc [OUT] dvpp picture description.
451- * @param retCode [IN] dvpp picture retcode.
452- *
453- * @retval ACL_SUCCESS The function is successfully executed.
454- * @retval OtherValues Failure
455- */
456-ACL_FUNC_VISIBILITY aclError acldvppSetPicDescRetCode(acldvppPicDesc *picDesc, uint32_t retCode);
457- 
458-/**
459- * @ingroup AscendCL
460- * @brief Get picture data.
461- *
462- * @param picDesc [IN] dvpp picture description.
463- *
464- * @retval picture data addr.
465- * @retval default nullptr.
466- */
467-ACL_FUNC_VISIBILITY void *acldvppGetPicDescData(const acldvppPicDesc *picDesc);
468- 
469-/**
470- * @ingroup AscendCL
471- * @brief Get picture data size.
472- *
473- * @param picDesc [IN] dvpp picture description.
474- *
475- * @retval picture data size.
476- * @retval default 0.
477- */
478-ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescSize(const acldvppPicDesc *picDesc);
479- 
480-/**
481- * @ingroup AscendCL
482- * @brief Get dvpp picture desc's format.
483- *
484- * @param picDesc [IN] dvpp picture description.
485- *
486- * @retval format
487- * @retval default PIXEL_FORMAT_YUV_400.
488- */
489-ACL_FUNC_VISIBILITY acldvppPixelFormat acldvppGetPicDescFormat(const acldvppPicDesc *picDesc);
490- 
491-/**
492- * @ingroup AscendCL
493- * @brief Get dvpp picture desc's width.
494- *
495- * @param picDesc [IN] dvpp picture description.
496- *
497- * @retval width.
498- * @retval default 0.
499- */
500-ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidth(const acldvppPicDesc *picDesc);
501- 
502-/**
503- * @ingroup AscendCL
504- * @brief Get dvpp picture desc's height.
505- *
506- * @param picDesc [IN] dvpp picture description.
507- *
508- * @retval height.
509- * @retval default 0.
510- */
511-ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeight(const acldvppPicDesc *picDesc);
512- 
513-/**
514- * @ingroup AscendCL
515- * @brief Get dvpp picture desc's widthStride.
516- *
517- * @par Restriction
518- * Width alignment requirements:
519- * @li The minimum stride is 32 and the maximum is 4096 * 4
520- * (that is, an image in argb format with a width of 4096);
521- * @li For 8K scaling, widthStride is required to be aligned to 2;
522- * @li For non 8K scaling, the calculation formula for widthStride
523- * is different for different image formats:
524- * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
525- * @li yuv422packed: input image width * 2 and then align to 16
526- * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
527- * @li xrgb8888: input image width * 4, align to 16
528- * @li HFBC:input image width
529- *
530- * @param picDesc [IN] dvpp picture description.
531- *
532- * @retval stride width.
533- * @retval default 0.
534- */
535-ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidthStride(const acldvppPicDesc *picDesc);
536- 
537-/**
538- * @ingroup AscendCL
539- * @brief Get dvpp picture desc's heightStride.
540- *
541- * @par Restriction
542- * Height alignment requirements:
543- * @li The height of the input image is aligned to 2.
544- * High stride minimum 6 and maximum 4096.
545- *
546- * @param picDesc [IN] dvpp picture description.
547- *
548- * @retval stride height.
549- * @retval default 0.
550- */
551-ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeightStride(const acldvppPicDesc *picDesc);
552- 
553-/**
554- * @ingroup AscendCL
555- * @brief Get dvpp picture desc's retcode.
556- *
557- * @param picDesc [IN] dvpp picture description.
558- *
559- * @retval ret code.
560- * @retval default 0.
561- */
562-ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescRetCode(const acldvppPicDesc *picDesc);
563- 
564-/**
565- * @ingroup AscendCL
566- * @brief Create dvpp roi config.
567- *
568- * @param left [IN] the left offset, must be even
569- * @param right [IN] the right offset, must be odd
570- * @param top [IN] the top offset, must be even
571- * @param bottom [IN] the bottom offset, must be odd
572- *
573- * @retval null for failed.
574- * @retval other success
575- */
576-ACL_FUNC_VISIBILITY acldvppRoiConfig *acldvppCreateRoiConfig(uint32_t left, uint32_t right,
577- uint32_t top, uint32_t bottom);
578- 
579-/**
580- * @ingroup AscendCL
581- * @brief Destroy dvpp roi config.
582- *
583- * @par Function
584- * Destroys data created through the acldvppCreateRoiConfig interface
585- * @param roiConfig [IN] dvpp roi config.
586- *
587- * @retval ACL_SUCCESS The function is successfully executed.
588- * @retval OtherValues Failure
589- *
590- * @see acldvppCreateRoiConfig
591- */
592-ACL_FUNC_VISIBILITY aclError acldvppDestroyRoiConfig(acldvppRoiConfig *roiConfig);
593- 
594-/**
595- * @ingroup AscendCL
596- * @brief Set left of RoiConfig.
597- *
598- * @param config [OUT] RoiConfig
599- * @param left [IN] left offset
600- *
601- * @retval ACL_SUCCESS The function is successfully executed.
602- * @retval OtherValues Failure
603- */
604-ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigLeft(acldvppRoiConfig *config, uint32_t left);
605- 
606-/**
607- * @ingroup AscendCL
608- * @brief Set right of RoiConfig.
609- *
610- * @param config [OUT] RoiConfig
611- * @param right [IN] right offset
612- *
613- * @retval ACL_SUCCESS The function is successfully executed.
614- * @retval OtherValues Failure
615- */
616-ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigRight(acldvppRoiConfig *config, uint32_t right);
617- 
618-/**
619- * @ingroup AscendCL
620- * @brief Set top of RoiConfig.
621- *
622- * @param config [OUT] RoiConfig
623- * @param top [IN] top offset
624- *
625- * @retval ACL_SUCCESS The function is successfully executed.
626- * @retval OtherValues Failure
627- */
628-ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigTop(acldvppRoiConfig *config, uint32_t top);
629- 
630-/**
631- * @ingroup AscendCL
632- * @brief Set bottom of RoiConfig.
633- *
634- * @param config [OUT] RoiConfig
635- * @param bottom [IN] bottom offset
636- *
637- * @retval ACL_SUCCESS The function is successfully executed.
638- * @retval OtherValues Failure
639- */
640-ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigBottom(acldvppRoiConfig *config, uint32_t bottom);
641- 
642-/**
643- * @ingroup AscendCL
644- * @brief Set RoiConfig.
645- *
646- * @param config [OUT] RoiConfig
647- * @param left [IN] left offset
648- * @param right [IN] right offset
649- * @param top [IN] top offset
650- * @param bottom [IN] bottom offset
651- *
652- * @retval ACL_SUCCESS The function is successfully executed.
653- * @retval OtherValues Failure
654- */
655-ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfig(acldvppRoiConfig *config,
656- uint32_t left, uint32_t right,
657- uint32_t top, uint32_t bottom);
658- 
659-/**
660- * @ingroup AscendCL
661- * @brief Create dvpp resize config.
662- * The specified scaling algorithm is not supported.
663- * The default scaling algorithm is "nearest neighbor interpolation".
664- *
665- * @retval null for failed.
666- * @retval other success.
667- */
668-ACL_FUNC_VISIBILITY acldvppResizeConfig *acldvppCreateResizeConfig();
669- 
670-/**
671- * @ingroup AscendCL
672- * @brief Destroy dvpp resize config.
673- *
674- * @par Function
675- * Destroys the scaling configuration data created by
676- * the acldvppCreateResizeConfig interface
677- *
678- * @param resizeConfig [IN] resize config.
679- *
680- * @retval ACL_SUCCESS The function is successfully executed.
681- * @retval OtherValues Failure
682- *
683- * @see acldvppCreateResizeConfig
684- */
685-ACL_FUNC_VISIBILITY aclError acldvppDestroyResizeConfig(acldvppResizeConfig *resizeConfig);
686- 
687-/**
688- * @ingroup AscendCL
689- * @brief Create jpege config.
690- *
691- * @retval null for failed.
692- * @retval other success.
693- */
694-ACL_FUNC_VISIBILITY acldvppJpegeConfig *acldvppCreateJpegeConfig();
695- 
696-/**
697- * @ingroup AscendCL
698- * @brief Destroy jpege config.
699- *
700- * @par Function
701- * Destroys the encoding configuration data created by
702- * the acldvppCreateJpegeConfig interface
703- * @param jpegeConfig [IN] config pointer to destroy.
704- *
705- * @retval ACL_SUCCESS The function is successfully executed.
706- * @retval OtherValues Failure
707- *
708- * @see acldvppCreateJpegeConfig
709- */
710-ACL_FUNC_VISIBILITY aclError acldvppDestroyJpegeConfig(acldvppJpegeConfig *jpegeConfig);
711- 
712-/**
713- * @ingroup AscendCL
714- * @brief Set jpege config's level.
715- *
716- * @param jpegeConfig [OUT] Call the acldvppCreateJpegeConfig
717- * interface to create acldvppJpegeConfig data
718- * @param level [IN] Encoding quality range [0, 100],
719- * where level 0 encoding quality is similar to level 100,
720- * and the smaller the value in [1, 100],
721- * the worse the quality of the output picture.
722- *
723- * @retval ACL_SUCCESS The function is successfully executed.
724- * @retval OtherValues Failure
725- */
726-ACL_FUNC_VISIBILITY aclError acldvppSetJpegeConfigLevel(acldvppJpegeConfig *jpegeConfig, uint32_t level);
727- 
728-/**
729- * @ingroup AscendCL
730- * @brief Get jpege config's level.
731- *
732- * @param jpegeConfig [IN] jpege config.
733- *
734- * @retval compression level.
735- * @retval default 0.
736- */
737-ACL_FUNC_VISIBILITY uint32_t acldvppGetJpegeConfigLevel(const acldvppJpegeConfig *jpegeConfig);
738- 
739-/**
740- * @ingroup AscendCL
741- * @brief create vdecChannelDesc.Channel description information
742- * when creating a video data processing channel.
743- *
744- * @retval null for failed.
745- * @retval other success
746- */
747-ACL_FUNC_VISIBILITY aclvdecChannelDesc *aclvdecCreateChannelDesc();
748- 
749-/**
750- * @ingroup AscendCL
751- * @brief destroy vdecChannelDesc.
752- *
753- * @par Function
754- * Can only destroy aclvdecChannelDesc type created
755- * through aclvdecCreateChannelDesc interface
756- * @param channelDesc [IN] channel description.
757- *
758- * @retval ACL_SUCCESS The function is successfully executed.
759- * @retval OtherValues Failure
760- 
761- * @see aclvdecCreateChannelDesc
762- */
763-ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannelDesc(aclvdecChannelDesc *channelDesc);
764- 
765-/**
766- * @ingroup AscendCL
767- * @brief Set vdec channel description's channel id.
768- *
769- * @param channelDesc [OUT] vdec channel description.
770- * @param channelId [IN] decoding channel id: 0~15.
771- *
772- * @retval ACL_SUCCESS The function is successfully executed.
773- * @retval OtherValues Failure
774- */
775-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescChannelId(aclvdecChannelDesc *channelDesc, uint32_t channelId);
776- 
777-/**
778- * @ingroup AscendCL
779- * @brief Set vdec channel description's thread id.
780- *
781- * @param channelDesc [OUT] vdec channel description.
782- * @param threadId [IN] thread id.
783- *
784- * @retval ACL_SUCCESS The function is successfully executed.
785- * @retval OtherValues Failure
786- */
787-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescThreadId(aclvdecChannelDesc *channelDesc, uint64_t threadId);
788- 
789-/**
790- * @ingroup AscendCL
791- * @brief Set vdec channel description's callback function.
792- *
793- * @param channelDesc [OUT] vdec channel description.
794- * @param callback [IN] function callback.Function prototype:
795- * void (* aclvdecCallback)
796- * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata)
797- *
798- * @retval ACL_SUCCESS The function is successfully executed.
799- * @retval OtherValues Failure
800- *
801- * @see aclvdecCallback
802- */
803-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescCallback(aclvdecChannelDesc *channelDesc, aclvdecCallback callback);
804- 
805-/**
806- * @ingroup AscendCL
807- * @brief Set vdec channel description's video encoding type.
808- *
809- * @param channelDesc [OUT] vdec channel description.
810- * @param enType [IN] video encoding type.
811- *
812- * @retval ACL_SUCCESS The function is successfully executed.
813- * @retval OtherValues Failure
814- */
815-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescEnType(aclvdecChannelDesc *channelDesc, acldvppStreamFormat enType);
816- 
817-/**
818- * @ingroup AscendCL
819- * @brief Set vdec channel description's out picture format.
820- *
821- * @param channelDesc [OUT] vdec channel description.
822- * @param outPicFormat [IN] out picture format (acldvppPixelFormat).
823- *
824- * @retval ACL_SUCCESS The function is successfully executed.
825- * @retval OtherValues Failure
826- */
827-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicFormat(aclvdecChannelDesc *channelDesc,
828- acldvppPixelFormat outPicFormat);
829- 
830-/**
831- * @ingroup AscendCL
832- * @brief Set vdec channel description's out picture width.
833- *
834- * @param channelDesc [OUT] vdec channel description.
835- * @param outPicWidth [IN] out picture width.
836- *
837- * @retval ACL_SUCCESS The function is successfully executed.
838- * @retval OtherValues Failure
839- */
840-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicWidth(aclvdecChannelDesc *channelDesc, uint32_t outPicWidth);
841- 
842-/**
843- * @ingroup AscendCL
844- * @brief Set vdec channel description's out picture height.
845- *
846- * @param channelDesc [OUT] vdec channel description.
847- * @param outPicHeight [IN] out picture height.
848- *
849- * @retval ACL_SUCCESS The function is successfully executed.
850- * @retval OtherValues Failure
851- */
852-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicHeight(aclvdecChannelDesc *channelDesc, uint32_t outPicHeight);
853- 
854-/**
855- * @ingroup AscendCL
856- * @brief Set vdec channel description's reference frame num.
857- *
858- * @param channelDesc [OUT] vdec channel description.
859- * @param refFrameNum [IN] reference frame num.
860- *
861- * @retval ACL_SUCCESS The function is successfully executed.
862- * @retval OtherValues Failure
863- */
864-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescRefFrameNum(aclvdecChannelDesc *channelDesc, uint32_t refFrameNum);
865- 
866-/**
867- * @ingroup AscendCL
868- * @brief Set vdec channel description's bit depth.
869- *
870- * @param channelDesc [OUT] vdec channel description.
871- * @param bitDepth [IN] bit depth.
872- *
873- * @retval ACL_SUCCESS The function is successfully executed.
874- * @retval OtherValues Failure
875- */
876-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescBitDepth(aclvdecChannelDesc *channelDesc, uint32_t bitDepth);
877- 
878-/**
879- * @ingroup AscendCL
880- * @brief Get vdec channel description's channel id.
881- *
882- * @param channelDesc [IN] vdec channel description.
883- *
884- * @retval decoding channel id: 0~15.
885- * @retval default 0.
886- */
887-ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescChannelId(const aclvdecChannelDesc *channelDesc);
888- 
889-/**
890- * @ingroup AscendCL
891- * @brief Get vdec channel description's thread id.
892- *
893- * @param channelDesc [IN] vdec channel description.
894- *
895- * @retval thread id.
896- * @retval default 0.
897- */
898-ACL_FUNC_VISIBILITY uint64_t aclvdecGetChannelDescThreadId(const aclvdecChannelDesc *channelDesc);
899- 
900-/**
901- * @ingroup AscendCL
902- * @brief Get vdec channel description's callback function.
903- *
904- * @param channelDesc [IN] vdec channel description.
905- *
906- * @retval function callback.Function prototype:
907- * void (* aclvdecCallback)
908- * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata)
909- * @retval default null.
910- *
911- * @see aclvdecCallback
912- */
913-ACL_FUNC_VISIBILITY aclvdecCallback aclvdecGetChannelDescCallback(const aclvdecChannelDesc *channelDesc);
914- 
915-/**
916- * @ingroup AscendCL
917- * @brief Get vdec channel description's video encoding type.
918- *
919- * @param channelDesc [IN] vdec channel description.
920- *
921- * @retval video encoding type.
922- * @retval default H265_MAIN_LEVEL.
923- */
924-ACL_FUNC_VISIBILITY acldvppStreamFormat aclvdecGetChannelDescEnType(const aclvdecChannelDesc *channelDesc);
925- 
926-/**
927- * @ingroup AscendCL
928- * @brief Get vdec channel description's out picture format.
929- *
930- * @param channelDesc [IN] vdec channel description.
931- *
932- * @retval out picture format.
933- * @retval default DVPP_OUTPUT_YUV420SP_UV.
934- */
935-ACL_FUNC_VISIBILITY acldvppPixelFormat aclvdecGetChannelDescOutPicFormat(const aclvdecChannelDesc *channelDesc);
936- 
937-/**
938- * @ingroup AscendCL
939- * @brief Get vdec channel description's out picture width.
940- *
941- * @param channelDesc [IN] vdec channel description.
942- *
943- * @retval out picture width.
944- * @retval default 0.
945- */
946-ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicWidth(const aclvdecChannelDesc *channelDesc);
947- 
948-/**
949- * @ingroup AscendCL
950- * @brief Get vdec channel description's out picture height.
951- *
952- * @param channelDesc [IN] vdec channel description.
953- *
954- * @retval out picture height (for vdec malloc memory).
955- * @retval default 0.
956- */
957-ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicHeight(const aclvdecChannelDesc *channelDesc);
958- 
959-/**
960- * @ingroup AscendCL
961- * @brief Get vdec channel description's bit depth.
962- *
963- * @param channelDesc [IN] vdec channel description.
964- *
965- * @retval bit depth.
966- * @retval default 0.
967- */
968-ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescBitDepth(const aclvdecChannelDesc *channelDesc);
969- 
970-/**
971- * @ingroup AscendCL
972- * @brief Get vdec channel description's reference frame num.
973- *
974- * @param channelDesc [IN] vdec channel description.
975- *
976- * @retval reference frame num.
977- * @retval default 0.
978- */
979-ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescRefFrameNum(const aclvdecChannelDesc *channelDesc);
980- 
981-/**
982- * @ingroup AscendCL
983- * @brief create vencChannelDesc.
984- *
985- * @retval null for failed, other success
986- */
987-ACL_FUNC_VISIBILITY aclvencChannelDesc *aclvencCreateChannelDesc();
988- 
989-/**
990- * @ingroup AscendCL
991- * @brief destroy vencChannelDesc.
992- *
993- * @param channelDesc [IN] channel desc.
994- *
995- * @retval ACL_SUCCESS:success, other:failed
996- */
997-ACL_FUNC_VISIBILITY aclError aclvencDestroyChannelDesc(aclvencChannelDesc *channelDesc);
998- 
999-/**
1000- * @ingroup AscendCL
1001- * @brief Set decoding thread id for venc channel desc.
1002- *
1003- * @param channelDesc [OUT] venc channel desc
1004- * @param threadId [IN] thread id
1005- *
1006- * @retval ACL_SUCCESS for success, other for failure
1007- */
1008-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescThreadId(aclvencChannelDesc *channelDesc, uint64_t threadId);
1009- 
1010-/**
1011- * @ingroup AscendCL
1012- * @brief Set func callback for venc channel desc.
1013- *
1014- * @param channelDesc [OUT] venc channel desc
1015- * @param callback [IN] func callback
1016- *
1017- * @retval ACL_SUCCESS for success, other for failure
1018- */
1019-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescCallback(aclvencChannelDesc *channelDesc, aclvencCallback callback);
1020- 
1021-/**
1022- * @ingroup AscendCL
1023- * @brief Set video encoding type for venc channel desc.
1024- *
1025- * @param channelDesc [OUT] venc channel desc
1026- * @param enType [IN] video encoding type
1027- *
1028- * @retval ACL_SUCCESS for success, other for failure
1029- */
1030-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescEnType(aclvencChannelDesc *channelDesc, acldvppStreamFormat enType);
1031- 
1032-/**
1033- * @ingroup AscendCL
1034- * @brief Set pic format for venc channel desc.
1035- *
1036- * @param channelDesc [OUT] venc channel desc
1037- * @param picFormat [IN] pic format
1038- *
1039- * @retval ACL_SUCCESS for success, other for failure
1040- */
1041-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicFormat(aclvencChannelDesc *channelDesc,
1042- acldvppPixelFormat picFormat);
1043- 
1044-/**
1045- * @ingroup AscendCL
1046- * @brief Set out pic width for venc channel desc.
1047- *
1048- * @param channelDesc [OUT] venc channel desc
1049- * @param picWidth [IN] pic width
1050- *
1051- * @retval ACL_SUCCESS for success, other for failure
1052- */
1053-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicWidth(aclvencChannelDesc *channelDesc, uint32_t picWidth);
1054- 
1055-/**
1056- * @ingroup AscendCL
1057- * @brief Set pic height for venc channel desc.
1058- *
1059- * @param channelDesc [OUT] venc channel desc
1060- * @param picHeight [IN] pic height
1061- *
1062- * @retval ACL_SUCCESS for success, other for failure
1063- */
1064-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicHeight(aclvencChannelDesc *channelDesc, uint32_t picHeight);
1065- 
1066-/**
1067- * @ingroup AscendCL
1068- * @brief Set key frame interval for venc channel desc.
1069- *
1070- * @param channelDesc [OUT] venc channel desc
1071- * @param keyFrameInterval [IN] Interval of key frame
1072- *
1073- * @retval ACL_SUCCESS for success, other for failure
1074- */
1075-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescKeyFrameInterval(aclvencChannelDesc *channelDesc,
1076- uint32_t keyFrameInterval);
1077- 
1078-/**
1079- * @ingroup AscendCL
1080- * @brief Set output buffer address for venc channel desc.
1081- *
1082- * @param channelDesc [OUT] venc channel desc
1083- * @param bufAddr [IN] output buffer address
1084- *
1085- * @retval ACL_SUCCESS for success, other for failure
1086- */
1087-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufAddr(aclvencChannelDesc *channelDesc, void *bufAddr);
1088- 
1089-/**
1090- * @ingroup AscendCL
1091- * @brief Set output buffer size for venc channel desc.
1092- *
1093- * @param channelDesc [OUT] venc channel desc
1094- * @param bufSize [IN] output buffer size
1095- *
1096- * @retval ACL_SUCCESS for success, other for failure
1097- */
1098-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufSize(aclvencChannelDesc *channelDesc, uint32_t bufSize);
1099- 
1100-/**
1101- * @ingroup AscendCL
1102- * @brief Set rc model for venc channel desc.
1103- *
1104- * @param channelDesc [OUT] venc channel desc
1105- * @param rcMode [IN] venc rc mode(VBR=1, CBR=2)
1106- *
1107- * @retval ACL_SUCCESS for success, other for failure
1108- */
1109-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescRcMode(aclvencChannelDesc *channelDesc, uint32_t rcMode);
1110- 
1111-/**
1112- * @ingroup AscendCL
1113- * @brief Set source rate for venc channel desc.
1114- *
1115- * @param channelDesc [OUT] venc channel desc
1116- * @param srcRate [IN] source rate
1117- *
1118- * @retval ACL_SUCCESS for success, other for failure
1119- */
1120-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescSrcRate(aclvencChannelDesc *channelDesc, uint32_t srcRate);
1121- 
1122-/**
1123- * @ingroup AscendCL
1124- * @brief Set max bit rate for venc channel desc.
1125- *
1126- * @param channelDesc [OUT] venc channel desc
1127- * @param maxBitRate [IN] max bit rate
1128- *
1129- * @retval ACL_SUCCESS for success, other for failure
1130- */
1131-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescMaxBitRate(aclvencChannelDesc *channelDesc, uint32_t maxBitRate);
1132- 
1133-/**
1134- * @ingroup AscendCL
1135- * @brief Set venc parameter for venc channel desc.
1136- *
1137- * @param channelDesc [OUT] venc channel desc
1138- * @param paramType [IN] parameter type
1139- * @param length [IN] parameter length
1140- * @param param [IN] pointer to parameter value
1141- *
1142- * @retval ACL_SUCCESS for success, other for failure
1143- */
1144-ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescParam(aclvencChannelDesc *channelDesc,
1145- aclvencChannelDescParamType paramType, size_t length, const void *param);
1146- 
1147-/**
1148- * @ingroup AscendCL
1149- * @brief Get output buffer address for venc channel desc.
1150- *
1151- * @param channelDesc[IN] venc channel desc
1152- *
1153- * @retval output buffer address
1154- */
1155-ACL_FUNC_VISIBILITY void *aclvencGetChannelDescBufAddr(const aclvencChannelDesc *channelDesc);
1156- 
1157-/**
1158- * @ingroup AscendCL
1159- * @brief Get output buffer size for venc channel desc.
1160- *
1161- * @param channelDesc [IN] venc channel desc
1162- *
1163- * @retval output buffer size
1164- */
1165-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescBufSize(const aclvencChannelDesc *channelDesc);
1166- 
1167-/**
1168- * @ingroup AscendCL
1169- * @brief Get decoding channel id for venc channel desc.
1170- *
1171- * @param channelDesc [IN] venc channel desc
1172- *
1173- * @retval decoding channel id: 0~15, default 0
1174- */
1175-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescChannelId(const aclvencChannelDesc *channelDesc);
1176- 
1177-/**
1178- * @ingroup AscendCL
1179- * @brief Get decoding thread id for venc channel desc.
1180- *
1181- * @param channelDesc [IN] venc channel desc
1182- *
1183- * @retval thread id, default 0
1184- */
1185-ACL_FUNC_VISIBILITY uint64_t aclvencGetChannelDescThreadId(const aclvencChannelDesc *channelDesc);
1186- 
1187-/**
1188- * @ingroup AscendCL
1189- * @brief Get func callback for venc channel desc.
1190- *
1191- * @param channelDesc [IN] venc channel desc
1192- *
1193- * @retval func callback, default null
1194- */
1195-ACL_FUNC_VISIBILITY aclvencCallback aclvencGetChannelDescCallback(const aclvencChannelDesc *channelDesc);
1196- 
1197-/**
1198- * @ingroup AscendCL
1199- * @brief Get video encoding type for venc channel desc.
1200- *
1201- * @param channelDesc [IN] venc channel desc
1202- *
1203- * @retval video encoding type, default H265_MAIN_LEVEL
1204- */
1205-ACL_FUNC_VISIBILITY acldvppStreamFormat aclvencGetChannelDescEnType(const aclvencChannelDesc *channelDesc);
1206- 
1207-/**
1208- * @ingroup AscendCL
1209- * @brief Get pic format for venc channel desc.
1210- *
1211- * @param channelDesc [IN] venc channel desc
1212- *
1213- * @retval pic format
1214- */
1215-ACL_FUNC_VISIBILITY acldvppPixelFormat aclvencGetChannelDescPicFormat(const aclvencChannelDesc *channelDesc);
1216- 
1217-/**
1218- * @ingroup AscendCL
1219- * @brief Get pic width for venc channel desc.
1220- *
1221- * @param channelDesc [IN] venc channel desc
1222- *
1223- * @retval pic width, default 0
1224- */
1225-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicWidth(const aclvencChannelDesc *channelDesc);
1226- 
1227-/**
1228- * @ingroup AscendCL
1229- * @brief Get pic height for venc channel desc.
1230- *
1231- * @param channelDesc [IN] venc channel desc
1232- *
1233- * @retval pic height, default 0
1234- */
1235-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicHeight(const aclvencChannelDesc *channelDesc);
1236- 
1237-/**
1238- * @ingroup AscendCL
1239- * @brief Get interval of key frame for venc channel desc.
1240- *
1241- * @param channelDesc [IN] venc channel desc
1242- *
1243- * @retval interval of key frame, default 0
1244- */
1245-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescKeyFrameInterval(const aclvencChannelDesc *channelDesc);
1246- 
1247-/**
1248- * @ingroup AscendCL
1249- *
1250- * @brief Get rc mode for venc channel desc.
1251- *
1252- * @param channelDesc [IN] venc channel desc
1253- *
1254- * @retval rc mode, default 0
1255- */
1256-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescRcMode(const aclvencChannelDesc *channelDesc);
1257- 
1258-/**
1259- * @ingroup AscendCL
1260- *
1261- * @brief Get source rate for venc channel desc.
1262- *
1263- * @param channelDesc [IN] venc channel desc
1264- *
1265- * @retval source rate, default 0
1266- */
1267-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescSrcRate(const aclvencChannelDesc *channelDesc);
1268- 
1269-/**
1270- * @ingroup AscendCL
1271- *
1272- * @brief Get max bit rate for venc channel desc.
1273- *
1274- * @param channelDesc [IN] venc channel desc
1275- *
1276- * @retval max bit rate, default 0
1277- */
1278-ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescMaxBitRate(const aclvencChannelDesc *channelDesc);
1279- 
1280-/**
1281- * @ingroup AscendCL
1282- *
1283- * @brief Get venc parameter for venc channel desc.
1284- *
1285- * @param channelDesc [IN] venc channel desc
1286- * @param paramType [IN] parameter type
1287- * @param length [IN] parameter length
1288- * @param paramRetSize [OUT] pointer to parameter real length
1289- * @param param [OUT] pointer to parameter value
1290- *
1291- * @retval ACL_SUCCESS for success, other for failure
1292- */
1293-ACL_FUNC_VISIBILITY aclError aclvencGetChannelDescParam(const aclvencChannelDesc *channelDesc,
1294- aclvencChannelDescParamType paramType, size_t length, size_t *paramRetSize, void *param);
1295- 
1296-/**
1297- * @ingroup AscendCL
1298- * @brief get forced restart of I-frame interval from config
1299- *
1300- * @param config [IN] venc frame config
1301- *
1302- * @retval 0: Not forced; 1: Forced restart of I-frame -1: error
1303- */
1304-ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigForceIFrame(const aclvencFrameConfig *config);
1305- 
1306-/**
1307- * @ingroup AscendCL
1308- * @brief get forced restart of I-frame interval from config
1309- *
1310- * @param config [IN] venc frame config
1311- *
1312- * @retval Whether it is the end frame: 0: no; 1: end frame
1313- */
1314-ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigEos(const aclvencFrameConfig *config);
1315- 
1316-/**
1317- * @ingroup AscendCL
1318- * @brief set single frame encoding configuration parameters
1319- *
1320- * @param config [OUT] venc frame config
1321- * @param forceFrame [IN] forced restart of I-frame interval: 0: Not forced; 1: Forced restart of I-frame
1322- *
1323- * @retval ACL_SUCCESS for ok, others for fail
1324- */
1325-ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigForceIFrame(aclvencFrameConfig *config, uint8_t forceIFrame);
1326- 
1327-/**
1328- * @ingroup AscendCL
1329- * @brief set single frame encoding configuration parameters
1330- *
1331- * @param config [OUT] venc frame config
1332- * @param eos [IN] Whether it is the end frame: 0: no; 1: end frame
1333- *
1334- * @retval ACL_SUCCESS for ok, others for fail
1335- */
1336-ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigEos(aclvencFrameConfig *config, uint8_t eos);
1337- 
1338-/**
1339- * @ingroup AscendCL
1340- * @brief dvpp venc destroy frame config
1341- *
1342- * @param config [IN] venc frame config
1343- *
1344- * @retval ACL_SUCCESS for ok, others for fail
1345- */
1346-ACL_FUNC_VISIBILITY aclError aclvencDestroyFrameConfig(aclvencFrameConfig *config);
1347- 
1348-/**
1349- * @ingroup AscendCL
1350- * @brief Create dvpp venc frame config.
1351- *
1352- * @retval null for failed, other aclvencFrameConfig ptr
1353- */
1354-ACL_FUNC_VISIBILITY aclvencFrameConfig *aclvencCreateFrameConfig();
1355- 
1356-/**
1357- * @ingroup AscendCL
1358- * @brief Create dvpp venc channel.
1359- *
1360- * @param channelDesc [IN|OUT] venc channel desc
1361- *
1362- * @retval ACL_SUCCESS for ok, others for fail
1363- */
1364-ACL_FUNC_VISIBILITY aclError aclvencCreateChannel(aclvencChannelDesc *channelDesc);
1365- 
1366-/**
1367- * @ingroup AscendCL
1368- * @brief Destroy dvpp venc channel.
1369- *
1370- * @param channelDesc [IN] venc channel desc
1371- *
1372- * @retval ACL_SUCCESS for ok, others for fail
1373- */
1374-ACL_FUNC_VISIBILITY aclError aclvencDestroyChannel(aclvencChannelDesc *channelDesc);
1375- 
1376-/**
1377- * @ingroup AscendCL
1378- * @brief dvpp venc launch send frame task.
1379- *
1380- * @param channelDesc [IN] venc channel desc
1381- * @param input [IN] input picture desc
1382- * @param reserve [IN] reserve parameter
1383- * @param config [IN] dvpp frame config
1384- * @param userdata [IN] user callback function
1385- *
1386- * @retval ACL_SUCCESS for ok, others for fail
1387- */
1388-ACL_FUNC_VISIBILITY aclError aclvencSendFrame(aclvencChannelDesc *channelDesc, acldvppPicDesc *input, void *reserve,
1389- aclvencFrameConfig *config, void *userdata);
1390- 
1391-/**
1392- * @ingroup AscendCL
1393- * @brief Create dvpp stream description.
1394- *
1395- * @retval null for failed.
1396- * @retval other success.
1397- */
1398-ACL_FUNC_VISIBILITY acldvppStreamDesc *acldvppCreateStreamDesc();
1399- 
1400-/**
1401- * @ingroup AscendCL
1402- * @brief Destroy dvpp stream description.
1403- *
1404- * @par Function
1405- * Can only destroy acldvppStreamDesc type created through
1406- * acldvppCreateStreamDesc interface.
1407- *
1408- * @param streamDesc [IN] dvpp stream description.
1409- *
1410- * @retval ACL_SUCCESS The function is successfully executed.
1411- * @retval OtherValues Failure
1412- *
1413- * @see acldvppCreateStreamDesc
1414- */
1415-ACL_FUNC_VISIBILITY aclError acldvppDestroyStreamDesc(acldvppStreamDesc *streamDesc);
1416- 
1417-/**
1418- * @ingroup AscendCL
1419- * @brief Set stream description's data addr.
1420- *
1421- * @param streamDesc [OUT] dvpp stream description.
1422- * @param dataDev [IN] data addr.
1423- *
1424- * @retval ACL_SUCCESS The function is successfully executed.
1425- * @retval OtherValues Failure
1426- */
1427-ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescData(acldvppStreamDesc *streamDesc, void *dataDev);
1428- 
1429-/**
1430- * @ingroup AscendCL
1431- * @brief Set stream description's data size.
1432- *
1433- * @param streamDesc [OUT] dvpp stream description.
1434- * @param size [IN] data size.
1435- *
1436- * @retval ACL_SUCCESS The function is successfully executed.
1437- * @retval OtherValues Failure
1438- */
1439-ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescSize(acldvppStreamDesc *streamDesc, uint32_t size);
1440- 
1441-/**
1442- * @ingroup AscendCL
1443- * @brief Set stream description's format.
1444- *
1445- * @param streamDesc [OUT] dvpp stream description.
1446- * @param format [IN] stream format.
1447- *
1448- * @retval ACL_SUCCESS The function is successfully executed.
1449- * @retval OtherValues Failure
1450- */
1451-ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescFormat(acldvppStreamDesc *streamDesc, acldvppStreamFormat format);
1452- 
1453-/**
1454- * @ingroup AscendCL
1455- * @brief Set stream description's timestamp.
1456- *
1457- * @param streamDesc [OUT] dvpp stream description.
1458- * @param timestamp [IN] current timestamp.
1459- *
1460- * @retval ACL_SUCCESS The function is successfully executed.
1461- * @retval OtherValues Failure
1462- */
1463-ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescTimestamp(acldvppStreamDesc *streamDesc, uint64_t timestamp);
1464- 
1465-/**
1466- * @ingroup AscendCL
1467- * @brief Set stream description's ret code.
1468- *
1469- * @param streamDesc [OUT] dvpp stream description.
1470- * @param retCode [IN] result code.
1471- *
1472- * @retval ACL_SUCCESS The function is successfully executed.
1473- * @retval OtherValues Failure
1474- */
1475-ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescRetCode(acldvppStreamDesc *streamDesc, uint32_t retCode);
1476- 
1477-/**
1478- * @ingroup AscendCL
1479- * @brief Set stream description's eos.
1480- *
1481- * @param streamDesc [OUT] dvpp stream description.
1482- * @param eos [IN] end flag of sequence.
1483- *
1484- * @retval ACL_SUCCESS The function is successfully executed.
1485- * @retval OtherValues Failure
1486- */
1487-ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescEos(acldvppStreamDesc *streamDesc, uint8_t eos);
1488- 
1489-/**
1490- * @ingroup AscendCL
1491- * @brief Get stream description's data addr.
1492- *
1493- * @param streamDesc [IN] dvpp stream description.
1494- *
1495- * @retval data addr.
1496- * @retval deault nullptr.
1497- */
1498-ACL_FUNC_VISIBILITY void *acldvppGetStreamDescData(const acldvppStreamDesc *streamDesc);
1499- 
1500-/**
1501- * @ingroup AscendCL
1502- * @brief Get stream description's data size.
1503- *
1504- * @param streamDesc [IN] dvpp stream description.
1505- *
1506- * @retval data size.
1507- * @retval default 0.
1508- */
1509-ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescSize(const acldvppStreamDesc *streamDesc);
1510- 
1511-/**
1512- * @ingroup AscendCL
1513- * @brief Get stream description's format.
1514- *
1515- * @param streamDesc [IN] dvpp stream description.
1516- *
1517- * @retval stream format.
1518- * @retval default ACL_DVPP_STREAM_H264.
1519- */
1520-ACL_FUNC_VISIBILITY acldvppStreamFormat acldvppGetStreamDescFormat(const acldvppStreamDesc *streamDesc);
1521- 
1522-/**
1523- * @ingroup AscendCL
1524- * @brief Get stream description's timestamp.
1525- *
1526- * @param streamDesc [IN] dvpp stream description.
1527- *
1528- * @retval current timestamp.
1529- * @retval default 0.
1530- */
1531-ACL_FUNC_VISIBILITY uint64_t acldvppGetStreamDescTimestamp(const acldvppStreamDesc *streamDesc);
1532- 
1533-/**
1534- * @ingroup AscendCL
1535- * @brief Get stream description's retCode.
1536- *
1537- * @param streamDesc [IN] dvpp stream description.
1538- *
1539- * @retval result code.
1540- * @retval default 0.
1541- */
1542-ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescRetCode(const acldvppStreamDesc *streamDesc);
1543- 
1544-/**
1545- * @ingroup AscendCL
1546- * @brief Get stream description's eos.
1547- *
1548- * @param streamDesc [IN] dvpp stream description.
1549- *
1550- * @retval end flag of sequence.
1551- * @retval default 0(false).
1552- */
1553-ACL_FUNC_VISIBILITY uint8_t acldvppGetStreamDescEos(const acldvppStreamDesc *streamDesc);
1554- 
1555-/**
1556- * @ingroup AscendCL
1557- * @brief Create vdec frame config.
1558- *
1559- * @retval null for failed.
1560- * @retval other success.
1561- */
1562-ACL_FUNC_VISIBILITY aclvdecFrameConfig *aclvdecCreateFrameConfig();
1563- 
1564-/**
1565- * @ingroup AscendCL
1566- * @brief Destroy vdec frame config.
1567- *
1568- * @par Function
1569- * Can only destroy aclvdecFrameConfig type created through
1570- * aclvdecCreateFrameConfig interface
1571- *
1572- * @param vdecFrameConfig [IN] vdec frame config.
1573- *
1574- * @retval ACL_SUCCESS The function is successfully executed.
1575- * @retval OtherValues Failure
1576- *
1577- * @see aclvdecCreateFrameConfig
1578- */
1579-ACL_FUNC_VISIBILITY aclError aclvdecDestroyFrameConfig(aclvdecFrameConfig *vdecFrameConfig);
1580- 
1581-/**
1582- * @ingroup AscendCL
1583- * @brief Get image width and height of jpeg.
1584- *
1585- * @param data [IN] image data in host memory
1586- * @param size [IN] the size of image data
1587- * @param width [OUT] the width of image from image header
1588- * @param height [OUT] the height of image from image header
1589- * @param components [OUT] the components of image from image header
1590- *
1591- * @retval ACL_SUCCESS The function is successfully executed.
1592- * @retval OtherValues Failure
1593- */
1594-ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfo(const void *data, uint32_t size,
1595- uint32_t *width, uint32_t *height,
1596- int32_t *components);
1597- 
1598-/**
1599- * @ingroup AscendCL
1600- * @brief Get image width and height of jpeg.
1601- *
1602- * @param data [IN] image data in host memory
1603- * @param size [IN] the size of image data
1604- * @param width [OUT] the width of image from image header
1605- * @param height [OUT] the height of image from image header
1606- * @param components [OUT] the components of image from image header
1607- * @param format [OUT] the format of image from image header
1608- *
1609- * @retval ACL_SUCCESS The function is successfully executed.
1610- * @retval OtherValues Failure
1611- */
1612-ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfoV2(const void *data, uint32_t size,
1613- uint32_t *width, uint32_t *height,
1614- int32_t *components, acldvppJpegFormat *format);
1615- 
1616-/**
1617- * @ingroup AscendCL
1618- * @brief Predict encode size of jpeg image.
1619- *
1620- * @param inputDesc [IN] dvpp image desc
1621- * @param config [IN] jpeg encode config
1622- * @param size [OUT] the size predicted of image
1623- *
1624- * @retval ACL_SUCCESS The function is successfully executed.
1625- * @retval OtherValues Failure
1626- */
1627-ACL_FUNC_VISIBILITY aclError acldvppJpegPredictEncSize(const acldvppPicDesc *inputDesc,
1628- const acldvppJpegeConfig *config,
1629- uint32_t *size);
1630- 
1631-/**
1632- * @ingroup AscendCL
1633- * @brief Predict decode size of jpeg image.
1634- *
1635- * @param data [IN] origin image data in host memory
1636- * @param dataSize [IN] the size of origin image data
1637- * @param outputPixelFormat [IN] the pixel format jpeg decode
1638- * @param decSize [OUT] the size predicted for decode image
1639- *
1640- * @retval ACL_SUCCESS The function is successfully executed.
1641- * @retval OtherValues Failure
1642- */
1643-ACL_FUNC_VISIBILITY aclError acldvppJpegPredictDecSize(const void *data, uint32_t dataSize,
1644- acldvppPixelFormat outputPixelFormat,
1645- uint32_t *decSize);
1646- 
1647-/**
1648- * @ingroup AscendCL
1649- * @brief Get image width and height of png.
1650- *
1651- * @param data [IN] image data in host memory
1652- * @param size [IN] the size of image data
1653- * @param width [OUT] the width of image from image header
1654- * @param height [OUT] the height of image from image header
1655- * @param components [OUT] the components of image from image header
1656- *
1657- * @retval ACL_SUCCESS The function is successfully executed.
1658- * @retval OtherValues Failure
1659- */
1660-ACL_FUNC_VISIBILITY aclError acldvppPngGetImageInfo(const void *data, uint32_t dataSize,
1661- uint32_t *width, uint32_t *height,
1662- int32_t *components);
1663- 
1664-/**
1665- * @ingroup AscendCL
1666- * @brief Predict decode size of png image.
1667- *
1668- * @param data [IN] origin image data in host memory
1669- * @param dataSize [IN] the size of origin image data
1670- * @param outputPixelFormat [IN] the pixel format jpeg decode
1671- * @param decSize [OUT] the size predicted for decode image
1672- *
1673- * @retval ACL_SUCCESS The function is successfully executed.
1674- * @retval OtherValues Failure
1675- */
1676-ACL_FUNC_VISIBILITY aclError acldvppPngPredictDecSize(const void *data, uint32_t dataSize,
1677- acldvppPixelFormat outputPixelFormat,
1678- uint32_t *decSize);
1679- 
1680-/**
1681- * @ingroup AscendCL
1682- * @brief Create dvpp channel, the same channel can be reused
1683- * and is no longer available after destruction.
1684- *
1685- * @param channelDesc [IN|OUT] the channel destruction
1686- *
1687- * @retval ACL_SUCCESS The function is successfully executed.
1688- * @retval OtherValues Failure
1689- *
1690- * @see acldvppCreateChannelDesc
1691- */
1692-ACL_FUNC_VISIBILITY aclError acldvppCreateChannel(acldvppChannelDesc *channelDesc);
1693- 
1694-/**
1695- * @ingroup AscendCL
1696- * @brief Destroy dvpp channel.
1697- *
1698- * @par Restriction
1699- * Can only destroy channel created through the acldvppCreateChannel interface
1700- *
1701- * @param channelDesc [IN] the channel destruction
1702- *
1703- * @retval ACL_SUCCESS The function is successfully executed.
1704- * @retval OtherValues Failure
1705- *
1706- * @see acldvppCreateChannel
1707- */
1708-ACL_FUNC_VISIBILITY aclError acldvppDestroyChannel(acldvppChannelDesc *channelDesc);
1709- 
1710-/**
1711- * @ingroup AscendCL
1712- * @brief dvpp vpc resize.
1713- *
1714- * @par Restriction
1715- * Width alignment requirements:
1716- * @li The minimum stride is 32 and the maximum is 4096 * 4
1717- * (that is, an image in argb format with a width of 4096);
1718- * @li For 8K scaling, widthStride is required to be aligned to 2;
1719- * @li For non 8K scaling, the calculation formula for widthStride
1720- * is different for different image formats:
1721- * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
1722- * @li yuv422packed: input image width * 2 and then align to 16
1723- * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
1724- * @li xrgb8888: input image width * 4, align to 16
1725- * @li HFBC:input image width
1726- * Height alignment requirements:
1727- * @li The height of the input image is aligned to 2.
1728- * High stride minimum 6 and maximum 4096.
1729- *
1730- * @param channelDesc [IN] the channel destruction
1731- * @param inputDesc [IN] resize input picture destruction
1732- * @param outputDesc [IN|OUT] resize output picture destruction
1733- * @param resizeConfig [IN] resize config
1734- * @param stream [IN] resize task stream
1735- *
1736- * @retval ACL_SUCCESS The function is successfully executed.
1737- * @retval OtherValues Failure
1738- *
1739- * @see acldvppCreateChannel | acldvppCreatePicDesc
1740- * | acldvppCreateResizeConfig
1741- */
1742-ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDesc,
1743- acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
1744- acldvppResizeConfig *resizeConfig, aclrtStream stream);
1745- 
1746-/**
1747- * @ingroup AscendCL
1748- * @brief dvpp vpc crop.
1749- *
1750- * @par Function
1751- * crop the input picture according to the specified area,
1752- * and then store the picture in the output memory as the output picture
1753- *
1754- * @par Restriction
1755- * Width alignment requirements:
1756- * @li The minimum stride is 32 and the maximum is 4096 * 4
1757- * (that is, an image in argb format with a width of 4096);
1758- * @li For 8K scaling, widthStride is required to be aligned to 2;
1759- * @li For non 8K scaling, the calculation formula for widthStride
1760- * is different for different image formats:
1761- * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
1762- * @li yuv422packed: input image width * 2 and then align to 16
1763- * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
1764- * @li xrgb8888: input image width * 4, align to 16
1765- * @li HFBC:input image width
1766- * Height alignment requirements:
1767- * @li The height of the input image is aligned to 2.
1768- * High stride minimum 6 and maximum 4096.
1769- *
1770- * @param channelDesc [IN] the channel destruction
1771- * @param inputDesc [IN] crop input picture destruction
1772- * @param outputDesc [IN|OUT] crop output picture destruction
1773- * @param cropArea [IN] crop area config
1774- * @param stream [IN] crop task stream
1775- *
1776- * @retval ACL_SUCCESS The function is successfully executed.
1777- * @retval OtherValues Failure
1778- */
1779-ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc,
1780- acldvppPicDesc *inputDesc,
1781- acldvppPicDesc *outputDesc,
1782- acldvppRoiConfig *cropArea,
1783- aclrtStream stream);
1784- 
1785-/**
1786- * @ingroup AscendCL
1787- * @brief dvpp vpc crop and resize config.
1788- *
1789- * @par Function
1790- * crop the input picture with resize config according to the specified area,
1791- * and then store the picture in the output memory as the output picture
1792- *
1793- * @par Restriction
1794- * Width alignment requirements:
1795- * @li The minimum stride is 32 and the maximum is 4096 * 4
1796- * (that is, an image in argb format with a width of 4096);
1797- * @li For 8K scaling, widthStride is required to be aligned to 2;
1798- * @li For non 8K scaling, the calculation formula for widthStride
1799- * is different for different image formats:
1800- * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
1801- * @li yuv422packed: input image width * 2 and then align to 16
1802- * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
1803- * @li xrgb8888: input image width * 4, align to 16
1804- * @li HFBC:input image width
1805- * Height alignment requirements:
1806- * @li The height of the input image is aligned to 2.
1807- * High stride minimum 6 and maximum 4096.
1808- *
1809- * @param channelDesc [IN] the channel destruction
1810- * @param inputDesc [IN] crop input picture destruction
1811- * @param outputDesc [IN|OUT] crop output picture destruction
1812- * @param cropArea [IN] crop area config
1813- * @param resizeConfig [IN] resize config
1814- * @param stream [IN] crop and resize config task stream
1815- *
1816- * @retval ACL_SUCCESS The function is successfully executed.
1817- * @retval OtherValues Failure
1818- */
1819-ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizeAsync(acldvppChannelDesc *channelDesc,
1820- acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
1821- acldvppRoiConfig *cropArea, acldvppResizeConfig *resizeConfig,
1822- aclrtStream stream);
1823- 
1824- 
1825-/**
1826- * @ingroup AscendCL
1827- * @brief dvpp vpc batch crop.
1828- *
1829- * @par Function
1830- * crop the input batch picture according to the specified area
1831- * as the output batch pictures
1832- *
1833- * @param channelDesc [IN] the channel destruction
1834- * @param srcBatchPicDescs [IN] crop input batch picture destruction
1835- * @param roiNums [IN] roi config numbers
1836- * @param size [IN] roiNum size
1837- * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
1838- * @param cropAreas [IN] crop area configs
1839- * @param stream [IN] crop batch task stream
1840- *
1841- * @retval ACL_SUCCESS The function is successfully executed.
1842- * @retval OtherValues Failure
1843- *
1844- * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig
1845- */
1846-ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *channelDesc,
1847- acldvppBatchPicDesc *srcBatchPicDescs,
1848- uint32_t *roiNums, uint32_t size,
1849- acldvppBatchPicDesc *dstBatchPicDescs,
1850- acldvppRoiConfig *cropAreas[],
1851- aclrtStream stream);
1852- 
1853-/**
1854- * @ingroup AscendCL
1855- * @brief dvpp vpc batch crop and resize config.
1856- *
1857- * @par Function
1858- * crop the input batch picture with resize config according to the specified area
1859- * as the output batch pictures
1860- *
1861- * @param channelDesc [IN] the channel destruction
1862- * @param srcBatchPicDescs [IN] crop input batch picture destruction
1863- * @param roiNums [IN] roi config numbers
1864- * @param size [IN] roiNum size
1865- * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
1866- * @param cropAreas [IN] crop area configs
1867- * @param resizeConfig [IN] resize config
1868- * @param stream [IN] crop batch and resize config task stream
1869- *
1870- * @retval ACL_SUCCESS The function is successfully executed.
1871- * @retval OtherValues Failure
1872- *
1873- * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateDvppConfig
1874- */
1875-ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeAsync(acldvppChannelDesc *channelDesc,
1876- acldvppBatchPicDesc *srcBatchPicDescs,
1877- uint32_t *roiNums, uint32_t size,
1878- acldvppBatchPicDesc *dstBatchPicDescs,
1879- acldvppRoiConfig *cropAreas[],
1880- acldvppResizeConfig *resizeConfig,
1881- aclrtStream stream);
1882- 
1883-/**
1884- * @ingroup AscendCL
1885- * @brief dvpp vpc crop and paste.
1886- *
1887- * @par Function
1888- * crop the input picture according to the specified area,
1889- * and paste the picture to the specified position of the target picture
1890- * as the output picture
1891- *
1892- * @param channelDesc [IN] thechannel destruction
1893- * @param inputDesc [IN] crop and paste input picture destruction
1894- * @param outputDesc [IN|OUT] crop and paste output picture destruction
1895- * @param cropArea [IN] crop area config
1896- * @param pasteArea [IN] paste area config
1897- * @param stream [IN] crop and paste task stream
1898- *
1899- * @retval ACL_SUCCESS The function is successfully executed.
1900- * @retval OtherValues Failure
1901- *
1902- * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig
1903- */
1904-ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc,
1905- acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
1906- acldvppRoiConfig *cropArea, acldvppRoiConfig *pasteArea,
1907- aclrtStream stream);
1908- 
1909-/**
1910- * @ingroup AscendCL
1911- * @brief dvpp vpc crop, resize config and paste.
1912- *
1913- * @par Function
1914- * crop the input picture with resize config according to the specified area,
1915- * and paste the picture to the specified position of the target picture
1916- * as the output picture
1917- *
1918- * @param channelDesc [IN] thechannel destruction
1919- * @param inputDesc [IN] crop and paste input picture destruction
1920- * @param outputDesc [IN|OUT] crop and paste output picture destruction
1921- * @param cropArea [IN] crop area config
1922- * @param pasteArea [IN] paste area config
1923- * @param resizeConfig [IN] resize config
1924- * @param stream [IN] crop, paste and resize task stream
1925- *
1926- * @retval ACL_SUCCESS The function is successfully executed.
1927- * @retval OtherValues Failure
1928- *
1929- * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig
1930- */
1931-ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc *channelDesc,
1932- acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
1933- acldvppRoiConfig *cropArea, acldvppRoiConfig *pasteArea,
1934- acldvppResizeConfig *resizeConfig,
1935- aclrtStream stream);
1936- 
1937-/**
1938- * @ingroup AscendCL
1939- * @brief dvpp vpc batch crop and paste.
1940- *
1941- * @par Function
1942- * crop the input batch picture according to the specified area,
1943- * and paste the pictures to the specified position of the target pictures
1944- * as the output batch pictures
1945- *
1946- * @param channelDesc [IN] the channel destruction
1947- * @param srcBatchPicDescs [IN] crop input batch picture destruction
1948- * @param roiNums [IN] roi config numbers
1949- * @param size [IN] roiNum size
1950- * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
1951- * @param cropAreas [IN] crop area configs
1952- * @param pasteAreas [IN] paste area configs
1953- * @param stream [IN] crop batch task stream
1954- *
1955- * @retval ACL_SUCCESS The function is successfully executed.
1956- * @retval OtherValues Failure
1957- *
1958- * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig
1959- */
1960- ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *channelDesc,
1961- acldvppBatchPicDesc *srcBatchPicDescs,
1962- uint32_t *roiNums, uint32_t size,
1963- acldvppBatchPicDesc *dstBatchPicDescs,
1964- acldvppRoiConfig *cropAreas[],
1965- acldvppRoiConfig *pasteAreas[],
1966- aclrtStream stream);
1967- 
1968-/**
1969- * @ingroup AscendCL
1970- * @brief dvpp vpc batch crop, resize config and paste.
1971- *
1972- * @par Function
1973- * crop the input batch picture with resize config according to the specified area,
1974- * and paste the pictures to the specified position of the target pictures
1975- * as the output batch pictures
1976- *
1977- * @param channelDesc [IN] the channel destruction
1978- * @param srcBatchPicDescs [IN] crop input batch picture destruction
1979- * @param roiNums [IN] roi config numbers
1980- * @param size [IN] roiNum size
1981- * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
1982- * @param cropAreas [IN] crop area configs
1983- * @param pasteAreas [IN] paste area configs
1984- * @param resizeConfig [IN] resize config
1985- * @param stream [IN] crop batch and resize config task stream
1986- *
1987- * @retval ACL_SUCCESS The function is successfully executed.
1988- * @retval OtherValues Failure
1989- *
1990- * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig
1991- */
1992-ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizePasteAsync(acldvppChannelDesc *channelDesc,
1993- acldvppBatchPicDesc *srcBatchPicDescs,
1994- uint32_t *roiNums, uint32_t size,
1995- acldvppBatchPicDesc *dstBatchPicDescs,
1996- acldvppRoiConfig *cropAreas[],
1997- acldvppRoiConfig *pasteAreas[],
1998- acldvppResizeConfig *resizeConfig,
1999- aclrtStream stream);
2000- 
2001- 
2002-/**
2003- * @ingroup AscendCL
2004- * @brief dvpp vpc jpeg decode.
2005- *
2006- * @par Function
2007- * For different source picture formats, after decoding,
2008- * output pictures in the following format:
2009- * @li jpeg(444) -> YUV444SP:V is front U is back,
2010- * YUV420 SP V is front U is back, YUV420SP U is front V is back;
2011- * @li jpeg(422) -> YUV422SP:V is in front U is behind,
2012- * YUV420SP V is in front U is behind, YUV420SP U is in front V is behind;
2013- * @li jpeg(420) -> YUV420SP:
2014- * V is front U is back, YUV420SP U is front V is back;
2015- * @li jpeg(400) -> YUV420SP:UV data is filled with 0 x 80.
2016- *
2017- * @param channelDesc [IN] the channel destruction
2018- * @param data [IN] decode input picture destruction's data
2019- * @param size [IN] decode input picture destruction's size
2020- * @param outputDesc [IN|OUT] decode output picture destruction
2021- * @param stream [IN] decode task stream
2022- *
2023- * @retval ACL_SUCCESS The function is successfully executed.
2024- * @retval OtherValues Failure
2025- *
2026- * @see acldvppCreateChannel | acldvppCreatePicDesc
2027- */
2028-ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc,
2029- const void *data, uint32_t size,
2030- acldvppPicDesc *outputDesc,
2031- aclrtStream stream);
2032- 
2033-/**
2034- * @ingroup AscendCL
2035- * @brief dvpp vpc jpeg encode.
2036- *
2037- * @param channelDesc [IN] the channel destruction
2038- * @param inputDesc [IN] encode input picture destruction
2039- * @param data [OUT] encode output picture destruction's data
2040- * @param size [IN|OUT] encode output picture destruction's size
2041- * @param config [IN] jpeg encode config
2042- * @param stream [IN] encode task stream
2043- *
2044- * @retval ACL_SUCCESS The function is successfully executed.
2045- * @retval OtherValues Failure
2046- *
2047- * @see acldvppCreateChannel | acldvppCreateJpegeConfig
2048- */
2049-ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc,
2050- acldvppPicDesc *inputDesc,
2051- const void *data, uint32_t *size,
2052- acldvppJpegeConfig *config,
2053- aclrtStream stream);
2054- 
2055-/**
2056- * @ingroup AscendCL
2057- * @brief dvpp vpc png decode.
2058- *
2059- * @param channelDesc [IN] the channel destruction
2060- * @param data [IN] decode input picture destruction's data
2061- * @param size [IN] decode input picture destruction's size
2062- * @param outputDesc [IN|OUT] decode output picture destruction
2063- * @param stream [IN] decode task stream
2064- *
2065- * @retval ACL_SUCCESS The function is successfully executed.
2066- * @retval OtherValues Failure
2067- *
2068- * @see acldvppCreateChannel | acldvppCreatePicDesc
2069- */
2070-ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc,
2071- const void *data, uint32_t size,
2072- acldvppPicDesc *outputDesc,
2073- aclrtStream stream);
2074- 
2075-/**
2076- * @ingroup AscendCL
2077- * @brief Create vdec channel.
2078- *
2079- * @par Function
2080- * Create a channel for video data processing,
2081- * the same channel can be reused,
2082- * and is no longer available after destruction
2083- *
2084- * @param channelDesc [IN|OUT] the channel destruction
2085- *
2086- * @retval ACL_SUCCESS The function is successfully executed.
2087- * @retval OtherValues Failure
2088- *
2089- * @see aclvdecCreateChannelDesc
2090- */
2091-ACL_FUNC_VISIBILITY aclError aclvdecCreateChannel(aclvdecChannelDesc *channelDesc);
2092- 
2093-/**
2094- * @ingroup AscendCL
2095- * @brief Destroy vdec channel.
2096- *
2097- * @par Function
2098- * Can only destroy channels created by the aclvdecCreateChannel interface
2099- *
2100- * @param channelDesc [IN] the channel destruction
2101- *
2102- * @retval ACL_SUCCESS The function is successfully executed.
2103- * @retval OtherValues Failure
2104- *
2105- * @see aclvdecCreateChannel
2106- */
2107-ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannel(aclvdecChannelDesc *channelDesc);
2108- 
2109-/**
2110- * @ingroup AscendCL
2111- * @brief dvpp vdec send frame.
2112- *
2113- * @par Function
2114- * Pass the input memory to be decoded
2115- * and the decoded output memory to the decoder for decoding
2116- *
2117- * @param channelDesc [IN] vdec channel destruction
2118- * @param input [IN] input stream destruction
2119- * @param output [IN|OUT] output picture destruction
2120- * @param config [IN] vdec frame config
2121- * @param userData [IN] user data for callback function
2122- *
2123- * @retval ACL_SUCCESS The function is successfully executed.
2124- * @retval OtherValues Failure
2125- *
2126- * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc
2127- */
2128-ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc,
2129- acldvppStreamDesc *input,
2130- acldvppPicDesc *output,
2131- aclvdecFrameConfig *config,
2132- void *userData);
2133- 
2134-/**
2135- * @ingroup AscendCL
2136- * @brief dvpp vdec send skipped frame.
2137- *
2138- * @par Function
2139- * Pass video frame to decoder
2140- *
2141- * @param channelDesc [IN] vdec channel destruction
2142- * @param input [IN] input stream destruction
2143- * @param config [IN] vdec frame config
2144- * @param userData [IN] user data for callback function
2145- *
2146- * @retval ACL_SUCCESS The function is successfully executed.
2147- * @retval OtherValues Failure
2148- *
2149- * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc | aclvdecSendFrame
2150- */
2151-ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc,
2152- acldvppStreamDesc *input,
2153- aclvdecFrameConfig *config,
2154- void *userData);
2155- 
2156-/**
2157- * @ingroup AscendCL
2158- * @brief dvpp vpc convert color.
2159- *
2160- * @par Restriction
2161- * @li outputDesc:Width height stride, No changes are allowed. Just configure 0
2162- * @par Function
2163- * Convert color gamut
2164- *
2165- * @param channelDesc [IN] the channel destruction
2166- * @param inputDesc [IN] convert color input picture destruction
2167- * @param outputDesc [IN|OUT] convert color output picture destruction
2168- * @param stream [IN] convert color task stream
2169- *
2170- * @retval ACL_SUCCESS The function is successfully executed.
2171- * @retval OtherValues Failure
2172- *
2173- * @see acldvppCreateChannel | acldvppCreatePicDesc
2174- */
2175-ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc,
2176- acldvppPicDesc *inputDesc,
2177- acldvppPicDesc *outputDesc,
2178- aclrtStream stream);
2179- 
2180-/**
2181- * @ingroup AscendCL
2182- * @brief dvpp vpc pyramid down.
2183- *
2184- * @par Restriction
2185- * @li outputDesc:format only supported YUV400
2186- * @par Function
2187- * Image pyramid down
2188- *
2189- * @param channelDesc [IN] the channel destruction
2190- * @param inputDesc [IN] pyr down input picture destruction
2191- * @param outputDesc [IN|OUT] pyr down output picture destruction
2192- * @param reserve [IN] reserved param , must be nullptr
2193- * @param stream [IN] pyr down task stream
2194- *
2195- * @retval ACL_SUCCESS The function is successfully executed.
2196- * @retval OtherValues Failure
2197- *
2198- * @see acldvppCreateChannel | acldvppCreatePicDesc
2199- */
2200-ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc,
2201- acldvppPicDesc *inputDesc,
2202- acldvppPicDesc *outputDesc,
2203- void *reserve,
2204- aclrtStream stream);
2205- 
2206-/**
2207- * @ingroup AscendCL
2208- * @brief Set dvpp channel mode.
2209- *
2210- * @param channelDesc [OUT] the channel destruction
2211- * @param mode [IN] channel mode
2212- *
2213- * @retval ACL_SUCCESS The function is successfully executed.
2214- * @retval OtherValues Failure
2215- */
2216-ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, uint32_t mode);
2217- 
2218-/**
2219- * @ingroup AscendCL
2220- * @brief Set resize config interpolation.
2221- *
2222- * @param resizeConfig [OUT] the resize config
2223- * @param interpolation [IN] interpolation
2224- *
2225- * @retval ACL_SUCCESS The function is successfully executed.
2226- * @retval OtherValues Failure
2227- */
2228-ACL_FUNC_VISIBILITY aclError acldvppSetResizeConfigInterpolation(acldvppResizeConfig *resizeConfig,
2229- uint32_t interpolation);
2230- 
2231-/**
2232- * @ingroup AscendCL
2233- * @brief Get resize config interpolation.
2234- *
2235- * @param resizeConfig [IN] the resize config
2236- *
2237- * @retval Interpolation of resize config.
2238- */
2239-ACL_FUNC_VISIBILITY uint32_t acldvppGetResizeConfigInterpolation(const acldvppResizeConfig *resizeConfig);
2240- 
2241-/**
2242- * @ingroup AscendCL
2243- * @brief Set vdec channel out mode.
2244- *
2245- * @param channelDesc [OUT] the channel destruction
2246- * @param outMode [IN] channel out mode
2247- *
2248- * @retval ACL_SUCCESS The function is successfully executed.
2249- * @retval OtherValues Failure
2250- */
2251-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, uint32_t outMode);
2252- 
2253-/**
2254- * @ingroup AscendCL
2255- * @brief Get vdec channel out mode.
2256- *
2257- * @param channelDesc [IN] the channel destruction
2258- *
2259- * @retval Out mode of channel destruction
2260- * @retval default 0
2261- */
2262-ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutMode(const aclvdecChannelDesc *channelDesc);
2263- 
2264-/**
2265- * @ingroup AscendCL
2266- * @brief Create dvpp batch picture description.
2267- *
2268- * @param batchSize [IN] batch size
2269- *
2270- * @retval null for failed.
2271- * @retval OtherValues success.
2272- */
2273-ACL_FUNC_VISIBILITY acldvppBatchPicDesc *acldvppCreateBatchPicDesc(uint32_t batchSize);
2274- 
2275-/**
2276- * @ingroup AscendCL
2277- * @brief Get dvpp picture description.
2278- *
2279- * @param batchPicDesc [IN] dvpp batch picture description.
2280- * @param index [IN] index of batch
2281- *
2282- * @retval null for failed.
2283- * @retval OtherValues Failure
2284- *
2285- * @see acldvppCreateBatchPicDesc
2286- */
2287-ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppGetPicDesc(acldvppBatchPicDesc *batchPicDesc, uint32_t index);
2288- 
2289-/**
2290- * @ingroup AscendCL
2291- * @brief Destroy dvpp batch picture description.
2292- *
2293- * @par Function
2294- * Can only destroy batch picture description information created
2295- * through acldvppCreateBatchPicDesc interface.
2296- *
2297- * @param batchPicDesc [IN] dvpp batch picture description.
2298- *
2299- * @retval ACL_SUCCESS The function is successfully executed.
2300- * @retval OtherValues Failure
2301- *
2302- * @see acldvppCreateBatchPicDesc
2303- */
2304-ACL_FUNC_VISIBILITY aclError acldvppDestroyBatchPicDesc(acldvppBatchPicDesc *batchPicDesc);
2305- 
2306-/**
2307- * @ingroup AscendCL
2308- * @brief Create dvpp lut map.
2309- *
2310- * @retval null for failed.
2311- * @retval OtherValues success.
2312- */
2313-ACL_FUNC_VISIBILITY acldvppLutMap *acldvppCreateLutMap();
2314- 
2315-/**
2316- * @ingroup AscendCL
2317- * @brief Destroy lut map.
2318- *
2319- * @param lutMap [IN] lut map
2320- *
2321- * @retval ACL_SUCCESS for success, other for failure
2322- */
2323-ACL_FUNC_VISIBILITY aclError acldvppDestroyLutMap(acldvppLutMap *lutMap);
2324- 
2325-/**
2326- * @ingroup AscendCL
2327- * @brief Get lut map dims.
2328- *
2329- * @param lutMap [IN] lut map
2330- *
2331- * @retval 0 for failed.
2332- * @retval OtherValues success.
2333- */
2334-ACL_FUNC_VISIBILITY uint32_t acldvppGetLutMapDims(const acldvppLutMap *lutMap);
2335- 
2336-/**
2337- * @ingroup AscendCL
2338- * @brief Get lut map data.
2339- *
2340- * @param lutMap [IN] lut map
2341- * @param dim [IN] input dim of map
2342- * @param data [OUT] the dim of lut map's data
2343- * @param len [OUT] the dim of lut map's length
2344- *
2345- * @retval ACL_SUCCESS The function is successfully executed.
2346- * @retval OtherValues Failure
2347- */
2348-ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, uint32_t dim,
2349- uint8_t **data, uint32_t *len);
2350-/**
2351- * @ingroup AscendCL
2352- * @brief Vpc equalize hist.
2353- *
2354- * @param channelDesc [IN] channel desc
2355- * @param inputDesc [IN] input desc
2356- * @param outputDesc [IN|OUT] output desc
2357- * @param lutMap [IN] lut map param
2358- * @param stream [IN] runtime stream
2359- *
2360- * @retval ACL_SUCCESS The function is successfully executed.
2361- * @retval OtherValues Failure
2362- *
2363- * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateLutMap
2364- */
2365-ACL_FUNC_VISIBILITY aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *channelDesc,
2366- const acldvppPicDesc *inputDesc,
2367- acldvppPicDesc *outputDesc,
2368- const acldvppLutMap *lutMap,
2369- aclrtStream stream);
2370- 
2371-/**
2372- * @ingroup AscendCL
2373- * @brief Create dvpp border config.
2374- *
2375- * @retval null for failed.
2376- * @retval OtherValues success.
2377- */
2378-ACL_FUNC_VISIBILITY acldvppBorderConfig *acldvppCreateBorderConfig();
2379- 
2380-/**
2381- * @ingroup AscendCL
2382- * @brief Set value of border config.
2383- *
2384- * @param borderConfig [OUT] border config
2385- * @param index [IN] index of value array
2386- * @param value [IN] value
2387- *
2388- * @retval ACL_SUCCESS for success, other for failure
2389- */
2390-ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig,
2391- uint32_t index, double value);
2392- 
2393-/**
2394- * @ingroup AscendCL
2395- * @brief Set border type of border config.
2396- *
2397- * @param borderConfig [OUT] border config
2398- * @param borderType [IN] border type
2399- *
2400- * @retval ACL_SUCCESS for success, other for failure
2401- */
2402-ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBorderType(acldvppBorderConfig *borderConfig,
2403- acldvppBorderType borderType);
2404- 
2405-/**
2406- * @ingroup AscendCL
2407- * @brief Set top of border config.
2408- *
2409- * @param borderConfig [OUT] border config
2410- * @param top [IN] top of border
2411- *
2412- * @retval ACL_SUCCESS for success, other for failure
2413- */
2414-ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigTop(acldvppBorderConfig *borderConfig, uint32_t top);
2415- 
2416-/**
2417- * @ingroup AscendCL
2418- * @brief Set bottom of border config.
2419- *
2420- * @param borderConfig [OUT] border config
2421- * @param bottom [IN] bottom of border
2422- *
2423- * @retval ACL_SUCCESS for success, other for failure
2424- */
2425-ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBottom(acldvppBorderConfig *borderConfig, uint32_t bottom);
2426- 
2427-/**
2428- * @ingroup AscendCL
2429- * @brief Set left of border config.
2430- *
2431- * @param borderConfig [OUT] border config
2432- * @param left [IN] left of border
2433- *
2434- * @retval ACL_SUCCESS for success, other for failure
2435- */
2436-ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigLeft(acldvppBorderConfig *borderConfig, uint32_t left);
2437- 
2438-/**
2439- * @ingroup AscendCL
2440- * @brief Set right of border config.
2441- *
2442- * @param borderConfig [OUT] border config
2443- * @param right [IN] right of border
2444- *
2445- * @retval ACL_SUCCESS for success, other for failure
2446- */
2447-ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigRight(acldvppBorderConfig *borderConfig, uint32_t right);
2448- 
2449-/**
2450- * @ingroup AscendCL
2451- * @brief Get value of border config.
2452- *
2453- * @param borderConfig [IN] border config
2454- * @param index[IN] index of value array
2455- *
2456- * @retval invalid value is < 0, normal Value is >= 0
2457- */
2458-ACL_FUNC_VISIBILITY double acldvppGetBorderConfigValue(const acldvppBorderConfig *borderConfig, uint32_t index);
2459- 
2460-/**
2461- * @ingroup AscendCL
2462- * @brief Get border type of border config.
2463- *
2464- * @param borderConfig [IN] border config
2465- * @retval border type of border config
2466- */
2467-ACL_FUNC_VISIBILITY acldvppBorderType acldvppGetBorderConfigBorderType(const acldvppBorderConfig *borderConfig);
2468- 
2469-/**
2470- * @ingroup AscendCL
2471- * @brief Get right of border config.
2472- *
2473- * @param borderConfig [IN] border config
2474- *
2475- * @retval default 0, top value of border config
2476- */
2477-ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigTop(const acldvppBorderConfig *borderConfig);
2478- 
2479-/**
2480- * @ingroup AscendCL
2481- * @brief Get Bottom of border config.
2482- *
2483- * @param borderConfig [IN] border config
2484- *
2485- * @retval default 0, top value of border config
2486- */
2487-ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigBottom(const acldvppBorderConfig *borderConfig);
2488- 
2489-/**
2490- * @ingroup AscendCL
2491- * @brief Get left of border config.
2492- *
2493- * @param borderConfig [IN] border config
2494- *
2495- * @retval default 0, top value of border config
2496- */
2497-ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigLeft(const acldvppBorderConfig *borderConfig);
2498- 
2499-/**
2500- * @ingroup AscendCL
2501- * @brief Get right of border config.
2502- *
2503- * @param borderConfig [IN] border config
2504- *
2505- * @retval default 0, right value of border config
2506- */
2507-ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigRight(const acldvppBorderConfig *borderConfig);
2508- 
2509-/**
2510- * @ingroup AscendCL
2511- * @brief Destroy border config.
2512- *
2513- * @param borderConfig [IN] border config
2514- *
2515- * @retval ACL_SUCCESS for success, other for failure
2516- */
2517-ACL_FUNC_VISIBILITY aclError acldvppDestroyBorderConfig(acldvppBorderConfig *borderConfig);
2518- 
2519-/**
2520- * @ingroup AscendCL
2521- * @brief Vpc make border.
2522- *
2523- * @param channelDesc [IN] channel desc
2524- * @param inputDesc [IN] input desc
2525- * @param outputDesc [IN|OUT] output desc
2526- * @param borderConfig [IN] border config param
2527- * @param stream [IN] runtime stream
2528- *
2529- * @retval ACL_SUCCESS The function is successfully executed.
2530- * @retval OtherValues Failure
2531- *
2532- * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateBorderConfig
2533- */
2534-ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *channelDesc,
2535- const acldvppPicDesc *inputDesc,
2536- acldvppPicDesc *outputDesc,
2537- const acldvppBorderConfig *borderConfig,
2538- aclrtStream stream);
2539- 
2540-/**
2541- * @ingroup AscendCL
2542- * @brief Dvpp vpc calc hist.
2543- *
2544- * @param channelDesc [IN] the channel destruction
2545- * @param srcPicDesc [IN] pyr down input picture destruction
2546- * @param hist [IN|OUT] pyr down output picture destruction
2547- * @param reserve [IN] reserved param, must be nullptr
2548- * @param stream [IN] task stream
2549- *
2550- * @retval ACL_SUCCESS The function is successfully executed.
2551- * @retval OtherValues Failure
2552- *
2553- * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateHist
2554- */
2555-ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc,
2556- acldvppPicDesc *srcPicDesc,
2557- acldvppHist *hist,
2558- void *reserve,
2559- aclrtStream stream);
2560- 
2561-/**
2562- * @ingroup AscendCL
2563- * @brief Create vpc hist description.
2564- *
2565- * @retval null for failed.
2566- * @retval OtherValues success.
2567- */
2568-ACL_FUNC_VISIBILITY acldvppHist* acldvppCreateHist();
2569- 
2570-/**
2571- * @ingroup AscendCL
2572- * @brief Destroy vpc hist description.
2573- *
2574- * @par Function
2575- * Can only destroy hist description information created
2576- * through acldvppCreateHist interface.
2577- *
2578- * @param hist [IN] vpc hist description.
2579- *
2580- * @retval ACL_SUCCESS The function is successfully executed.
2581- * @retval OtherValues Failure
2582- *
2583- * @see acldvppCreateHist
2584- */
2585-ACL_FUNC_VISIBILITY aclError acldvppDestroyHist(acldvppHist *hist);
2586- 
2587-/**
2588- * @ingroup AscendCL
2589- * @brief Get dims of vpc hist description.
2590- *
2591- * @param hist [IN] vpc hist description.
2592- *
2593- * @retval dims of vpc hist description.
2594- *
2595- * @see acldvppCreateHist | acldvppVpcCalcHistAsync
2596- */
2597-ACL_FUNC_VISIBILITY uint32_t acldvppGetHistDims(acldvppHist *hist);
2598- 
2599-/**
2600- * @ingroup AscendCL
2601- * @brief Get data from vpc hist description by dim.
2602- *
2603- * @param hist [IN] vpc hist description.
2604- * @param dim [IN] which dim to get data.
2605- * @param data [OUT] address of output hist data.
2606- * @param len [OUT] len of output hist data.
2607- *
2608- * @retval ACL_SUCCESS The function is successfully executed.
2609- * @retval OtherValues Failure
2610- *
2611- * @see acldvppCreateHist | acldvppVpcCalcHistAsync
2612- */
2613-ACL_FUNC_VISIBILITY aclError acldvppGetHistData(acldvppHist *hist, uint32_t dim, uint32_t **data, uint16_t *len);
2614- 
2615-/**
2616- * @ingroup AscendCL
2617- * @brief Get dvpp calc hist process return code.
2618- *
2619- * @param hist [IN] vpc hist description.
2620- *
2621- * @retval Dvpp calc hist process return code.
2622- *
2623- * @see acldvppCreateHist | acldvppVpcCalcHistAsync
2624- */
2625-ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist* hist);
2626- 
2627-/**
2628- * @ingroup AscendCL
2629- * @brief Set vpc hist description to 0.
2630- *
2631- * @par Function
2632- * Can only clear hist description information created
2633- * through acldvppCreateHist interface.
2634- *
2635- * @param hist [IN] vpc hist description.
2636- *
2637- * @retval ACL_SUCCESS The function is successfully executed.
2638- * @retval OtherValues Failure
2639- *
2640- * @see acldvppCreateHist
2641- */
2642-ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist);
2643- 
2644- 
2645-/**
2646- * @ingroup AscendCL
2647- * @brief dvpp vpc batch crop, resize config and make border.
2648- *
2649- * @par Function
2650- * crop the input batch picture with resize config and border configs according to the specified area
2651- * as the output batch pictures
2652- *
2653- * @param channelDesc [IN] the channel destruction
2654- * @param srcBatchPicDescs [IN] crop input batch picture destruction
2655- * @param roiNums [IN] roi config numbers
2656- * @param size [IN] roiNum size
2657- * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
2658- * @param cropAreas [IN] crop area configs
2659- * @param borderCfgs [IN] border configs
2660- * @param resizeConfig [IN] resize config
2661- * @param stream [IN] crop batch, resize config and make border task stream
2662- *
2663- * @retval ACL_SUCCESS The function is successfully executed.
2664- * @retval OtherValues Failure
2665- *
2666- * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig
2667- */
2668-ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeMakeBorderAsync(acldvppChannelDesc *channelDesc,
2669- acldvppBatchPicDesc *srcBatchPicDescs,
2670- uint32_t *roiNums,
2671- uint32_t size,
2672- acldvppBatchPicDesc *dstBatchPicDescs,
2673- acldvppRoiConfig *cropAreas[],
2674- acldvppBorderConfig *borderCfgs[],
2675- acldvppResizeConfig *resizeConfig,
2676- aclrtStream stream);
2677-/**
2678- * @ingroup AscendCL
2679- * @brief set param for dvpp channel desc
2680- *
2681- * @par Function
2682- * set attribution in dvpp channelDesc for specified type
2683- *
2684- * @param channelDesc [OUT] the channel destruction
2685- * @param paramType [IN] specified param type
2686- * @param length [IN] mem length of param
2687- * @param param [IN] pointer to param
2688- *
2689- * @retval ACL_SUCCESS The function is successfully executed.
2690- * @retval OtherValues Failure
2691- *
2692- * @see acldvppGetChannelDescParam | acldvppCreateChannelDesc | acldvppDestroyChannelDesc
2693- */
2694-ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescParam(acldvppChannelDesc *channelDesc,
2695- acldvppChannelDescParamType paramType,
2696- size_t length,
2697- const void *param);
2698- 
2699-/**
2700- * @ingroup AscendCL
2701- * @brief get param of dvpp channel desc
2702- *
2703- * @par Function
2704- * get attribution value in dvpp channelDesc for specified type
2705- *
2706- * @param channelDesc [IN] the channel destruction
2707- * @param paramType [IN] specified param type
2708- * @param length [IN] mem length allocated for output param
2709- * @param paramRetSize [OUT] mem length of output param
2710- * @param param [OUT] pointer to output param
2711- *
2712- * @retval ACL_SUCCESS The function is successfully executed.
2713- * @retval OtherValues Failure
2714- *
2715- * @see acldvppSetChannelDescParam | acldvppCreateChannelDesc | acldvppDestroyChannelDesc
2716- */
2717-ACL_FUNC_VISIBILITY aclError acldvppGetChannelDescParam(const acldvppChannelDesc *channelDesc,
2718- acldvppChannelDescParamType paramType,
2719- size_t length,
2720- size_t *paramRetSize,
2721- void *param);
2722-/**
2723- * @ingroup AscendCL
2724- * @brief set param for vdec channel desc
2725- *
2726- * @par Function
2727- * set attribution in channelDesc for specified type
2728- *
2729- * @param channelDesc [OUT] the vdec channel destruction
2730- * @param paramType [IN] specified param type
2731- * @param length [IN] mem length of param
2732- * @param param [IN] pointer to param
2733- *
2734- * @retval ACL_SUCCESS The function is successfully executed.
2735- * @retval OtherValues Failure
2736- *
2737- * @see aclvdecGetChannelDescParam | aclvdecCreateChannelDesc | aclvdecDestroyChannelDesc
2738- */
2739-ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescParam(aclvdecChannelDesc *channelDesc,
2740- aclvdecChannelDescParamType paramType,
2741- size_t length,
2742- const void *param);
2743- 
2744-/**
2745- * @ingroup AscendCL
2746- * @brief get param of vdec channel desc
2747- *
2748- * @par Function
2749- * get attribution value in channelDesc for specified type
2750- *
2751- * @param channelDesc [IN] the vdec channel destruction
2752- * @param paramType [IN] specified param type
2753- * @param length [IN] mem length allocated for output param
2754- * @param paramRetSize [OUT] mem length of output param
2755- * @param param [OUT] pointer to output param
2756- *
2757- * @retval ACL_SUCCESS The function is successfully executed.
2758- * @retval OtherValues Failure
2759- *
2760- * @see aclvdecSetChannelDescParam | aclvdecCreateChannelDesc | aclvdecDestroyChannelDesc
2761- */
2762-ACL_FUNC_VISIBILITY aclError aclvdecGetChannelDescParam(const aclvdecChannelDesc *channelDesc,
2763- aclvdecChannelDescParamType paramType,
2764- size_t length,
2765- size_t *paramRetSize,
2766- void *param);
2767-#ifdef __cplusplus
2768-}
2769-#endif
2770- 
2771-#endif // INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_
Dthird_party/acl/inc/acl/ops/acl_fv.h+0-339
@@ -1,339 +0,0 @@
1-/**
2- * @file acl_fv.h
3- *
4- * Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
5- *
6- * This program is distributed in the hope that it will be useful,
7- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9- */
10-#ifndef INC_EXTERNAL_ACL_OPS_ACL_RETR_H_
11-#define INC_EXTERNAL_ACL_OPS_ACL_RETR_H_
12- 
13-#include "acl/acl.h"
14- 
15-#ifdef __cplusplus
16-extern "C" {
17-#endif
18- 
19-typedef struct aclfvInitPara aclfvInitPara;
20-typedef struct aclfvFeatureInfo aclfvFeatureInfo;
21-typedef struct aclfvRepoRange aclfvRepoRange;
22-typedef struct aclfvQueryTable aclfvQueryTable;
23-typedef struct aclfvSearchInput aclfvSearchInput;
24-typedef struct aclfvSearchResult aclfvSearchResult;
25- 
26-// search operation type
27-enum aclfvSearchType {
28- SEARCH_1_N, // 1:N operation type
29- SEARCH_N_M // N:M operation type
30-};
31- 
32-/**
33- * @ingroup AscendCL
34- * @brief Create fv init param.
35- *
36- * @param fsNum [IN] The feature num
37- *
38- * @retval null for failed.
39- * @retval OtherValues success.
40- */
41-ACL_FUNC_VISIBILITY aclfvInitPara *aclfvCreateInitPara(uint64_t fsNum);
42- 
43-/**
44- * @ingroup AscendCL
45- * @brief Destroy fv init param.
46- *
47- * @par Function
48- * Can only destroy fv init param information created
49- * through aclfvCreateInitPara interface.
50- *
51- * @param initPara [IN] fv init param.
52- *
53- * @retval ACL_SUCCESS The function is successfully executed.
54- * @retval OtherValues Failure
55- *
56- * @see aclfvCreateInitPara
57- */
58-ACL_FUNC_VISIBILITY aclError aclfvDestroyInitPara(aclfvInitPara *initPara);
59- 
60-/**
61- * @ingroup AscendCL
62- * @brief set value for maxTopNumFor1N which in fv init param.
63- *
64- * @param initPara [IN|OUT] fv init param.
65- * @param maxTopNumFor1N [IN] maxTopNumFor1N value for init param.
66- *
67- * @retval ACL_SUCCESS The function is successfully executed.
68- * @retval OtherValues Failure
69- */
70-ACL_FUNC_VISIBILITY aclError aclfvSet1NTopNum(aclfvInitPara *initPara, uint32_t maxTopNumFor1N);
71- 
72-/**
73- * @ingroup AscendCL
74- * @brief set value for maxTopNumForNM which in fv init param.
75- *
76- * @param initPara [IN|OUT] fv init param.
77- * @param maxTopNumForNM [IN] maxTopNumForNM value for init param.
78- *
79- * @retval ACL_SUCCESS The function is successfully executed.
80- * @retval OtherValues Failure
81- */
82-ACL_FUNC_VISIBILITY aclError aclfvSetNMTopNum(aclfvInitPara *initPara, uint32_t maxTopNumForNM);
83- 
84-/**
85- * @ingroup AscendCL
86- * @brief Create fv feature info.
87- *
88- * @param id0 [IN] The first level library id0
89- * @param id1 [IN] Secondary library id1
90- * @param offset [IN] The offset of the first feature in the library
91- * @param featureLen [IN] Single feature length
92- * @param featureCount [IN] Single feature count
93- * @param featureData [IN] Feature value list
94- * @param featureDataLen [IN] Feature value list length
95- *
96- * @retval null for failed.
97- * @retval OtherValues success.
98- */
99-ACL_FUNC_VISIBILITY aclfvFeatureInfo *aclfvCreateFeatureInfo(uint32_t id0, uint32_t id1, uint32_t offset,
100- uint32_t featureLen, uint32_t featureCount, uint8_t *featureData, uint32_t featureDataLen);
101- 
102-/**
103- * @ingroup AscendCL
104- * @brief Destroy fv feature info.
105- *
106- * @par Function
107- * Can only destroy fv feature info information created
108- * through aclfvCreateFeatureInfo interface.
109- *
110- * @param featureInfo [IN] fv feature info.
111- *
112- * @retval ACL_SUCCESS The function is successfully executed.
113- * @retval OtherValues Failure
114- *
115- * @see aclfvCreateFeatureInfo
116- */
117-ACL_FUNC_VISIBILITY aclError aclfvDestroyFeatureInfo(aclfvFeatureInfo *featureInfo);
118- 
119-/**
120- * @ingroup AscendCL
121- * @brief Create fv repo range.
122- *
123- * @param id0Min [IN] id0 start value
124- * @param id0Min [IN] id0 max
125- * @param id1Min [IN] id0 start value
126- * @param id1Max [IN] id1 max
127- *
128- * @retval null for failed. OtherValues success
129- */
130-ACL_FUNC_VISIBILITY aclfvRepoRange *aclfvCreateRepoRange(uint32_t id0Min, uint32_t id0Max, uint32_t id1Min,
131- uint32_t id1Max);
132- 
133-/**
134- * @ingroup AscendCL
135- * @brief Destroy fv repo range.
136- *
137- * @par Function
138- * Can only destroy fv repo range information created
139- * through aclfvCreateRepoRange interface.
140- *
141- * @param repoRange [IN] fv repo range.
142- *
143- * @retval ACL_SUCCESS The function is successfully executed.
144- * @retval OtherValues Failure
145- *
146- * @see aclfvCreateRepoRange
147- */
148-ACL_FUNC_VISIBILITY aclError aclfvDestroyRepoRange(aclfvRepoRange *repoRange);
149- 
150-/**
151- * @ingroup AscendCL
152- * @brief Create query table.
153- *
154- * @param queryCnt [IN] Number of tables, the maximum number is 6
155- * @param tableLen [IN] Single table length, table length is 32KB
156- * @param tableData [IN] Feature value list
157- * @param tableDataLen [IN] The length of memory requested by the featureData pointer
158- *
159- * @retval null for failed. OtherValues success
160- */
161-ACL_FUNC_VISIBILITY aclfvQueryTable *aclfvCreateQueryTable(uint32_t queryCnt, uint32_t tableLen, uint8_t *tableData,
162- uint32_t tableDataLen);
163- 
164-/**
165- * @ingroup AscendCL
166- * @brief Destroy query table.
167- *
168- * @par Function
169- * Can only destroy query table information created
170- * through aclfvCreateQueryTable interface.
171- *
172- * @param queryTable [IN] query table.
173- *
174- * @retval ACL_SUCCESS The function is successfully executed.
175- * @retval OtherValues Failure
176- *
177- * @see aclfvCreateQueryTable
178- */
179-ACL_FUNC_VISIBILITY aclError aclfvDestroyQueryTable(aclfvQueryTable *queryTable);
180- 
181-/**
182- * @ingroup AscendCL
183- * @brief Create search input.
184- *
185- * @param queryTable [IN] query table
186- * @param repoRange [IN] query repo range
187- * @param topk [IN] query topk
188- *
189- * @retval null for failed. OtherValues success
190- */
191-ACL_FUNC_VISIBILITY aclfvSearchInput *aclfvCreateSearchInput(aclfvQueryTable *queryTable, aclfvRepoRange *repoRange,
192- uint32_t topk);
193- 
194-/**
195- * @ingroup AscendCL
196- * @brief Destroy search input.
197- *
198- * @par Function
199- * Can only destroy search input information created
200- * through aclfvCreateSearchInput interface.
201- *
202- * @param searchInput [IN] search input.
203- *
204- * @retval ACL_SUCCESS The function is successfully executed.
205- * @retval OtherValues Failure
206- *
207- * @see aclfvCreateSearchInput
208- */
209-ACL_FUNC_VISIBILITY aclError aclfvDestroySearchInput(aclfvSearchInput *searchInput);
210- 
211-/**
212- * @ingroup AscendCL
213- * @brief Create search result.
214- *
215- * @param queryCnt [IN] Retrieve the number of features
216- * @param resultNum [IN] The number of search results for each feature, the number is queryCnt
217- * @param resultNumDataLen [IN] resultNum memory length
218- * @param id0 [IN] Level 1 library id0
219- * @param id1 [IN] Secondary library id1
220- * @param resultOffset [IN] The offset of the bottom library corresponding
221- * to each feature retrieval result, total length topK * queryCnt
222- * @param resultDistance [IN] Distance, total length topK * queryCnt
223- * @param dataLen [IN] The memory size requested by
224- * id0\id1\reslutOffset\resultDistance
225- *
226- * @retval null for failed. OtherValues success
227- */
228-ACL_FUNC_VISIBILITY aclfvSearchResult *aclfvCreateSearchResult(uint32_t queryCnt, uint32_t *resultNum,
229- uint32_t resultNumDataLen, uint32_t *id0, uint32_t *id1, uint32_t *resultOffset, float *resultDistance,
230- uint32_t dataLen);
231- 
232-/**
233- * @ingroup AscendCL
234- * @brief Destroy search result.
235- *
236- * @par Function
237- * Can only destroy search result information created
238- * through aclfvCreateSearchResult interface.
239- *
240- * @param searchResult [IN] search result.
241- *
242- * @retval ACL_SUCCESS The function is successfully executed.
243- * @retval OtherValues Failure
244- *
245- * @see aclfvCreateSearchResult
246- */
247-ACL_FUNC_VISIBILITY aclError aclfvDestroySearchResult(aclfvSearchResult *searchResult);
248- 
249-/**
250- * @ingroup AscendCL
251- * @brief fv IP initialize.
252- *
253- * @param initPara [IN] fv init param.
254- *
255- * @retval ACL_SUCCESS The function is successfully executed.
256- * @retval OtherValues Failure.
257- */
258-ACL_FUNC_VISIBILITY aclError aclfvInit(aclfvInitPara *initPara);
259- 
260-/**
261- * @ingroup AscendCL
262- * @brief release fv resources.
263- *
264- * @par Function
265- * Can only release fv resources created
266- * through aclfvInit interface.
267- *
268- * @retval ACL_SUCCESS The function is successfully executed.
269- * @retval OtherValues Failure.
270- *
271- * @see aclfvInit
272- */
273-ACL_FUNC_VISIBILITY aclError aclfvRelease();
274- 
275-/**
276- * @ingroup AscendCL
277- * @brief fv repo add.
278- *
279- * @param type [IN] repo add type
280- * @param featureInfo [IN] add feature information
281- *
282- * @retval ACL_SUCCESS The function is successfully executed.
283- * @retval OtherValues Failure.
284- */
285-ACL_FUNC_VISIBILITY aclError aclfvRepoAdd(aclfvSearchType type, aclfvFeatureInfo *featureInfo);
286- 
287-/**
288- * @ingroup AscendCL
289- * @brief fv repo del.
290- *
291- * @param type [IN] repo delete type
292- * @param repoRange [IN] repo range information
293- *
294- * @retval ACL_SUCCESS The function is successfully executed.
295- * @retval OtherValues Failure.
296- */
297-ACL_FUNC_VISIBILITY aclError aclfvRepoDel(aclfvSearchType type, aclfvRepoRange *repoRange);
298- 
299-/**
300- * @ingroup AscendCL
301- * @brief fv accurate del.
302- *
303- * @param featureInfo [IN] accurate delete feature information
304- *
305- * @retval ACL_SUCCESS The function is successfully executed.
306- * @retval OtherValues Failure.
307- */
308-ACL_FUNC_VISIBILITY aclError aclfvDel(aclfvFeatureInfo *featureInfo);
309- 
310-/**
311- * @ingroup AscendCL
312- * @brief fv accurate modify.
313- *
314- * @param featureInfo [IN] accurate modify feature information
315- *
316- * @retval ACL_SUCCESS The function is successfully executed.
317- * @retval OtherValues Failure.
318- */
319-ACL_FUNC_VISIBILITY aclError aclfvModify(aclfvFeatureInfo *featureInfo);
320- 
321-/**
322- * @ingroup AscendCL
323- * @brief fv search.
324- *
325- * @param type [IN] search type
326- * @param searchInput [IN] search input
327- * @param searchRst [OUT] search result
328- *
329- * @retval ACL_SUCCESS The function is successfully executed.
330- * @retval OtherValues Failure.
331- */
332-ACL_FUNC_VISIBILITY aclError aclfvSearch(aclfvSearchType type, aclfvSearchInput *searchInput,
333- aclfvSearchResult *searchRst);
334- 
335-#ifdef __cplusplus
336-}
337-#endif
338- 
339-#endif // INC_EXTERNAL_ACL_OPS_ACL_RETR_H_
Athird_party/acl_src/ge+1-0
@@ -0,0 +1 @@
1+Subproject commit a74342b574f03ffe45e059c1a0fa74e50ccf5733
Athird_party/acl_src/graph-autofusion+1-0
@@ -0,0 +1 @@
1+Subproject commit 6ff8fe3b4722857da8ceeef10c026b88f0997f83
Athird_party/acl_src/runtime+1-0
@@ -0,0 +1 @@
1+Subproject commit 6cce8b2417de63cfb5726489fa894199dc8a77e1
Mtorch_npu/csrc/core/npu/NPUCachingAllocator.cpp+14-12
@@ -34,6 +34,8 @@
34#include "torch_npu/csrc/sanitizer/NPUTrace.h"34#include "torch_npu/csrc/sanitizer/NPUTrace.h"
35#endif35#endif
36 36 
37+static constexpr size_t kMaxModuleNum = 128;
38+ 
37std::string format_size(uint64_t size)39std::string format_size(uint64_t size)
38{40{
39 std::ostringstream os;41 std::ostringstream os;
@@ -904,11 +906,11 @@ void setAllocatorSettings(const std::string& settings)
904 906 
905bool saveDevMemUsageInfo(const int& device)907bool saveDevMemUsageInfo(const int& device)
906{908{
907- aclrtMemUsageInfo memUsageInfo[MAX_MODULE_NUM] = {0};909+ aclrtMemUsageInfo memUsageInfo[kMaxModuleNum] = {0};
908 size_t moduleCount = 0;910 size_t moduleCount = 0;
909 911 
910 // Get the memory usage information912 // Get the memory usage information
911- aclError ret = c10_npu::acl::AclrtGetMemUsageInfo(device, memUsageInfo, MAX_MODULE_NUM, &moduleCount);913+ aclError ret = c10_npu::acl::AclrtGetMemUsageInfo(device, memUsageInfo, kMaxModuleNum, &moduleCount);
912 if (ret != ACL_ERROR_NONE) {914 if (ret != ACL_ERROR_NONE) {
913 TORCH_NPU_MEMORY_LOGE("AclrtGetMemUsageInfo failed, ret:%d", ret);915 TORCH_NPU_MEMORY_LOGE("AclrtGetMemUsageInfo failed, ret:%d", ret);
914 return false;916 return false;
@@ -931,13 +933,13 @@ bool saveDevMemUsageInfo(const int& device)
931 933 
932 csv_file << "moduleName,curMemSize(MB),memPeakSize(MB)\n" << std::fixed << std::setprecision(kPrecision);934 csv_file << "moduleName,curMemSize(MB),memPeakSize(MB)\n" << std::fixed << std::setprecision(kPrecision);
933 935 
934- // moduleCount is unreliable, so limit i to MAX_MODULE_NUM936+ // moduleCount is unreliable, so limit i to kMaxModuleNum
935- for (size_t i = 0; i < moduleCount && i < MAX_MODULE_NUM; ++i) {937+ for (size_t i = 0; i < moduleCount && i < kMaxModuleNum; ++i) {
936 csv_file << memUsageInfo[i].name << "," << static_cast<double>(memUsageInfo[i].curMemSize) / kMB << ","938 csv_file << memUsageInfo[i].name << "," << static_cast<double>(memUsageInfo[i].curMemSize) / kMB << ","
937 << static_cast<double>(memUsageInfo[i].memPeakSize) / kMB << "\n";939 << static_cast<double>(memUsageInfo[i].memPeakSize) / kMB << "\n";
938 }940 }
939- if (moduleCount > MAX_MODULE_NUM) {941+ if (moduleCount > kMaxModuleNum) {
940- TORCH_NPU_MEMORY_LOGW("The number of modules exceeds the maximum limit: %zu > %zu", moduleCount, MAX_MODULE_NUM);942+ TORCH_NPU_MEMORY_LOGW("The number of modules exceeds the maximum limit: %zu > %zu", moduleCount, kMaxModuleNum);
941 }943 }
942 csv_file.close();944 csv_file.close();
943 945 
@@ -968,7 +970,7 @@ private:
968};970};
969 971 
970struct handle_str {972struct handle_str {
971- char data[ACL_IPC_HANDLE_SIZE];973+ char data[kAclIpcHandleSize];
972};974};
973 975 
974// handle for ptr976// handle for ptr
@@ -1559,12 +1561,12 @@ public:
1559 auto it = ipc_handle_map.find(base_ptr);1561 auto it = ipc_handle_map.find(base_ptr);
1560 if (it == ipc_handle_map.end()) {1562 if (it == ipc_handle_map.end()) {
1561 NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemGetExportKey(1563 NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemGetExportKey(
1562- base_ptr, base_size, handle.data, ACL_IPC_HANDLE_SIZE, ACL_RT_IPC_MEM_EXPORT_FLAG_DISABLE_PID_VALIDATION));1564+ base_ptr, base_size, handle.data, kAclIpcHandleSize, ACL_RT_IPC_MEM_EXPORT_FLAG_DISABLE_PID_VALIDATION));
1563 ipc_handle_map[base_ptr] = handle;1565 ipc_handle_map[base_ptr] = handle;
1564 } else {1566 } else {
1565 handle = it->second;1567 handle = it->second;
1566 }1568 }
1567- ss.write((char*)&handle, ACL_IPC_HANDLE_SIZE);1569+ ss.write((char*)&handle, kAclIpcHandleSize);
1568 } else {1570 } else {
1569 ss.put(SHAREABLE_NPU_EXPANDABLE_SEGMENT);1571 ss.put(SHAREABLE_NPU_EXPANDABLE_SEGMENT);
1570 auto full_range = block->expandable_segment_->share(1572 auto full_range = block->expandable_segment_->share(
@@ -3706,7 +3708,7 @@ public:
3706 {3708 {
3707 int type = SHAREABLE_NPU_MALLOC;3709 int type = SHAREABLE_NPU_MALLOC;
3708 std::istringstream ss(handle);3710 std::istringstream ss(handle);
3709- if (handle.size() != ACL_IPC_HANDLE_SIZE) {3711+ if (handle.size() != kAclIpcHandleSize) {
3710 auto version = ss.get();3712 auto version = ss.get();
3711 TORCH_CHECK(3713 TORCH_CHECK(
3712 version <= SHAREABLE_HANDLE_VERSION,3714 version <= SHAREABLE_HANDLE_VERSION,
@@ -3718,10 +3720,10 @@ public:
3718 // SHAREABLE_NPU_MALLOC3720 // SHAREABLE_NPU_MALLOC
3719 if (type == SHAREABLE_NPU_MALLOC) {3721 if (type == SHAREABLE_NPU_MALLOC) {
3720 handle_str handle_r;3722 handle_str handle_r;
3721- ss.read(handle_r.data, ACL_IPC_HANDLE_SIZE);3723+ ss.read(handle_r.data, kAclIpcHandleSize);
3722 NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemImportByKey(3724 NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemImportByKey(
3723 &npu_ipc_ptr_, handle_r.data, ACL_RT_IPC_MEM_IMPORT_FLAG_ENABLE_PEER_ACCESS));3725 &npu_ipc_ptr_, handle_r.data, ACL_RT_IPC_MEM_IMPORT_FLAG_ENABLE_PEER_ACCESS));
3724- handle_s.assign(handle_r.data, ACL_IPC_HANDLE_SIZE);3726+ handle_s.assign(handle_r.data, kAclIpcHandleSize);
3725 } else if (type == SHAREABLE_NPU_EXPANDABLE_SEGMENT) {3727 } else if (type == SHAREABLE_NPU_EXPANDABLE_SEGMENT) {
3726 expandable_segment_ =3728 expandable_segment_ =
3727 ExpandableSegment::fromShared(device, ss)3729 ExpandableSegment::fromShared(device, ss)
Mtorch_npu/csrc/core/npu/NPUCachingAllocator.h+1-0
@@ -46,6 +46,7 @@ inline std::shared_ptr<npu_logging::Logger>& GetLoggerMem()
46std::string format_size(uint64_t size);46std::string format_size(uint64_t size);
47 47 
48namespace c10_npu {48namespace c10_npu {
49+constexpr size_t kAclIpcHandleSize = 65;
49namespace NPUCachingAllocator {50namespace NPUCachingAllocator {
50 51 
51C10_NPU_API std::mutex* getFreeMutex();52C10_NPU_API std::mutex* getFreeMutex();
Mtorch_npu/csrc/core/npu/NPUGraph.cpp+1-1
@@ -30,7 +30,7 @@ void apply_cache_op_info(aclrtStream stream, bool enabled)
30 }30 }
31 aclrtStreamAttrValue val;31 aclrtStreamAttrValue val;
32 val.cacheOpInfoSwitch = static_cast<uint32_t>(enabled ? 1u : 0u);32 val.cacheOpInfoSwitch = static_cast<uint32_t>(enabled ? 1u : 0u);
33- int32_t ret = c10_npu::acl::AclrtSetStreamAttribute(stream, aclrtStreamAttr::ACL_STREAM_ATTR_CACHE_OP_IFNO,33+ int32_t ret = c10_npu::acl::AclrtSetStreamAttribute(stream, aclrtStreamAttr::ACL_STREAM_ATTR_CACHE_OP_INFO,
34 &val);34 &val);
35 if (ret == ACL_ERROR_RT_PARAM_INVALID) {35 if (ret == ACL_ERROR_RT_PARAM_INVALID) {
36 ASCEND_LOGW("Report shape function is disabled due to incompatible CANN version.");36 ASCEND_LOGW("Report shape function is disabled due to incompatible CANN version.");
Mtorch_npu/csrc/core/npu/NPUGraph.h+1-1
@@ -6,7 +6,7 @@
6 6 
7#include "third_party/acl/inc/acl/acl_base.h"7#include "third_party/acl/inc/acl/acl_base.h"
8#include "third_party/acl/inc/acl/acl_rt.h"8#include "third_party/acl/inc/acl/acl_rt.h"
9-#include "third_party/acl/inc/acl/acl_sk.h"9+#include "third_party/acl/inc/acl/super_kernel.h"
10#include "torch_npu/csrc/core/npu/interface/SkInterface.h"10#include "torch_npu/csrc/core/npu/interface/SkInterface.h"
11#include "torch_npu/csrc/core/npu/NPUGraphsUtils.h"11#include "torch_npu/csrc/core/npu/NPUGraphsUtils.h"
12#include "torch_npu/csrc/core/npu/NPUMacros.h"12#include "torch_npu/csrc/core/npu/NPUMacros.h"
Mtorch_npu/csrc/core/npu/interface/AclInterface.cpp+1-1
@@ -272,7 +272,7 @@ aclError AclrtValueWait(void* event, aclrtStream stream)
272 func = (AclrtValueWaitFunc)GET_FUNC(aclrtValueWait);272 func = (AclrtValueWaitFunc)GET_FUNC(aclrtValueWait);
273 }273 }
274 TORCH_CHECK(func, "Failed to find function aclrtValueWait", PTA_ERROR(ErrCode::NOT_FOUND));274 TORCH_CHECK(func, "Failed to find function aclrtValueWait", PTA_ERROR(ErrCode::NOT_FOUND));
275- return func(event, 1, ACL_VALUE_WAIT_EQ, stream);275+ return func(event, 1, ACL_STREAM_WAIT_VALUE_EQ, stream);
276}276}
277 277 
278aclError AclrtValueWrite(void* event, uint64_t value, aclrtStream stream)278aclError AclrtValueWrite(void* event, uint64_t value, aclrtStream stream)
Mtorch_npu/csrc/core/npu/interface/SkInterface.h+2-2
@@ -1,6 +1,6 @@
1#pragma once1#pragma once
2 2 
3-#include "third_party/acl/inc/acl/acl_sk.h"3+#include "third_party/acl/inc/acl/super_kernel.h"
4#include "third_party/acl/inc/acl/acl_base.h"4#include "third_party/acl/inc/acl/acl_base.h"
5#include "third_party/acl/inc/acl/acl_mdl.h"5#include "third_party/acl/inc/acl/acl_mdl.h"
6 6 
@@ -21,4 +21,4 @@ aclError AclskScopeBegin(const char *scopeName, aclrtStream stream);
21*/21*/
22aclError AclskScopeEnd(const char *scopeName, aclrtStream stream);22aclError AclskScopeEnd(const char *scopeName, aclrtStream stream);
23} // namespace skapi23} // namespace skapi
24-} // namespace c10_npu24+} // namespace c10_npu
Mtorch_npu/csrc/ipc/StorageSharing.cpp+2-2
@@ -212,7 +212,7 @@ static PyObject* THNPStorage_newSharedNpu(PyObject* _unused, PyObject* args)
212 npu_event.block(c10_npu::getCurrentNPUStream(device));212 npu_event.block(c10_npu::getCurrentNPUStream(device));
213 }213 }
214 214 
215- std::string s_handle = THNPStorage_bytesAsHandleString(_handle, ACL_IPC_HANDLE_SIZE);215+ std::string s_handle = THNPStorage_bytesAsHandleString(_handle, c10_npu::kAclIpcHandleSize);
216 if (s_handle.empty()) {216 if (s_handle.empty()) {
217 return nullptr;217 return nullptr;
218 }218 }
@@ -317,4 +317,4 @@ PyMethodDef* reductions_functions()
317} // namespace reductions317} // namespace reductions
318} // namespace torch_npu318} // namespace torch_npu
319 319 
320-#endif320+#endif
Mtorch_npu/csrc/npu/Graph.h+2-2
@@ -5,7 +5,7 @@
5 5 
6#include "third_party/acl/inc/acl/acl_base.h"6#include "third_party/acl/inc/acl/acl_base.h"
7#include "third_party/acl/inc/acl/acl_rt.h"7#include "third_party/acl/inc/acl/acl_rt.h"
8-#include "third_party/acl/inc/acl/acl_sk.h"8+#include "third_party/acl/inc/acl/super_kernel.h"
9 9 
10struct PyFuncStruct {10struct PyFuncStruct {
11 PyFuncStruct(PyObject *pyFunc, PyObject *pyFuncArgs)11 PyFuncStruct(PyObject *pyFunc, PyObject *pyFuncArgs)
@@ -31,4 +31,4 @@ struct ThreadArgs {
31 31 
32 aclrtContext context;32 aclrtContext context;
33 bool exitFlag;33 bool exitFlag;
34-};34+};
Mtorch_npu/csrc/npu/Module.cpp+8-6
@@ -61,6 +61,8 @@
61#include <torch_npu/csrc/profiler/python/combined_traceback.h>61#include <torch_npu/csrc/profiler/python/combined_traceback.h>
62#include <torch_npu/csrc/utils/LazyInit.h>62#include <torch_npu/csrc/utils/LazyInit.h>
63 63 
64+constexpr int32_t kDeviceUtilizationNotSupport = -1;
65+ 
64struct NPUDeviceProp {66struct NPUDeviceProp {
65 std::string name;67 std::string name;
66 size_t totalGlobalMem = 0;68 size_t totalGlobalMem = 0;
@@ -1000,16 +1002,16 @@ PyObject* THNPModule_getDeviceUtilizationRate_wrap(
1000 int32_t vector = util_info.vectorUtilization;1002 int32_t vector = util_info.vectorUtilization;
1001 int32_t util_rate = 0;1003 int32_t util_rate = 0;
1002 // 如果vector和cube谁支持,就返回谁的使用率,如果都支持计算(vector*1+cube*1)/21004 // 如果vector和cube谁支持,就返回谁的使用率,如果都支持计算(vector*1+cube*1)/2
1003- if (cube == DEVICE_UTILIZATION_NOT_SUPPORT &&1005+ if (cube == kDeviceUtilizationNotSupport &&
1004- vector != DEVICE_UTILIZATION_NOT_SUPPORT) {1006+ vector != kDeviceUtilizationNotSupport) {
1005 util_rate = vector;1007 util_rate = vector;
1006 } else if (1008 } else if (
1007- cube != DEVICE_UTILIZATION_NOT_SUPPORT &&1009+ cube != kDeviceUtilizationNotSupport &&
1008- vector == DEVICE_UTILIZATION_NOT_SUPPORT) {1010+ vector == kDeviceUtilizationNotSupport) {
1009 util_rate = cube;1011 util_rate = cube;
1010 } else if (1012 } else if (
1011- cube != DEVICE_UTILIZATION_NOT_SUPPORT &&1013+ cube != kDeviceUtilizationNotSupport &&
1012- vector != DEVICE_UTILIZATION_NOT_SUPPORT) {1014+ vector != kDeviceUtilizationNotSupport) {
1013 util_rate = (cube + vector) / 2;1015 util_rate = (cube + vector) / 2;
1014 }1016 }
1015 TORCH_CHECK(1017 TORCH_CHECK(
Mtorch_npu/csrc/npu/Stress_detect.cpp+9-5
@@ -22,6 +22,10 @@ void* StressDetector::localHcclComm = nullptr;
22constexpr int kDetectSucceeded = 0;22constexpr int kDetectSucceeded = 0;
23constexpr int kDetectFailed = 1;23constexpr int kDetectFailed = 1;
24constexpr int kDetectFailedWithHardwareFailure = 2;24constexpr int kDetectFailedWithHardwareFailure = 2;
25+constexpr int kAclnnStressBitFail = 574006;
26+constexpr int kAclnnClearDeviceStateFail = 574007;
27+constexpr int kAclnnStressLowBitFail = 574008;
28+constexpr int kAclnnStressHighBitFail = 574009;
25 29 
26// Persistent worker thread implementation30// Persistent worker thread implementation
27void StressDetector::worker_thread()31void StressDetector::worker_thread()
@@ -96,14 +100,14 @@ int StressDetector::transfer_result(int detectResult)
96 ret = kDetectSucceeded;100 ret = kDetectSucceeded;
97 ASCEND_LOGI("Stress detect test case execution succeeded, device id is %d.", device_id);101 ASCEND_LOGI("Stress detect test case execution succeeded, device id is %d.", device_id);
98 break;102 break;
99- case ACLNN_STRESS_BIT_FAIL:103+ case kAclnnStressBitFail:
100- case ACLNN_STRESS_LOW_BIT_FAIL:104+ case kAclnnStressLowBitFail:
101- case ACLNN_STRESS_HIGH_BIT_FAIL:105+ case kAclnnStressHighBitFail:
102 ret = kDetectFailedWithHardwareFailure;106 ret = kDetectFailedWithHardwareFailure;
103 ASCEND_LOGW("Stress detect failed due to hardware malfunction, device id is %d, error code is %d.", device_id, detectResult);107 ASCEND_LOGW("Stress detect failed due to hardware malfunction, device id is %d, error code is %d.", device_id, detectResult);
104 TORCH_NPU_WARN("Stress detect failed due to hardware malfunction, device id is ", device_id, ", error code is ", detectResult);108 TORCH_NPU_WARN("Stress detect failed due to hardware malfunction, device id is ", device_id, ", error code is ", detectResult);
105 break;109 break;
106- case ACLNN_CLEAR_DEVICE_STATE_FAIL:110+ case kAclnnClearDeviceStateFail:
107 ASCEND_LOGW("Stress detect error. Error code is 574007. Error message is Voltage recovery failed, device id is %d.", device_id);111 ASCEND_LOGW("Stress detect error. Error code is 574007. Error message is Voltage recovery failed, device id is %d.", device_id);
108 TORCH_CHECK(false, "Stress detect error. Error code is 574007. Error message is Voltage recovery failed.", PTA_ERROR(ErrCode::ACL));112 TORCH_CHECK(false, "Stress detect error. Error code is 574007. Error message is Voltage recovery failed.", PTA_ERROR(ErrCode::ACL));
109 break;113 break;
@@ -187,4 +191,4 @@ void StressDetector::stop_worker_thread()
187 if (stress_detect_thread.joinable()) {191 if (stress_detect_thread.joinable()) {
188 stress_detect_thread.join(); // Wait for the thread to exit192 stress_detect_thread.join(); // Wait for the thread to exit
189 }193 }
190-}194+}