已合并
[v2.9.0][refactor]CANN ACL headers decouple #36005
Dring创建于 5月19日
[v2.9.0][refactor]CANN ACL headers decouple #36005
已合并
Dring创建于 5月19日
29 个文件变更+86-8060
@@ -25,3 +25,12 @@
25 path = third_party/dvm/dvm25 path = third_party/dvm/dvm
26 url = https://gitcode.com/mindspore/dvm.git26 url = https://gitcode.com/mindspore/dvm.git
27 branch = r2.1027 branch = r2.10
28+[submodule "third_party/acl_src/runtime"]
29+ path = third_party/acl_src/runtime
30+ url = https://gitcode.com/cann/runtime.git
31+[submodule "third_party/acl_src/ge"]
32+ path = third_party/acl_src/ge
33+ url = https://gitcode.com/cann/ge.git
34+[submodule "third_party/acl_src/graph-autofusion"]
35+ path = third_party/acl_src/graph-autofusion
36+ url = https://gitcode.com/cann/graph-autofusion.git
@@ -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
@@ -781,4 +781,4 @@ setup(
781 'torch_npu = torch_npu:_autoload',781 'torch_npu = torch_npu:_autoload',
782 ],782 ],
783 }783 }
784-)784+)
@@ -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_
@@ -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_
@@ -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_