@@ -19,6 +19,11 @@ | |||||
extern "C" { | extern "C" { | ||||
#endif | #endif | ||||
// Current version is 1.1.0 | |||||
#define ACL_MAJOR_VERSION 1 | |||||
#define ACL_MINOR_VERSION 1 | |||||
#define ACL_PATCH_VERSION 0 | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief acl initialize | * @brief acl initialize | ||||
@@ -26,7 +31,7 @@ extern "C" { | |||||
* @par Restriction | * @par Restriction | ||||
* The aclInit interface can be called only once in a process | * The aclInit interface can be called only once in a process | ||||
* @param configPath [IN] the config path,it can be NULL | * @param configPath [IN] the config path,it can be NULL | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath); | ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath); | ||||
@@ -38,11 +43,32 @@ ACL_FUNC_VISIBILITY aclError aclInit(const char *configPath); | |||||
* @par Restriction | * @par Restriction | ||||
* Need to call aclFinalize before the process exits. | * Need to call aclFinalize before the process exits. | ||||
* After calling aclFinalize,the services cannot continue to be used normally. | * After calling aclFinalize,the services cannot continue to be used normally. | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclFinalize(); | 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); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief get recent error message | |||||
* | |||||
* @retval null for failed | |||||
* @retval OtherValues success | |||||
*/ | |||||
ACL_FUNC_VISIBILITY const char *aclGetRecentErrMsg(); | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } | ||||
#endif | #endif | ||||
@@ -13,16 +13,37 @@ | |||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include "error_codes/rt_error_codes.h" | |||||
#include "error_codes/ge_error_codes.h" | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" { | extern "C" { | ||||
#endif | #endif | ||||
#if defined(_MSC_VER) | |||||
#ifdef FUNC_VISIBILITY | |||||
#define ACL_FUNC_VISIBILITY _declspec(dllexport) | |||||
#else | |||||
#define ACL_FUNC_VISIBILITY | |||||
#endif | |||||
#else | |||||
#ifdef FUNC_VISIBILITY | #ifdef FUNC_VISIBILITY | ||||
#define ACL_FUNC_VISIBILITY __attribute__((visibility("default"))) | #define ACL_FUNC_VISIBILITY __attribute__((visibility("default"))) | ||||
#else | #else | ||||
#define ACL_FUNC_VISIBILITY | #define ACL_FUNC_VISIBILITY | ||||
#endif | #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 *aclrtStream; | ||||
typedef void *aclrtEvent; | typedef void *aclrtEvent; | ||||
@@ -32,64 +53,83 @@ typedef uint16_t aclFloat16; | |||||
typedef struct aclDataBuffer aclDataBuffer; | typedef struct aclDataBuffer aclDataBuffer; | ||||
typedef struct aclTensorDesc aclTensorDesc; | typedef struct aclTensorDesc aclTensorDesc; | ||||
const int ACL_ERROR_NONE = 0; | |||||
const int ACL_ERROR_INVALID_PARAM = 100000; | |||||
const int ACL_ERROR_UNINITIALIZE = 100001; | |||||
const int ACL_ERROR_REPEAT_INITIALIZE = 100002; | |||||
const int ACL_ERROR_INVALID_FILE = 100003; | |||||
const int ACL_ERROR_WRITE_FILE = 100004; | |||||
const int ACL_ERROR_INVALID_FILE_SIZE = 100005; | |||||
const int ACL_ERROR_PARSE_FILE = 100006; | |||||
const int ACL_ERROR_FILE_MISSING_ATTR = 100007; | |||||
const int ACL_ERROR_FILE_ATTR_INVALID = 100008; | |||||
const int ACL_ERROR_INVALID_DUMP_CONFIG = 100009; | |||||
const int ACL_ERROR_INVALID_PROFILING_CONFIG = 100010; | |||||
const int ACL_ERROR_INVALID_MODEL_ID = 100011; | |||||
const int ACL_ERROR_DESERIALIZE_MODEL = 100012; | |||||
const int ACL_ERROR_PARSE_MODEL = 100013; | |||||
const int ACL_ERROR_READ_MODEL_FAILURE = 100014; | |||||
const int ACL_ERROR_MODEL_SIZE_INVALID = 100015; | |||||
const int ACL_ERROR_MODEL_MISSING_ATTR = 100016; | |||||
const int ACL_ERROR_MODEL_INPUT_NOT_MATCH = 100017; | |||||
const int ACL_ERROR_MODEL_OUTPUT_NOT_MATCH = 100018; | |||||
const int ACL_ERROR_MODEL_NOT_DYNAMIC = 100019; | |||||
const int ACL_ERROR_OP_TYPE_NOT_MATCH = 100020; | |||||
const int ACL_ERROR_OP_INPUT_NOT_MATCH = 100021; | |||||
const int ACL_ERROR_OP_OUTPUT_NOT_MATCH = 100022; | |||||
const int ACL_ERROR_OP_ATTR_NOT_MATCH = 100023; | |||||
const int ACL_ERROR_OP_NOT_FOUND = 100024; | |||||
const int ACL_ERROR_OP_LOAD_FAILED = 100025; | |||||
const int ACL_ERROR_UNSUPPORTED_DATA_TYPE = 100026; | |||||
const int ACL_ERROR_FORMAT_NOT_MATCH = 100027; | |||||
const int ACL_ERROR_BIN_SELECTOR_NOT_REGISTERED = 100028; | |||||
const int ACL_ERROR_KERNEL_NOT_FOUND = 100029; | |||||
const int ACL_ERROR_BIN_SELECTOR_ALREADY_REGISTERED = 100030; | |||||
const int ACL_ERROR_KERNEL_ALREADY_REGISTERED = 100031; | |||||
const int ACL_ERROR_INVALID_QUEUE_ID = 100032; | |||||
const int ACL_ERROR_REPEAT_SUBSCRIBE = 100033; | |||||
const int ACL_ERROR_STREAM_NOT_SUBSCRIBE = 100034; | |||||
const int ACL_ERROR_THREAD_NOT_SUBSCRIBE = 100035; | |||||
const int ACL_ERROR_WAIT_CALLBACK_TIMEOUT = 100036; | |||||
const int ACL_ERROR_REPEAT_FINALIZE = 100037; | |||||
const int ACL_ERROR_NOT_STATIC_AIPP = 100038; | |||||
const int ACL_ERROR_BAD_ALLOC = 200000; | |||||
const int ACL_ERROR_API_NOT_SUPPORT = 200001; | |||||
const int ACL_ERROR_INVALID_DEVICE = 200002; | |||||
const int ACL_ERROR_MEMORY_ADDRESS_UNALIGNED = 200003; | |||||
const int ACL_ERROR_RESOURCE_NOT_MATCH = 200004; | |||||
const int ACL_ERROR_INVALID_RESOURCE_HANDLE = 200005; | |||||
const int ACL_ERROR_FEATURE_UNSUPPORTED = 200006; | |||||
const int ACL_ERROR_STORAGE_OVER_LIMIT = 300000; | |||||
const int ACL_ERROR_INTERNAL_ERROR = 500000; | |||||
const int ACL_ERROR_FAILURE = 500001; | |||||
const int ACL_ERROR_GE_FAILURE = 500002; | |||||
const int ACL_ERROR_RT_FAILURE = 500003; | |||||
const int ACL_ERROR_DRV_FAILURE = 500004; | |||||
const int ACL_ERROR_PROFILING_FAILURE = 500005; | |||||
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_INVALID_MAX_OPQUEUE_NUM_CONFIG = 148048; | |||||
static const int ACL_ERROR_INVALID_OPP_PATH = 148049; | |||||
static const int ACL_ERROR_OP_UNSUPPORTED_DYNAMIC = 148050; | |||||
static const int ACL_ERROR_RELATIVE_RESOURCE_NOT_CLEARED = 148051; | |||||
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_TENSOR_VALUE_RANGE_NUM 2 | |||||
#define ACL_UNKNOWN_RANK 0xFFFFFFFFFFFFFFFE | |||||
typedef enum { | typedef enum { | ||||
ACL_DT_UNDEFINED = -1, | ACL_DT_UNDEFINED = -1, | ||||
@@ -105,6 +145,9 @@ typedef enum { | |||||
ACL_UINT64 = 10, | ACL_UINT64 = 10, | ||||
ACL_DOUBLE = 11, | ACL_DOUBLE = 11, | ||||
ACL_BOOL = 12, | ACL_BOOL = 12, | ||||
ACL_STRING = 13, | |||||
ACL_COMPLEX64 = 16, | |||||
ACL_COMPLEX128 = 17 | |||||
} aclDataType; | } aclDataType; | ||||
typedef enum { | typedef enum { | ||||
@@ -114,7 +157,13 @@ typedef enum { | |||||
ACL_FORMAT_ND = 2, | ACL_FORMAT_ND = 2, | ||||
ACL_FORMAT_NC1HWC0 = 3, | ACL_FORMAT_NC1HWC0 = 3, | ||||
ACL_FORMAT_FRACTAL_Z = 4, | ACL_FORMAT_FRACTAL_Z = 4, | ||||
ACL_FORMAT_NC1HWC0_C04 = 12, | |||||
ACL_FORMAT_HWCN = 16, | |||||
ACL_FORMAT_NDHWC = 27, | |||||
ACL_FORMAT_FRACTAL_NZ = 29, | ACL_FORMAT_FRACTAL_NZ = 29, | ||||
ACL_FORMAT_NCDHW = 30, | |||||
ACL_FORMAT_NDC1HWC0 = 32, | |||||
ACL_FRACTAL_Z_3D = 33 | |||||
} aclFormat; | } aclFormat; | ||||
typedef enum { | typedef enum { | ||||
@@ -124,11 +173,19 @@ typedef enum { | |||||
ACL_ERROR = 3, | ACL_ERROR = 3, | ||||
} aclLogLevel; | } aclLogLevel; | ||||
typedef enum { | |||||
ACL_MEMTYPE_DEVICE = 0, | |||||
ACL_MEMTYPE_HOST = 1, | |||||
ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT = 2 | |||||
} aclMemType; | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Converts data of type aclFloat16 to data of type float | * @brief Converts data of type aclFloat16 to data of type float | ||||
* | * | ||||
* @param value [IN] Data to be converted | * @param value [IN] Data to be converted | ||||
* | |||||
* @retval Transformed data | * @retval Transformed data | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value); | ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value); | ||||
@@ -138,6 +195,7 @@ ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value); | |||||
* @brief Converts data of type float to data of type aclFloat16 | * @brief Converts data of type float to data of type aclFloat16 | ||||
* | * | ||||
* @param value [IN] Data to be converted | * @param value [IN] Data to be converted | ||||
* | |||||
* @retval Transformed data | * @retval Transformed data | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value); | ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value); | ||||
@@ -150,7 +208,9 @@ ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value); | |||||
* @li Need to be managed by the user, | * @li Need to be managed by the user, | ||||
* call aclrtMalloc interface to apply for memory, | * call aclrtMalloc interface to apply for memory, | ||||
* call aclrtFree interface to release memory | * call aclrtFree interface to release memory | ||||
* | |||||
* @param size [IN] size of data in bytes | * @param size [IN] size of data in bytes | ||||
* | |||||
* @retval pointer to created instance. nullptr if run out of memory | * @retval pointer to created instance. nullptr if run out of memory | ||||
* | * | ||||
* @see aclrtMalloc | aclrtFree | * @see aclrtMalloc | aclrtFree | ||||
@@ -165,8 +225,10 @@ ACL_FUNC_VISIBILITY aclDataBuffer *aclCreateDataBuffer(void *data, size_t size); | |||||
* Only the aclDataBuffer type data is destroyed here. | * Only the aclDataBuffer type data is destroyed here. | ||||
* The memory of the data passed in when the aclDataDataBuffer interface | * The memory of the data passed in when the aclDataDataBuffer interface | ||||
* is called to create aclDataBuffer type data must be released by the user | * is called to create aclDataBuffer type data must be released by the user | ||||
* | |||||
* @param dataBuffer [IN] pointer to the aclDataBuffer | * @param dataBuffer [IN] pointer to the aclDataBuffer | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclCreateDataBuffer | * @see aclCreateDataBuffer | ||||
@@ -175,9 +237,33 @@ ACL_FUNC_VISIBILITY aclError aclDestroyDataBuffer(const aclDataBuffer *dataBuffe | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief update new data of aclDataBuffer | |||||
* | |||||
* @param dataBuffer [OUT] pointer to aclDataBuffer | |||||
* @li The old data need to be released by the user, otherwise it may occur memory leak leakage | |||||
* call aclGetDataBufferAddr interface to get old data address | |||||
* call aclrtFree interface to release memory | |||||
* | |||||
* @param data [IN] pointer to new 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 ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
* | |||||
* @see aclrtMalloc | aclrtFree | aclGetDataBufferAddr | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclUpdateDataBuffer(aclDataBuffer *dataBuffer, void *data, size_t size); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief get data address from aclDataBuffer | * @brief get data address from aclDataBuffer | ||||
* | * | ||||
* @param dataBuffer [IN] pointer to the data of aclDataBuffer | * @param dataBuffer [IN] pointer to the data of aclDataBuffer | ||||
* | |||||
* @retval data address | * @retval data address | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer); | ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer); | ||||
@@ -187,15 +273,28 @@ ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer); | |||||
* @brief get data size of aclDataBuffer | * @brief get data size of aclDataBuffer | ||||
* | * | ||||
* @param dataBuffer [IN] pointer to the data of aclDataBuffer | * @param dataBuffer [IN] pointer to the data of aclDataBuffer | ||||
* | |||||
* @retval data size | * @retval data size | ||||
*/ | */ | ||||
// ACL_DEPRECATED_MESSAGE("aclGetDataBufferSize is deprecated, use aclGetDataBufferSizeV2 instead") | |||||
ACL_FUNC_VISIBILITY uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer); | ACL_FUNC_VISIBILITY uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @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 | * @brief get size of aclDataType | ||||
* | * | ||||
* @param dataType [IN] aclDataType data the size to get | * @param dataType [IN] aclDataType data the size to get | ||||
* | |||||
* @retval size of the aclDataType | * @retval size of the aclDataType | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); | ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); | ||||
@@ -209,6 +308,7 @@ ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); | |||||
* @param numDims [IN] the number of dimensions of the shape | * @param numDims [IN] the number of dimensions of the shape | ||||
* @param dims [IN] the size of the specified dimension | * @param dims [IN] the size of the specified dimension | ||||
* @param format [IN] tensor format | * @param format [IN] tensor format | ||||
* | |||||
* @retval aclTensorDesc pointer. | * @retval aclTensorDesc pointer. | ||||
* @retval nullptr if param is invalid or run out of memory | * @retval nullptr if param is invalid or run out of memory | ||||
*/ | */ | ||||
@@ -227,9 +327,39 @@ ACL_FUNC_VISIBILITY void aclDestroyTensorDesc(const aclTensorDesc *desc); | |||||
/** | /** | ||||
* @ingroup AscendCL | * @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 set value range for aclTensorDesc | |||||
* | |||||
* @param desc [OUT] pointer to the data of aclTensorDesc | |||||
* @param valueCount [IN] the number of value | |||||
* @param valueRange [IN] the range of value | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclSetTensorValueRange(aclTensorDesc* desc, | |||||
size_t valueCount, | |||||
int64_t valueRange[][ACL_TENSOR_VALUE_RANGE_NUM]); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief get data type specified by the tensor description | * @brief get data type specified by the tensor description | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* | |||||
* @retval data type specified by the tensor description. | * @retval data type specified by the tensor description. | ||||
* @retval ACL_DT_UNDEFINED if description is null | * @retval ACL_DT_UNDEFINED if description is null | ||||
*/ | */ | ||||
@@ -240,6 +370,7 @@ ACL_FUNC_VISIBILITY aclDataType aclGetTensorDescType(const aclTensorDesc *desc); | |||||
* @brief get data format specified by the tensor description | * @brief get data format specified by the tensor description | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* | |||||
* @retval data format specified by the tensor description. | * @retval data format specified by the tensor description. | ||||
* @retval ACL_FORMAT_UNDEFINED if description is null | * @retval ACL_FORMAT_UNDEFINED if description is null | ||||
*/ | */ | ||||
@@ -250,6 +381,7 @@ ACL_FUNC_VISIBILITY aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc); | |||||
* @brief get tensor size specified by the tensor description | * @brief get tensor size specified by the tensor description | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* | |||||
* @retval data size specified by the tensor description. | * @retval data size specified by the tensor description. | ||||
* @retval 0 if description is null | * @retval 0 if description is null | ||||
*/ | */ | ||||
@@ -260,6 +392,7 @@ ACL_FUNC_VISIBILITY size_t aclGetTensorDescSize(const aclTensorDesc *desc); | |||||
* @brief get element count specified by the tensor description | * @brief get element count specified by the tensor description | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* | |||||
* @retval element count specified by the tensor description. | * @retval element count specified by the tensor description. | ||||
* @retval 0 if description is null | * @retval 0 if description is null | ||||
*/ | */ | ||||
@@ -270,8 +403,10 @@ ACL_FUNC_VISIBILITY size_t aclGetTensorDescElementCount(const aclTensorDesc *des | |||||
* @brief get number of dims specified by the tensor description | * @brief get number of dims specified by the tensor description | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* | |||||
* @retval number of dims specified by the tensor description. | * @retval number of dims specified by the tensor description. | ||||
* @retval 0 if description is null | * @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); | ACL_FUNC_VISIBILITY size_t aclGetTensorDescNumDims(const aclTensorDesc *desc); | ||||
@@ -281,16 +416,48 @@ ACL_FUNC_VISIBILITY size_t aclGetTensorDescNumDims(const aclTensorDesc *desc); | |||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* @param index [IN] index of dims, start from 0. | * @param index [IN] index of dims, start from 0. | ||||
* | |||||
* @retval dim specified by the tensor description and index. | * @retval dim specified by the tensor description and index. | ||||
* @retval -1 if description or index is invalid | * @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); | ACL_FUNC_VISIBILITY int64_t aclGetTensorDescDim(const aclTensorDesc *desc, size_t index); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @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 | * @brief set tensor description name | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | |||||
* @param desc [OUT] pointer to the instance of aclTensorDesc | |||||
* @param name [IN] tensor description name | * @param name [IN] tensor description name | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *name); | ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *name); | ||||
@@ -300,6 +467,7 @@ ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *n | |||||
* @brief get tensor description name | * @brief get tensor description name | ||||
* | * | ||||
* @param desc [IN] pointer to the instance of aclTensorDesc | * @param desc [IN] pointer to the instance of aclTensorDesc | ||||
* | |||||
* @retval tensor description name. | * @retval tensor description name. | ||||
* @retval empty string if description is null | * @retval empty string if description is null | ||||
*/ | */ | ||||
@@ -313,8 +481,9 @@ ACL_FUNC_VISIBILITY const char *aclGetTensorDescName(aclTensorDesc *desc); | |||||
* | * | ||||
* @param srcDesc [IN] pointer to the source tensor desc | * @param srcDesc [IN] pointer to the source tensor desc | ||||
* @param dstFormat [IN] destination format | * @param dstFormat [IN] destination format | ||||
* @param dstDesc [OUT] pointer to the pointer to the destination tensor desc | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @param dstDesc [OUT] pointer to the pointer to the destination tensor desc | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, | ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, | ||||
@@ -324,27 +493,142 @@ ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDe | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Set the storage format specified by the tensor description | * @brief Set the storage format specified by the tensor description | ||||
* | * | ||||
* @param desc [IN|OUT] pointer to the instance of aclTensorDesc | |||||
* @param format [IN] the storage format | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @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 | * @retval OtherValues Failure | ||||
*/ | */ | ||||
// ACL_DEPRECATED_MESSAGE("aclSetTensorStorageFormat is deprecated, use aclSetTensorFormat instead") | |||||
ACL_FUNC_VISIBILITY aclError aclSetTensorStorageFormat(aclTensorDesc *desc, aclFormat format); | ACL_FUNC_VISIBILITY aclError aclSetTensorStorageFormat(aclTensorDesc *desc, aclFormat format); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Set the storage shape specified by the tensor description | * @brief Set the storage shape specified by the tensor description | ||||
* | * | ||||
* @param desc [IN|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_ERROR_NONE The function is successfully executed. | |||||
* @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 | * @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); | ACL_FUNC_VISIBILITY aclError aclSetTensorStorageShape(aclTensorDesc *desc, int numDims, const int64_t *dims); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @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 Set const data specified by the tensor description | |||||
* | |||||
* @param desc [OUT] pointer to the instance of aclTensorDesc | |||||
* @param dataBuffer [IN] pointer to the const databuffer | |||||
* @param length [IN] the length of const databuffer | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief Set tensor memory type specified by the tensor description | |||||
* | |||||
* @param desc [OUT] pointer to the instance of aclTensorDesc | |||||
* @param memType [IN] ACL_MEMTYPE_DEVICE means device, ACL_MEMTYPE_HOST or | |||||
* ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT means host | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclSetTensorPlaceMent(aclTensorDesc *desc, aclMemType memType); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief an interface for users to output APP logs | * @brief an interface for users to output APP logs | ||||
* | * | ||||
* @param logLevel [IN] the level of current log | * @param logLevel [IN] the level of current log | ||||
@@ -354,8 +638,17 @@ ACL_FUNC_VISIBILITY aclError aclSetTensorStorageShape(aclTensorDesc *desc, int n | |||||
* @param fmt [IN] the format of current log | * @param fmt [IN] the format of current log | ||||
* @param ... [IN] the value 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, ...); | |||||
// ACL_FUNC_VISIBILITY void aclAppLog(aclLogLevel logLevel, const char *func, const char *file, uint32_t line, | |||||
// const char *fmt, ...); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief get soc name | |||||
* | |||||
* @retval null for failed | |||||
* @retval OtherValues success | |||||
*/ | |||||
ACL_FUNC_VISIBILITY const char *aclrtGetSocName(); | |||||
#define ACL_APP_LOG(level, fmt, ...) \ | #define ACL_APP_LOG(level, fmt, ...) \ | ||||
aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__) | aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__) | ||||
@@ -23,7 +23,7 @@ typedef struct aclopKernelDesc aclopKernelDesc; | |||||
typedef void (*aclDataDeallocator)(void *data, size_t length); | typedef void (*aclDataDeallocator)(void *data, size_t length); | ||||
const int ACL_COMPILE_FLAG_BIN_SELECTOR = 1; | |||||
static const int ACL_COMPILE_FLAG_BIN_SELECTOR = 1; | |||||
typedef enum aclEngineType { | typedef enum aclEngineType { | ||||
ACL_ENGINE_SYS, | ACL_ENGINE_SYS, | ||||
@@ -38,7 +38,8 @@ typedef enum aclEngineType { | |||||
* @par Restriction | * @par Restriction | ||||
* The aclopSetModelDir interface can be called only once in a process. | * The aclopSetModelDir interface can be called only once in a process. | ||||
* @param modelDir [IN] path of the directory | * @param modelDir [IN] path of the directory | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir); | ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir); | ||||
@@ -51,10 +52,11 @@ ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir); | |||||
* The aclopLoad interface can be called more than one times in a process. | * The aclopLoad interface can be called more than one times in a process. | ||||
* @param model [IN] address of single op models | * @param model [IN] address of single op models | ||||
* @param modelSize [IN] size of single op models | * @param modelSize [IN] size of single op models | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopLoad(const void *model, size_t modelSize); | |||||
ACL_FUNC_VISIBILITY aclError aclopLoad(const void *model, size_t modelSize); | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
@@ -77,11 +79,12 @@ ACL_FUNC_VISIBILITY void aclopDestroyAttr(const aclopAttr *attr); | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is bool | * @brief set an attribute. the type of the attribute is bool | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param attrValue [IN] attribute value | * @param attrValue [IN] attribute value | ||||
* false if attrValue is 0, true otherwise. | * false if attrValue is 0, true otherwise. | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrName, uint8_t attrValue); | ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrName, uint8_t attrValue); | ||||
@@ -90,10 +93,11 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrN | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is int64_t | * @brief set an attribute. the type of the attribute is int64_t | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param attrValue [IN] attribute value | * @param attrValue [IN] attribute value | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrName, int64_t attrValue); | ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrName, int64_t attrValue); | ||||
@@ -102,10 +106,11 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrNa | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is float | * @brief set an attribute. the type of the attribute is float | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param attrValue [IN] attribute value | * @param attrValue [IN] attribute value | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attrName, float attrValue); | ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attrName, float attrValue); | ||||
@@ -114,23 +119,53 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attr | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is string | * @brief set an attribute. the type of the attribute is string | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param attrValue [IN] attribute value | * @param attrValue [IN] attribute value | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *attrName, const char *attrValue); | ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *attrName, const char *attrValue); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is aclDataType | |||||
* | |||||
* @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 aclopSetAttrDataType(aclopAttr *attr, const char *attrName, aclDataType attrValue); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief set an attribute. the type of the attribute is list of aclDataType | |||||
* | |||||
* @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 aclopSetAttrListDataType(aclopAttr *attr, const char *attrName, int numValues, | |||||
const aclDataType values[]); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief set an attribute. the type of the attribute is list of bools | * @brief set an attribute. the type of the attribute is list of bools | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param numValues [IN] number of values. false if attrValue is 0, true otherwise. | * @param numValues [IN] number of values. false if attrValue is 0, true otherwise. | ||||
* @param values [IN] pointer to values | * @param values [IN] pointer to values | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues, | ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues, | ||||
@@ -140,11 +175,12 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *a | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is list of ints | * @brief set an attribute. the type of the attribute is list of ints | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param numValues [IN] number of values | * @param numValues [IN] number of values | ||||
* @param values [IN] pointer to values | * @param values [IN] pointer to values | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues, | ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues, | ||||
@@ -154,11 +190,12 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *at | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is list of floats | * @brief set an attribute. the type of the attribute is list of floats | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param numValues [IN] number of values | * @param numValues [IN] number of values | ||||
* @param values [IN] pointer to values | * @param values [IN] pointer to values | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues, | ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues, | ||||
@@ -168,11 +205,12 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char * | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is list of strings | * @brief set an attribute. the type of the attribute is list of strings | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param numValues [IN] number of values | * @param numValues [IN] number of values | ||||
* @param values [IN] pointer to values | * @param values [IN] pointer to values | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues, | ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues, | ||||
@@ -182,12 +220,13 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief set an attribute. the type of the attribute is list of list of ints | * @brief set an attribute. the type of the attribute is list of list of ints | ||||
* | * | ||||
* @param attr [IN] pointer to the instance of aclopAttr | |||||
* @param attr [OUT] pointer to the instance of aclopAttr | |||||
* @param attrName [IN] attribute name | * @param attrName [IN] attribute name | ||||
* @param numLists [IN] number of lists | * @param numLists [IN] number of lists | ||||
* @param numValues [IN] pointer to number of values of each list | * @param numValues [IN] pointer to number of values of each list | ||||
* @param values [IN] pointer to values | * @param values [IN] pointer to values | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, | ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, | ||||
@@ -208,6 +247,7 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, | |||||
* the ACL finds the corresponding task according to the optype, | * the ACL finds the corresponding task according to the optype, | ||||
* the description of the input tesnsor, | * the description of the input tesnsor, | ||||
* the description of the output tesnsor, and attr, and issues the execution. | * the description of the output tesnsor, and attr, and issues the execution. | ||||
* | |||||
* @param opType [IN] type of op | * @param opType [IN] type of op | ||||
* @param numInputs [IN] number of inputs | * @param numInputs [IN] number of inputs | ||||
* @param inputDesc [IN] pointer to array of input tensor descriptions | * @param inputDesc [IN] pointer to array of input tensor descriptions | ||||
@@ -218,9 +258,11 @@ ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, | |||||
* @param attr [IN] pointer to instance of aclopAttr. | * @param attr [IN] pointer to instance of aclopAttr. | ||||
* may pass nullptr if the op has no attribute | * may pass nullptr if the op has no attribute | ||||
* @param stream [IN] stream | * @param stream [IN] stream | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
// ACL_DEPRECATED_MESSAGE("aclopExecute is deprecated, use aclopExecuteV2 instead") | |||||
ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, | ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, | ||||
int numInputs, | int numInputs, | ||||
const aclTensorDesc *const inputDesc[], | const aclTensorDesc *const inputDesc[], | ||||
@@ -233,6 +275,44 @@ ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, | |||||
/** | /** | ||||
* @ingroup AscendCL | * @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. | * @brief create a instance of aclopHandle. | ||||
* | * | ||||
* @param opType [IN] type of op | * @param opType [IN] type of op | ||||
@@ -243,7 +323,8 @@ ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, | |||||
* @param opAttr [IN] pointer to instance of aclopAttr. | * @param opAttr [IN] pointer to instance of aclopAttr. | ||||
* may pass nullptr if the op has no attribute | * may pass nullptr if the op has no attribute | ||||
* @param handle [OUT] pointer to the pointer to the handle | * @param handle [OUT] pointer to the pointer to the handle | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType, | ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType, | ||||
@@ -275,9 +356,10 @@ ACL_FUNC_VISIBILITY void aclopDestroyHandle(aclopHandle *handle); | |||||
* The aclCreateDataBuffer interface has been called | * The aclCreateDataBuffer interface has been called | ||||
* in advance to create aclDataBuffer type data. | * in advance to create aclDataBuffer type data. | ||||
* @param numOutputs [IN] number of outputs | * @param numOutputs [IN] number of outputs | ||||
* @param outputs [IN] pointer to array of output buffers | |||||
* @param outputs [OUT] pointer to array of output buffers | |||||
* @param stream [IN] stream | * @param stream [IN] stream | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclopCreateHandle | aclCreateDataBuffer | * @see aclopCreateHandle | aclCreateDataBuffer | ||||
@@ -299,7 +381,8 @@ ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, | |||||
* @param dstBuffer [OUT] destination tensor buffer | * @param dstBuffer [OUT] destination tensor buffer | ||||
* @param truncate [IN] do not truncate if value is 0, truncate otherwise | * @param truncate [IN] do not truncate if value is 0, truncate otherwise | ||||
* @param stream [IN] stream | * @param stream [IN] stream | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, | ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, | ||||
@@ -313,11 +396,12 @@ ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief create a handle for casting datatype | * @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 [IN] pointer to the pointer to the handle | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @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 | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, | ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, | ||||
@@ -338,7 +422,8 @@ ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, | |||||
* @param enginetype [IN] enigne type | * @param enginetype [IN] enigne type | ||||
* @param deallocator [IN] callback function for deallocating bin data, | * @param deallocator [IN] callback function for deallocating bin data, | ||||
* null if bin data to be deallocated by caller | * null if bin data to be deallocated by caller | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclopCompile | * @see aclopCompile | ||||
@@ -362,7 +447,8 @@ ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType, | |||||
* @param outputDesc [IN] pointer to array of output tensor descriptions | * @param outputDesc [IN] pointer to array of output tensor descriptions | ||||
* @param opAttr [IN] pointer to instance of aclopAttr | * @param opAttr [IN] pointer to instance of aclopAttr | ||||
* @param aclopKernelDesc [IN] pointer to instance of aclopKernelDesc | * @param aclopKernelDesc [IN] pointer to instance of aclopKernelDesc | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
typedef aclError (*aclopCompileFunc)(int numInputs, | typedef aclError (*aclopCompileFunc)(int numInputs, | ||||
@@ -378,7 +464,8 @@ typedef aclError (*aclopCompileFunc)(int numInputs, | |||||
* | * | ||||
* @param opType [IN] op type | * @param opType [IN] op type | ||||
* @param func [IN] compile function | * @param func [IN] compile function | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclopUnregisterCompileFunc | * @see aclopUnregisterCompileFunc | ||||
@@ -390,7 +477,8 @@ ACL_FUNC_VISIBILITY aclError aclopRegisterCompileFunc(const char *opType, aclopC | |||||
* @brief unregister compile function | * @brief unregister compile function | ||||
* | * | ||||
* @param opType [IN] op type | * @param opType [IN] op type | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); | ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); | ||||
@@ -404,7 +492,8 @@ ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); | |||||
* @param blockDim [IN] block dim | * @param blockDim [IN] block dim | ||||
* @param args [IN] args | * @param args [IN] args | ||||
* @param argSize [IN] size in bytes of args | * @param argSize [IN] size in bytes of args | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, | ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, | ||||
@@ -420,24 +509,26 @@ ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, | |||||
* @param kernelDesc [IN] pointer to instance of aclopKernelDesc | * @param kernelDesc [IN] pointer to instance of aclopKernelDesc | ||||
* @param numWorkspaces [IN] number of workspaces | * @param numWorkspaces [IN] number of workspaces | ||||
* @param workspaceSizes [IN] pointer to array of sizes of workspaces | * @param workspaceSizes [IN] pointer to array of sizes of workspaces | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kernelDesc, int numWorkspaces, | ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kernelDesc, int numWorkspaces, | ||||
size_t *workspaceSizes); | |||||
size_t *workspaceSizes); | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief compile op with dynamic shape | * @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_ERROR_NONE The function is successfully executed. | |||||
* @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 | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, | ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, | ||||
@@ -447,6 +538,31 @@ ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, | |||||
const aclTensorDesc *const outputDesc[], | const aclTensorDesc *const outputDesc[], | ||||
const aclopAttr *attr); | 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 | #ifdef __cplusplus | ||||
} | } | ||||
#endif | #endif | ||||
@@ -19,6 +19,8 @@ | |||||
extern "C" { | extern "C" { | ||||
#endif | #endif | ||||
#define ACL_EVENT_TIME_LINE 0x00000008u | |||||
typedef enum aclrtRunMode { | typedef enum aclrtRunMode { | ||||
ACL_DEVICE, | ACL_DEVICE, | ||||
ACL_HOST, | ACL_HOST, | ||||
@@ -36,6 +38,17 @@ typedef enum aclrtEventStatus { | |||||
ACL_EVENT_STATUS_RESERVED = 2, | ACL_EVENT_STATUS_RESERVED = 2, | ||||
} aclrtEventStatus; | } aclrtEventStatus; | ||||
typedef enum aclrtEventRecordedStatus { | |||||
ACL_EVENT_RECORDED_STATUS_NOT_READY = 0, | |||||
ACL_EVENT_RECORDED_STATUS_COMPLETE = 1, | |||||
} aclrtEventRecordedStatus; | |||||
typedef enum aclrtEventWaitStatus { | |||||
ACL_EVENT_WAIT_STATUS_COMPLETE = 0, | |||||
ACL_EVENT_WAIT_STATUS_NOT_READY = 1, | |||||
ACL_EVENT_WAIT_STATUS_RESERVED = 0xffff, | |||||
} aclrtEventWaitStatus; | |||||
typedef enum aclrtCallbackBlockType { | typedef enum aclrtCallbackBlockType { | ||||
ACL_CALLBACK_NO_BLOCK, | ACL_CALLBACK_NO_BLOCK, | ||||
ACL_CALLBACK_BLOCK, | ACL_CALLBACK_BLOCK, | ||||
@@ -52,8 +65,35 @@ typedef enum aclrtMemMallocPolicy { | |||||
ACL_MEM_MALLOC_HUGE_FIRST, | ACL_MEM_MALLOC_HUGE_FIRST, | ||||
ACL_MEM_MALLOC_HUGE_ONLY, | ACL_MEM_MALLOC_HUGE_ONLY, | ||||
ACL_MEM_MALLOC_NORMAL_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; | } 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, | |||||
ACL_GROUP_GROUPID_INT | |||||
} aclrtGroupAttr; | |||||
typedef struct tagRtGroupInfo aclrtGroupInfo; | |||||
typedef struct rtExceptionInfo aclrtExceptionInfo; | typedef struct rtExceptionInfo aclrtExceptionInfo; | ||||
typedef void (*aclrtCallback)(void *userData); | typedef void (*aclrtCallback)(void *userData); | ||||
@@ -65,7 +105,8 @@ typedef void (*aclrtExceptionInfoCallback)(aclrtExceptionInfo *exceptionInfo); | |||||
* @brief Set a callback function to handle exception information | * @brief Set a callback function to handle exception information | ||||
* | * | ||||
* @param callback [IN] callback function to handle exception information | * @param callback [IN] callback function to handle exception information | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback); | ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCallback callback); | ||||
@@ -75,6 +116,7 @@ ACL_FUNC_VISIBILITY aclError aclrtSetExceptionInfoCallback(aclrtExceptionInfoCal | |||||
* @brief Get task id from exception information | * @brief Get task id from exception information | ||||
* | * | ||||
* @param info [IN] pointer of exception information | * @param info [IN] pointer of exception information | ||||
* | |||||
* @retval The task id from exception information | * @retval The task id from exception information | ||||
* @retval 0xFFFFFFFF if info is null | * @retval 0xFFFFFFFF if info is null | ||||
*/ | */ | ||||
@@ -85,6 +127,7 @@ ACL_FUNC_VISIBILITY uint32_t aclrtGetTaskIdFromExceptionInfo(const aclrtExceptio | |||||
* @brief Get stream id from exception information | * @brief Get stream id from exception information | ||||
* | * | ||||
* @param info [IN] pointer of exception information | * @param info [IN] pointer of exception information | ||||
* | |||||
* @retval The stream id from exception information | * @retval The stream id from exception information | ||||
* @retval 0xFFFFFFFF if info is null | * @retval 0xFFFFFFFF if info is null | ||||
*/ | */ | ||||
@@ -95,6 +138,7 @@ ACL_FUNC_VISIBILITY uint32_t aclrtGetStreamIdFromExceptionInfo(const aclrtExcept | |||||
* @brief Get thread id from exception information | * @brief Get thread id from exception information | ||||
* | * | ||||
* @param info [IN] pointer of exception information | * @param info [IN] pointer of exception information | ||||
* | |||||
* @retval The thread id of fail task | * @retval The thread id of fail task | ||||
* @retval 0xFFFFFFFF if info is null | * @retval 0xFFFFFFFF if info is null | ||||
*/ | */ | ||||
@@ -102,11 +146,23 @@ ACL_FUNC_VISIBILITY uint32_t aclrtGetThreadIdFromExceptionInfo(const aclrtExcept | |||||
/** | /** | ||||
* @ingroup AscendCL | * @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 | * @brief The thread that handles the callback function on the Stream | ||||
* | * | ||||
* @param threadId [IN] thread ID | |||||
* @param threadId [IN] thread ID | |||||
* @param stream [IN] stream handle | * @param stream [IN] stream handle | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream stream); | ACL_FUNC_VISIBILITY aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream stream); | ||||
@@ -120,13 +176,14 @@ ACL_FUNC_VISIBILITY aclError aclrtSubscribeReport(uint64_t threadId, aclrtStream | |||||
* The function prototype of the callback function is: | * The function prototype of the callback function is: | ||||
* typedef void (*aclrtCallback)(void *userData); | * typedef void (*aclrtCallback)(void *userData); | ||||
* @param userData [IN] User data to be passed to the callback function | * @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_ERROR_NONE The function is successfully executed. | |||||
* @param blockType [IN] callback block type | |||||
* @param stream [IN] stream handle | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtLaunchCallback(aclrtCallback fn, void *userData, aclrtCallbackBlockType blockType, | ACL_FUNC_VISIBILITY aclError aclrtLaunchCallback(aclrtCallback fn, void *userData, aclrtCallbackBlockType blockType, | ||||
aclrtStream stream); | |||||
aclrtStream stream); | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
@@ -135,8 +192,10 @@ ACL_FUNC_VISIBILITY aclError aclrtLaunchCallback(aclrtCallback fn, void *userDat | |||||
* @par Function | * @par Function | ||||
* The thread processing callback specified by | * The thread processing callback specified by | ||||
* the aclrtSubscribeReport interface | * the aclrtSubscribeReport interface | ||||
* | |||||
* @param timeout [IN] timeout value | * @param timeout [IN] timeout value | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtSubscribeReport | * @see aclrtSubscribeReport | ||||
@@ -150,8 +209,9 @@ ACL_FUNC_VISIBILITY aclError aclrtProcessReport(int32_t timeout); | |||||
* is no longer processed by the specified thread | * is no longer processed by the specified thread | ||||
* | * | ||||
* @param threadId [IN] thread ID | * @param threadId [IN] thread ID | ||||
* @param stream [IN] stream handle | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @param stream [IN] stream handle | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream); | ACL_FUNC_VISIBILITY aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream); | ||||
@@ -172,9 +232,11 @@ ACL_FUNC_VISIBILITY aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStre | |||||
* It is recommended to explicitly specify the context of the current thread | * It is recommended to explicitly specify the context of the current thread | ||||
* through the aclrtSetCurrentContext interface to increase. | * through the aclrtSetCurrentContext interface to increase. | ||||
* the maintainability of the program. | * the maintainability of the program. | ||||
* @param context [OUT] point to the created context | |||||
* | |||||
* @param context [OUT] point to the created context | |||||
* @param deviceId [IN] device to create context on | * @param deviceId [IN] device to create context on | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtSetDevice | aclrtSetCurrentContext | * @see aclrtSetDevice | aclrtSetCurrentContext | ||||
@@ -187,8 +249,10 @@ ACL_FUNC_VISIBILITY aclError aclrtCreateContext(aclrtContext *context, int32_t d | |||||
* | * | ||||
* @par Function | * @par Function | ||||
* Can only destroy context created through aclrtCreateContext interface | * Can only destroy context created through aclrtCreateContext interface | ||||
* | |||||
* @param context [IN] the context to destroy | * @param context [IN] the context to destroy | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtCreateContext | * @see aclrtCreateContext | ||||
@@ -221,8 +285,10 @@ ACL_FUNC_VISIBILITY aclError aclrtDestroyContext(aclrtContext context); | |||||
* and the context is used in thread B, | * and the context is used in thread B, | ||||
* the user must guarantee the execution order of tasks in the same stream | * the user must guarantee the execution order of tasks in the same stream | ||||
* under the same context in two threads. | * under the same context in two threads. | ||||
* | |||||
* @param context [IN] the current context of the thread | * @param context [IN] the current context of the thread | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtCreateContext | aclrtDestroyContext | * @see aclrtCreateContext | aclrtDestroyContext | ||||
@@ -237,8 +303,10 @@ ACL_FUNC_VISIBILITY aclError aclrtSetCurrentContext(aclrtContext context); | |||||
* If the user calls the aclrtSetCurrentContext interface | * If the user calls the aclrtSetCurrentContext interface | ||||
* multiple times to set the context of the current thread, | * multiple times to set the context of the current thread, | ||||
* then the last set context is obtained | * then the last set context is obtained | ||||
* | |||||
* @param context [OUT] the current context of the thread | * @param context [OUT] the current context of the thread | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtSetCurrentContext | * @see aclrtSetCurrentContext | ||||
@@ -263,8 +331,10 @@ ACL_FUNC_VISIBILITY aclError aclrtGetCurrentContext(aclrtContext *context); | |||||
* create a Context (aclrtCreateContext interface). | * create a Context (aclrtCreateContext interface). | ||||
* @li In multi-device scenarios, you can switch to other devices | * @li In multi-device scenarios, you can switch to other devices | ||||
* through the aclrtSetDevice interface in the process. | * through the aclrtSetDevice interface in the process. | ||||
* | |||||
* @param deviceId [IN] the device id | * @param deviceId [IN] the device id | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtResetDevice |aclrtCreateContext | * @see aclrtResetDevice |aclrtCreateContext | ||||
@@ -290,8 +360,10 @@ ACL_FUNC_VISIBILITY aclError aclrtSetDevice(int32_t deviceId); | |||||
* call aclrtDestroyStream interface to release explicitly created Stream-> | * call aclrtDestroyStream interface to release explicitly created Stream-> | ||||
* call aclrtDestroyContext to release explicitly created Context-> | * call aclrtDestroyContext to release explicitly created Context-> | ||||
* call aclrtResetDevice interface | * call aclrtResetDevice interface | ||||
* | |||||
* @param deviceId [IN] the device id | * @param deviceId [IN] the device id | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId); | ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId); | ||||
@@ -301,7 +373,8 @@ ACL_FUNC_VISIBILITY aclError aclrtResetDevice(int32_t deviceId); | |||||
* @brief get target device of current thread | * @brief get target device of current thread | ||||
* | * | ||||
* @param deviceId [OUT] the device id | * @param deviceId [OUT] the device id | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtGetDevice(int32_t *deviceId); | ACL_FUNC_VISIBILITY aclError aclrtGetDevice(int32_t *deviceId); | ||||
@@ -311,7 +384,8 @@ ACL_FUNC_VISIBILITY aclError aclrtGetDevice(int32_t *deviceId); | |||||
* @brief get target side | * @brief get target side | ||||
* | * | ||||
* @param runMode [OUT] the run mode | * @param runMode [OUT] the run mode | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtGetRunMode(aclrtRunMode *runMode); | ACL_FUNC_VISIBILITY aclError aclrtGetRunMode(aclrtRunMode *runMode); | ||||
@@ -320,7 +394,7 @@ ACL_FUNC_VISIBILITY aclError aclrtGetRunMode(aclrtRunMode *runMode); | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Wait for compute device to finish | * @brief Wait for compute device to finish | ||||
* | * | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtSynchronizeDevice(void); | ACL_FUNC_VISIBILITY aclError aclrtSynchronizeDevice(void); | ||||
@@ -330,7 +404,8 @@ ACL_FUNC_VISIBILITY aclError aclrtSynchronizeDevice(void); | |||||
* @brief Set Scheduling TS | * @brief Set Scheduling TS | ||||
* | * | ||||
* @param tsId [IN] the ts id | * @param tsId [IN] the ts id | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtSetTsDevice(aclrtTsId tsId); | ACL_FUNC_VISIBILITY aclError aclrtSetTsDevice(aclrtTsId tsId); | ||||
@@ -339,8 +414,9 @@ ACL_FUNC_VISIBILITY aclError aclrtSetTsDevice(aclrtTsId tsId); | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief get total device number. | * @brief get total device number. | ||||
* | * | ||||
* @param count [IN|OUT] the device number | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @param count [OUT] the device number | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count); | ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count); | ||||
@@ -350,13 +426,26 @@ ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count); | |||||
* @brief create event instance | * @brief create event instance | ||||
* | * | ||||
* @param event [OUT] created event | * @param event [OUT] created event | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event); | ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief create event instance with flag | |||||
* | |||||
* @param event [OUT] created event | |||||
* @param flag [IN] event flag | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief destroy event instance | * @brief destroy event instance | ||||
* | * | ||||
* @par Function | * @par Function | ||||
@@ -365,8 +454,10 @@ ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event); | |||||
* the user must ensure that the tasks involved in the aclrtSynchronizeEvent | * the user must ensure that the tasks involved in the aclrtSynchronizeEvent | ||||
* interface or the aclrtStreamWaitEvent interface are completed before | * interface or the aclrtStreamWaitEvent interface are completed before | ||||
* they are destroyed. | * they are destroyed. | ||||
* | |||||
* @param event [IN] event to destroy | * @param event [IN] event to destroy | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtCreateEvent | aclrtSynchronizeEvent | aclrtStreamWaitEvent | * @see aclrtCreateEvent | aclrtSynchronizeEvent | aclrtStreamWaitEvent | ||||
@@ -377,9 +468,10 @@ ACL_FUNC_VISIBILITY aclError aclrtDestroyEvent(aclrtEvent event); | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Record an Event in the Stream | * @brief Record an Event in the Stream | ||||
* | * | ||||
* @param event [IN] event to record | |||||
* @param event [IN] event to record | |||||
* @param stream [IN] stream handle | * @param stream [IN] stream handle | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream); | ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream); | ||||
@@ -391,9 +483,11 @@ ACL_FUNC_VISIBILITY aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stre | |||||
* @par Function | * @par Function | ||||
* Users need to make sure to wait for the tasks in the Stream | * Users need to make sure to wait for the tasks in the Stream | ||||
* to complete before resetting the Event | * to complete before resetting the Event | ||||
* @param event [IN] event to reset | |||||
* | |||||
* @param event [IN] event to reset | |||||
* @param stream [IN] stream handle | * @param stream [IN] stream handle | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream); | ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream stream); | ||||
@@ -402,19 +496,46 @@ ACL_FUNC_VISIBILITY aclError aclrtResetEvent(aclrtEvent event, aclrtStream strea | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Queries an event's status | * @brief Queries an event's status | ||||
* | * | ||||
* @param event [IN] event to query | |||||
* @param event [IN] event to query | |||||
* @param status [OUT] event status | * @param status [OUT] event status | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
// ACL_DEPRECATED_MESSAGE("aclrtQueryEvent is deprecated, use aclrtQueryEventStatus instead") | |||||
ACL_FUNC_VISIBILITY aclError aclrtQueryEvent(aclrtEvent event, aclrtEventStatus *status); | ACL_FUNC_VISIBILITY aclError aclrtQueryEvent(aclrtEvent event, aclrtEventStatus *status); | ||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Queries an event's status | |||||
* | |||||
* @param event [IN] event to query | |||||
* @param status [OUT] event recorded status | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclrtQueryEventStatus(aclrtEvent event, aclrtEventRecordedStatus *status); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief Queries an event's wait-status | |||||
* | |||||
* @param event [IN] event to query | |||||
* @param status [OUT] event wait-status | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclrtQueryEventWaitStatus(aclrtEvent event, aclrtEventWaitStatus *status); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief Block Host Running, wait event to be complete | * @brief Block Host Running, wait event to be complete | ||||
* | * | ||||
* @param event [IN] event to wait | * @param event [IN] event to wait | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event); | ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event); | ||||
@@ -423,15 +544,16 @@ ACL_FUNC_VISIBILITY aclError aclrtSynchronizeEvent(aclrtEvent event); | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief computes the elapsed time between events. | * @brief computes the elapsed time between events. | ||||
* | * | ||||
* @param ms [OUT] time between start and end in ms | |||||
* @param start [IN] starting event | |||||
* @param ms [OUT] time between start and end in ms | |||||
* @param start [IN] starting event | |||||
* @param end [IN] ending event | * @param end [IN] ending event | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtCreateEvent | aclrtRecordEvent | aclrtSynchronizeStream | * @see aclrtCreateEvent | aclrtRecordEvent | aclrtSynchronizeStream | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent start, aclrtEvent end); | |||||
ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent startEvent, aclrtEvent endEvent); | |||||
/** | /** | ||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
@@ -447,13 +569,15 @@ ACL_FUNC_VISIBILITY aclError aclrtEventElapsedTime(float *ms, aclrtEvent start, | |||||
* @li Before calling the media data processing interface, | * @li Before calling the media data processing interface, | ||||
* if you need to apply memory on the device to store input or output data, | * if you need to apply memory on the device to store input or output data, | ||||
* you need to call acldvppMalloc to apply for memory. | * you need to call acldvppMalloc to apply for memory. | ||||
* @param devPtr [IN|OUT] pointer to pointer to allocated memory on device | |||||
* @param size [IN] alloc memory size | |||||
* | |||||
* @param devPtr [OUT] pointer to pointer to allocated memory on device | |||||
* @param size [IN] alloc memory size | |||||
* @param policy [IN] memory alloc policy | * @param policy [IN] memory alloc policy | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtFree | acldvppMalloc | |||||
* @see aclrtFree | acldvppMalloc | aclrtMallocCached | |||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, | ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, | ||||
size_t size, | size_t size, | ||||
@@ -461,12 +585,63 @@ ACL_FUNC_VISIBILITY aclError aclrtMalloc(void **devPtr, | |||||
/** | /** | ||||
* @ingroup AscendCL | * @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 | * @brief free device memory | ||||
* | * | ||||
* @par Function | * @par Function | ||||
* can only free memory allocated through the aclrtMalloc interface | * can only free memory allocated through the aclrtMalloc interface | ||||
* | |||||
* @param devPtr [IN] Pointer to memory to be freed | * @param devPtr [IN] Pointer to memory to be freed | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtMalloc | * @see aclrtMalloc | ||||
@@ -482,9 +657,11 @@ ACL_FUNC_VISIBILITY aclError aclrtFree(void *devPtr); | |||||
* and needs to be explicitly copied to the Device. | * and needs to be explicitly copied to the Device. | ||||
* @li The memory requested by the aclrtMallocHost interface | * @li The memory requested by the aclrtMallocHost interface | ||||
* needs to be released through the aclrtFreeHost interface. | * needs to be released through the aclrtFreeHost interface. | ||||
* @param hostPtr [IN|OUT] pointer to pointer to allocated memory on the host | |||||
* @param size [IN] alloc memory size | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @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 | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtFreeHost | * @see aclrtFreeHost | ||||
@@ -497,8 +674,10 @@ ACL_FUNC_VISIBILITY aclError aclrtMallocHost(void **hostPtr, size_t size); | |||||
* | * | ||||
* @par Function | * @par Function | ||||
* can only free memory allocated through the aclrtMallocHost interface | * can only free memory allocated through the aclrtMallocHost interface | ||||
* | |||||
* @param hostPtr [IN] free memory pointer | * @param hostPtr [IN] free memory pointer | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtMallocHost | * @see aclrtMallocHost | ||||
@@ -509,12 +688,13 @@ ACL_FUNC_VISIBILITY aclError aclrtFreeHost(void *hostPtr); | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief synchronous memory replication between host and device | * @brief synchronous memory replication between host and device | ||||
* | * | ||||
* @param dst [IN] destination address pointer | |||||
* @param dst [IN] destination address pointer | |||||
* @param destMax [IN] Max length of the destination address memory | * @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_ERROR_NONE The function is successfully executed. | |||||
* @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 | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, | ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, | ||||
@@ -531,11 +711,13 @@ ACL_FUNC_VISIBILITY aclError aclrtMemcpy(void *dst, | |||||
* The memory to be initialized is on the Host or device side, | * The memory to be initialized is on the Host or device side, | ||||
* and the system determines whether | * and the system determines whether | ||||
* it is host or device according to the address | * it is host or device according to the address | ||||
* | |||||
* @param devPtr [IN] Starting address of memory | * @param devPtr [IN] Starting address of memory | ||||
* @param maxCount [IN] Max length of destination address memory | * @param maxCount [IN] Max length of destination address memory | ||||
* @param value [IN] Set value | * @param value [IN] Set value | ||||
* @param count [IN] The length of memory | * @param count [IN] The length of memory | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count); | ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t value, size_t count); | ||||
@@ -552,13 +734,15 @@ ACL_FUNC_VISIBILITY aclError aclrtMemset(void *devPtr, size_t maxCount, int32_t | |||||
* @par Restriction | * @par Restriction | ||||
* @li For on-chip Device-to-Device memory copy, | * @li For on-chip Device-to-Device memory copy, | ||||
* both the source and destination addresses must be 64-byte aligned | * both the source and destination addresses must be 64-byte aligned | ||||
* | |||||
* @param dst [IN] destination address pointer | * @param dst [IN] destination address pointer | ||||
* @param destMax [IN] Max length of destination address memory | * @param destMax [IN] Max length of destination address memory | ||||
* @param src [IN] source address pointer | * @param src [IN] source address pointer | ||||
* @param count [IN] the number of byte to copy | * @param count [IN] the number of byte to copy | ||||
* @param kind [IN] memcpy type | * @param kind [IN] memcpy type | ||||
* @param stream [IN] asynchronized task stream | |||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* @param stream [IN] asynchronized task stream | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtSynchronizeStream | * @see aclrtSynchronizeStream | ||||
@@ -571,6 +755,54 @@ ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst, | |||||
aclrtStream stream); | aclrtStream stream); | ||||
/** | /** | ||||
* @ingroup AscendCL | |||||
* @brief synchronous memory replication of two-dimensional matrix between host and device | |||||
* | |||||
* @param dst [IN] destination address pointer | |||||
* @param dpitch [IN] pitch of destination memory | |||||
* @param src [IN] source address pointer | |||||
* @param spitch [IN] pitch of source memory | |||||
* @param width [IN] width of matrix transfer | |||||
* @param height [IN] height of matrix transfer | |||||
* @param kind [IN] memcpy type | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclrtMemcpy2d(void *dst, | |||||
size_t dpitch, | |||||
const void *src, | |||||
size_t spitch, | |||||
size_t width, | |||||
size_t height, | |||||
aclrtMemcpyKind kind); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief asynchronous memory replication of two-dimensional matrix between host and device | |||||
* | |||||
* @param dst [IN] destination address pointer | |||||
* @param dpitch [IN] pitch of destination memory | |||||
* @param src [IN] source address pointer | |||||
* @param spitch [IN] pitch of source memory | |||||
* @param width [IN] width of matrix transfer | |||||
* @param height [IN] height of matrix transfer | |||||
* @param kind [IN] memcpy type | |||||
* @param stream [IN] asynchronized task stream | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclrtMemcpy2dAsync(void *dst, | |||||
size_t dpitch, | |||||
const void *src, | |||||
size_t spitch, | |||||
size_t width, | |||||
size_t height, | |||||
aclrtMemcpyKind kind, | |||||
aclrtStream stream); | |||||
/** | |||||
* @ingroup AscendCL | * @ingroup AscendCL | ||||
* @brief Asynchronous initialize memory | * @brief Asynchronous initialize memory | ||||
* and set contents of memory to specified value async | * and set contents of memory to specified value async | ||||
@@ -579,12 +811,14 @@ ACL_FUNC_VISIBILITY aclError aclrtMemcpyAsync(void *dst, | |||||
* The memory to be initialized is on the Host or device side, | * The memory to be initialized is on the Host or device side, | ||||
* and the system determines whether | * and the system determines whether | ||||
* it is host or device according to the address | * it is host or device according to the address | ||||
* | |||||
* @param devPtr [IN] destination address pointer | * @param devPtr [IN] destination address pointer | ||||
* @param maxCount [IN] Max length of destination address memory | * @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_ERROR_NONE The function is successfully executed. | |||||
* @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 | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtSynchronizeStream | * @see aclrtSynchronizeStream | ||||
@@ -600,7 +834,8 @@ ACL_FUNC_VISIBILITY aclError aclrtMemsetAsync(void *devPtr, | |||||
* @brief create stream instance | * @brief create stream instance | ||||
* | * | ||||
* @param stream [OUT] the created stream | * @param stream [OUT] the created stream | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream); | ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream); | ||||
@@ -616,8 +851,10 @@ ACL_FUNC_VISIBILITY aclError aclrtCreateStream(aclrtStream *stream); | |||||
* Before calling the aclrtDestroyStream interface to destroy | * Before calling the aclrtDestroyStream interface to destroy | ||||
* the specified Stream, you need to call the aclrtSynchronizeStream interface | * the specified Stream, you need to call the aclrtSynchronizeStream interface | ||||
* to ensure that the tasks in the Stream have been completed. | * to ensure that the tasks in the Stream have been completed. | ||||
* | |||||
* @param stream [IN] the stream to destroy | * @param stream [IN] the stream to destroy | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
* | * | ||||
* @see aclrtCreateStream | aclrtSynchronizeStream | * @see aclrtCreateStream | aclrtSynchronizeStream | ||||
@@ -630,7 +867,8 @@ ACL_FUNC_VISIBILITY aclError aclrtDestroyStream(aclrtStream stream); | |||||
* in the specified stream have completed | * in the specified stream have completed | ||||
* | * | ||||
* @param stream [IN] the stream to wait | * @param stream [IN] the stream to wait | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream); | ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream); | ||||
@@ -643,11 +881,171 @@ ACL_FUNC_VISIBILITY aclError aclrtSynchronizeStream(aclrtStream stream); | |||||
* | * | ||||
* @param stream [IN] the wait stream If using thedefault Stream, set NULL | * @param stream [IN] the wait stream If using thedefault Stream, set NULL | ||||
* @param event [IN] the event to wait | * @param event [IN] the event to wait | ||||
* @retval ACL_ERROR_NONE The function is successfully executed. | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | * @retval OtherValues Failure | ||||
*/ | */ | ||||
ACL_FUNC_VISIBILITY aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event); | 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 groupIndex [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 groupIndex, | |||||
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); | |||||
/** | |||||
* @ingroup AscendCL | |||||
* @brief Set the timeout interval for waitting of op | |||||
* | |||||
* @param timeout [IN] op wait timeout | |||||
* | |||||
* @retval ACL_SUCCESS The function is successfully executed. | |||||
* @retval OtherValues Failure | |||||
*/ | |||||
ACL_FUNC_VISIBILITY aclError aclrtSetOpWaitTimeout(uint32_t timeout); | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } | ||||
#endif | #endif | ||||
@@ -0,0 +1,76 @@ | |||||
/** | |||||
* Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. | |||||
* | |||||
* 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_ | |||||
#if defined(_MSC_VER) | |||||
#ifdef FUNC_VISIBILITY | |||||
#define GE_FUNC_VISIBILITY _declspec(dllexport) | |||||
#else | |||||
#define GE_FUNC_VISIBILITY | |||||
#endif | |||||
#else | |||||
#ifdef FUNC_VISIBILITY | |||||
#define GE_FUNC_VISIBILITY __attribute__((visibility("default"))) | |||||
#else | |||||
#define GE_FUNC_VISIBILITY | |||||
#endif | |||||
#endif | |||||
#include <stddef.h> | |||||
#include <stdint.h> | |||||
#ifdef __cplusplus | |||||
extern "C" { | |||||
#endif | |||||
static const uint32_t ACL_ERROR_GE_PARAM_INVALID = 145000U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_NOT_INIT = 145001U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID = 145002U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ID_INVALID = 145003U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID = 145006U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID = 145007U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID = 145008U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED = 145009U; | |||||
static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID = 145011U; | |||||
static const uint32_t ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID = 145012U; | |||||
static const uint32_t ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID = 145013U; | |||||
static const uint32_t ACL_ERROR_GE_AIPP_BATCH_EMPTY = 145014U; | |||||
static const uint32_t ACL_ERROR_GE_AIPP_NOT_EXIST = 145015U; | |||||
static const uint32_t ACL_ERROR_GE_AIPP_MODE_INVALID = 145016U; | |||||
static const uint32_t ACL_ERROR_GE_OP_TASK_TYPE_INVALID = 145017U; | |||||
static const uint32_t ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID = 145018U; | |||||
static const uint32_t ACL_ERROR_GE_PLGMGR_PATH_INVALID = 145019U; | |||||
static const uint32_t ACL_ERROR_GE_FORMAT_INVALID = 145020U; | |||||
static const uint32_t ACL_ERROR_GE_SHAPE_INVALID = 145021U; | |||||
static const uint32_t ACL_ERROR_GE_DATATYPE_INVALID = 145022U; | |||||
static const uint32_t ACL_ERROR_GE_MEMORY_ALLOCATION = 245000U; | |||||
static const uint32_t ACL_ERROR_GE_MEMORY_OPERATE_FAILED = 245001U; | |||||
static const uint32_t ACL_ERROR_GE_INTERNAL_ERROR = 545000U; | |||||
static const uint32_t ACL_ERROR_GE_LOAD_MODEL = 545001U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED = 545002U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED = 545003U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED = 545004U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED = 545005U; | |||||
static const uint32_t ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA = 545006U; | |||||
static const uint32_t ACL_ERROR_GE_COMMAND_HANDLE = 545007U; | |||||
static const uint32_t ACL_ERROR_GE_GET_TENSOR_INFO = 545008U; | |||||
static const uint32_t ACL_ERROR_GE_UNLOAD_MODEL = 545009U; | |||||
#ifdef __cplusplus | |||||
} // namespace ge | |||||
#endif | |||||
#endif // INC_EXTERNAL_GE_GE_ERROR_CODES_H_ |
@@ -0,0 +1,112 @@ | |||||
/** | |||||
* @file rt_error_codes.h | |||||
* | |||||
* Copyright (C) Huawei Technologies Co., Ltd. 2019-2020. All Rights Reserved. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |||||
*/ | |||||
#ifndef __INC_EXTERNEL_RT_ERROR_CODES_H__ | |||||
#define __INC_EXTERNEL_RT_ERROR_CODES_H__ | |||||
#include <stddef.h> | |||||
#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_INVALID_HANDLE = 107017; // invalid handle | |||||
static const int32_t ACL_ERROR_RT_INVALID_MALLOC_TYPE = 107018; // invalid malloc type | |||||
static const int32_t ACL_ERROR_RT_WAIT_TIMEOUT = 107019; // wait timeout | |||||
static const int32_t ACL_ERROR_RT_TASK_TIMEOUT = 107020; // task timeout | |||||
static const int32_t ACL_ERROR_RT_FEATURE_NOT_SUPPORT = 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_AICORE_OVER_FLOW = 207003; // aicore over flow | |||||
static const int32_t ACL_ERROR_RT_NO_DEVICE = 207004; // no device | |||||
static const int32_t ACL_ERROR_RT_RESOURCE_ALLOC_FAIL = 207005; // resource alloc fail | |||||
static const int32_t ACL_ERROR_RT_NO_PERMISSION = 207006; // no permission | |||||
static const int32_t ACL_ERROR_RT_NO_EVENT_RESOURCE = 207007; // no event resource | |||||
static const int32_t ACL_ERROR_RT_NO_STREAM_RESOURCE = 207008; // no stream resource | |||||
static const int32_t ACL_ERROR_RT_NO_NOTIFY_RESOURCE = 207009; // no notify resource | |||||
static const int32_t ACL_ERROR_RT_NO_MODEL_RESOURCE = 207010; // no model resource | |||||
static const int32_t ACL_ERROR_RT_NO_CDQ_RESOURCE = 207011; // no cdq resource | |||||
static const int32_t ACL_ERROR_RT_OVER_LIMIT = 207012; // over limit | |||||
static const int32_t ACL_ERROR_RT_QUEUE_EMPTY = 207013; // queue is empty | |||||
static const int32_t ACL_ERROR_RT_QUEUE_FULL = 207014; // queue is full | |||||
static const int32_t ACL_ERROR_RT_REPEATED_INIT = 207015; // repeated init | |||||
static const int32_t ACL_ERROR_RT_AIVEC_OVER_FLOW = 207016; // aivec over flow | |||||
static const int32_t ACL_ERROR_RT_INTERNAL_ERROR = 507000; // runtime internal 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_VECTOR_CORE_TIMEOUT = 507034; // vector core timeout | |||||
static const int32_t ACL_ERROR_RT_VECTOR_CORE_EXCEPTION = 507035; // vector core exception | |||||
static const int32_t ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION = 507036; // vector core trap exception | |||||
static const int32_t ACL_ERROR_RT_CDQ_BATCH_ABNORMAL = 507037; // cdq alloc batch abnormal | |||||
static const int32_t ACL_ERROR_RT_DIE_MODE_CHANGE_ERROR = 507038; // can not change die mode | |||||
static const int32_t ACL_ERROR_RT_DIE_SET_ERROR = 507039; // single die mode can not set die | |||||
static const int32_t ACL_ERROR_RT_INVALID_DIEID = 507040; // invalid die id | |||||
static const int32_t ACL_ERROR_RT_DIE_MODE_NOT_SET = 507041; // die mode not set | |||||
static const int32_t ACL_ERROR_RT_DRV_INTERNAL_ERROR = 507899; // drv internal error | |||||
static const int32_t ACL_ERROR_RT_AICPU_INTERNAL_ERROR = 507900; // aicpu internal error | |||||
static const int32_t ACL_ERROR_RT_SOCKET_CLOSE = 507901; // hdc disconnect | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif // __INC_EXTERNEL_RT_ERROR_CODES_H__ |
@@ -118,9 +118,25 @@ aclmdlAIPP* on_init_failed(int func_idx) { | |||||
log_failed_load(func_idx); | log_failed_load(func_idx); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
template <> | |||||
aclmdlConfigHandle* on_init_failed(int func_idx) { | |||||
log_failed_load(func_idx); | |||||
return nullptr; | |||||
} | |||||
template <> | |||||
tagRtGroupInfo* on_init_failed(int func_idx) { | |||||
log_failed_load(func_idx); | |||||
return nullptr; | |||||
} | |||||
} // namespace | } // namespace | ||||
//! atlas310 | |||||
#if !defined(ACL_MAJOR_VERSION) | |||||
#include "./libatlas-wrap.h" | #include "./libatlas-wrap.h" | ||||
//! atlas710 | |||||
#elif (ACL_MAJOR_VERSION == 1 && ACL_MINOR_VERSION == 1 && ACL_PATCH_VERSION == 0) | |||||
#include "./libatlas-wrap_1.1.0.h" | |||||
#endif | |||||
static const char* default_so_paths[] = { | static const char* default_so_paths[] = { | ||||
"/usr/local/Ascend/acllib/lib64/libascendcl.so", | "/usr/local/Ascend/acllib/lib64/libascendcl.so", | ||||
@@ -153,8 +169,5 @@ static void* resolve_library_func(void* handle, const char* func) { | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
auto ret = dlsym(handle, func); | auto ret = dlsym(handle, func); | ||||
if (!ret) { | |||||
LOGE("failed to load atlas func: %s", func); | |||||
} | |||||
return ret; | return ret; | ||||
} | } |
@@ -53,7 +53,6 @@ const char* megcore::atlas::get_error_str(aclError error) { | |||||
switch (error) { | switch (error) { | ||||
ERROR(ACL_ERROR_NONE); | ERROR(ACL_ERROR_NONE); | ||||
ERROR(ACL_ERROR_INVALID_PARAM); | ERROR(ACL_ERROR_INVALID_PARAM); | ||||
ERROR(ACL_ERROR_UNINITIALIZE); | ERROR(ACL_ERROR_UNINITIALIZE); | ||||
ERROR(ACL_ERROR_REPEAT_INITIALIZE); | ERROR(ACL_ERROR_REPEAT_INITIALIZE); | ||||
@@ -93,7 +92,19 @@ const char* megcore::atlas::get_error_str(aclError error) { | |||||
ERROR(ACL_ERROR_WAIT_CALLBACK_TIMEOUT); | ERROR(ACL_ERROR_WAIT_CALLBACK_TIMEOUT); | ||||
ERROR(ACL_ERROR_REPEAT_FINALIZE); | ERROR(ACL_ERROR_REPEAT_FINALIZE); | ||||
ERROR(ACL_ERROR_NOT_STATIC_AIPP); | ERROR(ACL_ERROR_NOT_STATIC_AIPP); | ||||
ERROR(ACL_ERROR_COMPILING_STUB_MODE); | |||||
ERROR(ACL_ERROR_GROUP_NOT_SET); | |||||
ERROR(ACL_ERROR_GROUP_NOT_CREATE); | |||||
ERROR(ACL_ERROR_PROF_ALREADY_RUN); | |||||
ERROR(ACL_ERROR_PROF_NOT_RUN); | |||||
ERROR(ACL_ERROR_DUMP_ALREADY_RUN); | |||||
ERROR(ACL_ERROR_DUMP_NOT_RUN); | |||||
ERROR(ACL_ERROR_PROF_REPEAT_SUBSCRIBE); | |||||
ERROR(ACL_ERROR_PROF_API_CONFLICT); | |||||
ERROR(ACL_ERROR_INVALID_MAX_OPQUEUE_NUM_CONFIG); | |||||
ERROR(ACL_ERROR_INVALID_OPP_PATH); | |||||
ERROR(ACL_ERROR_OP_UNSUPPORTED_DYNAMIC); | |||||
ERROR(ACL_ERROR_RELATIVE_RESOURCE_NOT_CLEARED); | |||||
ERROR(ACL_ERROR_BAD_ALLOC); | ERROR(ACL_ERROR_BAD_ALLOC); | ||||
ERROR(ACL_ERROR_API_NOT_SUPPORT); | ERROR(ACL_ERROR_API_NOT_SUPPORT); | ||||
ERROR(ACL_ERROR_INVALID_DEVICE); | ERROR(ACL_ERROR_INVALID_DEVICE); | ||||
@@ -101,9 +112,8 @@ const char* megcore::atlas::get_error_str(aclError error) { | |||||
ERROR(ACL_ERROR_RESOURCE_NOT_MATCH); | ERROR(ACL_ERROR_RESOURCE_NOT_MATCH); | ||||
ERROR(ACL_ERROR_INVALID_RESOURCE_HANDLE); | ERROR(ACL_ERROR_INVALID_RESOURCE_HANDLE); | ||||
ERROR(ACL_ERROR_FEATURE_UNSUPPORTED); | ERROR(ACL_ERROR_FEATURE_UNSUPPORTED); | ||||
ERROR(ACL_ERROR_PROF_MODULES_UNSUPPORTED); | |||||
ERROR(ACL_ERROR_STORAGE_OVER_LIMIT); | ERROR(ACL_ERROR_STORAGE_OVER_LIMIT); | ||||
ERROR(ACL_ERROR_INTERNAL_ERROR); | ERROR(ACL_ERROR_INTERNAL_ERROR); | ||||
ERROR(ACL_ERROR_FAILURE); | ERROR(ACL_ERROR_FAILURE); | ||||
ERROR(ACL_ERROR_GE_FAILURE); | ERROR(ACL_ERROR_GE_FAILURE); | ||||
@@ -111,6 +121,123 @@ const char* megcore::atlas::get_error_str(aclError error) { | |||||
ERROR(ACL_ERROR_DRV_FAILURE); | ERROR(ACL_ERROR_DRV_FAILURE); | ||||
ERROR(ACL_ERROR_PROFILING_FAILURE); | ERROR(ACL_ERROR_PROFILING_FAILURE); | ||||
ERROR(ACL_ERROR_GE_PARAM_INVALID); | |||||
ERROR(ACL_ERROR_GE_EXEC_NOT_INIT); | |||||
ERROR(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID); | |||||
ERROR(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID); | |||||
ERROR(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID); | |||||
ERROR(ACL_ERROR_GE_EXEC_MODEL_ADDR_INVALID); | |||||
ERROR(ACL_ERROR_GE_EXEC_MODEL_QUEUE_ID_INVALID); | |||||
ERROR(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED); | |||||
ERROR(ACL_ERROR_GE_DYNAMIC_INPUT_ADDR_INVALID); | |||||
ERROR(ACL_ERROR_GE_DYNAMIC_INPUT_LENGTH_INVALID); | |||||
ERROR(ACL_ERROR_GE_DYNAMIC_BATCH_SIZE_INVALID); | |||||
ERROR(ACL_ERROR_GE_AIPP_BATCH_EMPTY); | |||||
ERROR(ACL_ERROR_GE_AIPP_NOT_EXIST); | |||||
ERROR(ACL_ERROR_GE_AIPP_MODE_INVALID); | |||||
ERROR(ACL_ERROR_GE_OP_TASK_TYPE_INVALID); | |||||
ERROR(ACL_ERROR_GE_OP_KERNEL_TYPE_INVALID); | |||||
ERROR(ACL_ERROR_GE_PLGMGR_PATH_INVALID); | |||||
ERROR(ACL_ERROR_GE_FORMAT_INVALID); | |||||
ERROR(ACL_ERROR_GE_SHAPE_INVALID); | |||||
ERROR(ACL_ERROR_GE_DATATYPE_INVALID); | |||||
ERROR(ACL_ERROR_GE_MEMORY_ALLOCATION); | |||||
ERROR(ACL_ERROR_GE_MEMORY_OPERATE_FAILED); | |||||
ERROR(ACL_ERROR_GE_INTERNAL_ERROR); | |||||
ERROR(ACL_ERROR_GE_LOAD_MODEL); | |||||
ERROR(ACL_ERROR_GE_EXEC_LOAD_MODEL_PARTITION_FAILED); | |||||
ERROR(ACL_ERROR_GE_EXEC_LOAD_WEIGHT_PARTITION_FAILED); | |||||
ERROR(ACL_ERROR_GE_EXEC_LOAD_TASK_PARTITION_FAILED); | |||||
ERROR(ACL_ERROR_GE_EXEC_LOAD_KERNEL_PARTITION_FAILED); | |||||
ERROR(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA); | |||||
ERROR(ACL_ERROR_GE_COMMAND_HANDLE); | |||||
ERROR(ACL_ERROR_GE_GET_TENSOR_INFO); | |||||
ERROR(ACL_ERROR_GE_UNLOAD_MODEL); | |||||
ERROR(ACL_ERROR_RT_PARAM_INVALID); | |||||
ERROR(ACL_ERROR_RT_INVALID_DEVICEID); | |||||
ERROR(ACL_ERROR_RT_CONTEXT_NULL); | |||||
ERROR(ACL_ERROR_RT_STREAM_CONTEXT); | |||||
ERROR(ACL_ERROR_RT_MODEL_CONTEXT); | |||||
ERROR(ACL_ERROR_RT_STREAM_MODEL); | |||||
ERROR(ACL_ERROR_RT_EVENT_TIMESTAMP_INVALID); | |||||
ERROR(ACL_ERROR_RT_EVENT_TIMESTAMP_REVERSAL); | |||||
ERROR(ACL_ERROR_RT_ADDR_UNALIGNED); | |||||
ERROR(ACL_ERROR_RT_FILE_OPEN); | |||||
ERROR(ACL_ERROR_RT_FILE_WRITE); | |||||
ERROR(ACL_ERROR_RT_STREAM_SUBSCRIBE); | |||||
ERROR(ACL_ERROR_RT_THREAD_SUBSCRIBE); | |||||
ERROR(ACL_ERROR_RT_GROUP_NOT_SET); | |||||
ERROR(ACL_ERROR_RT_GROUP_NOT_CREATE); | |||||
ERROR(ACL_ERROR_RT_STREAM_NO_CB_REG); | |||||
ERROR(ACL_ERROR_RT_INVALID_MEMORY_TYPE); | |||||
ERROR(ACL_ERROR_RT_INVALID_HANDLE); | |||||
ERROR(ACL_ERROR_RT_INVALID_MALLOC_TYPE); | |||||
ERROR(ACL_ERROR_RT_WAIT_TIMEOUT); | |||||
ERROR(ACL_ERROR_RT_TASK_TIMEOUT); | |||||
ERROR(ACL_ERROR_RT_FEATURE_NOT_SUPPORT); | |||||
ERROR(ACL_ERROR_RT_MEMORY_ALLOCATION); | |||||
ERROR(ACL_ERROR_RT_MEMORY_FREE); | |||||
ERROR(ACL_ERROR_RT_AICORE_OVER_FLOW); | |||||
ERROR(ACL_ERROR_RT_NO_DEVICE); | |||||
ERROR(ACL_ERROR_RT_RESOURCE_ALLOC_FAIL); | |||||
ERROR(ACL_ERROR_RT_NO_PERMISSION); | |||||
ERROR(ACL_ERROR_RT_NO_EVENT_RESOURCE); | |||||
ERROR(ACL_ERROR_RT_NO_STREAM_RESOURCE); | |||||
ERROR(ACL_ERROR_RT_NO_NOTIFY_RESOURCE); | |||||
ERROR(ACL_ERROR_RT_NO_MODEL_RESOURCE); | |||||
ERROR(ACL_ERROR_RT_NO_CDQ_RESOURCE); | |||||
ERROR(ACL_ERROR_RT_OVER_LIMIT); | |||||
ERROR(ACL_ERROR_RT_QUEUE_EMPTY); | |||||
ERROR(ACL_ERROR_RT_QUEUE_FULL); | |||||
ERROR(ACL_ERROR_RT_REPEATED_INIT); | |||||
ERROR(ACL_ERROR_RT_AIVEC_OVER_FLOW); | |||||
ERROR(ACL_ERROR_RT_INTERNAL_ERROR); | |||||
ERROR(ACL_ERROR_RT_TS_ERROR); | |||||
ERROR(ACL_ERROR_RT_STREAM_TASK_FULL); | |||||
ERROR(ACL_ERROR_RT_STREAM_TASK_EMPTY); | |||||
ERROR(ACL_ERROR_RT_STREAM_NOT_COMPLETE); | |||||
ERROR(ACL_ERROR_RT_END_OF_SEQUENCE); | |||||
ERROR(ACL_ERROR_RT_EVENT_NOT_COMPLETE); | |||||
ERROR(ACL_ERROR_RT_CONTEXT_RELEASE_ERROR); | |||||
ERROR(ACL_ERROR_RT_SOC_VERSION); | |||||
ERROR(ACL_ERROR_RT_TASK_TYPE_NOT_SUPPORT); | |||||
ERROR(ACL_ERROR_RT_LOST_HEARTBEAT); | |||||
ERROR(ACL_ERROR_RT_MODEL_EXECUTE); | |||||
ERROR(ACL_ERROR_RT_REPORT_TIMEOUT); | |||||
ERROR(ACL_ERROR_RT_SYS_DMA); | |||||
ERROR(ACL_ERROR_RT_AICORE_TIMEOUT); | |||||
ERROR(ACL_ERROR_RT_AICORE_EXCEPTION); | |||||
ERROR(ACL_ERROR_RT_AICORE_TRAP_EXCEPTION); | |||||
ERROR(ACL_ERROR_RT_AICPU_TIMEOUT); | |||||
ERROR(ACL_ERROR_RT_AICPU_EXCEPTION); | |||||
ERROR(ACL_ERROR_RT_AICPU_DATADUMP_RSP_ERR); | |||||
ERROR(ACL_ERROR_RT_AICPU_MODEL_RSP_ERR); | |||||
ERROR(ACL_ERROR_RT_PROFILING_ERROR); | |||||
ERROR(ACL_ERROR_RT_IPC_ERROR); | |||||
ERROR(ACL_ERROR_RT_MODEL_ABORT_NORMAL); | |||||
ERROR(ACL_ERROR_RT_KERNEL_UNREGISTERING); | |||||
ERROR(ACL_ERROR_RT_RINGBUFFER_NOT_INIT); | |||||
ERROR(ACL_ERROR_RT_RINGBUFFER_NO_DATA); | |||||
ERROR(ACL_ERROR_RT_KERNEL_LOOKUP); | |||||
ERROR(ACL_ERROR_RT_KERNEL_DUPLICATE); | |||||
ERROR(ACL_ERROR_RT_DEBUG_REGISTER_FAIL); | |||||
ERROR(ACL_ERROR_RT_DEBUG_UNREGISTER_FAIL); | |||||
ERROR(ACL_ERROR_RT_LABEL_CONTEXT); | |||||
ERROR(ACL_ERROR_RT_PROGRAM_USE_OUT); | |||||
ERROR(ACL_ERROR_RT_DEV_SETUP_ERROR); | |||||
ERROR(ACL_ERROR_RT_VECTOR_CORE_TIMEOUT); | |||||
ERROR(ACL_ERROR_RT_VECTOR_CORE_EXCEPTION); | |||||
ERROR(ACL_ERROR_RT_VECTOR_CORE_TRAP_EXCEPTION); | |||||
ERROR(ACL_ERROR_RT_CDQ_BATCH_ABNORMAL); | |||||
ERROR(ACL_ERROR_RT_DIE_MODE_CHANGE_ERROR); | |||||
ERROR(ACL_ERROR_RT_DIE_SET_ERROR); | |||||
ERROR(ACL_ERROR_RT_INVALID_DIEID); | |||||
ERROR(ACL_ERROR_RT_DIE_MODE_NOT_SET); | |||||
ERROR(ACL_ERROR_RT_DRV_INTERNAL_ERROR); | |||||
ERROR(ACL_ERROR_RT_AICPU_INTERNAL_ERROR); | |||||
ERROR(ACL_ERROR_RT_SOCKET_CLOSE); | |||||
default: | default: | ||||
return "unknown error"; | return "unknown error"; | ||||
} | } | ||||
@@ -30,13 +30,23 @@ VarNodeArray TraceResult::dump( | |||||
std::vector<std::pair<size_t, std::string>> outputs, bool prefer_input_names) { | std::vector<std::pair<size_t, std::string>> outputs, bool prefer_input_names) { | ||||
// var -> VarNode | // var -> VarNode | ||||
std::vector<VarNode*> nodes(vars.size(), nullptr); | std::vector<VarNode*> nodes(vars.size(), nullptr); | ||||
auto get_compnode = [](const VarInfo& info) -> CompNode { | |||||
auto& orig_cn = *(info.device); | |||||
std::string device_name_prefix = | |||||
orig_cn.locator_logical().to_string().substr(0, 3); | |||||
if (device_name_prefix == "cpu" || device_name_prefix == "gpu" || | |||||
device_name_prefix == "xpu") { | |||||
return CompNode::load("xpux"); | |||||
} | |||||
return orig_cn; | |||||
}; | |||||
// make h2d node for each input | // make h2d node for each input | ||||
for (auto&& [input, name, shape] : inputs) { | for (auto&& [input, name, shape] : inputs) { | ||||
auto& var = vars[input]; | auto& var = vars[input]; | ||||
auto& node = nodes[input]; | auto& node = nodes[input]; | ||||
// TODO: cambricon CompNode | |||||
auto host = std::make_shared<HostTensorND>( | |||||
CompNode::load("xpux"), shape, *var.dtype); | |||||
auto host = | |||||
std::make_shared<HostTensorND>(get_compnode(var), shape, *var.dtype); | |||||
OperatorNodeConfig config; | OperatorNodeConfig config; | ||||
// if prefer_input_names, prefer names from dump args | // if prefer_input_names, prefer names from dump args | ||||
// else prefer names got from trace procedure | // else prefer names got from trace procedure | ||||
@@ -390,7 +390,8 @@ public: | |||||
init(); | init(); | ||||
int32_t device_id = -1; | int32_t device_id = -1; | ||||
auto err = aclrtGetDevice(&device_id); | auto err = aclrtGetDevice(&device_id); | ||||
if (err == ACL_ERROR_INVALID_DEVICE || device != device_id) { | |||||
if (err == ACL_ERROR_INVALID_DEVICE || err == ACL_ERROR_RT_CONTEXT_NULL || | |||||
device != device_id) { | |||||
MGB_ATLAS_CHECK(aclrtSetDevice(device)); | MGB_ATLAS_CHECK(aclrtSetDevice(device)); | ||||
} else { | } else { | ||||
MGB_ATLAS_CHECK(err); | MGB_ATLAS_CHECK(err); | ||||
@@ -191,7 +191,9 @@ AtlasRuntimeOpr::AtlasRuntimeOpr( | |||||
MegBrainError, | MegBrainError, | ||||
"Unsupported aclAippInputFormat for input %zu. ", i); | "Unsupported aclAippInputFormat for input %zu. ", i); | ||||
} | } | ||||
} else if (ACL_ERROR_NOT_STATIC_AIPP == acl_err) { | |||||
} else if ( | |||||
ACL_ERROR_NOT_STATIC_AIPP == acl_err || | |||||
ACL_ERROR_GE_AIPP_NOT_EXIST == acl_err) { | |||||
m_aipp_input_format[i] = AippInputFormat::NO_AIPP; | m_aipp_input_format[i] = AippInputFormat::NO_AIPP; | ||||
} else { | } else { | ||||
MGB_ATLAS_CHECK(acl_err); | MGB_ATLAS_CHECK(acl_err); | ||||