diff --git a/inc/external/acl/acl.h b/inc/external/acl/acl.h deleted file mode 100644 index ef5b4772..00000000 --- a/inc/external/acl/acl.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INC_EXTERNAL_ACL_ACL_H_ -#define INC_EXTERNAL_ACL_ACL_H_ - -#include "acl_rt.h" -#include "acl_op.h" -#include "acl_mdl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Current version is 1.0.0 -#define ACL_MAJOR_VERSION 1 -#define ACL_MINOR_VERSION 0 -#define ACL_PATCH_VERSION 0 - -/** - * @ingroup AscendCL - * @brief acl initialize - * - * @par Restriction - * The aclInit interface can be called only once in a process - * @param configPath [IN] the config path,it can be NULL - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath); - -/** - * @ingroup AscendCL - * @brief acl finalize - * - * @par Restriction - * Need to call aclFinalize before the process exits. - * After calling aclFinalize,the services cannot continue to be used normally. - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclFinalize(); - -/** - * @ingroup AscendCL - * @brief query ACL interface version - * - * @param majorVersion[OUT] ACL interface major version - * @param minorVersion[OUT] ACL interface minor version - * @param patchVersion[OUT] ACL interface patch version - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtGetVersion(int32_t *majorVersion, int32_t *minorVersion, int32_t *patchVersion); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_H_ diff --git a/inc/external/acl/acl_base.h b/inc/external/acl/acl_base.h deleted file mode 100644 index 224a8ef0..00000000 --- a/inc/external/acl/acl_base.h +++ /dev/null @@ -1,569 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INC_EXTERNAL_ACL_ACL_BASE_H_ -#define INC_EXTERNAL_ACL_ACL_BASE_H_ - -#include -#include -#include "error_codes/rt_error_codes.h" -#include "error_codes/ge_error_codes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_MSC_VER) -#ifdef FUNC_VISIBILITY -#define ACL_FUNC_VISIBILITY _declspec(dllexport) -#else -#define ACL_FUNC_VISIBILITY -#endif -#else -#ifdef FUNC_VISIBILITY -#define ACL_FUNC_VISIBILITY __attribute__((visibility("default"))) -#else -#define ACL_FUNC_VISIBILITY -#endif -#endif - -#ifdef __GNUC__ -#define ACL_DEPRECATED __attribute__((deprecated)) -#define ACL_DEPRECATED_MESSAGE(message) __attribute__((deprecated(message))) -#elif defined(_MSC_VER) -#define ACL_DEPRECATED __declspec(deprecated) -#define ACL_DEPRECATED_MESSAGE(message) __declspec(deprecated(message)) -#else -#define ACL_DEPRECATED -#define ACL_DEPRECATED_MESSAGE(message) -#endif - -typedef void *aclrtStream; -typedef void *aclrtEvent; -typedef void *aclrtContext; -typedef int aclError; -typedef uint16_t aclFloat16; -typedef struct aclDataBuffer aclDataBuffer; -typedef struct aclTensorDesc aclTensorDesc; - -static const int ACL_ERROR_NONE = 0; -static const int ACL_SUCCESS = 0; - -static const int ACL_ERROR_INVALID_PARAM = 100000; -static const int ACL_ERROR_UNINITIALIZE = 100001; -static const int ACL_ERROR_REPEAT_INITIALIZE = 100002; -static const int ACL_ERROR_INVALID_FILE = 100003; -static const int ACL_ERROR_WRITE_FILE = 100004; -static const int ACL_ERROR_INVALID_FILE_SIZE = 100005; -static const int ACL_ERROR_PARSE_FILE = 100006; -static const int ACL_ERROR_FILE_MISSING_ATTR = 100007; -static const int ACL_ERROR_FILE_ATTR_INVALID = 100008; -static const int ACL_ERROR_INVALID_DUMP_CONFIG = 100009; -static const int ACL_ERROR_INVALID_PROFILING_CONFIG = 100010; -static const int ACL_ERROR_INVALID_MODEL_ID = 100011; -static const int ACL_ERROR_DESERIALIZE_MODEL = 100012; -static const int ACL_ERROR_PARSE_MODEL = 100013; -static const int ACL_ERROR_READ_MODEL_FAILURE = 100014; -static const int ACL_ERROR_MODEL_SIZE_INVALID = 100015; -static const int ACL_ERROR_MODEL_MISSING_ATTR = 100016; -static const int ACL_ERROR_MODEL_INPUT_NOT_MATCH = 100017; -static const int ACL_ERROR_MODEL_OUTPUT_NOT_MATCH = 100018; -static const int ACL_ERROR_MODEL_NOT_DYNAMIC = 100019; -static const int ACL_ERROR_OP_TYPE_NOT_MATCH = 100020; -static const int ACL_ERROR_OP_INPUT_NOT_MATCH = 100021; -static const int ACL_ERROR_OP_OUTPUT_NOT_MATCH = 100022; -static const int ACL_ERROR_OP_ATTR_NOT_MATCH = 100023; -static const int ACL_ERROR_OP_NOT_FOUND = 100024; -static const int ACL_ERROR_OP_LOAD_FAILED = 100025; -static const int ACL_ERROR_UNSUPPORTED_DATA_TYPE = 100026; -static const int ACL_ERROR_FORMAT_NOT_MATCH = 100027; -static const int ACL_ERROR_BIN_SELECTOR_NOT_REGISTERED = 100028; -static const int ACL_ERROR_KERNEL_NOT_FOUND = 100029; -static const int ACL_ERROR_BIN_SELECTOR_ALREADY_REGISTERED = 100030; -static const int ACL_ERROR_KERNEL_ALREADY_REGISTERED = 100031; -static const int ACL_ERROR_INVALID_QUEUE_ID = 100032; -static const int ACL_ERROR_REPEAT_SUBSCRIBE = 100033; -static const int ACL_ERROR_STREAM_NOT_SUBSCRIBE = 100034; -static const int ACL_ERROR_THREAD_NOT_SUBSCRIBE = 100035; -static const int ACL_ERROR_WAIT_CALLBACK_TIMEOUT = 100036; -static const int ACL_ERROR_REPEAT_FINALIZE = 100037; -static const int ACL_ERROR_NOT_STATIC_AIPP = 100038; -static const int ACL_ERROR_COMPILING_STUB_MODE = 100039; -static const int ACL_ERROR_GROUP_NOT_SET = 100040; -static const int ACL_ERROR_GROUP_NOT_CREATE = 100041; -static const int ACL_ERROR_PROF_ALREADY_RUN = 100042; -static const int ACL_ERROR_PROF_NOT_RUN = 100043; -static const int ACL_ERROR_DUMP_ALREADY_RUN = 100044; -static const int ACL_ERROR_DUMP_NOT_RUN = 100045; -static const int ACL_ERROR_PROF_REPEAT_SUBSCRIBE = 148046; -static const int ACL_ERROR_PROF_API_CONFLICT = 148047; - -static const int ACL_ERROR_BAD_ALLOC = 200000; -static const int ACL_ERROR_API_NOT_SUPPORT = 200001; -static const int ACL_ERROR_INVALID_DEVICE = 200002; -static const int ACL_ERROR_MEMORY_ADDRESS_UNALIGNED = 200003; -static const int ACL_ERROR_RESOURCE_NOT_MATCH = 200004; -static const int ACL_ERROR_INVALID_RESOURCE_HANDLE = 200005; -static const int ACL_ERROR_FEATURE_UNSUPPORTED = 200006; -static const int ACL_ERROR_PROF_MODULES_UNSUPPORTED = 200007; - -static const int ACL_ERROR_STORAGE_OVER_LIMIT = 300000; - -static const int ACL_ERROR_INTERNAL_ERROR = 500000; -static const int ACL_ERROR_FAILURE = 500001; -static const int ACL_ERROR_GE_FAILURE = 500002; -static const int ACL_ERROR_RT_FAILURE = 500003; -static const int ACL_ERROR_DRV_FAILURE = 500004; -static const int ACL_ERROR_PROFILING_FAILURE = 500005; - -#define ACL_TENSOR_SHAPE_RANGE_NUM 2 -#define ACL_UNKNOWN_RANK 0xFFFFFFFFFFFFFFFE - -typedef enum { - ACL_DT_UNDEFINED = -1, - ACL_FLOAT = 0, - ACL_FLOAT16 = 1, - ACL_INT8 = 2, - ACL_INT32 = 3, - ACL_UINT8 = 4, - ACL_INT16 = 6, - ACL_UINT16 = 7, - ACL_UINT32 = 8, - ACL_INT64 = 9, - ACL_UINT64 = 10, - ACL_DOUBLE = 11, - ACL_BOOL = 12, - ACL_STRING = 13, -} aclDataType; - -typedef enum { - ACL_FORMAT_UNDEFINED = -1, - ACL_FORMAT_NCHW = 0, - ACL_FORMAT_NHWC = 1, - ACL_FORMAT_ND = 2, - ACL_FORMAT_NC1HWC0 = 3, - ACL_FORMAT_FRACTAL_Z = 4, - ACL_FORMAT_NC1HWC0_C04 = 12, - ACL_FORMAT_FRACTAL_NZ = 29, -} aclFormat; - -typedef enum { - ACL_DEBUG = 0, - ACL_INFO = 1, - ACL_WARNING = 2, - ACL_ERROR = 3, -} aclLogLevel; - -/** - * @ingroup AscendCL - * @brief Converts data of type aclFloat16 to data of type float - * - * @param value [IN] Data to be converted - * - * @retval Transformed data - */ -ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value); - -/** - * @ingroup AscendCL - * @brief Converts data of type float to data of type aclFloat16 - * - * @param value [IN] Data to be converted - * - * @retval Transformed data - */ -ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value); - -/** - * @ingroup AscendCL - * @brief create data of aclDataBuffer - * - * @param data [IN] pointer to data - * @li Need to be managed by the user, - * call aclrtMalloc interface to apply for memory, - * call aclrtFree interface to release memory - * - * @param size [IN] size of data in bytes - * - * @retval pointer to created instance. nullptr if run out of memory - * - * @see aclrtMalloc | aclrtFree - */ -ACL_FUNC_VISIBILITY aclDataBuffer *aclCreateDataBuffer(void *data, size_t size); - -/** - * @ingroup AscendCL - * @brief destroy data of aclDataBuffer - * - * @par Function - * Only the aclDataBuffer type data is destroyed here. - * The memory of the data passed in when the aclDataDataBuffer interface - * is called to create aclDataBuffer type data must be released by the user - * - * @param dataBuffer [IN] pointer to the aclDataBuffer - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclCreateDataBuffer - */ -ACL_FUNC_VISIBILITY aclError aclDestroyDataBuffer(const aclDataBuffer *dataBuffer); - -/** - * @ingroup AscendCL - * @brief get data address from aclDataBuffer - * - * @param dataBuffer [IN] pointer to the data of aclDataBuffer - * - * @retval data address - */ -ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer); - -/** - * @ingroup AscendCL - * @brief get data size of aclDataBuffer - * - * @param dataBuffer [IN] pointer to the data of aclDataBuffer - * - * @retval data size - */ -ACL_DEPRECATED_MESSAGE("aclGetDataBufferSize is deprecated, use aclGetDataBufferSizeV2 instead") -ACL_FUNC_VISIBILITY uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer); - -/** - * @ingroup AscendCL - * @brief get data size of aclDataBuffer to replace aclGetDataBufferSize - * - * @param dataBuffer [IN] pointer to the data of aclDataBuffer - * - * @retval data size - */ -ACL_FUNC_VISIBILITY size_t aclGetDataBufferSizeV2(const aclDataBuffer *dataBuffer); - -/** - * @ingroup AscendCL - * @brief get size of aclDataType - * - * @param dataType [IN] aclDataType data the size to get - * - * @retval size of the aclDataType - */ -ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); - -// interfaces of tensor desc -/** - * @ingroup AscendCL - * @brief create data aclTensorDesc - * - * @param dataType [IN] Data types described by tensor - * @param numDims [IN] the number of dimensions of the shape - * @param dims [IN] the size of the specified dimension - * @param format [IN] tensor format - * - * @retval aclTensorDesc pointer. - * @retval nullptr if param is invalid or run out of memory - */ -ACL_FUNC_VISIBILITY aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, int numDims, const int64_t *dims, - aclFormat format); - -/** - * @ingroup AscendCL - * @brief destroy data aclTensorDesc - * - * @param desc [IN] pointer to the data of aclTensorDesc to destroy - */ -ACL_FUNC_VISIBILITY void aclDestroyTensorDesc(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief set tensor shape range for aclTensorDesc - * - * @param desc [OUT] pointer to the data of aclTensorDesc - * @param dimsCount [IN] the number of dimensions of the shape - * @param dimsRange [IN] the range of dimensions of the shape - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetTensorShapeRange(aclTensorDesc *desc, size_t dimsCount, - int64_t dimsRange[][ACL_TENSOR_SHAPE_RANGE_NUM]); - -/** - * @ingroup AscendCL - * @brief get data type specified by the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * - * @retval data type specified by the tensor description. - * @retval ACL_DT_UNDEFINED if description is null - */ -ACL_FUNC_VISIBILITY aclDataType aclGetTensorDescType(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief get data format specified by the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * - * @retval data format specified by the tensor description. - * @retval ACL_FORMAT_UNDEFINED if description is null - */ -ACL_FUNC_VISIBILITY aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief get tensor size specified by the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * - * @retval data size specified by the tensor description. - * @retval 0 if description is null - */ -ACL_FUNC_VISIBILITY size_t aclGetTensorDescSize(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief get element count specified by the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * - * @retval element count specified by the tensor description. - * @retval 0 if description is null - */ -ACL_FUNC_VISIBILITY size_t aclGetTensorDescElementCount(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief get number of dims specified by the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * - * @retval number of dims specified by the tensor description. - * @retval 0 if description is null - * @retval ACL_UNKNOWN_RANK if the tensor dim is -2 - */ -ACL_FUNC_VISIBILITY size_t aclGetTensorDescNumDims(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief Get the size of the specified dim in the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * @param index [IN] index of dims, start from 0. - * - * @retval dim specified by the tensor description and index. - * @retval -1 if description or index is invalid - */ -ACL_DEPRECATED_MESSAGE("aclGetTensorDescDim is deprecated, use aclGetTensorDescDimV2 instead") -ACL_FUNC_VISIBILITY int64_t aclGetTensorDescDim(const aclTensorDesc *desc, size_t index); - -/** - * @ingroup AscendCL - * @brief Get the size of the specified dim in the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * @param index [IN] index of dims, start from 0. - * @param dimSize [OUT] size of the specified dim. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimV2(const aclTensorDesc *desc, size_t index, int64_t *dimSize); - -/** - * @ingroup AscendCL - * @brief Get the range of the specified dim in the tensor description - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * @param index [IN] index of dims, start from 0. - * @param dimRangeNum [IN] number of dimRange. - * @param dimRange [OUT] range of the specified dim. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimRange(const aclTensorDesc *desc, size_t index, size_t dimRangeNum, - int64_t *dimRange); - -/** - * @ingroup AscendCL - * @brief set tensor description name - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param name [IN] tensor description name - */ -ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *name); - -/** - * @ingroup AscendCL - * @brief get tensor description name - * - * @param desc [IN] pointer to the instance of aclTensorDesc - * - * @retval tensor description name. - * @retval empty string if description is null - */ -ACL_FUNC_VISIBILITY const char *aclGetTensorDescName(aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief Convert the format in the source aclTensorDesc according to - * the specified dstFormat to generate a new target aclTensorDesc. - * The format in the source aclTensorDesc remains unchanged. - * - * @param srcDesc [IN] pointer to the source tensor desc - * @param dstFormat [IN] destination format - * @param dstDesc [OUT] pointer to the pointer to the destination tensor desc - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, - aclTensorDesc **dstDesc); - -/** - * @ingroup AscendCL - * @brief Set the storage format specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param format [IN] the storage format - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_DEPRECATED_MESSAGE("aclSetTensorStorageFormat is deprecated, use aclSetTensorFormat instead") -ACL_FUNC_VISIBILITY aclError aclSetTensorStorageFormat(aclTensorDesc *desc, aclFormat format); - -/** - * @ingroup AscendCL - * @brief Set the storage shape specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param numDims [IN] the number of dimensions of the shape - * @param dims [IN] the size of the specified dimension - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_DEPRECATED_MESSAGE("aclSetTensorStorageShape is deprecated, use aclSetTensorShape instead") -ACL_FUNC_VISIBILITY aclError aclSetTensorStorageShape(aclTensorDesc *desc, int numDims, const int64_t *dims); - -/** - * @ingroup AscendCL - * @brief Set the format specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param format [IN] the storage format - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetTensorFormat(aclTensorDesc *desc, aclFormat format); - -/** - * @ingroup AscendCL - * @brief Set the shape specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param numDims [IN] the number of dimensions of the shape - * @param dims [IN] the size of the specified dimension - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetTensorShape(aclTensorDesc *desc, int numDims, const int64_t *dims); - -/** - * @ingroup AscendCL - * @brief Set the original format specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param format [IN] the storage format - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetTensorOriginFormat(aclTensorDesc *desc, aclFormat format); - -/** - * @ingroup AscendCL - * @brief Set the original shape specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param numDims [IN] the number of dimensions of the shape - * @param dims [IN] the size of the specified dimension - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetTensorOriginShape(aclTensorDesc *desc, int numDims, const int64_t *dims); - -/** - * @ingroup AscendCL - * @brief get op description info - * - * @param desc [IN] pointer to tensor description - * @param index [IN] index of tensor - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, size_t index); - -/** - * @ingroup AscendCL - * @brief get address of tensor - * - * @param desc [IN] pointer to tensor description - * - * @retval null for failed - * @retval OtherValues success - */ -ACL_FUNC_VISIBILITY void *aclGetTensorDescAddress(const aclTensorDesc *desc); - -/** - * @ingroup AscendCL - * @brief Set the dynamic input name specified by the tensor description - * - * @param desc [OUT] pointer to the instance of aclTensorDesc - * @param dynamicInputName [IN] pointer to the dynamic input name - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetTensorDynamicInput(aclTensorDesc *desc, const char *dynamicInputName); - -/** - * @ingroup AscendCL - * @brief an interface for users to output APP logs - * - * @param logLevel [IN] the level of current log - * @param func [IN] the function where the log is located - * @param file [IN] the file where the log is located - * @param line [IN] Number of source lines where the log is located - * @param fmt [IN] the format of current log - * @param ... [IN] the value of current log - */ -ACL_FUNC_VISIBILITY void aclAppLog(aclLogLevel logLevel, const char *func, const char *file, uint32_t line, - const char *fmt, ...); - -#define ACL_APP_LOG(level, fmt, ...) aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__) - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_BASE_H_ diff --git a/inc/external/acl/acl_mdl.h b/inc/external/acl/acl_mdl.h deleted file mode 100644 index 0652358d..00000000 --- a/inc/external/acl/acl_mdl.h +++ /dev/null @@ -1,1112 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INC_EXTERNAL_ACL_ACL_MODEL_H_ -#define INC_EXTERNAL_ACL_ACL_MODEL_H_ - -#include -#include - -#include "acl_base.h" -#include "acl_rt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ACL_MAX_DIM_CNT 128 -#define ACL_MAX_TENSOR_NAME_LEN 128 -#define ACL_MAX_BATCH_NUM 128 -#define ACL_MAX_HW_NUM 128 -#define ACL_MAX_SHAPE_COUNT 128 -#define ACL_INVALID_NODE_INDEX 0xFFFFFFFF - -#define ACL_DYNAMIC_TENSOR_NAME "ascend_mbatch_shape_data" -#define ACL_DYNAMIC_AIPP_NAME "ascend_dynamic_aipp_data" - -typedef struct aclmdlDataset aclmdlDataset; -typedef struct aclmdlDesc aclmdlDesc; -typedef struct aclmdlAIPP aclmdlAIPP; -typedef struct aclAippExtendInfo aclAippExtendInfo; - -typedef enum { - ACL_YUV420SP_U8 = 1, - ACL_XRGB8888_U8, - ACL_RGB888_U8, - ACL_YUV400_U8, - ACL_NC1HWC0DI_FP16, - ACL_NC1HWC0DI_S8, - ACL_ARGB8888_U8, - ACL_YUYV_U8, - ACL_YUV422SP_U8, - ACL_AYUV444_U8, - ACL_RAW10, - ACL_RAW12, - ACL_RAW16, - ACL_RAW24, - ACL_AIPP_RESERVED = 0xffff, -} aclAippInputFormat; - -typedef enum { - ACL_DATA_WITHOUT_AIPP = 0, - ACL_DATA_WITH_STATIC_AIPP, - ACL_DATA_WITH_DYNAMIC_AIPP, - ACL_DYNAMIC_AIPP_NODE -} aclmdlInputAippType; - -typedef struct aclmdlIODims { - char name[ACL_MAX_TENSOR_NAME_LEN]; /**< tensor name */ - size_t dimCount; /**< dim array count */ - int64_t dims[ACL_MAX_DIM_CNT]; /**< dim data array */ -} aclmdlIODims; - -typedef struct aclAippDims { - aclmdlIODims srcDims; /**< input dims before model transform */ - size_t srcSize; /**< input size before model transform */ - aclmdlIODims aippOutdims; /**< aipp output dims */ - size_t aippOutSize; /**< aipp output size */ -} aclAippDims; - -typedef struct aclmdlBatch { - size_t batchCount; /**< batch array count */ - uint64_t batch[ACL_MAX_BATCH_NUM]; /**< batch data array */ -} aclmdlBatch; - -typedef struct aclmdlHW { - size_t hwCount; /**< height&width array count */ - uint64_t hw[ACL_MAX_HW_NUM][2]; /**< height&width data array */ -} aclmdlHW; - -typedef struct aclAippInfo { - aclAippInputFormat inputFormat; - int32_t srcImageSizeW; - int32_t srcImageSizeH; - int8_t cropSwitch; - int32_t loadStartPosW; - int32_t loadStartPosH; - int32_t cropSizeW; - int32_t cropSizeH; - int8_t resizeSwitch; - int32_t resizeOutputW; - int32_t resizeOutputH; - int8_t paddingSwitch; - int32_t leftPaddingSize; - int32_t rightPaddingSize; - int32_t topPaddingSize; - int32_t bottomPaddingSize; - int8_t cscSwitch; - int8_t rbuvSwapSwitch; - int8_t axSwapSwitch; - int8_t singleLineMode; - int32_t matrixR0C0; - int32_t matrixR0C1; - int32_t matrixR0C2; - int32_t matrixR1C0; - int32_t matrixR1C1; - int32_t matrixR1C2; - int32_t matrixR2C0; - int32_t matrixR2C1; - int32_t matrixR2C2; - int32_t outputBias0; - int32_t outputBias1; - int32_t outputBias2; - int32_t inputBias0; - int32_t inputBias1; - int32_t inputBias2; - int32_t meanChn0; - int32_t meanChn1; - int32_t meanChn2; - int32_t meanChn3; - float minChn0; - float minChn1; - float minChn2; - float minChn3; - float varReciChn0; - float varReciChn1; - float varReciChn2; - float varReciChn3; - aclFormat srcFormat; - aclDataType srcDatatype; - size_t srcDimNum; - size_t shapeCount; - aclAippDims outDims[ACL_MAX_SHAPE_COUNT]; - aclAippExtendInfo *aippExtend; /**< reserved parameters, current version needs to be null */ -} aclAippInfo; - -/** - * @ingroup AscendCL - * @brief Create data of type aclmdlDesc - * - * @retval the aclmdlDesc pointer - */ -ACL_FUNC_VISIBILITY aclmdlDesc *aclmdlCreateDesc(); - -/** - * @ingroup AscendCL - * @brief destroy data of type aclmdlDesc - * - * @param modelDesc [IN] Pointer to almdldlDesc to be destroyed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlDestroyDesc(aclmdlDesc *modelDesc); - -/** - * @ingroup AscendCL - * @brief Get aclmdlDesc data of the model according to the model ID - * - * @param modelDesc [OUT] aclmdlDesc pointer - * @param modelId [IN] model id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetDesc(aclmdlDesc *modelDesc, uint32_t modelId); - -/** - * @ingroup AscendCL - * @brief Get the number of the inputs of - * the model according to data of aclmdlDesc - * - * @param modelDesc [IN] aclmdlDesc pointer - * - * @retval input size with aclmdlDesc - */ -ACL_FUNC_VISIBILITY size_t aclmdlGetNumInputs(aclmdlDesc *modelDesc); - -/** - * @ingroup AscendCL - * @brief Get the number of the output of - * the model according to data of aclmdlDesc - * - * @param modelDesc [IN] aclmdlDesc pointer - * - * @retval output size with aclmdlDesc - */ -ACL_FUNC_VISIBILITY size_t aclmdlGetNumOutputs(aclmdlDesc *modelDesc); - -/** - * @ingroup AscendCL - * @brief Get the size of the specified input according to - * the data of type aclmdlDesc - * - * @param modelDesc [IN] aclmdlDesc pointer - * @param index [IN] the size of the number of inputs to be obtained, - * the index value starts from 0 - * - * @retval Specify the size of the input - */ -ACL_FUNC_VISIBILITY size_t aclmdlGetInputSizeByIndex(aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief Get the size of the specified output according to - * the data of type aclmdlDesc - * - * @param modelDesc [IN] aclmdlDesc pointer - * @param index [IN] the size of the number of outputs to be obtained, - * the index value starts from 0 - * - * @retval Specify the size of the output - */ -ACL_FUNC_VISIBILITY size_t aclmdlGetOutputSizeByIndex(aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief Create data of type aclmdlDataset - * - * @retval the aclmdlDataset pointer - */ -ACL_FUNC_VISIBILITY aclmdlDataset *aclmdlCreateDataset(); - -/** - * @ingroup AscendCL - * @brief destroy data of type aclmdlDataset - * - * @param dataset [IN] Pointer to aclmdlDataset to be destroyed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlDestroyDataset(const aclmdlDataset *dataset); - -/** - * @ingroup AscendCL - * @brief Add aclDataBuffer to aclmdlDataset - * - * @param dataset [OUT] aclmdlDataset address of aclDataBuffer to be added - * @param dataBuffer [IN] aclDataBuffer address to be added - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlAddDatasetBuffer(aclmdlDataset *dataset, aclDataBuffer *dataBuffer); - -/** - * @ingroup AscendCL - * @brief Get the number of aclDataBuffer in aclmdlDataset - * - * @param dataset [IN] aclmdlDataset poiter - * - * @retval the number of aclDataBuffer - */ -ACL_FUNC_VISIBILITY size_t aclmdlGetDatasetNumBuffers(const aclmdlDataset *dataset); - -/** - * @ingroup AscendCL - * @brief Get the aclDataBuffer in aclmdlDataset by index - * - * @param dataset [IN] aclmdlDataset poiter - * @param index [IN] the index of aclDataBuffer - * - * @retval Get successfully, return the address of aclDataBuffer - * @retval Failure return NULL - */ -ACL_FUNC_VISIBILITY aclDataBuffer *aclmdlGetDatasetBuffer(const aclmdlDataset *dataset, size_t index); - -/** - * @ingroup AscendCL - * @brief Load offline model data from files - * and manage memory internally by the system - * - * @par Function - * After the system finishes loading the model, - * the model ID returned is used as a mark to identify the model - * during subsequent operations - * - * @param modelPath [IN] Storage path for offline model files - * @param modelId [OUT] Model ID generated after - * the system finishes loading the model - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFile(const char *modelPath, uint32_t *modelId); - -/** - * @ingroup AscendCL - * @brief Load offline model data from memory and manage the memory of - * model running internally by the system - * - * @par Function - * After the system finishes loading the model, - * the model ID returned is used as a mark to identify the model - * during subsequent operations - * - * @param model [IN] Model data stored in memory - * @param modelSize [IN] model data size - * @param modelId [OUT] Model ID generated after - * the system finishes loading the model - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMem(const void *model, size_t modelSize, uint32_t *modelId); - -/** - * @ingroup AscendCL - * @brief Load offline model data from a file, - * and the user manages the memory of the model run by itself - * - * @par Function - * After the system finishes loading the model, - * the model ID returned is used as a mark to identify the model - * during subsequent operations. - * @param modelPath [IN] Storage path for offline model files - * @param modelId [OUT] Model ID generated after finishes loading the model - * @param workPtr [IN] A pointer to the working memory - * required by the model on the Device,can be null - * @param workSize [IN] The amount of working memory required by the model - * @param weightPtr [IN] Pointer to model weight memory on Device - * @param weightSize [IN] The amount of weight memory required by the model - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithMem(const char *modelPath, uint32_t *modelId, void *workPtr, - size_t workSize, void *weightPtr, size_t weightSize); - -/** - * @ingroup AscendCL - * @brief Load offline model data from memory, - * and the user can manage the memory of model running - * - * @par Function - * After the system finishes loading the model, - * the model ID returned is used as a mark to identify the model - * during subsequent operations - * @param model [IN] Model data stored in memory - * @param modelSize [IN] model data size - * @param modelId [OUT] Model ID generated after finishes loading the model - * @param workPtr [IN] A pointer to the working memory - * required by the model on the Device,can be null - * @param workSize [IN] work memory size - * @param weightPtr [IN] Pointer to model weight memory on Device,can be null - * @param weightSize [IN] The amount of weight memory required by the model - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithMem(const void *model, size_t modelSize, uint32_t *modelId, - void *workPtr, size_t workSize, void *weightPtr, - size_t weightSize); - -/** - * @ingroup AscendCL - * @brief load model from file with async queue - * - * @param modelPath [IN] model path - * @param modelId [OUT] return model id if load success - * @param inputQ [IN] input queue pointer - * @param inputQNum [IN] input queue num - * @param outputQ [IN] output queue pointer - * @param outputQNum [IN] output queue num - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromFileWithQ(const char *modelPath, uint32_t *modelId, const uint32_t *inputQ, - size_t inputQNum, const uint32_t *outputQ, size_t outputQNum); - -/** - * @ingroup AscendCL - * @brief load model from memory with async queue - * - * @param model [IN] model memory which user manages - * @param modelSize [IN] model size - * @param modelId [OUT] return model id if load success - * @param inputQ [IN] input queue pointer - * @param inputQNum [IN] input queue num - * @param outputQ [IN] output queue pointer - * @param outputQNum [IN] output queue num - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlLoadFromMemWithQ(const void *model, size_t modelSize, uint32_t *modelId, - const uint32_t *inputQ, size_t inputQNum, const uint32_t *outputQ, - size_t outputQNum); - -/** - * @ingroup AscendCL - * @brief Execute model synchronous inference until the inference result is returned - * - * @param modelId [IN] ID of the model to perform inference - * @param input [IN] Input data for model inference - * @param output [OUT] Output data for model inference - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlExecute(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output); - -/** - * @ingroup AscendCL - * @brief Execute model asynchronous inference until the inference result is returned - * - * @param modelId [IN] ID of the model to perform inference - * @param input [IN] Input data for model inference - * @param output [OUT] Output data for model inference - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem - */ -ACL_FUNC_VISIBILITY aclError aclmdlExecuteAsync(uint32_t modelId, const aclmdlDataset *input, aclmdlDataset *output, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief unload model with model id - * - * @param modelId [IN] model id to be unloaded - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlUnload(uint32_t modelId); - -/** - * @ingroup AscendCL - * @brief Get the weight memory size and working memory size - * required for model execution according to the model file - * - * @param fileName [IN] Model path to get memory information - * @param workSize [OUT] The amount of working memory for model executed - * @param weightSize [OUT] The amount of weight memory for model executed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlQuerySize(const char *fileName, size_t *workSize, size_t *weightSize); - -/** - * @ingroup AscendCL - * @brief Obtain the weights required for - * model execution according to the model data in memory - * - * @par Restriction - * The execution and weight memory is Device memory, - * and requires user application and release. - * @param model [IN] model memory which user manages - * @param modelSize [IN] model data size - * @param workSize [OUT] The amount of working memory for model executed - * @param weightSize [OUT] The amount of weight memory for model executed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlQuerySizeFromMem(const void *model, size_t modelSize, size_t *workSize, - size_t *weightSize); - -/** - * @ingroup AscendCL - * @brief In dynamic batch scenarios, - * it is used to set the number of images processed - * at one time during model inference - * - * @param modelId [IN] model id - * @param dataset [IN|OUT] data for model inference - * @param index [IN] index of dynamic tensor - * @param batchSize [IN] Number of images processed at a time during model - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetDynamicBatchSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, - uint64_t batchSize); - -/** - * @ingroup AscendCL - * @brief Sets the H and W of the specified input of the model - * - * @param modelId [IN] model id - * @param dataset [IN|OUT] data for model inference - * @param index [IN] index of dynamic tensor - * @param height [IN] model height - * @param width [IN] model width - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetDynamicHWSize(uint32_t modelId, aclmdlDataset *dataset, size_t index, - uint64_t height, uint64_t width); - -/** - * @ingroup AscendCL - * @brief Sets the dynamic dims of the specified input of the model - * - * @param modelId [IN] model id - * @param dataset [IN|OUT] data for model inference - * @param index [IN] index of dynamic dims - * @param dims [IN] value of dynamic dims - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetInputDynamicDims(uint32_t modelId, aclmdlDataset *dataset, size_t index, - const aclmdlIODims *dims); - -/** - * @ingroup AscendCL - * @brief get input dims info - * - * @param modelDesc [IN] model description - * @param index [IN] input tensor index - * @param dims [OUT] dims info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlGetInputDimsV2 - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetInputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); - -/** - * @ingroup AscendCL - * @brief get input dims info(version 2), especially for static aipp - * it is the same with aclmdlGetInputDims while model without static aipp - * - * @param modelDesc [IN] model description - * @param index [IN] input tensor index - * @param dims [OUT] dims info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlGetInputDims - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetInputDimsV2(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); - -/** - * @ingroup AscendCL - * @brief get output dims info - * - * @param modelDesc [IN] model description - * @param index [IN] output tensor index - * @param dims [OUT] dims info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); - -/** - * @ingroup AscendCL - * @brief get current output dims info - * - * @par Function - * The following use cases are supported: - * @li Get current output shape when model is dynamic and - * dynamic shape info is set - * @li Get max output shape when model is dynamic and - * dynamic shape info is not set - * @li Get actual output shape when model is static - * - * @param modelDesc [IN] model description - * @param index [IN] output tensor index - * @param dims [OUT] dims info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetCurOutputDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims); - -/** - * @ingroup AscendCL - * @brief get input name by index - * - * @param modelDesc [IN] model description - * @param index [IN] intput tensor index - * - * @retval input tensor name,the same life cycle with modelDesc - */ -ACL_FUNC_VISIBILITY const char *aclmdlGetInputNameByIndex(const aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief get output name by index - * - * @param modelDesc [IN] model description - * @param index [IN] output tensor index - * - * @retval output tensor name,the same life cycle with modelDesc - */ -ACL_FUNC_VISIBILITY const char *aclmdlGetOutputNameByIndex(const aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief get input format by index - * - * @param modelDesc [IN] model description - * @param index [IN] intput tensor index - * - * @retval input tensor format - */ -ACL_FUNC_VISIBILITY aclFormat aclmdlGetInputFormat(const aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief get output format by index - * - * @param modelDesc [IN] model description - * @param index [IN] output tensor index - * - * @retval output tensor format - */ -ACL_FUNC_VISIBILITY aclFormat aclmdlGetOutputFormat(const aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief get input data type by index - * - * @param modelDesc [IN] model description - * @param index [IN] intput tensor index - * - * @retval input tensor data type - */ -ACL_FUNC_VISIBILITY aclDataType aclmdlGetInputDataType(const aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief get output data type by index - * - * @param modelDesc [IN] model description - * @param index [IN] output tensor index - * - * @retval output tensor data type - */ -ACL_FUNC_VISIBILITY aclDataType aclmdlGetOutputDataType(const aclmdlDesc *modelDesc, size_t index); - -/** - * @ingroup AscendCL - * @brief get input tensor index by name - * - * @param modelDesc [IN] model description - * @param name [IN] intput tensor name - * @param index [OUT] intput tensor index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetInputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index); - -/** - * @ingroup AscendCL - * @brief get output tensor index by name - * - * @param modelDesc [IN] model description - * @param name [IN] output tensor name - * @param index [OUT] output tensor index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetOutputIndexByName(const aclmdlDesc *modelDesc, const char *name, size_t *index); - -/** - * @ingroup AscendCL - * @brief get dynamic batch info - * - * @param modelDesc [IN] model description - * @param batch [OUT] dynamic batch info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetDynamicBatch(const aclmdlDesc *modelDesc, aclmdlBatch *batch); - -/** - * @ingroup AscendCL - * @brief get dynamic height&width info - * - * @param modelDesc [IN] model description - * @param index [IN] input tensor index - * @param hw [OUT] dynamic height&width info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetDynamicHW(const aclmdlDesc *modelDesc, size_t index, aclmdlHW *hw); - -/** - * @ingroup AscendCL - * @brief get dynamic gear count - * - * @param modelDesc [IN] model description - * @param index [IN] unused, must be -1 - * @param gearCount [OUT] dynamic gear count - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetInputDynamicGearCount(const aclmdlDesc *modelDesc, size_t index, - size_t *gearCount); - -/** - * @ingroup AscendCL - * @brief get dynamic dims info - * - * @param modelDesc [IN] model description - * @param index [IN] unused, must be -1 - * @param dims [OUT] value of dynamic dims - * @param gearCount [IN] dynamic gear count - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetInputDynamicDims(const aclmdlDesc *modelDesc, size_t index, aclmdlIODims *dims, - size_t gearCount); - -/** - * @ingroup AscendCL - * @brief Create data of type aclmdlAIPP - * - * @param batchSize [IN] batchsizes of model - * - * @retval the aclmdlAIPP pointer - */ -ACL_FUNC_VISIBILITY aclmdlAIPP *aclmdlCreateAIPP(uint64_t batchSize); - -/** - * @ingroup AscendCL - * @brief destroy data of type aclmdlAIPP - * - * @param aippParmsSet [IN] Pointer for aclmdlAIPP to be destroyed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlDestroyAIPP(const aclmdlAIPP *aippParmsSet); - -/** - * @ingroup AscendCL - * @brief set InputFormat of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param inputFormat [IN] The inputFormat of aipp - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPInputFormat(aclmdlAIPP *aippParmsSet, aclAippInputFormat inputFormat); - -/** - * @ingroup AscendCL - * @brief set cscParms of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param csc_switch [IN] Csc switch - * @param cscMatrixR0C0 [IN] Csc_matrix_r0_c0 - * @param cscMatrixR0C1 [IN] Csc_matrix_r0_c1 - * @param cscMatrixR0C2 [IN] Csc_matrix_r0_c2 - * @param cscMatrixR1C0 [IN] Csc_matrix_r1_c0 - * @param cscMatrixR1C1 [IN] Csc_matrix_r1_c1 - * @param cscMatrixR1C2 [IN] Csc_matrix_r1_c2 - * @param cscMatrixR2C0 [IN] Csc_matrix_r2_c0 - * @param cscMatrixR2C1 [IN] Csc_matrix_r2_c1 - * @param cscMatrixR2C2 [IN] Csc_matrix_r2_c2 - * @param cscOutputBiasR0 [IN] Output Bias for RGB to YUV, element of row 0, unsigned number - * @param cscOutputBiasR1 [IN] Output Bias for RGB to YUV, element of row 1, unsigned number - * @param cscOutputBiasR2 [IN] Output Bias for RGB to YUV, element of row 2, unsigned number - * @param cscInputBiasR0 [IN] Input Bias for YUV to RGB, element of row 0, unsigned number - * @param cscInputBiasR1 [IN] Input Bias for YUV to RGB, element of row 1, unsigned number - * @param cscInputBiasR2 [IN] Input Bias for YUV to RGB, element of row 2, unsigned number - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCscParams(aclmdlAIPP *aippParmsSet, int8_t csc_switch, int16_t cscMatrixR0C0, - int16_t cscMatrixR0C1, int16_t cscMatrixR0C2, int16_t cscMatrixR1C0, - int16_t cscMatrixR1C1, int16_t cscMatrixR1C2, int16_t cscMatrixR2C0, - int16_t cscMatrixR2C1, int16_t cscMatrixR2C2, - uint8_t cscOutputBiasR0, uint8_t cscOutputBiasR1, - uint8_t cscOutputBiasR2, uint8_t cscInputBiasR0, - uint8_t cscInputBiasR1, uint8_t cscInputBiasR2); - -/** - * @ingroup AscendCL - * @brief set rb/ub swap switch of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param rbuvSwapSwitch [IN] rb/ub swap switch - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPRbuvSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t rbuvSwapSwitch); - -/** - * @ingroup AscendCL - * @brief set RGBA->ARGB, YUVA->AYUV swap switch of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param axSwapSwitch [IN] RGBA->ARGB, YUVA->AYUV swap switch - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPAxSwapSwitch(aclmdlAIPP *aippParmsSet, int8_t axSwapSwitch); - -/** - * @ingroup AscendCL - * @brief set source image of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param srcImageSizeW [IN] Source image width - * @param srcImageSizeH [IN] Source image height - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPSrcImageSize(aclmdlAIPP *aippParmsSet, int32_t srcImageSizeW, - int32_t srcImageSizeH); - -/** - * @ingroup AscendCL - * @brief set resize switch of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param scfSwitch [IN] Resize switch - * @param scfInputSizeW [IN] Input width of scf - * @param scfInputSizeH [IN] Input height of scf - * @param scfOutputSizeW [IN] Output width of scf - * @param scfOutputSizeH [IN] Output height of scf - * @param batchIndex [IN] Batch parameter index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPScfParams(aclmdlAIPP *aippParmsSet, int8_t scfSwitch, int32_t scfInputSizeW, - int32_t scfInputSizeH, int32_t scfOutputSizeW, - int32_t scfOutputSizeH, uint64_t batchIndex); - -/** - * @ingroup AscendCL - * @brief set cropParams of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param cropSwitch [IN] Crop switch - * @param cropStartPosW [IN] The start horizontal position of cropping - * @param cropStartPosH [IN] The start vertical position of cropping - * @param cropSizeW [IN] Crop width - * @param cropSizeH [IN] Crop height - * @param batchIndex [IN] Batch parameter index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPCropParams(aclmdlAIPP *aippParmsSet, int8_t cropSwitch, int32_t cropStartPosW, - int32_t cropStartPosH, int32_t cropSizeW, int32_t cropSizeH, - uint64_t batchIndex); - -/** - * @ingroup AscendCL - * @brief set paddingParams of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param paddingSwitch [IN] Padding switch - * @param paddingSizeTop [IN] Top padding size - * @param paddingSizeBottom [IN] Bottom padding size - * @param paddingSizeLeft [IN] Left padding size - * @param paddingSizeRight [IN] Right padding size - * @param batchIndex [IN] Batch parameter index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPaddingParams(aclmdlAIPP *aippParmsSet, int8_t paddingSwitch, - int32_t paddingSizeTop, int32_t paddingSizeBottom, - int32_t paddingSizeLeft, int32_t paddingSizeRight, - uint64_t batchIndex); - -/** - * @ingroup AscendCL - * @brief set DtcPixelMean of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param dtcPixelMeanChn0 [IN] Mean value of channel 0 - * @param dtcPixelMeanChn1 [IN] Mean value of channel 1 - * @param dtcPixelMeanChn2 [IN] Mean value of channel 2 - * @param dtcPixelMeanChn3 [IN] Mean value of channel 3 - * @param batchIndex [IN] Batch parameter index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMean(aclmdlAIPP *aippParmsSet, int16_t dtcPixelMeanChn0, - int16_t dtcPixelMeanChn1, int16_t dtcPixelMeanChn2, - int16_t dtcPixelMeanChn3, uint64_t batchIndex); - -/** - * @ingroup AscendCL - * @brief set DtcPixelMin of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param dtcPixelMinChn0 [IN] Min value of channel 0 - * @param dtcPixelMinChn1 [IN] Min value of channel 1 - * @param dtcPixelMinChn2 [IN] Min value of channel 2 - * @param dtcPixelMinChn3 [IN] Min value of channel 3 - * @param batchIndex [IN] Batch parameter index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPDtcPixelMin(aclmdlAIPP *aippParmsSet, float dtcPixelMinChn0, - float dtcPixelMinChn1, float dtcPixelMinChn2, - float dtcPixelMinChn3, uint64_t batchIndex); - -/** - * @ingroup AscendCL - * @brief set PixelVarReci of type aclmdlAIPP - * - * @param aippParmsSet [OUT] Pointer for aclmdlAIPP - * @param dtcPixelVarReciChn0 [IN] sfr_dtc_pixel_variance_reci_ch0 - * @param dtcPixelVarReciChn1 [IN] sfr_dtc_pixel_variance_reci_ch1 - * @param dtcPixelVarReciChn2 [IN] sfr_dtc_pixel_variance_reci_ch2 - * @param dtcPixelVarReciChn3 [IN] sfr_dtc_pixel_variance_reci_ch3 - * @param batchIndex [IN] Batch parameter index - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPPixelVarReci(aclmdlAIPP *aippParmsSet, float dtcPixelVarReciChn0, - float dtcPixelVarReciChn1, float dtcPixelVarReciChn2, - float dtcPixelVarReciChn3, uint64_t batchIndex); - -/** - * @ingroup AscendCL - * @brief set aipp parameters to model - * - * @param modelId [IN] model id - * @param dataset [IN] Pointer of dataset - * @param index [IN] index of input for aipp data(ACL_DYNAMIC_AIPP_NODE) - * @param aippParmsSet [IN] Pointer for aclmdlAIPP - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetInputAIPP(uint32_t modelId, aclmdlDataset *dataset, size_t index, - const aclmdlAIPP *aippParmsSet); - -/** - * @ingroup AscendCL - * @brief set aipp parameters to model - * - * @param modelId [IN] model id - * @param dataset [IN] Pointer of dataset - * @param index [IN] index of input for data which linked dynamic aipp(ACL_DATA_WITH_DYNAMIC_AIPP) - * @param aippParmsSet [IN] Pointer for aclmdlAIPP - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetAIPPByInputIndex(uint32_t modelId, aclmdlDataset *dataset, size_t index, - const aclmdlAIPP *aippParmsSet); - -/** - * @ingroup AscendCL - * @brief get input aipp type - * - * @param modelId [IN] model id - * @param index [IN] index of input - * @param type [OUT] aipp type for input.refrer to aclmdlInputAippType(enum) - * @param dynamicAttachedDataIndex [OUT] index for dynamic attached data(ACL_DYNAMIC_AIPP_NODE) - * valid when type is ACL_DATA_WITH_DYNAMIC_AIPP, invalid value is ACL_INVALID_NODE_INDEX - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName | aclmdlCreateAIPP - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetAippType(uint32_t modelId, size_t index, aclmdlInputAippType *type, - size_t *dynamicAttachedDataIndex); - -/** - * @ingroup AscendCL - * @brief get static aipp parameters from model - * - * @param modelId [IN] model id - * @param index [IN] index of tensor - * @param aippinfo [OUT] Pointer for static aipp info - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval ACL_ERROR_MODEL_AIPP_NOT_EXIST The tensor of index is not configured with aipp - * @retval OtherValues Failure - * - * @see aclmdlLoadFromFile | aclmdlLoadFromMem | aclmdlLoadFromFileWithMem | - * aclmdlLoadFromMemWithMem | aclmdlGetInputIndexByName - */ -ACL_FUNC_VISIBILITY aclError aclmdlGetFirstAippInfo(uint32_t modelId, size_t index, aclAippInfo *aippinfo); - -/** - * @ingroup AscendCL - * @brief get op description info - * - * @param deviceId [IN] device id - * @param streamId [IN] stream id - * @param taskId [IN] task id - * @param opName [OUT] pointer to op name - * @param opNameLen [IN] the length of op name - * @param inputDesc [OUT] pointer to input description - * @param numInputs [OUT] the number of input tensor - * @param outputDesc [OUT] pointer to output description - * @param numOutputs [OUT] the number of output tensor - * - * @retval ACL_SUCCESS The function is successfully executed - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlCreateAndGetOpDesc(uint32_t deviceId, uint32_t streamId, uint32_t taskId, - char *opName, size_t opNameLen, aclTensorDesc **inputDesc, - size_t *numInputs, aclTensorDesc **outputDesc, - size_t *numOutputs); - -/** - * @ingroup AscendCL - * @brief init dump - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlInitDump(); - -/** - * @ingroup AscendCL - * @brief set param of dump - * - * @param dumpCfgPath [IN] the path of dump config - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlSetDump(const char *dumpCfgPath); - -/** - * @ingroup AscendCL - * @brief finalize dump. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclmdlFinalizeDump(); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_MODEL_H_ diff --git a/inc/external/acl/acl_op.h b/inc/external/acl/acl_op.h deleted file mode 100644 index 882c6ae6..00000000 --- a/inc/external/acl/acl_op.h +++ /dev/null @@ -1,503 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef INC_EXTERNAL_ACL_ACL_OP_H_ -#define INC_EXTERNAL_ACL_ACL_OP_H_ - -#include "acl_base.h" -#include "acl_rt.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct aclopHandle aclopHandle; -typedef struct aclopAttr aclopAttr; -typedef struct aclopKernelDesc aclopKernelDesc; - -typedef void (*aclDataDeallocator)(void *data, size_t length); - -static const int ACL_COMPILE_FLAG_BIN_SELECTOR = 1; - -typedef enum aclEngineType { - ACL_ENGINE_SYS, - ACL_ENGINE_AICORE, - ACL_ENGINE_VECTOR, -} aclopEngineType; - -/** - * @ingroup AscendCL - * @brief Set base directory that contains single op models - * - * @par Restriction - * The aclopSetModelDir interface can be called only once in a process. - * @param modelDir [IN] path of the directory - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir); - -/** - * @ingroup AscendCL - * @brief load single op models from memory - * - * @par Restriction - * The aclopLoad interface can be called more than one times in a process. - * @param model [IN] address of single op models - * @param modelSize [IN] size of single op models - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopLoad(const void *model, size_t modelSize); - -/** - * @ingroup AscendCL - * @brief create data of type aclopAttr - * - * @retval pointer to created instance. - * @retval nullptr if run out of memory - */ -ACL_FUNC_VISIBILITY aclopAttr *aclopCreateAttr(); - -/** - * @ingroup AscendCL - * @brief destroy data of typ aclopAttr - * - * @param attr [IN] pointer to the instance of aclopAttr - */ -ACL_FUNC_VISIBILITY void aclopDestroyAttr(const aclopAttr *attr); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is bool - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param attrValue [IN] attribute value - * false if attrValue is 0, true otherwise. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrName, uint8_t attrValue); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is int64_t - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param attrValue [IN] attribute value - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrName, int64_t attrValue); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is float - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param attrValue [IN] attribute value - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attrName, float attrValue); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is string - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param attrValue [IN] attribute value - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *attrName, const char *attrValue); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is list of bools - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param numValues [IN] number of values. false if attrValue is 0, true otherwise. - * @param values [IN] pointer to values - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues, - const uint8_t *values); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is list of ints - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param numValues [IN] number of values - * @param values [IN] pointer to values - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues, - const int64_t *values); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is list of floats - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param numValues [IN] number of values - * @param values [IN] pointer to values - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues, - const float *values); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is list of strings - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param numValues [IN] number of values - * @param values [IN] pointer to values - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues, - const char **values); - -/** - * @ingroup AscendCL - * @brief set an attribute. the type of the attribute is list of list of ints - * - * @param attr [OUT] pointer to the instance of aclopAttr - * @param attrName [IN] attribute name - * @param numLists [IN] number of lists - * @param numValues [IN] pointer to number of values of each list - * @param values [IN] pointer to values - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, const char *attrName, int numLists, - const int *numValues, const int64_t *const values[]); - -/** - * @ingroup AscendCL - * @brief Load and execute the specified operator asynchronously - * - * @par Restriction - * @li The input and output organization of each operator is different, - * and the application needs to organize the operator strictly - * according to the operator input and output parameters when calling. - * @li When the user calls aclopExecute, - * the ACL finds the corresponding task according to the optype, - * the description of the input tesnsor, - * the description of the output tesnsor, and attr, and issues the execution. - * - * @param opType [IN] type of op - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param inputs [IN] pointer to array of input buffers - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN] pointer to array of output tensor descriptions - * @param outputs [OUT] pointer to array of output buffers - * @param attr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_DEPRECATED_MESSAGE("aclopExecute is deprecated, use aclopExecuteV2 instead") -ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], - const aclDataBuffer *const inputs[], int numOutputs, - const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], - const aclopAttr *attr, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Load and execute the specified operator - * The difference with aclopExecute is that aclopExecuteV2 will refresh outputDesc - * - * @par Restriction - * @li The input and output organization of each operator is different, - * and the application needs to organize the operator strictly - * according to the operator input and output parameters when calling. - * @li When the user calls aclopExecuteV2, - * the ACL finds the corresponding task according to the optype, - * the description of the input tesnsor, - * the description of the output tesnsor, and attr, and issues the execution. - * - * @param opType [IN] type of op - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param inputs [IN] pointer to array of input buffers - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN|OUT] pointer to array of output tensor descriptions - * @param outputs [OUT] pointer to array of output buffers - * @param attr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopExecuteV2(const char *opType, int numInputs, aclTensorDesc *inputDesc[], - aclDataBuffer *inputs[], int numOutputs, aclTensorDesc *outputDesc[], - aclDataBuffer *outputs[], aclopAttr *attr, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a instance of aclopHandle. - * - * @param opType [IN] type of op - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN] pointer to array of output tensor descriptions - * @param opAttr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * @param handle [OUT] pointer to the pointer to the handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType, int numInputs, - const aclTensorDesc *const inputDesc[], int numOutputs, - const aclTensorDesc *const outputDesc[], const aclopAttr *opAttr, - aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief destroy aclopHandle instance - * - * @param handle [IN] pointer to the instance of aclopHandle - */ -ACL_FUNC_VISIBILITY void aclopDestroyHandle(aclopHandle *handle); - -/** - * @ingroup AscendCL - * @brief execute an op with the handle. - * can save op model matching cost compared with aclopExecute - * - * @param handle [IN] pointer to the instance of aclopHandle. - * The aclopCreateHandle interface has been called - * in advance to create aclopHandle type data. - * @param numInputs [IN] number of inputs - * @param inputs [IN] pointer to array of input buffers. - * The aclCreateDataBuffer interface has been called - * in advance to create aclDataBuffer type data. - * @param numOutputs [IN] number of outputs - * @param outputs [OUT] pointer to array of output buffers - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclopCreateHandle | aclCreateDataBuffer - */ -ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, int numInputs, - const aclDataBuffer *const inputs[], int numOutputs, - aclDataBuffer *const outputs[], aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief cast data type - * - * @param srcDesc [IN] source tensor desc - * @param srcBuffer [IN] source tensor buffer - * @param dstDesc [IN] destination tensor desc - * @param dstBuffer [OUT] destination tensor buffer - * @param truncate [IN] do not truncate if value is 0, truncate otherwise - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, const aclDataBuffer *srcBuffer, - const aclTensorDesc *dstDesc, aclDataBuffer *dstBuffer, uint8_t truncate, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for casting datatype - * - * @param srcDesc [IN] source tensor desc - * @param dstDesc [IN] destination tensor desc - * @param truncate [IN] do not truncate if value is 0, truncate otherwise - * @param handle [OUT] pointer to the pointer to the handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, aclTensorDesc *dstDesc, uint8_t truncate, - aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief create kernel - * - * @param opType [IN] op type - * @param kernelId [IN] kernel id - * @param kernelName [IN] kernel name - * @param binData [IN] kernel bin data - * @param binSize [IN] kernel bin size - * @param enginetype [IN] enigne type - * @param deallocator [IN] callback function for deallocating bin data, - * null if bin data to be deallocated by caller - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclopCompile - */ -ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType, const char *kernelId, const char *kernelName, - void *binData, int binSize, aclopEngineType enginetype, - aclDataDeallocator deallocator); - -/** - * @ingroup AscendCL - * @brief create kernel - * - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN] pointer to array of output tensor descriptions - * @param opAttr [IN] pointer to instance of aclopAttr - * @param aclopKernelDesc [IN] pointer to instance of aclopKernelDesc - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -typedef aclError (*aclopCompileFunc)(int numInputs, const aclTensorDesc *const inputDesc[], int numOutputs, - const aclTensorDesc *const outputDesc[], const aclopAttr *opAttr, - aclopKernelDesc *aclopKernelDesc); - -/** - * @ingroup AscendCL - * @brief register compile function - * - * @param opType [IN] op type - * @param func [IN] compile function - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclopUnregisterCompileFunc - */ -ACL_FUNC_VISIBILITY aclError aclopRegisterCompileFunc(const char *opType, aclopCompileFunc func); - -/** - * @ingroup AscendCL - * @brief unregister compile function - * - * @param opType [IN] op type - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); - -/** - * @ingroup AscendCL - * @brief set kernel args - * - * @param kernelDesc [IN] pointer to instance of aclopKernelDesc - * @param kernelId [IN] kernel id - * @param blockDim [IN] block dim - * @param args [IN] args - * @param argSize [IN] size in bytes of args - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, const char *kernelId, uint32_t blockDim, - const void *args, uint32_t argSize); - -/** - * @ingroup AscendCL - * @brief set workspace sizes - * - * @param kernelDesc [IN] pointer to instance of aclopKernelDesc - * @param numWorkspaces [IN] number of workspaces - * @param workspaceSizes [IN] pointer to array of sizes of workspaces - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kernelDesc, int numWorkspaces, - size_t *workspaceSizes); - -/** - * @ingroup AscendCL - * @brief compile op with dynamic shape - * - * @param opType [IN] op type - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN] pointer to array of output tensor descriptions - * @param attr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, int numInputs, - const aclTensorDesc *const inputDesc[], int numOutputs, - const aclTensorDesc *const outputDesc[], const aclopAttr *attr); - -/** - * @ingroup AscendCL - * @brief inferShape the specified operator synchronously - * - * @param opType [IN] type of op - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param inputs [IN] pointer to array of input buffers - * @param numOutputs [IN] number of outputs - * @param outputDesc [OUT] pointer to array of output tensor descriptions - * @param attr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopInferShape(const char *opType, int numInputs, aclTensorDesc *inputDesc[], - aclDataBuffer *inputs[], int numOutputs, aclTensorDesc *outputDesc[], - aclopAttr *attr); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_OP_H_ diff --git a/inc/external/acl/acl_op_compiler.h b/inc/external/acl/acl_op_compiler.h deleted file mode 100644 index 9bf5adf0..00000000 --- a/inc/external/acl/acl_op_compiler.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ -#define INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ - -#include "acl_base.h" -#include "acl_op.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum aclCompileType { ACL_COMPILE_SYS, ACL_COMPILE_UNREGISTERED } aclopCompileType; - -typedef enum { - ACL_PRECISION_MODE, - ACL_AICORE_NUM, - ACL_AUTO_TUNE_MODE, - ACL_OP_SELECT_IMPL_MODE, - ACL_OPTYPELIST_FOR_IMPLMODE, - ACL_OP_DEBUG_LEVEL, - ACL_DEBUG_DIR, - ACL_OP_COMPILER_CACHE_MODE, - ACL_OP_COMPILER_CACHE_DIR -} aclCompileOpt; - -/** - * @ingroup AscendCL - * @brief compile op - * - * @param opType [IN] op type - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN] pointer to array of output tensor descriptions - * @param attr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * @param engineType [IN] engine type - * @param compileFlag [IN] compile flag - * @param opPath [IN] path of op - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopCompile(const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], - int numOutputs, const aclTensorDesc *const outputDesc[], - const aclopAttr *attr, aclopEngineType engineType, - aclopCompileType compileFlag, const char *opPath); - -/** - * @ingroup AscendCL - * @brief compile and execute op - * - * @param opType [IN] op type - * @param numInputs [IN] number of inputs - * @param inputDesc [IN] pointer to array of input tensor descriptions - * @param inputs [IN] pointer to array of input buffers - * @param numOutputs [IN] number of outputs - * @param outputDesc [IN] pointer to array of output tensor descriptions - * @param outputs [IN] pointer to array of outputs buffers - * @param attr [IN] pointer to instance of aclopAttr. - * may pass nullptr if the op has no attribute - * @param engineType [IN] engine type - * @param compileFlag [IN] compile flag - * @param opPath [IN] path of op - * @param stream [IN] stream handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclopCompileAndExecute( - const char *opType, int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[], - int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], const aclopAttr *attr, - aclopEngineType engineType, aclopCompileType compileFlag, const char *opPath, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief set compile option - * - * @param aclCompileOpt [IN] compile option - * @param value [IN] pointer for the option value - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclSetCompileopt(aclCompileOpt opt, const char *value); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_OP_COMPILER_H_ diff --git a/inc/external/acl/acl_prof.h b/inc/external/acl/acl_prof.h deleted file mode 100644 index bfb8a68b..00000000 --- a/inc/external/acl/acl_prof.h +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INC_EXTERNAL_ACL_PROF_H_ -#define INC_EXTERNAL_ACL_PROF_H_ - -#include "acl_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ACL_PROF_ACL_API 0x0001 -#define ACL_PROF_TASK_TIME 0x0002 -#define ACL_PROF_AICORE_METRICS 0x0004 -#define ACL_PROF_AICPU_TRACE 0x0008 - -#define ACL_PROF_MAX_OP_NAME_LEN 257 -#define ACL_PROF_MAX_OP_TYPE_LEN 65 - -typedef enum { - ACL_AICORE_ARITHMATIC_THROUGHPUT = 0, - ACL_AICORE_PIPELINE = 1, - ACL_AICORE_SYNCHRONIZATION = 2, - ACL_AICORE_MEMORY = 3, - ACL_AICORE_INTERNAL_MEMORY = 4, - ACL_AICORE_STALL = 5, - ACL_AICORE_NONE = 0xFF -} aclprofAicoreMetrics; - -typedef struct aclprofConfig aclprofConfig; -typedef struct aclprofStopConfig aclprofStopConfig; -typedef struct aclprofAicoreEvents aclprofAicoreEvents; -typedef struct aclprofSubscribeConfig aclprofSubscribeConfig; - -/** - * @ingroup AscendCL - * @brief profiling initialize - * - * @param profilerResultPath [IN] path of profiling result - * @param length [IN] length of profilerResultPath - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofFinalize - */ -ACL_FUNC_VISIBILITY aclError aclprofInit(const char *profilerResultPath, size_t length); - -/** - * @ingroup AscendCL - * @brief profiling finalize - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofInit - */ -ACL_FUNC_VISIBILITY aclError aclprofFinalize(); - -/** - * @ingroup AscendCL - * @brief Start profiling modules by profilerConfig - * - * @param profilerConfig [IN] config of profiling - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofStop - */ -ACL_FUNC_VISIBILITY aclError aclprofStart(const aclprofConfig *profilerConfig); - -/** - * @ingroup AscendCL - * @brief Create data of type aclprofConfig - * - * @param deviceIdList [IN] list of device id - * @param deviceNums [IN] number of devices - * @param aicoreMetrics [IN] type of aicore metrics - * @param aicoreEvents [IN] pointer to aicore events, only support NULL now - * @param dataTypeConfig [IN] config modules need profiling - * - * @retval the aclprofConfig pointer - * - * @see aclprofDestroyConfig - */ -ACL_FUNC_VISIBILITY aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdList, uint32_t deviceNums, - aclprofAicoreMetrics aicoreMetrics, - aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig); - -/** - * @ingroup AscendCL - * @brief Destroy data of type aclprofConfig - * - * @param profilerConfig [IN] config of profiling - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofCreateConfig - */ -ACL_FUNC_VISIBILITY aclError aclprofDestroyConfig(const aclprofConfig *profilerConfig); - -/** - * @ingroup AscendCL - * @brief stop profiling modules by stopProfilingConfig - * - * @param profilerConfig [IN] pointer to stop config of profiling - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofStart - */ -ACL_FUNC_VISIBILITY aclError aclprofStop(const aclprofConfig *profilerConfig); - -/** - * @ingroup AscendCL - * @brief subscribe profiling data of model - * - * @param modelId [IN] the model id subscribed - * @param profSubscribeConfig [IN] pointer to config of model subscribe - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofModelUnSubscribe - */ -ACL_FUNC_VISIBILITY aclError aclprofModelSubscribe(uint32_t modelId, const aclprofSubscribeConfig *profSubscribeConfig); - -/** - * @ingroup AscendCL - * @brief unsubscribe profiling data of model - * - * @param modelId [IN] the model id unsubscribed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofModelSubscribe - */ -ACL_FUNC_VISIBILITY aclError aclprofModelUnSubscribe(uint32_t modelId); - -/** - * @ingroup AscendCL - * @brief create subscribe config - * - * @param timeInfoSwitch [IN] switch whether get time info from model - * @param aicoreMetrics [IN] aicore metrics - * @param fd [IN] pointer to write pipe - * - * @retval the aclprofSubscribeConfig pointer - * - * @see aclprofDestroySubscribeConfig - */ -ACL_FUNC_VISIBILITY aclprofSubscribeConfig *aclprofCreateSubscribeConfig(int8_t timeInfoSwitch, - aclprofAicoreMetrics aicoreMetrics, void *fd); - -/** - * @ingroup AscendCL - * @brief destroy subscribe config - * - * @param profSubscribeConfig [IN] subscribe config - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclprofCreateSubscribeConfig - */ -ACL_FUNC_VISIBILITY aclError aclprofDestroySubscribeConfig(const aclprofSubscribeConfig *profSubscribeConfig); - -/** - * @ingroup AscendCL - * @brief create subscribe config - * - * @param opDescSize [OUT] size of op desc - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclprofGetOpDescSize(size_t *opDescSize); - -/** - * @ingroup AscendCL - * @brief get op number from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * @param opNumber [OUT] op number of subscription data - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclprofGetOpNum(const void *opInfo, size_t opInfoLen, uint32_t *opNumber); - -/** - * @ingroup AscendCL - * @brief get op type from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * @param index [IN] index of op array in opInfo - * @param opType [OUT] obtained op type string - * @param opTypeLen [IN] obtained length of op type string - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclprofGetOpType(const void *opInfo, size_t opInfoLen, uint32_t index, char *opType, - size_t opTypeLen); - -/** - * @ingroup AscendCL - * @brief get op type from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * @param index [IN] index of op array in opInfo - * @param opName [OUT] obtained op name string - * @param opNameLen [IN] obtained length of op name string - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclprofGetOpName(const void *opInfo, size_t opInfoLen, uint32_t index, char *opName, - size_t opNameLen); - -/** - * @ingroup AscendCL - * @brief get start time of specified op from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * @param index [IN] index of op array in opInfo - * - * @retval start time(us) of specified op with timestamp - * @retval 0 for failed - */ -ACL_FUNC_VISIBILITY uint64_t aclprofGetOpStart(const void *opInfo, size_t opInfoLen, uint32_t index); - -/** - * @ingroup AscendCL - * @brief get end time of specified op from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * @param index [IN] index of op array in opInfo - * - * @retval end time(us) of specified op with timestamp - * @retval 0 for failed - */ -ACL_FUNC_VISIBILITY uint64_t aclprofGetOpEnd(const void *opInfo, size_t opInfoLen, uint32_t index); - -/** - * @ingroup AscendCL - * @brief get excution time of specified op from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * @param index [IN] index of op array in opInfo - * - * @retval execution time(us) of specified op with timestamp - * @retval 0 for failed - */ -ACL_FUNC_VISIBILITY uint64_t aclprofGetOpDuration(const void *opInfo, size_t opInfoLen, uint32_t index); - -/** - * @ingroup AscendCL - * @brief get model id from subscription data - * - * @param opInfo [IN] pointer to subscription data - * @param opInfoLen [IN] memory size of subscription data - * - * @retval model id of subscription data - * @retval 0 for failed - */ -ACL_FUNC_VISIBILITY size_t aclprofGetModelId(const void *opInfo, size_t opInfoLen, uint32_t index); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_PROF_H_ \ No newline at end of file diff --git a/inc/external/acl/acl_rt.h b/inc/external/acl/acl_rt.h deleted file mode 100644 index eb6b4240..00000000 --- a/inc/external/acl/acl_rt.h +++ /dev/null @@ -1,932 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INC_EXTERNAL_ACL_ACL_RT_H_ -#define INC_EXTERNAL_ACL_ACL_RT_H_ - -#include -#include -#include "acl_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum aclrtRunMode { - ACL_DEVICE, - ACL_HOST, -} aclrtRunMode; - -typedef enum aclrtTsId { - ACL_TS_ID_AICORE = 0, - ACL_TS_ID_AIVECTOR = 1, - ACL_TS_ID_RESERVED = 2, -} aclrtTsId; - -typedef enum aclrtEventStatus { - ACL_EVENT_STATUS_COMPLETE = 0, - ACL_EVENT_STATUS_NOT_READY = 1, - ACL_EVENT_STATUS_RESERVED = 2, -} aclrtEventStatus; - -typedef enum aclrtCallbackBlockType { - ACL_CALLBACK_NO_BLOCK, - ACL_CALLBACK_BLOCK, -} aclrtCallbackBlockType; - -typedef enum aclrtMemcpyKind { - ACL_MEMCPY_HOST_TO_HOST, - ACL_MEMCPY_HOST_TO_DEVICE, - ACL_MEMCPY_DEVICE_TO_HOST, - ACL_MEMCPY_DEVICE_TO_DEVICE, -} aclrtMemcpyKind; - -typedef enum aclrtMemMallocPolicy { - ACL_MEM_MALLOC_HUGE_FIRST, - ACL_MEM_MALLOC_HUGE_ONLY, - ACL_MEM_MALLOC_NORMAL_ONLY, - ACL_MEM_MALLOC_HUGE_FIRST_P2P, - ACL_MEM_MALLOC_HUGE_ONLY_P2P, - ACL_MEM_MALLOC_NORMAL_ONLY_P2P, -} aclrtMemMallocPolicy; - -typedef enum aclrtMemAttr { - ACL_DDR_MEM, - ACL_HBM_MEM, - ACL_DDR_MEM_HUGE, - ACL_DDR_MEM_NORMAL, - ACL_HBM_MEM_HUGE, - ACL_HBM_MEM_NORMAL, - ACL_DDR_MEM_P2P_HUGE, - ACL_DDR_MEM_P2P_NORMAL, - ACL_HBM_MEM_P2P_HUGE, - ACL_HBM_MEM_P2P_NORMAL, -} aclrtMemAttr; - -typedef enum aclrtGroupAttr { - ACL_GROUP_AICORE_INT, - ACL_GROUP_AIV_INT, - ACL_GROUP_AIC_INT, - ACL_GROUP_SDMANUM_INT, - ACL_GROUP_ASQNUM_INT -} aclrtGroupAttr; - -typedef struct tagRtGroupInfo aclrtGroupInfo; - -typedef struct rtExceptionInfo aclrtExceptionInfo; - -typedef void (*aclrtCallback)(void *userData); - -typedef void (*aclrtExceptionInfoCallback)(aclrtExceptionInfo *exceptionInfo); - -/** - * @ingroup AscendCL - * @brief Set a callback function to handle exception information - * - * @param callback [IN] callback function to handle exception information - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback); - -/** - * @ingroup AscendCL - * @brief Get task id from exception information - * - * @param info [IN] pointer of exception information - * - * @retval The task id from exception information - * @retval 0xFFFFFFFF if info is null - */ -ACL_FUNC_VISIBILITY uint32_t aclrtGetTaskIdFromExceptionInfo(const aclrtExceptionInfo *info); - -/** - * @ingroup AscendCL - * @brief Get stream id from exception information - * - * @param info [IN] pointer of exception information - * - * @retval The stream id from exception information - * @retval 0xFFFFFFFF if info is null - */ -ACL_FUNC_VISIBILITY uint32_t aclrtGetStreamIdFromExceptionInfo(const aclrtExceptionInfo *info); - -/** - * @ingroup AscendCL - * @brief Get thread id from exception information - * - * @param info [IN] pointer of exception information - * - * @retval The thread id of fail task - * @retval 0xFFFFFFFF if info is null - */ -ACL_FUNC_VISIBILITY uint32_t aclrtGetThreadIdFromExceptionInfo(const aclrtExceptionInfo *info); - -/** - * @ingroup AscendCL - * @brief Get device id from exception information - * - * @param info [IN] pointer of exception information - * - * @retval The thread id of fail task - * @retval 0xFFFFFFFF if info is null - */ -ACL_FUNC_VISIBILITY uint32_t aclrtGetDeviceIdFromExceptionInfo(const aclrtExceptionInfo *info); - -/** - * @ingroup AscendCL - * @brief The thread that handles the callback function on the Stream - * - * @param threadId [IN] thread ID - * @param stream [IN] stream handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Add a callback function to be executed on the host - * to the task queue of the Stream - * - * @param fn [IN] Specify the callback function to be added - * The function prototype of the callback function is: - * typedef void (*aclrtCallback)(void *userData); - * @param userData [IN] User data to be passed to the callback function - * @param blockType [IN] callback block type - * @param stream [IN] stream handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtLaunchCallback(aclrtCallback fn, void *userData, aclrtCallbackBlockType blockType, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief After waiting for a specified time, trigger callback processing - * - * @par Function - * The thread processing callback specified by - * the aclrtSubscribeReport interface - * - * @param timeout [IN] timeout value - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtSubscribeReport - */ -ACL_FUNC_VISIBILITY aclError aclrtProcessReport(int32_t timeout); - -/** - * @ingroup AscendCL - * @brief Cancel thread registration, - * the callback function on the specified Stream - * is no longer processed by the specified thread - * - * @param threadId [IN] thread ID - * @param stream [IN] stream handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create context and associates it with the calling thread - * - * @par Function - * The following use cases are supported: - * @li If you don't call the aclrtCreateContext interface - * to explicitly create the context, - * the system will use the default context, which is implicitly created - * when the aclrtSetDevice interface is called. - * @li If multiple contexts are created in a process - * (there is no limit on the number of contexts), - * the current thread can only use one of them at the same time. - * It is recommended to explicitly specify the context of the current thread - * through the aclrtSetCurrentContext interface to increase. - * the maintainability of the program. - * - * @param context [OUT] point to the created context - * @param deviceId [IN] device to create context on - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtSetDevice | aclrtSetCurrentContext - */ -ACL_FUNC_VISIBILITY aclError aclrtCreateContext(aclrtContext *context, int32_t deviceId); - -/** - * @ingroup AscendCL - * @brief destroy context instance - * - * @par Function - * Can only destroy context created through aclrtCreateContext interface - * - * @param context [IN] the context to destroy - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtCreateContext - */ -ACL_FUNC_VISIBILITY aclError aclrtDestroyContext(aclrtContext context); - -/** - * @ingroup AscendCL - * @brief set the context of the thread - * - * @par Function - * The following scenarios are supported: - * @li If the aclrtCreateContext interface is called in a thread to explicitly - * create a Context (for example: ctx1), the thread's Context can be specified - * without calling the aclrtSetCurrentContext interface. - * The system uses ctx1 as the context of thread1 by default. - * @li If the aclrtCreateContext interface is not explicitly created, - * the system uses the default context as the context of the thread. - * At this time, the aclrtDestroyContext interface cannot be used to release - * the default context. - * @li If the aclrtSetCurrentContext interface is called multiple times to - * set the thread's Context, the last one prevails. - * - * @par Restriction - * @li If the cevice corresponding to the context set for the thread - * has been reset, you cannot set the context as the context of the thread, - * otherwise a business exception will result. - * @li It is recommended to use the context created in a thread. - * If the aclrtCreateContext interface is called in thread A to create a context, - * and the context is used in thread B, - * the user must guarantee the execution order of tasks in the same stream - * under the same context in two threads. - * - * @param context [IN] the current context of the thread - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtCreateContext | aclrtDestroyContext - */ -ACL_FUNC_VISIBILITY aclError aclrtSetCurrentContext(aclrtContext context); - -/** - * @ingroup AscendCL - * @brief get the context of the thread - * - * @par Function - * If the user calls the aclrtSetCurrentContext interface - * multiple times to set the context of the current thread, - * then the last set context is obtained - * - * @param context [OUT] the current context of the thread - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtSetCurrentContext - */ -ACL_FUNC_VISIBILITY aclError aclrtGetCurrentContext(aclrtContext *context); - -/** - * @ingroup AscendCL - * @brief Specify the device to use for the operation - * implicitly create the default context and the default stream - * - * @par Function - * The following use cases are supported: - * @li Device can be specified in the process or thread. - * If you call the aclrtSetDevice interface multiple - * times to specify the same device, - * you only need to call the aclrtResetDevice interface to reset the device. - * @li The same device can be specified for operation - * in different processes or threads. - * @li Device is specified in a process, - * and multiple threads in the process can share this device to explicitly - * create a Context (aclrtCreateContext interface). - * @li In multi-device scenarios, you can switch to other devices - * through the aclrtSetDevice interface in the process. - * - * @param deviceId [IN] the device id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtResetDevice |aclrtCreateContext - */ -ACL_FUNC_VISIBILITY aclError aclrtSetDevice(int32_t deviceId); - -/** - * @ingroup AscendCL - * @brief Reset the current operating Device and free resources on the device, - * including the default context, the default stream, - * and all streams created under the default context, - * and synchronizes the interface. - * If the task under the default context or stream has not been completed, - * the system will wait for the task to complete before releasing it. - * - * @par Restriction - * @li The Context, Stream, and Event that are explicitly created - * on the device to be reset. Before resetting, - * it is recommended to follow the following interface calling sequence, - * otherwise business abnormalities may be caused. - * @li Interface calling sequence: - * call aclrtDestroyEvent interface to release Event or - * call aclrtDestroyStream interface to release explicitly created Stream-> - * call aclrtDestroyContext to release explicitly created Context-> - * call aclrtResetDevice interface - * - * @param deviceId [IN] the device id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId); - -/** - * @ingroup AscendCL - * @brief get target device of current thread - * - * @param deviceId [OUT] the device id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtGetDevice(int32_t *deviceId); - -/** - * @ingroup AscendCL - * @brief get target side - * - * @param runMode [OUT] the run mode - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtGetRunMode(aclrtRunMode *runMode); - -/** - * @ingroup AscendCL - * @brief Wait for compute device to finish - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtSynchronizeDevice(void); - -/** - * @ingroup AscendCL - * @brief Set Scheduling TS - * - * @param tsId [IN] the ts id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtSetTsDevice(aclrtTsId tsId); - -/** - * @ingroup AscendCL - * @brief get total device number. - * - * @param count [OUT] the device number - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count); - -/** - * @ingroup AscendCL - * @brief create event instance - * - * @param event [OUT] created event - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event); - -/** - * @ingroup AscendCL - * @brief destroy event instance - * - * @par Function - * Only events created through the aclrtCreateEvent interface can be - * destroyed, synchronous interfaces. When destroying an event, - * the user must ensure that the tasks involved in the aclrtSynchronizeEvent - * interface or the aclrtStreamWaitEvent interface are completed before - * they are destroyed. - * - * @param event [IN] event to destroy - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtCreateEvent | aclrtSynchronizeEvent | aclrtStreamWaitEvent - */ -ACL_FUNC_VISIBILITY aclError aclrtDestroyEvent(aclrtEvent event); - -/** - * @ingroup AscendCL - * @brief Record an Event in the Stream - * - * @param event [IN] event to record - * @param stream [IN] stream handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Reset an event - * - * @par Function - * Users need to make sure to wait for the tasks in the Stream - * to complete before resetting the Event - * - * @param event [IN] event to reset - * @param stream [IN] stream handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Queries an event's status - * - * @param event [IN] event to query - * @param status [OUT] event status - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtQueryEvent(aclrtEvent event, aclrtEventStatus *status); - -/** - * @ingroup AscendCL - * @brief Block Host Running, wait event to be complete - * - * @param event [IN] event to wait - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event); - -/** - * @ingroup AscendCL - * @brief computes the elapsed time between events. - * - * @param ms [OUT] time between start and end in ms - * @param start [IN] starting event - * @param end [IN] ending event - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtCreateEvent | aclrtRecordEvent | aclrtSynchronizeStream - */ -ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent start, aclrtEvent end); - -/** - * @ingroup AscendCL - * @brief alloc memory on device - * - * @par Function - * alloc for size linear memory on device - * and return a pointer to allocated memory by *devPtr - * - * @par Restriction - * @li The memory requested by the aclrtMalloc interface needs to be released - * through the aclrtFree interface. - * @li Before calling the media data processing interface, - * if you need to apply memory on the device to store input or output data, - * you need to call acldvppMalloc to apply for memory. - * - * @param devPtr [OUT] pointer to pointer to allocated memory on device - * @param size [IN] alloc memory size - * @param policy [IN] memory alloc policy - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtFree | acldvppMalloc | aclrtMallocCached - */ -ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, size_t size, aclrtMemMallocPolicy policy); - -/** - * @ingroup AscendCL - * @brief allocate memory on device with cache - * - * @par Function - * alloc for size linear memory on device - * and return a pointer to allocated memory by *devPtr - * - * @par Restriction - * @li The memory requested by the aclrtMallocCached interface needs to be released - * through the aclrtFree interface. - * - * @param devPtr [OUT] pointer to pointer to allocated memory on device - * @param size [IN] alloc memory size - * @param policy [IN] memory alloc policy - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtFree | aclrtMalloc - */ -ACL_FUNC_VISIBILITY aclError aclrtMallocCached(void **devPtr, size_t size, aclrtMemMallocPolicy policy); - -/** - * @ingroup AscendCL - * @brief flush cache data to ddr - * - * @param devPtr [IN] the pointer that flush data to ddr - * @param size [IN] flush size - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtMemFlush(void *devPtr, size_t size); - -/** - * @ingroup AscendCL - * @brief invalidate cache data - * - * @param devPtr [IN] pointer to invalidate cache data - * @param size [IN] invalidate size - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtMemInvalidate(void *devPtr, size_t size); - -/** - * @ingroup AscendCL - * @brief free device memory - * - * @par Function - * can only free memory allocated through the aclrtMalloc interface - * - * @param devPtr [IN] Pointer to memory to be freed - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtMalloc - */ -ACL_FUNC_VISIBILITY aclError aclrtFree(void *devPtr); - -/** - * @ingroup AscendCL - * @brief alloc memory on host - * - * @par Restriction - * @li The requested memory cannot be used in the Device - * and needs to be explicitly copied to the Device. - * @li The memory requested by the aclrtMallocHost interface - * needs to be released through the aclrtFreeHost interface. - * - * @param hostPtr [OUT] pointer to pointer to allocated memory on the host - * @param size [IN] alloc memory size - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtFreeHost - */ -ACL_FUNC_VISIBILITY aclError aclrtMallocHost(void **hostPtr, size_t size); - -/** - * @ingroup AscendCL - * @brief free host memory - * - * @par Function - * can only free memory allocated through the aclrtMallocHost interface - * - * @param hostPtr [IN] free memory pointer - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtMallocHost - */ -ACL_FUNC_VISIBILITY aclError aclrtFreeHost(void *hostPtr); - -/** - * @ingroup AscendCL - * @brief synchronous memory replication between host and device - * - * @param dst [IN] destination address pointer - * @param destMax [IN] Max length of the destination address memory - * @param src [IN] source address pointer - * @param count [IN] the length of byte to copy - * @param kind [IN] memcpy type - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count, - aclrtMemcpyKind kind); - -/** - * @ingroup AscendCL - * @brief Initialize memory and set contents of memory to specified value - * - * @par Function - * The memory to be initialized is on the Host or device side, - * and the system determines whether - * it is host or device according to the address - * - * @param devPtr [IN] Starting address of memory - * @param maxCount [IN] Max length of destination address memory - * @param value [IN] Set value - * @param count [IN] The length of memory - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count); - -/** - * @ingroup AscendCL - * @brief Asynchronous memory replication between Host and Device - * - * @par Function - * After calling this interface, - * be sure to call the aclrtSynchronizeStream interface to ensure that - * the task of memory replication has been completed - * - * @par Restriction - * @li For on-chip Device-to-Device memory copy, - * both the source and destination addresses must be 64-byte aligned - * - * @param dst [IN] destination address pointer - * @param destMax [IN] Max length of destination address memory - * @param src [IN] source address pointer - * @param count [IN] the number of byte to copy - * @param kind [IN] memcpy type - * @param stream [IN] asynchronized task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtSynchronizeStream - */ -ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst, size_t destMax, const void *src, size_t count, - aclrtMemcpyKind kind, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Asynchronous initialize memory - * and set contents of memory to specified value async - * - * @par Function - * The memory to be initialized is on the Host or device side, - * and the system determines whether - * it is host or device according to the address - * - * @param devPtr [IN] destination address pointer - * @param maxCount [IN] Max length of destination address memory - * @param value [IN] set value - * @param count [IN] the number of byte to set - * @param stream [IN] asynchronized task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtSynchronizeStream - */ -ACL_FUNC_VISIBILITY aclError aclrtMemsetAsync(void *devPtr, size_t maxCount, int32_t value, size_t count, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create stream instance - * - * @param stream [OUT] the created stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream); - -/** - * @ingroup AscendCL - * @brief destroy stream instance - * - * @par Function - * Can only destroy streams created through the aclrtCreateStream interface - * - * @par Restriction - * Before calling the aclrtDestroyStream interface to destroy - * the specified Stream, you need to call the aclrtSynchronizeStream interface - * to ensure that the tasks in the Stream have been completed. - * - * @param stream [IN] the stream to destroy - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtCreateStream | aclrtSynchronizeStream - */ -ACL_FUNC_VISIBILITY aclError aclrtDestroyStream(aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief block the host until all tasks - * in the specified stream have completed - * - * @param stream [IN] the stream to wait - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Blocks the operation of the specified Stream until - * the specified Event is completed. - * Support for multiple streams waiting for the same event. - * - * @param stream [IN] the wait stream If using thedefault Stream, set NULL - * @param event [IN] the event to wait - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event); - -/** - * @ingroup AscendCL - * @brief set group - * - * @par Function - * set the task to the corresponding group - * - * @param groupId [IN] group id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtGetGroupCount | aclrtGetAllGroupInfo | aclrtGetGroupInfoDetail - */ -ACL_FUNC_VISIBILITY aclError aclrtSetGroup(int32_t groupId); - -/** - * @ingroup AscendCL - * @brief get the number of group - * - * @par Function - * get the number of group. if the number of group is zero, - * it means that group is not supported or group is not created. - * - * @param count [OUT] the number of group - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - */ -ACL_FUNC_VISIBILITY aclError aclrtGetGroupCount(uint32_t *count); - -/** - * @ingroup AscendCL - * @brief create group information - * - * @retval null for failed. - * @retval OtherValues success. - * - * @see aclrtDestroyGroupInfo - */ -ACL_FUNC_VISIBILITY aclrtGroupInfo *aclrtCreateGroupInfo(); - -/** - * @ingroup AscendCL - * @brief destroy group information - * - * @param groupInfo [IN] pointer to group information - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtCreateGroupInfo - */ -ACL_FUNC_VISIBILITY aclError aclrtDestroyGroupInfo(aclrtGroupInfo *groupInfo); - -/** - * @ingroup AscendCL - * @brief get all group information - * - * @param groupInfo [OUT] pointer to group information - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtGetGroupCount - */ -ACL_FUNC_VISIBILITY aclError aclrtGetAllGroupInfo(aclrtGroupInfo *groupInfo); - -/** - * @ingroup AscendCL - * @brief get detail information of group - * - * @param groupInfo [IN] pointer to group information - * @param groupId [IN] group index value - * @param attr [IN] group attribute - * @param attrValue [OUT] pointer to attribute value - * @param valueLen [IN] length of attribute value - * @param paramRetSize [OUT] pointer to real length of attribute value - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtGetGroupCount | aclrtGetAllGroupInfo - */ -ACL_FUNC_VISIBILITY aclError aclrtGetGroupInfoDetail(const aclrtGroupInfo *groupInfo, int32_t groupId, - aclrtGroupAttr attr, void *attrValue, size_t valueLen, - size_t *paramRetSize); - -/** - * @ingroup AscendCL - * @brief checking whether current device and peer device support the p2p feature - * - * @param canAccessPeer [OUT] pointer to save the checking result - * @param deviceId [IN] current device id - * @param peerDeviceId [IN] peer device id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtDeviceEnablePeerAccess | aclrtDeviceDisablePeerAccess - */ -ACL_FUNC_VISIBILITY aclError aclrtDeviceCanAccessPeer(int32_t *canAccessPeer, int32_t deviceId, int32_t peerDeviceId); - -/** - * @ingroup AscendCL - * @brief enable the peer device to support the p2p feature - * - * @param peerDeviceId [IN] the peer device id - * @param flags [IN] reserved field, now it must be zero - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtDeviceCanAccessPeer | aclrtDeviceDisablePeerAccess - */ -ACL_FUNC_VISIBILITY aclError aclrtDeviceEnablePeerAccess(int32_t peerDeviceId, uint32_t flags); - -/** - * @ingroup AscendCL - * @brief disable the peer device to support the p2p function - * - * @param peerDeviceId [IN] the peer device id - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclrtDeviceCanAccessPeer | aclrtDeviceEnablePeerAccess - */ -ACL_FUNC_VISIBILITY aclError aclrtDeviceDisablePeerAccess(int32_t peerDeviceId); - -/** - * @ingroup AscendCL - * @brief Obtain the free memory and total memory of specified attribute. - * the specified memory include normal memory and huge memory. - * - * @param attr [IN] the memory attribute of specified device - * @param free [OUT] the free memory of specified device - * @param total [OUT] the total memory of specified device. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtGetMemInfo(aclrtMemAttr attr, size_t *free, size_t *total); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_RT_H_ diff --git a/inc/external/acl/acl_tdt.h b/inc/external/acl/acl_tdt.h deleted file mode 100644 index c357518d..00000000 --- a/inc/external/acl/acl_tdt.h +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef INC_EXTERNAL_ACL_ACL_TDT_H_ -#define INC_EXTERNAL_ACL_ACL_TDT_H_ - -#include "acl/acl_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum acltdtTensorType { - ACL_TENSOR_DATA_UNDEFINED = -1, - ACL_TENSOR_DATA_TENSOR, - ACL_TENSOR_DATA_END_OF_SEQUENCE, - ACL_TENSOR_DATA_ABNORMAL -}; - -typedef struct acltdtDataItem acltdtDataItem; -typedef struct acltdtDataset acltdtDataset; -typedef struct acltdtChannelHandle acltdtChannelHandle; - -/** - * @ingroup AscendCL - * @brief Get tensor type from item - * - * @param dataItem [IN] pointer to the data item - * - * @retval Tensor type. - * @retval ACL_DT_UNDEFINED if dataItem is null - */ -ACL_FUNC_VISIBILITY acltdtTensorType acltdtGetTensorTypeFromItem(const acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Get data type from item - * - * @param dataItem [IN] pointer to the data item - * - * @retval Data type. - * @retval ACL_DT_UNDEFINED if dataItem is null - */ -ACL_FUNC_VISIBILITY aclDataType acltdtGetDataTypeFromItem(const acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Get data address from item - * - * @param dataItem [IN] pointer to data item - * - * @retval null for failed - * @retval OtherValues success - */ -ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Get data size from item - * - * @param dataItem [IN] pointer to data item - * - * @retval 0 for failed - * @retval OtherValues success - */ -ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Get dim's number from item - * - * @param dataItem [IN] pointer to data item - * - * @retval 0 for failed - * @retval OtherValues success - */ -ACL_FUNC_VISIBILITY size_t acltdtGetDimNumFromItem(const acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Get dims from item - * - * @param dataItem [IN] the struct of data item - * @param dims [IN|OUT] pointer to the dims of dataTtem - * @param dimNum [IN] the size of the dims - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acltdtGetDimsFromItem(const acltdtDataItem *dataItem, int64_t *dims, size_t dimNum); - -/** - * @ingroup AscendCL - * @brief Create the struct of data item - * - * @param tdtType [IN] Tdt tensor type - * @param dims [IN] pointer of tdtDataItem's dims - * @param dimNum [IN] Dim number - * @param dataType [IN] Data type - * @param data [IN] Data pointer - * @param size [IN] Data size - * - * @retval null for failed - * @retval OtherValues success - * - * @see acltdtDestroyDataItem - */ -ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType, const int64_t *dims, size_t dimNum, - aclDataType dataType, void *data, size_t size); - -/** - * @ingroup AscendCL - * @brief Destroy the struct of data item - * - * @param dataItem [IN] pointer to the data item - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtCreateDataItem - */ -ACL_FUNC_VISIBILITY aclError acltdtDestroyDataItem(acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Create the tdt dataset - * - * @retval null for failed - * @retval OtherValues success - * - * @see acltdtDestroyDataset - */ -ACL_FUNC_VISIBILITY acltdtDataset *acltdtCreateDataset(); - -/** - * @ingroup AscendCL - * @brief Destroy the tdt dataset - * - * @param dataset [IN] pointer to the dataset - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtCreateDataset - */ -ACL_FUNC_VISIBILITY aclError acltdtDestroyDataset(acltdtDataset *dataset); - -/** - * @ingroup AscendCL - * @brief Get the data item - * - * @param dataset [IN] pointer to the dataset - * @param index [IN] index of the dataset - * - * @retval null for failed - * @retval OtherValues success - * - * @see acltdtAddDataItem - */ -ACL_FUNC_VISIBILITY acltdtDataItem *acltdtGetDataItem(const acltdtDataset *dataset, size_t index); - -/** - * @ingroup AscendCL - * @brief Get the data item - * - * @param dataset [OUT] pointer to the dataset - * @param dataItem [IN] pointer to the data item - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtGetDataItem - */ -ACL_FUNC_VISIBILITY aclError acltdtAddDataItem(acltdtDataset *dataset, acltdtDataItem *dataItem); - -/** - * @ingroup AscendCL - * @brief Get the size of dataset - * - * @param dataset [IN] pointer to the dataset - * - * @retval 0 for failed - * @retval OtherValues success - */ -ACL_FUNC_VISIBILITY size_t acltdtGetDatasetSize(const acltdtDataset *dataset); - -/** - * @ingroup AscendCL - * @brief Stop the channel - * - * @param handle [IN] pointer to the channel handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtCreateChannel | acltdtDestroyChannel - */ -ACL_FUNC_VISIBILITY aclError acltdtStopChannel(acltdtChannelHandle *handle); - -/** - * @ingroup AscendCL - * @brief Create the channel - * - * @param deviceId [IN] the device id - * @param name [IN] the channel's name - * - * @retval null for failed - * @retval OtherValues success - * - * @see acltdtStopChannel | acltdtDestroyChannel - */ -ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannel(uint32_t deviceId, const char *name); - -/** - * @ingroup AscendCL - * @brief Destroy the channel - * - * @param handle [IN] pointer to the channel handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtCreateChannel | acltdtStopChannel - */ -ACL_FUNC_VISIBILITY aclError acltdtDestroyChannel(acltdtChannelHandle *handle); - -/** - * @ingroup AscendCL - * @brief Send tensor to device - * - * @param handle [IN] pointer to the channel handle - * @param dataset [IN] pointer to the dataset - * @param timeout [IN] to be reserved, now it must be -1 - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtReceiveTensor - */ -ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, const acltdtDataset *dataset, - int32_t timeout); - -/** - * @ingroup AscendCL - * @brief Receive tensor from device - * - * @param handle [IN] pointer to the channel handle - * @param dataset [OUT] pointer to the dataset - * @param timeout [IN] to be reserved, now it must be -1 - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acltdtSendTensor - */ -ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle, acltdtDataset *dataset, - int32_t timeout); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_ACL_TDT_H_ diff --git a/inc/external/acl/error_codes/ge_error_codes.h b/inc/external/acl/error_codes/ge_error_codes.h deleted file mode 100644 index 6f82a897..00000000 --- a/inc/external/acl/error_codes/ge_error_codes.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef INC_EXTERNAL_GE_GE_ERROR_CODES_H_ -#define INC_EXTERNAL_GE_GE_ERROR_CODES_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif -static const uint32_t ACL_ERROR_GE_PARAM_INVALID = 145000; -static const uint32_t ACL_ERROR_GE_EXEC_NOT_INIT = 145001; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID = 145002; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ID_INVALID = 145003; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_KEY_PATH_INVALID = 145004; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_NOT_SUPPORT_ENCRYPTION = 145005; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID = 145006; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID = 145007; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID = 145008; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED = 145009; -static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PARTITION_NUM_INVALID = 145010; -static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID = 145011; -static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID = 145012; -static const uint32_t ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID = 145013; -static const uint32_t ACL_ERROR_GE_AIPP_BATCH_EMPTY = 145014; -static const uint32_t ACL_ERROR_GE_AIPP_NOT_EXIST = 145015; -static const uint32_t ACL_ERROR_GE_AIPP_MODE_INVALID = 145016; -static const uint32_t ACL_ERROR_GE_OP_TASK_TYPE_INVALID = 145017; -static const uint32_t ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID = 145018; -static const uint32_t ACL_ERROR_GE_MEMORY_ALLOCATION = 245000; -static const uint32_t ACL_ERROR_GE_INTERNAL_ERROR = 545000; -static const uint32_t ACL_ERROR_GE_LOAD_MODEL = 545001; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED = 545002; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED = 545003; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED = 545004; -static const uint32_t ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED = 545005; -static const uint32_t ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA = 545006; -static const uint32_t ACL_ERROR_GE_COMMAND_HANDLE = 545007; -static const uint32_t ACL_ERROR_GE_GET_TENSOR_INFO = 545008; -static const uint32_t ACL_ERROR_GE_UNLOAD_MODEL = 545009; -#ifdef __cplusplus -} // namespace ge -#endif -#endif // INC_EXTERNAL_GE_GE_ERROR_CODES_H_ diff --git a/inc/external/acl/error_codes/rt_error_codes.h b/inc/external/acl/error_codes/rt_error_codes.h deleted file mode 100644 index 0ae5303d..00000000 --- a/inc/external/acl/error_codes/rt_error_codes.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __INC_EXTERNEL_RT_ERROR_CODES_H__ -#define __INC_EXTERNEL_RT_ERROR_CODES_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -static const int32_t ACL_RT_SUCCESS = 0; // success - -static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid -static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id -static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null -static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context -static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context -static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal -static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned -static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed -static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed -static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream -static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread -static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set -static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create -static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream -static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type - -static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPROT = 207000; // feature not support -static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error -static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error - -static const int32_t ACL_ERROR_RT_INTERNEL_ERROR = 507000; // runtime internel error -static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error -static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream -static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream -static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete -static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence -static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete -static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error -static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error -static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support -static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat -static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed -static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout -static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error -static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout -static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception -static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception -static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout -static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception -static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error -static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error -static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error -static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error -static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal -static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering -static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init -static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data -static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error -static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate -static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed -static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed -static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context -static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out -static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error - -static const int32_t ACL_ERROR_RT_DRV_INTERNEL_ERROR = 507899; // drv internel error - -#ifdef __cplusplus -} -#endif - -#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ diff --git a/inc/external/acl/ops/acl_cblas.h b/inc/external/acl/ops/acl_cblas.h deleted file mode 100644 index 571a1183..00000000 --- a/inc/external/acl/ops/acl_cblas.h +++ /dev/null @@ -1,333 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ -#define INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ - -#include "acl/acl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum aclTransType { ACL_TRANS_N, ACL_TRANS_T, ACL_TRANS_NZ, ACL_TRANS_NZ_T } aclTransType; - -typedef enum aclComputeType { ACL_COMPUTE_HIGH_PRECISION, ACL_COMPUTE_LOW_PRECISION } aclComputeType; - -/** - * @ingroup AscendCL - * @brief perform the matrix-vector multiplication - * - * @param transA [IN] transpose type of matrix A - * @param m [IN] number of rows of matrix A - * @param n [IN] number of columns of matrix A - * @param alpha [IN] pointer to scalar used for multiplication. - * of same type as dataTypeC - * @param a [IN] pointer to matrix A - * @param lda [IN] leading dimension used to store the matrix A - * @param dataTypeA [IN] datatype of matrix A - * @param x [IN] pointer to vector x - * @param incx [IN] stride between consecutive elements of vector x - * @param dataTypeX [IN] datatype of vector x - * @param beta [IN] pointer to scalar used for multiplication. - * of same type as dataTypeC If beta == 0, - * then y does not have to be a valid input - * @param y [IN|OUT] pointer to vector y - * @param incy [IN] stride between consecutive elements of vector y - * @param dataTypeY [IN] datatype of vector y - * @param type [IN] computation type - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasGemvEx(aclTransType transA, int m, int n, const void *alpha, const void *a, int lda, - aclDataType dataTypeA, const void *x, int incx, aclDataType dataTypeX, - const void *beta, void *y, int incy, aclDataType dataTypeY, - aclComputeType type, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for performing the matrix-vector multiplication - * - * @param transA [IN] transpose type of matrix A - * @param m [IN] number of rows of matrix A - * @param n [IN] number of columns of matrix A - * @param dataTypeA [IN] datatype of matrix A - * @param dataTypeX [IN] datatype of vector x - * @param dataTypeY [IN] datatype of vector y - * @param type [IN] computation type - * @param handle [OUT] pointer to the pointer to the handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemvEx(aclTransType transA, int m, int n, aclDataType dataTypeA, - aclDataType dataTypeX, aclDataType dataTypeY, - aclComputeType type, aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief perform the matrix-vector multiplication - * - * @param transA [IN] transpose type of matrix A - * @param m [IN] number of rows of matrix A - * @param n [IN] number of columns of matrix A - * @param alpha [IN] pointer to scalar used for multiplication - * @param a [IN] pointer to matrix A - * @param lda [IN] leading dimension used to store the matrix A - * @param x [IN] pointer to vector x - * @param incx [IN] stride between consecutive elements of vector x - * @param beta [IN] pointer to scalar used for multiplication. - * If beta value == 0, - * then y does not have to be a valid input - * @param y [IN|OUT] pointer to vector y - * @param incy [IN] stride between consecutive elements of vector y - * @param type [IN] computation type - * @param stream [IN] stream - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasHgemv(aclTransType transA, int m, int n, const aclFloat16 *alpha, - const aclFloat16 *a, int lda, const aclFloat16 *x, int incx, - const aclFloat16 *beta, aclFloat16 *y, int incy, aclComputeType type, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for performing the matrix-vector multiplication - * - * @param transA [IN] transpose type of matrix A - * @param m [IN] number of rows of matrix A - * @param n [IN] number of columns of matrix A - * @param type [IN] computation type - * @param handle [OUT] pointer to the pointer to the handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA, int m, int n, aclComputeType type, - aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief perform the matrix-vector multiplication - * - * @param transA [IN] transpose type of matrix A - * @param m [IN] number of rows of matrix A - * @param n [IN] number of columns of matrix A - * @param alpha [IN] pointer to scalar used for multiplication - * @param a [IN] pointer to matrix A - * @param lda [IN] leading dimension used to store the matrix A - * @param x [IN] pointer to vector x - * @param incx [IN] stride between consecutive elements of vector x - * @param beta [IN] pointer to scalar used for multiplication. - * If beta value == 0, - * then y does not have to be a valid input - * @param y [IN|OUT] pointer to vector y - * @param incy [IN] stride between consecutive elements of vector y - * @param type [IN] computation type - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasS8gemv(aclTransType transA, int m, int n, const int32_t *alpha, const int8_t *a, - int lda, const int8_t *x, int incx, const int32_t *beta, int32_t *y, - int incy, aclComputeType type, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for performing the matrix-vector multiplication - * - * @param transA [IN] transpose type of matrix A - * @param m [IN] number of rows of matrix A - * @param n [IN] number of columns of matrix A - * @param handle [OUT] pointer to the pointer to the handle - * @param type [IN] computation type - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA, int m, int n, aclComputeType type, - aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief perform the matrix-matrix multiplication - * - * @param transA [IN] transpose type of matrix A - * @param transB [IN] transpose type of matrix B - * @param transC [IN] transpose type of matrix C - * @param m [IN] number of rows of matrix A and matrix C - * @param n [IN] number of columns of matrix B and matrix C - * @param k [IN] number of columns of matrix A and rows of matrix B - * @param alpha [IN] pointer to scalar used for multiplication. of same type as dataTypeC - * @param matrixA [IN] pointer to matrix A - * @param lda [IN] leading dimension array used to store matrix A - * @param dataTypeA [IN] datatype of matrix A - * @param matrixB [IN] pointer to matrix B - * @param ldb [IN] leading dimension array used to store matrix B - * @param dataTypeB [IN] datatype of matrix B - * @param beta [IN] pointer to scalar used for multiplication. - * of same type as dataTypeC If beta == 0, - * then matrixC does not have to be a valid input - * @param matrixC [IN|OUT] pointer to matrix C - * @param ldc [IN] leading dimension array used to store matrix C - * @param dataTypeC [IN] datatype of matrix C - * @param type [IN] computation type - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasGemmEx(aclTransType transA, aclTransType transB, aclTransType transC, int m, int n, - int k, const void *alpha, const void *matrixA, int lda, - aclDataType dataTypeA, const void *matrixB, int ldb, aclDataType dataTypeB, - const void *beta, void *matrixC, int ldc, aclDataType dataTypeC, - aclComputeType type, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for performing the matrix-matrix multiplication - * - * @param transA [IN] transpose type of matrix A - * @param transB [IN] transpose type of matrix B - * @param transC [IN] transpose type of matrix C - * @param m [IN] number of rows of matrix A and matrix C - * @param n [IN] number of columns of matrix B and matrix C - * @param k [IN] number of columns of matrix A and rows of matrix B - * @param dataTypeA [IN] datatype of matrix A - * @param dataTypeB [IN] datatype of matrix B - * @param dataTypeC [IN] datatype of matrix C - * @param type [IN] computation type - * @param handle [OUT] pointer to the pointer to the handle - * @param type [IN] computation type - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemmEx(aclTransType transA, aclTransType transB, aclTransType transC, - int m, int n, int k, aclDataType dataTypeA, - aclDataType dataTypeB, aclDataType dataTypeC, - aclComputeType type, aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief perform the matrix-matrix multiplication - * - * @param transA [IN] transpose type of matrix A - * @param transB [IN] transpose type of matrix B - * @param transC [IN] transpose type of matrix C - * @param m [IN] number of rows of matrix A and matrix C - * @param n [IN] number of columns of matrix B and matrix C - * @param k [IN] number of columns of matrix A and rows of matrix B - * @param alpha [IN] pointer to scalar used for multiplication - * @param matrixA [IN] pointer to matrix A - * @param lda [IN] leading dimension used to store the matrix A - * @param matrixB [IN] pointer to matrix B - * @param ldb [IN] leading dimension used to store the matrix B - * @param beta [IN] pointer to scalar used for multiplication. - * If beta value == 0, - * then matrixC does not have to be a valid input - * @param matrixC [IN|OUT] pointer to matrix C - * @param ldc [IN] leading dimension used to store the matrix C - * @param type [IN] computation type - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasHgemm(aclTransType transA, aclTransType transB, aclTransType transC, int m, int n, - int k, const aclFloat16 *alpha, const aclFloat16 *matrixA, int lda, - const aclFloat16 *matrixB, int ldb, const aclFloat16 *beta, - aclFloat16 *matrixC, int ldc, aclComputeType type, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for performing the matrix-matrix multiplication - * - * @param transA [IN] transpose type of matrix A - * @param transB [IN] transpose type of matrix B - * @param transC [IN] transpose type of matrix C - * @param m [IN] number of rows of matrix A and matrix C - * @param n [IN] number of columns of matrix B and matrix C - * @param k [IN] number of columns of matrix A and rows of matrix B - * @param type [IN] computation type - * @param handle [OUT] pointer to the pointer to the handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemm(aclTransType transA, aclTransType transB, aclTransType transC, - int m, int n, int k, aclComputeType type, - aclopHandle **handle); - -/** - * @ingroup AscendCL - * @brief perform the matrix-matrix multiplication - * - * @param transA [IN] transpose type of matrix A - * @param transB [IN] transpose type of matrix B - * @param transC [IN] transpose type of matrix C - * @param m [IN] number of rows of matrix A and matrix C - * @param n [IN] number of columns of matrix B and matrix C - * @param k [IN] number of columns of matrix A and rows of matrix B - * @param alpha [IN] pointer to scalar used for multiplication - * @param matrixA [IN] pointer to matrix A - * @param lda [IN] leading dimension used to store the matrix A - * @param matrixB [IN] pointer to matrix B - * @param ldb [IN] leading dimension used to store the matrix B - * @param beta [IN] pointer to scalar used for multiplication. - * If beta value == 0, - * then matrixC does not have to be a valid input - * @param matrixC [IN|OUT] pointer to matrix C - * @param ldc [IN] leading dimension used to store the matrix C - * @param type [IN] computation type - * @param stream [IN] stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasS8gemm(aclTransType transA, aclTransType transB, aclTransType transC, int m, int n, - int k, const int32_t *alpha, const int8_t *matrixA, int lda, - const int8_t *matrixB, int ldb, const int32_t *beta, int32_t *matrixC, - int ldc, aclComputeType type, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief create a handle for performing the matrix-matrix multiplication - * - * @param transA [IN] transpose type of matrix A - * @param transB [IN] transpose type of matrix B - * @param transC [IN] transpose type of matrix C - * @param m [IN] number of rows of matrix A and matrix C - * @param n [IN] number of columns of matrix B and matrix C - * @param k [IN] number of columns of matrix A and rows of matrix B - * @param type [IN] computation type - * @param handle [OUT] pointer to the pointer to the handle - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemm(aclTransType transA, aclTransType transB, aclTransType transC, - int m, int n, int k, aclComputeType type, - aclopHandle **handle); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_OPS_ACL_CBLAS_H_ diff --git a/inc/external/acl/ops/acl_dvpp.h b/inc/external/acl/ops/acl_dvpp.h deleted file mode 100644 index 32a21e91..00000000 --- a/inc/external/acl/ops/acl_dvpp.h +++ /dev/null @@ -1,2340 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if !defined(ENABLE_DVPP_INTERFACE) -#if defined(_MSC_VER) -#error message("if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE).") -#else -#error "if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE)." -#endif -#endif - -#ifndef INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ -#define INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ - -#include -#include -#include "acl/acl.h" -#include "acl/acl_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct acldvppPicDesc acldvppPicDesc; -typedef struct acldvppBatchPicDesc acldvppBatchPicDesc; -typedef struct acldvppRoiConfig acldvppRoiConfig; -typedef struct acldvppResizeConfig acldvppResizeConfig; -typedef struct acldvppBorderConfig acldvppBorderConfig; -typedef struct acldvppLutMap acldvppLutMap; -typedef struct acldvppChannelDesc acldvppChannelDesc; -typedef struct acldvppJpegeConfig acldvppJpegeConfig; -typedef struct aclvdecChannelDesc aclvdecChannelDesc; -typedef struct acldvppStreamDesc acldvppStreamDesc; -typedef struct aclvdecFrameConfig aclvdecFrameConfig; -typedef struct aclvencChannelDesc aclvencChannelDesc; -typedef struct aclvencFrameConfig aclvencFrameConfig; -typedef struct acldvppHist acldvppHist; -typedef void (*aclvdecCallback)(acldvppStreamDesc *input, acldvppPicDesc *output, void *userData); -typedef void (*aclvencCallback)(acldvppPicDesc *input, acldvppStreamDesc *output, void *userdata); - -// Supported Pixel Format -enum acldvppPixelFormat { - PIXEL_FORMAT_YUV_400 = 0, // 0 - PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1, // 1 - PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2, // 2 - PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3, // 3 - PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4, // 4 - PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5, // 5 - PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6, // 6 - PIXEL_FORMAT_YUYV_PACKED_422 = 7, // 7 - PIXEL_FORMAT_UYVY_PACKED_422 = 8, // 8 - PIXEL_FORMAT_YVYU_PACKED_422 = 9, // 9 - PIXEL_FORMAT_VYUY_PACKED_422 = 10, // 10 - PIXEL_FORMAT_YUV_PACKED_444 = 11, // 11 - PIXEL_FORMAT_RGB_888 = 12, // 12 - PIXEL_FORMAT_BGR_888 = 13, // 13 - PIXEL_FORMAT_ARGB_8888 = 14, // 14 - PIXEL_FORMAT_ABGR_8888 = 15, // 15 - PIXEL_FORMAT_RGBA_8888 = 16, // 16 - PIXEL_FORMAT_BGRA_8888 = 17, // 17 - PIXEL_FORMAT_YUV_SEMI_PLANNER_420_10BIT = 18, // 18 - PIXEL_FORMAT_YVU_SEMI_PLANNER_420_10BIT = 19, // 19 - PIXEL_FORMAT_YVU_PLANAR_420 = 20, // 20 - PIXEL_FORMAT_YVU_PLANAR_422, - PIXEL_FORMAT_YVU_PLANAR_444, - PIXEL_FORMAT_RGB_444 = 23, - PIXEL_FORMAT_BGR_444, - PIXEL_FORMAT_ARGB_4444, - PIXEL_FORMAT_ABGR_4444, - PIXEL_FORMAT_RGBA_4444, - PIXEL_FORMAT_BGRA_4444, - PIXEL_FORMAT_RGB_555, - PIXEL_FORMAT_BGR_555, - PIXEL_FORMAT_RGB_565, - PIXEL_FORMAT_BGR_565, - PIXEL_FORMAT_ARGB_1555, - PIXEL_FORMAT_ABGR_1555, - PIXEL_FORMAT_RGBA_1555, - PIXEL_FORMAT_BGRA_1555, - PIXEL_FORMAT_ARGB_8565, - PIXEL_FORMAT_ABGR_8565, - PIXEL_FORMAT_RGBA_8565, - PIXEL_FORMAT_BGRA_8565, - PIXEL_FORMAT_RGB_BAYER_8BPP = 50, - PIXEL_FORMAT_RGB_BAYER_10BPP, - PIXEL_FORMAT_RGB_BAYER_12BPP, - PIXEL_FORMAT_RGB_BAYER_14BPP, - PIXEL_FORMAT_RGB_BAYER_16BPP, - PIXEL_FORMAT_BGR_888_PLANAR = 70, - PIXEL_FORMAT_HSV_888_PACKAGE, - PIXEL_FORMAT_HSV_888_PLANAR, - PIXEL_FORMAT_LAB_888_PACKAGE, - PIXEL_FORMAT_LAB_888_PLANAR, - PIXEL_FORMAT_S8C1, - PIXEL_FORMAT_S8C2_PACKAGE, - PIXEL_FORMAT_S8C2_PLANAR, - PIXEL_FORMAT_S16C1, - PIXEL_FORMAT_U8C1, - PIXEL_FORMAT_U16C1, - PIXEL_FORMAT_S32C1, - PIXEL_FORMAT_U32C1, - PIXEL_FORMAT_U64C1, - PIXEL_FORMAT_S64C1, - PIXEL_FORMAT_YUV_SEMIPLANAR_440 = 1000, - PIXEL_FORMAT_YVU_SEMIPLANAR_440, - PIXEL_FORMAT_FLOAT32, - PIXEL_FORMAT_BUTT, - PIXEL_FORMAT_UNKNOWN = 10000 -}; - -// Stream Format -enum acldvppStreamFormat { H265_MAIN_LEVEL = 0, H264_BASELINE_LEVEL, H264_MAIN_LEVEL, H264_HIGH_LEVEL }; - -// Supported Channel Mode -enum acldvppChannelMode { DVPP_CHNMODE_VPC = 1, DVPP_CHNMODE_JPEGD = 2, DVPP_CHNMODE_JPEGE = 4 }; - -// Supported Border Type -enum acldvppBorderType { BORDER_CONSTANT = 0, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT_101 }; - -/** - * @ingroup AscendCL - * @brief alloc device memory for dvpp. - * - * @par Function - * @li It's mainly used for allocating memory to device media data processing. - * The requested memory meets the data processing requirements. - * After calling this interface to request memory, - * you must release the memory using the acldvppFree interface. - * @li When calling the acldvppMalloc interface to apply for memory, - * the size entered by the user is aligned upwards to 32 integer multiples, - * and an additional 32 bytes are applied. - * - * @par Restriction - * If the user uses the acldvppMalloc interface to apply for a large block of - * memory and divide and manage the memory by himself, - * when applying for memory, the user needs to align up to 32 integer - * times + 32 bytes (ALIGN_UP [len] +32 words) according to - * the actual data size of each picture Section) to manage memory. - * - * @param devPtr [OUT] memory pointer. - * @param size [IN] memory size. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppFree - */ -ACL_FUNC_VISIBILITY aclError acldvppMalloc(void **devPtr, size_t size); - -/** - * @ingroup AscendCL - * @brief free device memory for dvpp. - * - * @par Function - * Free the memory requested through the acldvppMalloc interface - * @param devPtr [IN] memory pointer to free. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppMalloc - */ -ACL_FUNC_VISIBILITY aclError acldvppFree(void *devPtr); - -/** - * @ingroup AscendCL - * @brief create DvppChannelDesc. - * - * @par Function - * Create a channel for image data processing. - * The same channel can be reused - * and is no longer available after destruction - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY acldvppChannelDesc *acldvppCreateChannelDesc(); - -/** - * @ingroup AscendCL - * @brief destroy dvppChannelDesc. - * - * @par Function - * Can only destroy channels created by the acldvppCreateChannel interface - * @param channelDesc [IN] the channel description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannelDesc | acldvppDestroyChannel - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyChannelDesc(acldvppChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp channel Id. - * - * @par Restriction - * Interface calling sequence: - * acldvppCreateChannelDesc --> acldvppCreateChannel --> - * acldvppGetChannelDescChannelId - * - * @param channelDesc [IN] the channel description. - * - * @retval channel id. - * - * @see acldvppCreateChannelDesc | acldvppCreateChannel - */ -ACL_FUNC_VISIBILITY uint64_t acldvppGetChannelDescChannelId(const acldvppChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Create dvpp picture description. - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppCreatePicDesc(); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp picture description. - * - * @par Function - * Can only destroy picture description information created - * through acldvppCreatePicDesc interface. - * @param picDesc [IN] dvpp picture description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreatePicDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyPicDesc(acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's data. - * - * @param picDesc [OUT] dvpp picture description. - * @param dataDev [IN] dvpp picture dataDev.Must be the memory - * requested using the acldvppMalloc interface. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppMalloc - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescData(acldvppPicDesc *picDesc, void *dataDev); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's size. - * - * @param picDesc [OUT] dvpp picture description. - * @param size dvpp [IN] picture size. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescSize(acldvppPicDesc *picDesc, uint32_t size); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's format. - * - * @param picDesc [OUT] dvpp picture description. - * @param format [IN] dvpp picture format. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescFormat(acldvppPicDesc *picDesc, acldvppPixelFormat format); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's width. - * - * @param picDesc [OUT] dvpp picture description. - * @param width [IN] dvpp picture width. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidth(acldvppPicDesc *picDesc, uint32_t width); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's height. - * - * @param picDesc [OUT] dvpp picture description. - * @param height [IN] dvpp picture height. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeight(acldvppPicDesc *picDesc, uint32_t height); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's widthStride. - * - * @par Restriction - * Width alignment requirements: - * @li The minimum stride is 32 and the maximum is 4096 * 4 - * (that is, an image in argb format with a width of 4096); - * @li For 8K scaling, widthStride is required to be aligned to 2; - * @li For non 8K scaling, the calculation formula for widthStride - * is different for different image formats: - * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 - * @li yuv422packed: input image width * 2 and then align to 16 - * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 - * @li xrgb8888: input image width * 4, align to 16 - * @li HFBC:input image width - * - * @param picDesc [OUT] dvpp picture description. - * @param widthStride [IN] dvpp picture widthStride. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidthStride(acldvppPicDesc *picDesc, uint32_t widthStride); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's heightStride. - * - * @par Restriction - * Height alignment requirements: - * @li The height of the input image is aligned to 2. - * High stride minimum 6 and maximum 4096. - * - * @param picDesc [OUT] dvpp picture description. - * @param heightStride [IN] dvpp picture heightStride. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeightStride(acldvppPicDesc *picDesc, uint32_t heightStride); - -/** - * @ingroup AscendCL - * @brief Set dvpp picture description's retcode. - * - * @param picDesc [OUT] dvpp picture description. - * @param retCode [IN] dvpp picture retcode. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetPicDescRetCode(acldvppPicDesc *picDesc, uint32_t retCode); - -/** - * @ingroup AscendCL - * @brief Get picture data. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval picture data addr. - * @retval default nullptr. - */ -ACL_FUNC_VISIBILITY void *acldvppGetPicDescData(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get picture data size. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval picture data size. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescSize(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture desc's format. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval format - * @retval default PIXEL_FORMAT_YUV_400. - */ -ACL_FUNC_VISIBILITY acldvppPixelFormat acldvppGetPicDescFormat(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture desc's width. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval width. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidth(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture desc's height. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval height. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeight(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture desc's widthStride. - * - * @par Restriction - * Width alignment requirements: - * @li The minimum stride is 32 and the maximum is 4096 * 4 - * (that is, an image in argb format with a width of 4096); - * @li For 8K scaling, widthStride is required to be aligned to 2; - * @li For non 8K scaling, the calculation formula for widthStride - * is different for different image formats: - * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 - * @li yuv422packed: input image width * 2 and then align to 16 - * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 - * @li xrgb8888: input image width * 4, align to 16 - * @li HFBC:input image width - * - * @param picDesc [IN] dvpp picture description. - * - * @retval stride width. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidthStride(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture desc's heightStride. - * - * @par Restriction - * Height alignment requirements: - * @li The height of the input image is aligned to 2. - * High stride minimum 6 and maximum 4096. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval stride height. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeightStride(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture desc's retcode. - * - * @param picDesc [IN] dvpp picture description. - * - * @retval ret code. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescRetCode(const acldvppPicDesc *picDesc); - -/** - * @ingroup AscendCL - * @brief Create dvpp roi config. - * - * @param left [IN] the left offset, must be even - * @param right [IN] the right offset, must be odd - * @param top [IN] the top offset, must be even - * @param bottom [IN] the bottom offset, must be odd - * - * @retval null for failed. - * @retval other success - */ -ACL_FUNC_VISIBILITY acldvppRoiConfig *acldvppCreateRoiConfig(uint32_t left, uint32_t right, uint32_t top, - uint32_t bottom); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp roi config. - * - * @par Function - * Destroys data created through the acldvppCreateRoiConfig interface - * @param roiConfig [IN] dvpp roi config. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateRoiConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyRoiConfig(acldvppRoiConfig *roiConfig); - -/** - * @ingroup AscendCL - * @brief Set left of RoiConfig. - * - * @param config [OUT] RoiConfig - * @param left [IN] left offset - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigLeft(acldvppRoiConfig *config, uint32_t left); - -/** - * @ingroup AscendCL - * @brief Set right of RoiConfig. - * - * @param config [OUT] RoiConfig - * @param right [IN] right offset - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigRight(acldvppRoiConfig *config, uint32_t right); - -/** - * @ingroup AscendCL - * @brief Set top of RoiConfig. - * - * @param config [OUT] RoiConfig - * @param top [IN] top offset - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigTop(acldvppRoiConfig *config, uint32_t top); - -/** - * @ingroup AscendCL - * @brief Set bottom of RoiConfig. - * - * @param config [OUT] RoiConfig - * @param bottom [IN] bottom offset - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigBottom(acldvppRoiConfig *config, uint32_t bottom); - -/** - * @ingroup AscendCL - * @brief Set RoiConfig. - * - * @param config [OUT] RoiConfig - * @param left [IN] left offset - * @param right [IN] right offset - * @param top [IN] top offset - * @param bottom [IN] bottom offset - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfig(acldvppRoiConfig *config, uint32_t left, uint32_t right, uint32_t top, - uint32_t bottom); - -/** - * @ingroup AscendCL - * @brief Create dvpp resize config. - * The specified scaling algorithm is not supported. - * The default scaling algorithm is "nearest neighbor interpolation". - * - * @retval null for failed. - * @retval other success. - */ -ACL_FUNC_VISIBILITY acldvppResizeConfig *acldvppCreateResizeConfig(); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp resize config. - * - * @par Function - * Destroys the scaling configuration data created by - * the acldvppCreateResizeConfig interface - * - * @param resizeConfig [IN] resize config. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateResizeConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyResizeConfig(acldvppResizeConfig *resizeConfig); - -/** - * @ingroup AscendCL - * @brief Create jpege config. - * - * @retval null for failed. - * @retval other success. - */ -ACL_FUNC_VISIBILITY acldvppJpegeConfig *acldvppCreateJpegeConfig(); - -/** - * @ingroup AscendCL - * @brief Destroy jpege config. - * - * @par Function - * Destroys the encoding configuration data created by - * the acldvppCreateJpegeConfig interface - * @param jpegeConfig [IN] config pointer to destroy. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateJpegeConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyJpegeConfig(acldvppJpegeConfig *jpegeConfig); - -/** - * @ingroup AscendCL - * @brief Set jpege config's level. - * - * @param jpegeConfig [OUT] Call the acldvppCreateJpegeConfig - * interface to create acldvppJpegeConfig data - * @param level [IN] Encoding quality range [0, 100], - * where level 0 encoding quality is similar to level 100, - * and the smaller the value in [1, 100], - * the worse the quality of the output picture. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetJpegeConfigLevel(acldvppJpegeConfig *jpegeConfig, uint32_t level); - -/** - * @ingroup AscendCL - * @brief Get jpege config's level. - * - * @param jpegeConfig [IN] jpege config. - * - * @retval compression level. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetJpegeConfigLevel(const acldvppJpegeConfig *jpegeConfig); - -/** - * @ingroup AscendCL - * @brief create vdecChannelDesc.Channel description information - * when creating a video data processing channel. - * - * @retval null for failed. - * @retval other success - */ -ACL_FUNC_VISIBILITY aclvdecChannelDesc *aclvdecCreateChannelDesc(); - -/** - * @ingroup AscendCL - * @brief destroy vdecChannelDesc. - * - * @par Function - * Can only destroy aclvdecChannelDesc type created - * through aclvdecCreateChannelDesc interface - * @param channelDesc [IN] channel description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - - * @see aclvdecCreateChannelDesc - */ -ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannelDesc(aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's channel id. - * - * @param channelDesc [OUT] vdec channel description. - * @param channelId [IN] decoding channel id: 0~15. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescChannelId(aclvdecChannelDesc *channelDesc, uint32_t channelId); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's thread id. - * - * @param channelDesc [OUT] vdec channel description. - * @param threadId [IN] thread id. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescThreadId(aclvdecChannelDesc *channelDesc, uint64_t threadId); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's callback function. - * - * @param channelDesc [OUT] vdec channel description. - * @param callback [IN] function callback.Function prototype: - * void (* aclvdecCallback) - * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata) - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclvdecCallback - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescCallback(aclvdecChannelDesc *channelDesc, aclvdecCallback callback); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's video encoding type. - * - * @param channelDesc [OUT] vdec channel description. - * @param enType [IN] video encoding type. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescEnType(aclvdecChannelDesc *channelDesc, acldvppStreamFormat enType); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's out picture format. - * - * @param channelDesc [OUT] vdec channel description. - * @param outPicFormat [IN] out picture format (acldvppPixelFormat). - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicFormat(aclvdecChannelDesc *channelDesc, - acldvppPixelFormat outPicFormat); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's out picture width. - * - * @param channelDesc [OUT] vdec channel description. - * @param outPicWidth [IN] out picture width. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicWidth(aclvdecChannelDesc *channelDesc, uint32_t outPicWidth); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's out picture height. - * - * @param channelDesc [OUT] vdec channel description. - * @param outPicHeight [IN] out picture height. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicHeight(aclvdecChannelDesc *channelDesc, uint32_t outPicHeight); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's reference frame num. - * - * @param channelDesc [OUT] vdec channel description. - * @param refFrameNum [IN] reference frame num. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescRefFrameNum(aclvdecChannelDesc *channelDesc, uint32_t refFrameNum); - -/** - * @ingroup AscendCL - * @brief Set vdec channel description's bit depth. - * - * @param channelDesc [OUT] vdec channel description. - * @param bitDepth [IN] bit depth. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescBitDepth(aclvdecChannelDesc *channelDesc, uint32_t bitDepth); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's channel id. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval decoding channel id: 0~15. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescChannelId(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's thread id. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval thread id. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint64_t aclvdecGetChannelDescThreadId(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's callback function. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval function callback.Function prototype: - * void (* aclvdecCallback) - * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata) - * @retval default null. - * - * @see aclvdecCallback - */ -ACL_FUNC_VISIBILITY aclvdecCallback aclvdecGetChannelDescCallback(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's video encoding type. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval video encoding type. - * @retval default H265_MAIN_LEVEL. - */ -ACL_FUNC_VISIBILITY acldvppStreamFormat aclvdecGetChannelDescEnType(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's out picture format. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval out picture format. - * @retval default DVPP_OUTPUT_YUV420SP_UV. - */ -ACL_FUNC_VISIBILITY acldvppPixelFormat aclvdecGetChannelDescOutPicFormat(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's out picture width. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval out picture width. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicWidth(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's out picture height. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval out picture height (for vdec malloc memory). - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicHeight(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's bit depth. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval bit depth. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescBitDepth(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get vdec channel description's reference frame num. - * - * @param channelDesc [IN] vdec channel description. - * - * @retval reference frame num. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescRefFrameNum(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief create vencChannelDesc. - * - * @retval null for failed, other success - */ -ACL_FUNC_VISIBILITY aclvencChannelDesc *aclvencCreateChannelDesc(); - -/** - * @ingroup AscendCL - * @brief destroy vencChannelDesc. - * - * @param channelDesc [IN] channel desc. - * - * @retval ACL_SUCCESS:success, other:failed - */ -ACL_FUNC_VISIBILITY aclError aclvencDestroyChannelDesc(aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Set decoding thread id for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param threadId [IN] thread id - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescThreadId(aclvencChannelDesc *channelDesc, uint64_t threadId); - -/** - * @ingroup AscendCL - * @brief Set func callback for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param callback [IN] func callback - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescCallback(aclvencChannelDesc *channelDesc, aclvencCallback callback); - -/** - * @ingroup AscendCL - * @brief Set video encoding type for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param enType [IN] video encoding type - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescEnType(aclvencChannelDesc *channelDesc, acldvppStreamFormat enType); - -/** - * @ingroup AscendCL - * @brief Set pic format for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param picFormat [IN] pic format - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicFormat(aclvencChannelDesc *channelDesc, - acldvppPixelFormat picFormat); - -/** - * @ingroup AscendCL - * @brief Set out pic width for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param picWidth [IN] pic width - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicWidth(aclvencChannelDesc *channelDesc, uint32_t picWidth); - -/** - * @ingroup AscendCL - * @brief Set pic height for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param picHeight [IN] pic height - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicHeight(aclvencChannelDesc *channelDesc, uint32_t picHeight); - -/** - * @ingroup AscendCL - * @brief Set key frame interval for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param keyFrameInterval [IN] Interval of key frame - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescKeyFrameInterval(aclvencChannelDesc *channelDesc, - uint32_t keyFrameInterval); - -/** - * @ingroup AscendCL - * @brief Set output buffer address for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param bufAddr [IN] output buffer address - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufAddr(aclvencChannelDesc *channelDesc, void *bufAddr); - -/** - * @ingroup AscendCL - * @brief Set output buffer size for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param bufSize [IN] output buffer size - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufSize(aclvencChannelDesc *channelDesc, uint32_t bufSize); - -/** - * @ingroup AscendCL - * @brief Set rc model for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param rcMode [IN] venc rc mode(VBR=1, CBR=2) - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescRcMode(aclvencChannelDesc *channelDesc, uint32_t rcMode); - -/** - * @ingroup AscendCL - * @brief Set source rate for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param srcRate [IN] source rate - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescSrcRate(aclvencChannelDesc *channelDesc, uint32_t srcRate); - -/** - * @ingroup AscendCL - * @brief Set max bit rate for venc channel desc. - * - * @param channelDesc [OUT] venc channel desc - * @param maxBitRate [IN] max bit rate - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescMaxBitRate(aclvencChannelDesc *channelDesc, uint32_t maxBitRate); - -/** - * @ingroup AscendCL - * @brief Get output buffer address for venc channel desc. - * - * @param channelDesc[IN] venc channel desc - * - * @retval output buffer address - */ -ACL_FUNC_VISIBILITY void *aclvencGetChannelDescBufAddr(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get output buffer size for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval output buffer size - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescBufSize(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get decoding channel id for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval decoding channel id: 0~15, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescChannelId(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get decoding thread id for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval thread id, default 0 - */ -ACL_FUNC_VISIBILITY uint64_t aclvencGetChannelDescThreadId(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get func callback for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval func callback, default null - */ -ACL_FUNC_VISIBILITY aclvencCallback aclvencGetChannelDescCallback(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get video encoding type for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval video encoding type, default H265_MAIN_LEVEL - */ -ACL_FUNC_VISIBILITY acldvppStreamFormat aclvencGetChannelDescEnType(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get pic format for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval pic format - */ -ACL_FUNC_VISIBILITY acldvppPixelFormat aclvencGetChannelDescPicFormat(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get pic width for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval pic width, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicWidth(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get pic height for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval pic height, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicHeight(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Get interval of key frame for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval interval of key frame, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescKeyFrameInterval(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * - * @brief Get rc mode for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval rc mode, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescRcMode(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * - * @brief Get source rate for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval source rate, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescSrcRate(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * - * @brief Get max bit rate for venc channel desc. - * - * @param channelDesc [IN] venc channel desc - * - * @retval max bit rate, default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescMaxBitRate(const aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief get forced restart of I-frame interval from config - * - * @param config [IN] venc frame config - * - * @retval 0: Not forced; 1: Forced restart of I-frame -1: error - */ -ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigForceIFrame(const aclvencFrameConfig *config); - -/** - * @ingroup AscendCL - * @brief get forced restart of I-frame interval from config - * - * @param config [IN] venc frame config - * - * @retval Whether it is the end frame: 0: no; 1: end frame - */ -ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigEos(const aclvencFrameConfig *config); - -/** - * @ingroup AscendCL - * @brief set single frame encoding configuration parameters - * - * @param config [OUT] venc frame config - * @param forceFrame [IN] forced restart of I-frame interval: 0: Not forced; 1: Forced restart of I-frame - * - * @retval ACL_SUCCESS for ok, others for fail - */ -ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigForceIFrame(aclvencFrameConfig *config, uint8_t forceIFrame); - -/** - * @ingroup AscendCL - * @brief set single frame encoding configuration parameters - * - * @param config [OUT] venc frame config - * @param eos [IN] Whether it is the end frame: 0: no; 1: end frame - * - * @retval ACL_SUCCESS for ok, others for fail - */ -ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigEos(aclvencFrameConfig *config, uint8_t eos); - -/** - * @ingroup AscendCL - * @brief dvpp venc destroy frame config - * - * @param config [IN] venc frame config - * - * @retval ACL_SUCCESS for ok, others for fail - */ -ACL_FUNC_VISIBILITY aclError aclvencDestroyFrameConfig(aclvencFrameConfig *config); - -/** - * @ingroup AscendCL - * @brief Create dvpp venc frame config. - * - * @retval null for failed, other aclvencFrameConfig ptr - */ -ACL_FUNC_VISIBILITY aclvencFrameConfig *aclvencCreateFrameConfig(); - -/** - * @ingroup AscendCL - * @brief Create dvpp venc channel. - * - * @param channelDesc [IN|OUT] venc channel desc - * - * @retval ACL_SUCCESS for ok, others for fail - */ -ACL_FUNC_VISIBILITY aclError aclvencCreateChannel(aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp venc channel. - * - * @param channelDesc [IN] venc channel desc - * - * @retval ACL_SUCCESS for ok, others for fail - */ -ACL_FUNC_VISIBILITY aclError aclvencDestroyChannel(aclvencChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief dvpp venc launch send frame task. - * - * @param channelDesc [IN] venc channel desc - * @param input [IN] input picture desc - * @param reserve [IN] reserve parameter - * @param config [IN] dvpp frame config - * @param userdata [IN] user callback function - * - * @retval ACL_SUCCESS for ok, others for fail - */ -ACL_FUNC_VISIBILITY aclError aclvencSendFrame(aclvencChannelDesc *channelDesc, acldvppPicDesc *input, void *reserve, - aclvencFrameConfig *config, void *userdata); - -/** - * @ingroup AscendCL - * @brief Create dvpp stream description. - * - * @retval null for failed. - * @retval other success. - */ -ACL_FUNC_VISIBILITY acldvppStreamDesc *acldvppCreateStreamDesc(); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp stream description. - * - * @par Function - * Can only destroy acldvppStreamDesc type created through - * acldvppCreateStreamDesc interface. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateStreamDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyStreamDesc(acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Set stream description's data addr. - * - * @param streamDesc [OUT] dvpp stream description. - * @param dataDev [IN] data addr. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescData(acldvppStreamDesc *streamDesc, void *dataDev); - -/** - * @ingroup AscendCL - * @brief Set stream description's data size. - * - * @param streamDesc [OUT] dvpp stream description. - * @param size [IN] data size. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescSize(acldvppStreamDesc *streamDesc, uint32_t size); - -/** - * @ingroup AscendCL - * @brief Set stream description's format. - * - * @param streamDesc [OUT] dvpp stream description. - * @param format [IN] stream format. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescFormat(acldvppStreamDesc *streamDesc, acldvppStreamFormat format); - -/** - * @ingroup AscendCL - * @brief Set stream description's timestamp. - * - * @param streamDesc [OUT] dvpp stream description. - * @param timestamp [IN] current timestamp. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescTimestamp(acldvppStreamDesc *streamDesc, uint64_t timestamp); - -/** - * @ingroup AscendCL - * @brief Set stream description's ret code. - * - * @param streamDesc [OUT] dvpp stream description. - * @param retCode [IN] result code. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescRetCode(acldvppStreamDesc *streamDesc, uint32_t retCode); - -/** - * @ingroup AscendCL - * @brief Set stream description's eos. - * - * @param streamDesc [OUT] dvpp stream description. - * @param eos [IN] end flag of sequence. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescEos(acldvppStreamDesc *streamDesc, uint8_t eos); - -/** - * @ingroup AscendCL - * @brief Get stream description's data addr. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval data addr. - * @retval deault nullptr. - */ -ACL_FUNC_VISIBILITY void *acldvppGetStreamDescData(const acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Get stream description's data size. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval data size. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescSize(const acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Get stream description's format. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval stream format. - * @retval default ACL_DVPP_STREAM_H264. - */ -ACL_FUNC_VISIBILITY acldvppStreamFormat acldvppGetStreamDescFormat(const acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Get stream description's timestamp. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval current timestamp. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint64_t acldvppGetStreamDescTimestamp(const acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Get stream description's retCode. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval result code. - * @retval default 0. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescRetCode(const acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Get stream description's eos. - * - * @param streamDesc [IN] dvpp stream description. - * - * @retval end flag of sequence. - * @retval default 0(false). - */ -ACL_FUNC_VISIBILITY uint8_t acldvppGetStreamDescEos(const acldvppStreamDesc *streamDesc); - -/** - * @ingroup AscendCL - * @brief Create vdec frame config. - * - * @retval null for failed. - * @retval other success. - */ -ACL_FUNC_VISIBILITY aclvdecFrameConfig *aclvdecCreateFrameConfig(); - -/** - * @ingroup AscendCL - * @brief Destroy vdec frame config. - * - * @par Function - * Can only destroy aclvdecFrameConfig type created through - * aclvdecCreateFrameConfig interface - * - * @param vdecFrameConfig [IN] vdec frame config. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclvdecCreateFrameConfig - */ -ACL_FUNC_VISIBILITY aclError aclvdecDestroyFrameConfig(aclvdecFrameConfig *vdecFrameConfig); - -/** - * @ingroup AscendCL - * @brief Get image width and height of jpeg. - * - * @param data [IN] image data in host memory - * @param size [IN] the size of image data - * @param width [OUT] the width of image from image header - * @param height [OUT] the height of image from image header - * @param components [OUT] the components of image from image header - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfo(const void *data, uint32_t size, uint32_t *width, uint32_t *height, - int32_t *components); - -/** - * @ingroup AscendCL - * @brief Predict encode size of jpeg image. - * - * @param inputDesc [IN] dvpp image desc - * @param config [IN] jpeg encode config - * @param size [OUT] the size predicted of image - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppJpegPredictEncSize(const acldvppPicDesc *inputDesc, - const acldvppJpegeConfig *config, uint32_t *size); - -/** - * @ingroup AscendCL - * @brief Predict decode size of jpeg image. - * - * @param data [IN] origin image data in host memory - * @param dataSize [IN] the size of origin image data - * @param outputPixelFormat [IN] the pixel format jpeg decode - * @param decSize [OUT] the size predicted for decode image - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppJpegPredictDecSize(const void *data, uint32_t dataSize, - acldvppPixelFormat outputPixelFormat, uint32_t *decSize); - -/** - * @ingroup AscendCL - * @brief Get image width and height of png. - * - * @param data [IN] image data in host memory - * @param size [IN] the size of image data - * @param width [OUT] the width of image from image header - * @param height [OUT] the height of image from image header - * @param components [OUT] the components of image from image header - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppPngGetImageInfo(const void *data, uint32_t dataSize, uint32_t *width, - uint32_t *height, int32_t *components); - -/** - * @ingroup AscendCL - * @brief Predict decode size of png image. - * - * @param data [IN] origin image data in host memory - * @param dataSize [IN] the size of origin image data - * @param outputPixelFormat [IN] the pixel format jpeg decode - * @param decSize [OUT] the size predicted for decode image - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppPngPredictDecSize(const void *data, uint32_t dataSize, - acldvppPixelFormat outputPixelFormat, uint32_t *decSize); - -/** - * @ingroup AscendCL - * @brief Create dvpp channel, the same channel can be reused - * and is no longer available after destruction. - * - * @param channelDesc [IN|OUT] the channel destruction - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannelDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppCreateChannel(acldvppChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp channel. - * - * @par Restriction - * Can only destroy channel created through the acldvppCreateChannel interface - * - * @param channelDesc [IN] the channel destruction - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyChannel(acldvppChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief dvpp vpc resize. - * - * @par Restriction - * Width alignment requirements: - * @li The minimum stride is 32 and the maximum is 4096 * 4 - * (that is, an image in argb format with a width of 4096); - * @li For 8K scaling, widthStride is required to be aligned to 2; - * @li For non 8K scaling, the calculation formula for widthStride - * is different for different image formats: - * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 - * @li yuv422packed: input image width * 2 and then align to 16 - * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 - * @li xrgb8888: input image width * 4, align to 16 - * @li HFBC:input image width - * Height alignment requirements: - * @li The height of the input image is aligned to 2. - * High stride minimum 6 and maximum 4096. - * - * @param channelDesc [IN] the channel destruction - * @param inputDesc [IN] resize input picture destruction - * @param outputDesc [IN|OUT] resize output picture destruction - * @param resizeConfig [IN] resize config - * @param stream [IN] resize task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc - * | acldvppCreateResizeConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, acldvppResizeConfig *resizeConfig, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc crop. - * - * @par Function - * crop the input picture according to the specified area, - * and then store the picture in the output memory as the output picture - * - * @par Restriction - * Width alignment requirements: - * @li The minimum stride is 32 and the maximum is 4096 * 4 - * (that is, an image in argb format with a width of 4096); - * @li For 8K scaling, widthStride is required to be aligned to 2; - * @li For non 8K scaling, the calculation formula for widthStride - * is different for different image formats: - * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16 - * @li yuv422packed: input image width * 2 and then align to 16 - * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16 - * @li xrgb8888: input image width * 4, align to 16 - * @li HFBC:input image width - * Height alignment requirements: - * @li The height of the input image is aligned to 2. - * High stride minimum 6 and maximum 4096. - * - * @param channelDesc [IN] the channel destruction - * @param inputDesc [IN] crop input picture destruction - * @param outputDesc [IN|OUT] crop output picture destruction - * @param cropArea [IN] crop area config - * @param stream [IN] crop task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc batch crop. - * - * @par Function - * crop the input batch picture according to the specified area - * as the output batch pictures - * - * @param channelDesc [IN] the channel destruction - * @param srcBatchPicDescs [IN] crop input batch picture destruction - * @param roiNums [IN] roi config numbers - * @param size [IN] roiNum size - * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction - * @param cropAreas [IN] crop area configs - * @param stream [IN] crop batch task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, - uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, - acldvppRoiConfig *cropAreas[], aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc crop and paste. - * - * @par Function - * crop the input picture according to the specified area, - * and paste the picture to the specified position of the target picture - * as the output picture - * - * @param channelDesc [IN] thechannel destruction - * @param inputDesc [IN] crop and paste input picture destruction - * @param outputDesc [IN|OUT] crop and paste output picture destruction - * @param cropArea [IN] crop area config - * @param pasteArea [IN] paste area config - * @param stream [IN] crop and paste task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea, - acldvppRoiConfig *pasteArea, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc batch crop and paste. - * - * @par Function - * crop the input batch picture according to the specified area, - * and paste the pictures to the specified position of the target pictures - * as the output batch pictures - * - * @param channelDesc [IN] the channel destruction - * @param srcBatchPicDescs [IN] crop input batch picture destruction - * @param roiNums [IN] roi config numbers - * @param size [IN] roiNum size - * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction - * @param cropAreas [IN] crop area configs - * @param pasteAreas [IN] paste area configs - * @param stream [IN] crop batch task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *channelDesc, - acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, - uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, - acldvppRoiConfig *cropAreas[], - acldvppRoiConfig *pasteAreas[], aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc jpeg decode. - * - * @par Function - * For different source picture formats, after decoding, - * output pictures in the following format: - * @li jpeg(444) -> YUV444SP:V is front U is back, - * YUV420 SP V is front U is back, YUV420SP U is front V is back; - * @li jpeg(422) -> YUV422SP:V is in front U is behind, - * YUV420SP V is in front U is behind, YUV420SP U is in front V is behind; - * @li jpeg(420) -> YUV420SP: - * V is front U is back, YUV420SP U is front V is back; - * @li jpeg(400) -> YUV420SP:UV data is filled with 0 x 80. - * - * @param channelDesc [IN] the channel destruction - * @param data [IN] decode input picture destruction's data - * @param size [IN] decode input picture destruction's size - * @param outputDesc [IN|OUT] decode output picture destruction - * @param stream [IN] decode task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, - acldvppPicDesc *outputDesc, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc jpeg encode. - * - * @param channelDesc [IN] the channel destruction - * @param inputDesc [IN] encode input picture destruction - * @param data [OUT] encode output picture destruction's data - * @param size [IN|OUT] encode output picture destruction's size - * @param config [IN] jpeg encode config - * @param stream [IN] encode task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreateJpegeConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, - const void *data, uint32_t *size, acldvppJpegeConfig *config, - aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc png decode. - * - * @param channelDesc [IN] the channel destruction - * @param data [IN] decode input picture destruction's data - * @param size [IN] decode input picture destruction's size - * @param outputDesc [IN|OUT] decode output picture destruction - * @param stream [IN] decode task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size, - acldvppPicDesc *outputDesc, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Create vdec channel. - * - * @par Function - * Create a channel for video data processing, - * the same channel can be reused, - * and is no longer available after destruction - * - * @param channelDesc [IN|OUT] the channel destruction - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclvdecCreateChannelDesc - */ -ACL_FUNC_VISIBILITY aclError aclvdecCreateChannel(aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Destroy vdec channel. - * - * @par Function - * Can only destroy channels created by the aclvdecCreateChannel interface - * - * @param channelDesc [IN] the channel destruction - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclvdecCreateChannel - */ -ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannel(aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief dvpp vdec send frame. - * - * @par Function - * Pass the input memory to be decoded - * and the decoded output memory to the decoder for decoding - * - * @param channelDesc [IN] vdec channel destruction - * @param input [IN] input stream destruction - * @param output [IN|OUT] output picture destruction - * @param config [IN] vdec frame config - * @param userData [IN] user data for callback function - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc - */ -ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input, - acldvppPicDesc *output, aclvdecFrameConfig *config, void *userData); - -/** - * @ingroup AscendCL - * @brief dvpp vdec send skipped frame. - * - * @par Function - * Pass video frame to decoder - * - * @param channelDesc [IN] vdec channel destruction - * @param input [IN] input stream destruction - * @param config [IN] vdec frame config - * @param userData [IN] user data for callback function - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc | aclvdecSendFrame - */ -ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input, - aclvdecFrameConfig *config, void *userData); - -/** - * @ingroup AscendCL - * @brief dvpp vpc convert color. - * - * @par Restriction - * @li outputDesc:Width height stride, No changes are allowed. Just configure 0 - * @par Function - * Convert color gamut - * - * @param channelDesc [IN] the channel destruction - * @param inputDesc [IN] convert color input picture destruction - * @param outputDesc [IN|OUT] convert color output picture destruction - * @param stream [IN] convert color task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief dvpp vpc pyramid down. - * - * @par Restriction - * @li outputDesc:format only supported YUV400 - * @par Function - * Image pyramid down - * - * @param channelDesc [IN] the channel destruction - * @param inputDesc [IN] pyr down input picture destruction - * @param outputDesc [IN|OUT] pyr down output picture destruction - * @param reserve [IN] reserved param , must be nullptr - * @param stream [IN] pyr down task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc, - acldvppPicDesc *outputDesc, void *reserve, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Set dvpp channel mode. - * - * @param channelDesc [OUT] the channel destruction - * @param mode [IN] channel mode - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, uint32_t mode); - -/** - * @ingroup AscendCL - * @brief Set resize config interpolation. - * - * @param resizeConfig [OUT] the resize config - * @param interpolation [IN] interpolation - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetResizeConfigInterpolation(acldvppResizeConfig *resizeConfig, - uint32_t interpolation); - -/** - * @ingroup AscendCL - * @brief Get resize config interpolation. - * - * @param resizeConfig [IN] the resize config - * - * @retval Interpolation of resize config. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetResizeConfigInterpolation(const acldvppResizeConfig *resizeConfig); - -/** - * @ingroup AscendCL - * @brief Set vdec channel out mode. - * - * @param channelDesc [OUT] the channel destruction - * @param outMode [IN] channel out mode - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, uint32_t outMode); - -/** - * @ingroup AscendCL - * @brief Get vdec channel out mode. - * - * @param channelDesc [IN] the channel destruction - * - * @retval Out mode of channel destruction - * @retval default 0 - */ -ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutMode(const aclvdecChannelDesc *channelDesc); - -/** - * @ingroup AscendCL - * @brief Create dvpp batch picture description. - * - * @param batchSize [IN] batch size - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY acldvppBatchPicDesc *acldvppCreateBatchPicDesc(uint32_t batchSize); - -/** - * @ingroup AscendCL - * @brief Get dvpp picture description. - * - * @param batchPicDesc [IN] dvpp batch picture description. - * @param index [IN] index of batch - * - * @retval null for failed. - * @retval OtherValues Failure - * - * @see acldvppCreateBatchPicDesc - */ -ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppGetPicDesc(acldvppBatchPicDesc *batchPicDesc, uint32_t index); - -/** - * @ingroup AscendCL - * @brief Destroy dvpp batch picture description. - * - * @par Function - * Can only destroy batch picture description information created - * through acldvppCreateBatchPicDesc interface. - * - * @param batchPicDesc [IN] dvpp batch picture description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateBatchPicDesc - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyBatchPicDesc(acldvppBatchPicDesc *batchPicDesc); - -/** - * @ingroup AscendCL - * @brief Create dvpp lut map. - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY acldvppLutMap *acldvppCreateLutMap(); - -/** - * @ingroup AscendCL - * @brief Destroy lut map. - * - * @param lutMap [IN] lut map - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyLutMap(acldvppLutMap *lutMap); - -/** - * @ingroup AscendCL - * @brief Get lut map dims. - * - * @param lutMap [IN] lut map - * - * @retval 0 for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetLutMapDims(const acldvppLutMap *lutMap); - -/** - * @ingroup AscendCL - * @brief Get lut map data. - * - * @param lutMap [IN] lut map - * @param dim [IN] input dim of map - * @param data [OUT] the dim of lut map's data - * @param len [OUT] the dim of lut map's length - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, uint32_t dim, uint8_t **data, - uint32_t *len); -/** - * @ingroup AscendCL - * @brief Vpc equalize hist. - * - * @param channelDesc [IN] channel desc - * @param inputDesc [IN] input desc - * @param outputDesc [IN|OUT] output desc - * @param lutMap [IN] lut map param - * @param stream [IN] runtime stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateLutMap - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *channelDesc, - const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc, - const acldvppLutMap *lutMap, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Create dvpp border config. - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY acldvppBorderConfig *acldvppCreateBorderConfig(); - -/** - * @ingroup AscendCL - * @brief Set value of border config. - * - * @param borderConfig [OUT] border config - * @param index [IN] index of value array - * @param value [IN] value - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig, uint32_t index, - double value); - -/** - * @ingroup AscendCL - * @brief Set border type of border config. - * - * @param borderConfig [OUT] border config - * @param borderType [IN] border type - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBorderType(acldvppBorderConfig *borderConfig, - acldvppBorderType borderType); - -/** - * @ingroup AscendCL - * @brief Set top of border config. - * - * @param borderConfig [OUT] border config - * @param top [IN] top of border - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigTop(acldvppBorderConfig *borderConfig, uint32_t top); - -/** - * @ingroup AscendCL - * @brief Set bottom of border config. - * - * @param borderConfig [OUT] border config - * @param bottom [IN] bottom of border - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBottom(acldvppBorderConfig *borderConfig, uint32_t bottom); - -/** - * @ingroup AscendCL - * @brief Set left of border config. - * - * @param borderConfig [OUT] border config - * @param left [IN] left of border - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigLeft(acldvppBorderConfig *borderConfig, uint32_t left); - -/** - * @ingroup AscendCL - * @brief Set right of border config. - * - * @param borderConfig [OUT] border config - * @param right [IN] right of border - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigRight(acldvppBorderConfig *borderConfig, uint32_t right); - -/** - * @ingroup AscendCL - * @brief Get value of border config. - * - * @param borderConfig [IN] border config - * @param index[IN] index of value array - * - * @retval invalid value is < 0, normal Value is >= 0 - */ -ACL_FUNC_VISIBILITY double acldvppGetBorderConfigValue(const acldvppBorderConfig *borderConfig, uint32_t index); - -/** - * @ingroup AscendCL - * @brief Get border type of border config. - * - * @param borderConfig [IN] border config - * @retval border type of border config - */ -ACL_FUNC_VISIBILITY acldvppBorderType acldvppGetBorderConfigBorderType(const acldvppBorderConfig *borderConfig); - -/** - * @ingroup AscendCL - * @brief Get right of border config. - * - * @param borderConfig [IN] border config - * - * @retval default 0, top value of border config - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigTop(const acldvppBorderConfig *borderConfig); - -/** - * @ingroup AscendCL - * @brief Get Bottom of border config. - * - * @param borderConfig [IN] border config - * - * @retval default 0, top value of border config - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigBottom(const acldvppBorderConfig *borderConfig); - -/** - * @ingroup AscendCL - * @brief Get left of border config. - * - * @param borderConfig [IN] border config - * - * @retval default 0, top value of border config - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigLeft(const acldvppBorderConfig *borderConfig); - -/** - * @ingroup AscendCL - * @brief Get right of border config. - * - * @param borderConfig [IN] border config - * - * @retval default 0, right value of border config - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigRight(const acldvppBorderConfig *borderConfig); - -/** - * @ingroup AscendCL - * @brief Destroy border config. - * - * @param borderConfig [IN] border config - * - * @retval ACL_SUCCESS for success, other for failure - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyBorderConfig(acldvppBorderConfig *borderConfig); - -/** - * @ingroup AscendCL - * @brief Vpc make border. - * - * @param channelDesc [IN] channel desc - * @param inputDesc [IN] input desc - * @param outputDesc [IN|OUT] output desc - * @param borderConfig [IN] border config param - * @param stream [IN] runtime stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateBorderConfig - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *channelDesc, - const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc, - const acldvppBorderConfig *borderConfig, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Dvpp vpc calc hist. - * - * @param channelDesc [IN] the channel destruction - * @param srcPicDesc [IN] pyr down input picture destruction - * @param hist [IN|OUT] pyr down output picture destruction - * @param reserve [IN] reserved param, must be nullptr - * @param stream [IN] task stream - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateHist - */ -ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *srcPicDesc, - acldvppHist *hist, void *reserve, aclrtStream stream); - -/** - * @ingroup AscendCL - * @brief Create vpc hist description. - * - * @retval null for failed. - * @retval OtherValues success. - */ -ACL_FUNC_VISIBILITY acldvppHist *acldvppCreateHist(); - -/** - * @ingroup AscendCL - * @brief Destroy vpc hist description. - * - * @par Function - * Can only destroy hist description information created - * through acldvppCreateHist interface. - * - * @param hist [IN] vpc hist description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateHist - */ -ACL_FUNC_VISIBILITY aclError acldvppDestroyHist(acldvppHist *hist); - -/** - * @ingroup AscendCL - * @brief Get dims of vpc hist description. - * - * @param hist [IN] vpc hist description. - * - * @retval dims of vpc hist description. - * - * @see acldvppCreateHist | acldvppVpcCalcHistAsync - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetHistDims(acldvppHist *hist); - -/** - * @ingroup AscendCL - * @brief Get data from vpc hist description by dim. - * - * @param hist [IN] vpc hist description. - * @param dim [IN] which dim to get data. - * @param data [OUT] address of output hist data. - * @param len [OUT] len of output hist data. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateHist | acldvppVpcCalcHistAsync - */ -ACL_FUNC_VISIBILITY aclError acldvppGetHistData(acldvppHist *hist, uint32_t dim, uint32_t **data, uint16_t *len); - -/** - * @ingroup AscendCL - * @brief Get dvpp calc hist process return code. - * - * @param hist [IN] vpc hist description. - * - * @retval Dvpp calc hist process return code. - * - * @see acldvppCreateHist | acldvppVpcCalcHistAsync - */ -ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist *hist); - -/** - * @ingroup AscendCL - * @brief Set vpc hist description to 0. - * - * @par Function - * Can only clear hist description information created - * through acldvppCreateHist interface. - * - * @param hist [IN] vpc hist description. - * - * @retval ACL_SUCCESS The function is successfully executed. - * @retval OtherValues Failure - * - * @see acldvppCreateHist - */ -ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist); - -#ifdef __cplusplus -} -#endif - -#endif // INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_ diff --git a/inc/external/hccl/hccl.h b/inc/external/hccl/hccl.h deleted file mode 100644 index 46d934e6..00000000 --- a/inc/external/hccl/hccl.h +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file hccl.h - * @brief HCCL API - */ - -#ifndef HCCL_H_ -#define HCCL_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -/** - * @brief Initialize HCCL. - * - * @param clusterInfo A string identifying the cluster info file path, include file name. - * @param rank A integer identifying the identify for the rank. - * @param comm A pointer identifying the initialized communication resource. - * @return HcclResult - * @see HcclCommDestroy() - */ -extern HcclResult HcclCommInitClusterInfo(const char *clusterInfo, uint32_t rank, HcclComm *comm); - -/** - * @brief Get hccl root info. - * - * @param rootInfo A pointer identifying the hccl root info. - * @return HcclResult - */ -extern HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo); - -/** - * @brief Initialize HCCL with root info. - * - * @param nRanks A integer identifying the rank size of the cluster. - * @param rootInfo A struct identifying the hccl root info. - * @param rank A integer identifying the identify for the rank. - * @param comm A pointer identifying the initialized communication resource. - * @return HcclResult - * @see HcclCommDestroy() - */ -extern HcclResult HcclCommInitRootInfo(uint32_t nRanks, const HcclRootInfo *rootInfo, uint32_t rank, HcclComm *comm); - -/** - * @brief AllReduce operator. - * - * @param sendBuf A pointer identifying the input data address of the operator. - * @param recvBuf A pointer identifying the output data address of the operator. - * @param count An integer(u64) identifying the number of the output data. - * @param dataType The data type of the operator, must be one of the following types: int8, int16, int32, float16, - * float32. - * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. - * @param comm A pointer identifying the communication resource based on. - * @param stream A pointer identifying the stream information. - * @return HcclResult - */ -extern HcclResult HcclAllReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op, - HcclComm comm, aclrtStream stream); - -/** - * @brief Broadcast operator. - * - * @param buf A pointer identifying the data address of the operator. - * @param count An integer(u64) identifying the number of the data. - * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param root An integer(u32) identifying the the root rank in the operator. - * @param comm A pointer identifying the communication resource based on - * @param stream A pointer identifying the stream information. - * @return HcclResult - */ -extern HcclResult HcclBroadcast(void *buf, uint64_t count, HcclDataType dataType, uint32_t root, HcclComm comm, - aclrtStream stream); - -/** - * @brief ReduceScatter operator. - * - * @param sendBuf A pointer identifying the input data address of the operator. - * @param recvBuf A pointer identifying the output data address of the operator. - * @param recvCount An integer(u64) identifying the number of the output data. - * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param op The reduction type of the operator, must be one of the following types: sum, min, max, prod. - * @param comm A pointer identifying the communication resource based on. - * @param stream A pointer identifying the stream information. - * @return HcclResult - */ -extern HcclResult HcclReduceScatter(void *sendBuf, void *recvBuf, uint64_t recvCount, HcclDataType dataType, - HcclReduceOp op, HcclComm comm, aclrtStream stream); - -/** - * @brief AllGather operator. - * - * @param sendBuf A pointer identifying the input data address of the operator. - * @param recvBuf A pointer identifying the output data address of the operator. - * @param sendCount An integer(u64) identifying the number of the input data. - * @param dataType The data type of the operator, must be one of the following types: int8, int32, float16, float32. - * @param comm A pointer identifying the communication resource based on. - * @param stream A pointer identifying the stream information. - * @return HcclResult - */ -extern HcclResult HcclAllGather(void *sendBuf, void *recvBuf, uint64_t sendCount, HcclDataType dataType, HcclComm comm, - aclrtStream stream); - -/** - * @brief Destroy HCCL comm - * - * @param comm A pointer identifying the communication resource targetting - * @return HcclResult - * @see HcclCommInitClusterInfo() - */ -extern HcclResult HcclCommDestroy(HcclComm comm); - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // HCCL_H_ diff --git a/inc/external/hccl/hccl_types.h b/inc/external/hccl/hccl_types.h deleted file mode 100644 index 0e832396..00000000 --- a/inc/external/hccl/hccl_types.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file hccl_types.h - * @brief HCCL data type definition - * - */ - -#ifndef HCCL_TYPES_H_ -#define HCCL_TYPES_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -/** - * @brief HCCL functions return value definition - */ -typedef enum { - HCCL_SUCCESS = 0, /**< success */ - HCCL_E_PARA = 1, /**< parameter error */ - HCCL_E_PTR = 2, /**< empty pointer */ - HCCL_E_MEMORY = 3, /**< memory error */ - HCCL_E_INTERNAL = 4, /**< internal error */ - HCCL_E_NOT_SUPPORT = 5, /**< not support feature */ - HCCL_E_NOT_FOUND = 6, /**< not found specific resource */ - HCCL_E_UNAVAIL = 7, /**< resource unavailable */ - HCCL_E_SYSCALL = 8, /**< call system interface error */ - HCCL_E_TIMEOUT = 9, /**< timeout */ - HCCL_E_OPEN_FILE_FAILURE = 10, /**< open file fail */ - HCCL_E_TCP_CONNECT = 11, /**< tcp connect fail */ - HCCL_E_ROCE_CONNECT = 12, /**< roce connect fail */ - HCCL_E_TCP_TRANSFER = 13, /**< tcp transfer fail */ - HCCL_E_ROCE_TRANSFER = 14, /**< roce transfer fail */ - HCCL_E_RUNTIME = 15, /**< call runtime api fail */ - HCCL_E_DRV = 16, /**< call driver api fail */ - HCCL_E_PROFILING = 17, /**< call profiling api fail */ - HCCL_E_CCE = 18, /**< call cce api fail */ - HCCL_E_NETWORK = 19, /**< call network api fail */ - HCCL_E_RESERVED /**< reserved */ -} HcclResult; - -/** - * @brief handle to HCCL communicator - */ -typedef void *HcclComm; - -/** - * @brief HCCL Reduction opperation - */ -typedef enum { - HCCL_REDUCE_SUM = 0, /**< sum */ - HCCL_REDUCE_PROD = 1, /**< prod */ - HCCL_REDUCE_MAX = 2, /**< max */ - HCCL_REDUCE_MIN = 3, /**< min */ - HCCL_REDUCE_RESERVED /**< reserved */ -} HcclReduceOp; - -/** - * @brief HCCL data type - */ -typedef enum { - HCCL_DATA_TYPE_INT8 = 0, /**< int8 */ - HCCL_DATA_TYPE_INT16 = 1, /**< int16 */ - HCCL_DATA_TYPE_INT32 = 2, /**< int32 */ - HCCL_DATA_TYPE_FP16 = 3, /**< fp16 */ - HCCL_DATA_TYPE_FP32 = 4, /**< fp32 */ - HCCL_DATA_TYPE_INT64 = 5, /**< int64 */ - HCCL_DATA_TYPE_UINT64 = 6, /**< uint64 */ - HCCL_DATA_TYPE_RESERVED /**< reserved */ -} HcclDataType; - -const uint32_t HCCL_ROOT_INFO_BYTES = 4108; // 4108: root info length - -/** - * @brief HCCL root info - */ -typedef struct HcclRootInfoDef { - char internal[HCCL_ROOT_INFO_BYTES]; -} HcclRootInfo; - -#ifdef __cplusplus -} -#endif // __cplusplus -#endif // HCCL_TYPES_H_ diff --git a/inc/external/runtime/rt_error_codes.h b/inc/external/runtime/rt_error_codes.h deleted file mode 100644 index 0ae5303d..00000000 --- a/inc/external/runtime/rt_error_codes.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2019-2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __INC_EXTERNEL_RT_ERROR_CODES_H__ -#define __INC_EXTERNEL_RT_ERROR_CODES_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -static const int32_t ACL_RT_SUCCESS = 0; // success - -static const int32_t ACL_ERROR_RT_PARAM_INVALID = 107000; // param invalid -static const int32_t ACL_ERROR_RT_INVALID_DEVICEID = 107001; // invalid device id -static const int32_t ACL_ERROR_RT_CONTEXT_NULL = 107002; // current context null -static const int32_t ACL_ERROR_RT_STREAM_CONTEXT = 107003; // stream not in current context -static const int32_t ACL_ERROR_RT_MODEL_CONTEXT = 107004; // model not in current context -static const int32_t ACL_ERROR_RT_STREAM_MODEL = 107005; // stream not in model -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID = 107006; // event timestamp invalid -static const int32_t ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL = 107007; // event timestamp reversal -static const int32_t ACL_ERROR_RT_ADDR_UNALIGNED = 107008; // memory address unaligned -static const int32_t ACL_ERROR_RT_FILE_OPEN = 107009; // open file failed -static const int32_t ACL_ERROR_RT_FILE_WRITE = 107010; // write file failed -static const int32_t ACL_ERROR_RT_STREAM_SUBSCRIBE = 107011; // error subscribe stream -static const int32_t ACL_ERROR_RT_THREAD_SUBSCRIBE = 107012; // error subscribe thread -static const int32_t ACL_ERROR_RT_GROUP_NOT_SET = 107013; // group not set -static const int32_t ACL_ERROR_RT_GROUP_NOT_CREATE = 107014; // group not create -static const int32_t ACL_ERROR_RT_STREAM_NO_CB_REG = 107015; // callback not register to stream -static const int32_t ACL_ERROR_RT_INVALID_MEMORY_TYPE = 107016; // invalid memory type - -static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPROT = 207000; // feature not support -static const int32_t ACL_ERROR_RT_MEMORY_ALLOCATION = 207001; // memory allocation error -static const int32_t ACL_ERROR_RT_MEMORY_FREE = 207002; // memory free error - -static const int32_t ACL_ERROR_RT_INTERNEL_ERROR = 507000; // runtime internel error -static const int32_t ACL_ERROR_RT_TS_ERROR = 507001; // ts internel error -static const int32_t ACL_ERROR_RT_STREAM_TASK_FULL = 507002; // task full in stream -static const int32_t ACL_ERROR_RT_STREAM_TASK_EMPTY = 507003; // task empty in stream -static const int32_t ACL_ERROR_RT_STREAM_NOT_COMPLETE = 507004; // stream not complete -static const int32_t ACL_ERROR_RT_END_OF_SEQUENCE = 507005; // end of sequence -static const int32_t ACL_ERROR_RT_EVENT_NOT_COMPLETE = 507006; // event not complete -static const int32_t ACL_ERROR_RT_CONTEXT_RELEASE_ERROR = 507007; // context release error -static const int32_t ACL_ERROR_RT_SOC_VERSION = 507008; // soc version error -static const int32_t ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT = 507009; // task type not support -static const int32_t ACL_ERROR_RT_LOST_HEARTBEAT = 507010; // ts lost heartbeat -static const int32_t ACL_ERROR_RT_MODEL_EXECUTE = 507011; // model execute failed -static const int32_t ACL_ERROR_RT_REPORT_TIMEOUT = 507012; // report timeout -static const int32_t ACL_ERROR_RT_SYS_DMA = 507013; // sys dma error -static const int32_t ACL_ERROR_RT_AICORE_TIMEOUT = 507014; // aicore timeout -static const int32_t ACL_ERROR_RT_AICORE_EXCEPTION = 507015; // aicore exception -static const int32_t ACL_ERROR_RT_AICORE_TRAP_EXCEPTION = 507016; // aicore trap exception -static const int32_t ACL_ERROR_RT_AICPU_TIMEOUT = 507017; // aicpu timeout -static const int32_t ACL_ERROR_RT_AICPU_EXCEPTION = 507018; // aicpu exception -static const int32_t ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR = 507019; // aicpu datadump response error -static const int32_t ACL_ERROR_RT_AICPU_MODEL_RSP_ERR = 507020; // aicpu model operate response error -static const int32_t ACL_ERROR_RT_PROFILING_ERROR = 507021; // profiling error -static const int32_t ACL_ERROR_RT_IPC_ERROR = 507022; // ipc error -static const int32_t ACL_ERROR_RT_MODEL_ABORT_NORMAL = 507023; // model abort normal -static const int32_t ACL_ERROR_RT_KERNEL_UNREGISTERING = 507024; // kernel unregistering -static const int32_t ACL_ERROR_RT_RINGBUFFER_NOT_INIT = 507025; // ringbuffer not init -static const int32_t ACL_ERROR_RT_RINGBUFFER_NO_DATA = 507026; // ringbuffer no data -static const int32_t ACL_ERROR_RT_KERNEL_LOOKUP = 507027; // kernel lookup error -static const int32_t ACL_ERROR_RT_KERNEL_DUPLICATE = 507028; // kernel register duplicate -static const int32_t ACL_ERROR_RT_DEBUG_REGISTER_FAIL = 507029; // debug register failed -static const int32_t ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL = 507030; // debug unregister failed -static const int32_t ACL_ERROR_RT_LABEL_CONTEXT = 507031; // label not in current context -static const int32_t ACL_ERROR_RT_PROGRAM_USE_OUT = 507032; // program register num use out -static const int32_t ACL_ERROR_RT_DEV_SETUP_ERROR = 507033; // device setup error - -static const int32_t ACL_ERROR_RT_DRV_INTERNEL_ERROR = 507899; // drv internel error - -#ifdef __cplusplus -} -#endif - -#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__