已合并
[2.10.0][refactor]CANN ACL headers decouple #36214
Dring创建于 5月20日
[2.10.0][refactor]CANN ACL headers decouple #36214
已合并
共 28 个文件变更+85-8058
| @@ -25,3 +25,12 @@ | |||
| 25 | path = third_party/dvm/dvm | 25 | path = third_party/dvm/dvm |
| 26 | url = https://gitcode.com/mindspore/dvm.git | 26 | url = https://gitcode.com/mindspore/dvm.git |
| 27 | branch = r2.10 | 27 | branch = r2.10 |
| 28 | +[submodule "third_party/acl_src/runtime"] | ||
| 29 | + path = third_party/acl_src/runtime | ||
| 30 | + url = https://gitcode.com/cann/runtime.git | ||
| 31 | +[submodule "third_party/acl_src/ge"] | ||
| 32 | + path = third_party/acl_src/ge | ||
| 33 | + url = https://gitcode.com/cann/ge.git | ||
| 34 | +[submodule "third_party/acl_src/graph-autofusion"] | ||
| 35 | + path = third_party/acl_src/graph-autofusion | ||
| 36 | + url = https://gitcode.com/cann/graph-autofusion.git | ||
| @@ -13,6 +13,38 @@ IFS='.' read -ra version_parts <<< "$pytorch_version" | |||
| 13 | 13 | ||
| 14 | pytorch_dir="v${version_parts[0]}r${version_parts[1]}" | 14 | pytorch_dir="v${version_parts[0]}r${version_parts[1]}" |
| 15 | 15 | ||
| 16 | +# Fetch ACL headers from submodule paths | ||
| 17 | +ACL_DEST="$CDIR/third_party/acl/inc/acl" | ||
| 18 | +echo " --- Fetching ACL headers from submodules..." | ||
| 19 | + | ||
| 20 | +ACL_SRC="$CDIR/third_party/acl_src" | ||
| 21 | + | ||
| 22 | +# Copy runtime headers (lower priority, copied first) | ||
| 23 | +if [ -d "$ACL_SRC/runtime/include/external/acl" ]; then | ||
| 24 | + mkdir -p "$ACL_DEST" | ||
| 25 | + cp -r "$ACL_SRC/runtime/include/external/acl/"* "$ACL_DEST/" | ||
| 26 | + echo " --- Copied runtime acl headers" | ||
| 27 | +fi | ||
| 28 | + | ||
| 29 | +# Copy ge headers (higher priority, overwrites runtime) | ||
| 30 | +if [ -d "$ACL_SRC/ge/inc/external/acl" ]; then | ||
| 31 | + mkdir -p "$ACL_DEST" | ||
| 32 | + cp -r "$ACL_SRC/ge/inc/external/acl/"* "$ACL_DEST/" | ||
| 33 | + echo " --- Copied ge acl headers" | ||
| 34 | +fi | ||
| 35 | + | ||
| 36 | +# Copy super_kernel.h from graph-autofusion | ||
| 37 | +SUPER_KERNEL_SRC="$ACL_SRC/graph-autofusion/super_kernel/include/super_kernel/super_kernel.h" | ||
| 38 | +if [ -f "$SUPER_KERNEL_SRC" ]; then | ||
| 39 | + cp "$SUPER_KERNEL_SRC" "$ACL_DEST/super_kernel.h" | ||
| 40 | + echo " --- Copied super_kernel.h" | ||
| 41 | +fi | ||
| 42 | + | ||
| 43 | +# Clean up submodule working directories | ||
| 44 | +rm -rf "$ACL_SRC" | ||
| 45 | +echo " --- Cleaned up acl_src submodule directories" | ||
| 46 | +echo " --- ACL headers fetched successfully" | ||
| 47 | + | ||
| 16 | file=$CDIR/third_party/op-plugin/gencode.sh | 48 | file=$CDIR/third_party/op-plugin/gencode.sh |
| 17 | 49 | ||
| 18 | if [ -f "${file}" ]; then | 50 | if [ -f "${file}" ]; then |
Dthird_party/acl/inc/acl/acl.h+0-18
| @@ -1,18 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
Dthird_party/acl/inc/acl/acl_base.h+0-747
| @@ -1,747 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_base.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | -extern "C" { | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | -typedef void *aclrtStream; | ||
| 49 | -typedef void *aclrtEvent; | ||
| 50 | -typedef void *aclrtContext; | ||
| 51 | -typedef void *aclrtNotify; | ||
| 52 | -typedef void *aclrtLabel; | ||
| 53 | -typedef void *aclrtLabelList; | ||
| 54 | -typedef void *aclrtMbuf; | ||
| 55 | -typedef int aclError; | ||
| 56 | -typedef uint16_t aclFloat16; | ||
| 57 | -typedef struct aclDataBuffer aclDataBuffer; | ||
| 58 | -typedef struct aclTensorDesc aclTensorDesc; | ||
| 59 | -typedef void *aclrtAllocatorDesc; | ||
| 60 | -typedef void *aclrtAllocator; | ||
| 61 | -typedef void *aclrtAllocatorBlock; | ||
| 62 | -typedef void *aclrtAllocatorAddr; | ||
| 63 | -typedef void *aclrtTaskGrp; | ||
| 64 | - | ||
| 65 | -static const int ACL_ERROR_NONE = 0; | ||
| 66 | -static const int ACL_SUCCESS = 0; | ||
| 67 | - | ||
| 68 | -static const int ACL_ERROR_INVALID_PARAM = 100000; | ||
| 69 | -static const int ACL_ERROR_UNINITIALIZE = 100001; | ||
| 70 | -static const int ACL_ERROR_REPEAT_INITIALIZE = 100002; | ||
| 71 | -static const int ACL_ERROR_INVALID_FILE = 100003; | ||
| 72 | -static const int ACL_ERROR_WRITE_FILE = 100004; | ||
| 73 | -static const int ACL_ERROR_INVALID_FILE_SIZE = 100005; | ||
| 74 | -static const int ACL_ERROR_PARSE_FILE = 100006; | ||
| 75 | -static const int ACL_ERROR_FILE_MISSING_ATTR = 100007; | ||
| 76 | -static const int ACL_ERROR_FILE_ATTR_INVALID = 100008; | ||
| 77 | -static const int ACL_ERROR_INVALID_DUMP_CONFIG = 100009; | ||
| 78 | -static const int ACL_ERROR_INVALID_PROFILING_CONFIG = 100010; | ||
| 79 | -static const int ACL_ERROR_INVALID_MODEL_ID = 100011; | ||
| 80 | -static const int ACL_ERROR_DESERIALIZE_MODEL = 100012; | ||
| 81 | -static const int ACL_ERROR_PARSE_MODEL = 100013; | ||
| 82 | -static const int ACL_ERROR_READ_MODEL_FAILURE = 100014; | ||
| 83 | -static const int ACL_ERROR_MODEL_SIZE_INVALID = 100015; | ||
| 84 | -static const int ACL_ERROR_MODEL_MISSING_ATTR = 100016; | ||
| 85 | -static const int ACL_ERROR_MODEL_INPUT_NOT_MATCH = 100017; | ||
| 86 | -static const int ACL_ERROR_MODEL_OUTPUT_NOT_MATCH = 100018; | ||
| 87 | -static const int ACL_ERROR_MODEL_NOT_DYNAMIC = 100019; | ||
| 88 | -static const int ACL_ERROR_OP_TYPE_NOT_MATCH = 100020; | ||
| 89 | -static const int ACL_ERROR_OP_INPUT_NOT_MATCH = 100021; | ||
| 90 | -static const int ACL_ERROR_OP_OUTPUT_NOT_MATCH = 100022; | ||
| 91 | -static const int ACL_ERROR_OP_ATTR_NOT_MATCH = 100023; | ||
| 92 | -static const int ACL_ERROR_OP_NOT_FOUND = 100024; | ||
| 93 | -static const int ACL_ERROR_OP_LOAD_FAILED = 100025; | ||
| 94 | -static const int ACL_ERROR_UNSUPPORTED_DATA_TYPE = 100026; | ||
| 95 | -static const int ACL_ERROR_FORMAT_NOT_MATCH = 100027; | ||
| 96 | -static const int ACL_ERROR_BIN_SELECTOR_NOT_REGISTERED = 100028; | ||
| 97 | -static const int ACL_ERROR_KERNEL_NOT_FOUND = 100029; | ||
| 98 | -static const int ACL_ERROR_BIN_SELECTOR_ALREADY_REGISTERED = 100030; | ||
| 99 | -static const int ACL_ERROR_KERNEL_ALREADY_REGISTERED = 100031; | ||
| 100 | -static const int ACL_ERROR_INVALID_QUEUE_ID = 100032; | ||
| 101 | -static const int ACL_ERROR_REPEAT_SUBSCRIBE = 100033; | ||
| 102 | -static const int ACL_ERROR_STREAM_NOT_SUBSCRIBE = 100034; | ||
| 103 | -static const int ACL_ERROR_THREAD_NOT_SUBSCRIBE = 100035; | ||
| 104 | -static const int ACL_ERROR_WAIT_CALLBACK_TIMEOUT = 100036; | ||
| 105 | -static const int ACL_ERROR_REPEAT_FINALIZE = 100037; | ||
| 106 | -static const int ACL_ERROR_NOT_STATIC_AIPP = 100038; | ||
| 107 | -static const int ACL_ERROR_COMPILING_STUB_MODE = 100039; | ||
| 108 | -static const int ACL_ERROR_GROUP_NOT_SET = 100040; | ||
| 109 | -static const int ACL_ERROR_GROUP_NOT_CREATE = 100041; | ||
| 110 | -static const int ACL_ERROR_PROF_ALREADY_RUN = 100042; | ||
| 111 | -static const int ACL_ERROR_PROF_NOT_RUN = 100043; | ||
| 112 | -static const int ACL_ERROR_DUMP_ALREADY_RUN = 100044; | ||
| 113 | -static const int ACL_ERROR_DUMP_NOT_RUN = 100045; | ||
| 114 | -static const int ACL_ERROR_PROF_REPEAT_SUBSCRIBE = 148046; | ||
| 115 | -static const int ACL_ERROR_PROF_API_CONFLICT = 148047; | ||
| 116 | -static const int ACL_ERROR_INVALID_MAX_OPQUEUE_NUM_CONFIG = 148048; | ||
| 117 | -static const int ACL_ERROR_INVALID_OPP_PATH = 148049; | ||
| 118 | -static const int ACL_ERROR_OP_UNSUPPORTED_DYNAMIC = 148050; | ||
| 119 | -static const int ACL_ERROR_RELATIVE_RESOURCE_NOT_CLEARED = 148051; | ||
| 120 | -static const int ACL_ERROR_UNSUPPORTED_JPEG = 148052; | ||
| 121 | -static const int ACL_ERROR_INVALID_BUNDLE_MODEL_ID = 148053; | ||
| 122 | - | ||
| 123 | -static const int ACL_ERROR_BAD_ALLOC = 200000; | ||
| 124 | -static const int ACL_ERROR_API_NOT_SUPPORT = 200001; | ||
| 125 | -static const int ACL_ERROR_INVALID_DEVICE = 200002; | ||
| 126 | -static const int ACL_ERROR_MEMORY_ADDRESS_UNALIGNED = 200003; | ||
| 127 | -static const int ACL_ERROR_RESOURCE_NOT_MATCH = 200004; | ||
| 128 | -static const int ACL_ERROR_INVALID_RESOURCE_HANDLE = 200005; | ||
| 129 | -static const int ACL_ERROR_FEATURE_UNSUPPORTED = 200006; | ||
| 130 | -static const int ACL_ERROR_PROF_MODULES_UNSUPPORTED = 200007; | ||
| 131 | - | ||
| 132 | -static const int ACL_ERROR_STORAGE_OVER_LIMIT = 300000; | ||
| 133 | - | ||
| 134 | -static const int ACL_ERROR_INTERNAL_ERROR = 500000; | ||
| 135 | -static const int ACL_ERROR_FAILURE = 500001; | ||
| 136 | -static const int ACL_ERROR_GE_FAILURE = 500002; | ||
| 137 | -static const int ACL_ERROR_RT_FAILURE = 500003; | ||
| 138 | -static const int ACL_ERROR_DRV_FAILURE = 500004; | ||
| 139 | -static const int ACL_ERROR_PROFILING_FAILURE = 500005; | ||
| 140 | - | ||
| 141 | - | ||
| 142 | - | ||
| 143 | - | ||
| 144 | - | ||
| 145 | -typedef enum { | ||
| 146 | - ACL_DT_UNDEFINED = -1, | ||
| 147 | - ACL_FLOAT = 0, | ||
| 148 | - ACL_FLOAT16 = 1, | ||
| 149 | - ACL_INT8 = 2, | ||
| 150 | - ACL_INT32 = 3, | ||
| 151 | - ACL_UINT8 = 4, | ||
| 152 | - ACL_INT16 = 6, | ||
| 153 | - ACL_UINT16 = 7, | ||
| 154 | - ACL_UINT32 = 8, | ||
| 155 | - ACL_INT64 = 9, | ||
| 156 | - ACL_UINT64 = 10, | ||
| 157 | - ACL_DOUBLE = 11, | ||
| 158 | - ACL_BOOL = 12, | ||
| 159 | - ACL_STRING = 13, | ||
| 160 | - ACL_COMPLEX64 = 16, | ||
| 161 | - ACL_COMPLEX128 = 17, | ||
| 162 | - ACL_BF16 = 27, | ||
| 163 | - ACL_INT4 = 29, | ||
| 164 | - ACL_UINT1 = 30, | ||
| 165 | - ACL_COMPLEX32 = 33, | ||
| 166 | - ACL_HIFLOAT8 = 34, | ||
| 167 | - ACL_FLOAT8_E5M2 = 35, | ||
| 168 | - ACL_FLOAT8_E4M3FN = 36, | ||
| 169 | - ACL_FLOAT8_E8M0 = 37, | ||
| 170 | - ACL_FLOAT6_E3M2 = 38, | ||
| 171 | - ACL_FLOAT6_E2M3 = 39, | ||
| 172 | - ACL_FLOAT4_E2M1 = 40, | ||
| 173 | - ACL_FLOAT4_E1M2 = 41, | ||
| 174 | -} aclDataType; | ||
| 175 | - | ||
| 176 | -typedef enum { | ||
| 177 | - ACL_FORMAT_UNDEFINED = -1, | ||
| 178 | - ACL_FORMAT_NCHW = 0, | ||
| 179 | - ACL_FORMAT_NHWC = 1, | ||
| 180 | - ACL_FORMAT_ND = 2, | ||
| 181 | - ACL_FORMAT_NC1HWC0 = 3, | ||
| 182 | - ACL_FORMAT_FRACTAL_Z = 4, | ||
| 183 | - ACL_FORMAT_NC1HWC0_C04 = 12, | ||
| 184 | - ACL_FORMAT_HWCN = 16, | ||
| 185 | - ACL_FORMAT_NDHWC = 27, | ||
| 186 | - ACL_FORMAT_FRACTAL_NZ = 29, | ||
| 187 | - ACL_FORMAT_NCDHW = 30, | ||
| 188 | - ACL_FORMAT_NDC1HWC0 = 32, | ||
| 189 | - ACL_FRACTAL_Z_3D = 33, | ||
| 190 | - ACL_FORMAT_NC = 35, | ||
| 191 | - ACL_FORMAT_NCL = 47, | ||
| 192 | - ACL_FORMAT_FRACTAL_NZ_C0_16 = 50, | ||
| 193 | - ACL_FORMAT_FRACTAL_NZ_C0_32 = 51, | ||
| 194 | - ACL_FORMAT_FRACTAL_NZ_C0_2 = 52, | ||
| 195 | - ACL_FORMAT_FRACTAL_NZ_C0_4 = 53, | ||
| 196 | - ACL_FORMAT_FRACTAL_NZ_C0_8 = 54, | ||
| 197 | -} aclFormat; | ||
| 198 | - | ||
| 199 | -typedef enum { | ||
| 200 | - ACL_DEBUG = 0, | ||
| 201 | - ACL_INFO = 1, | ||
| 202 | - ACL_WARNING = 2, | ||
| 203 | - ACL_ERROR = 3, | ||
| 204 | -} aclLogLevel; | ||
| 205 | - | ||
| 206 | -typedef enum { | ||
| 207 | - ACL_MEMTYPE_DEVICE = 0, | ||
| 208 | - ACL_MEMTYPE_HOST = 1, | ||
| 209 | - ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT = 2 | ||
| 210 | -} aclMemType; | ||
| 211 | - | ||
| 212 | -typedef enum { | ||
| 213 | - ACL_OPT_DETERMINISTIC = 0, | ||
| 214 | - ACL_OPT_ENABLE_DEBUG_KERNEL = 1, | ||
| 215 | - ACL_OPT_STRONG_CONSISTENCY = 2 | ||
| 216 | -} aclSysParamOpt; | ||
| 217 | - | ||
| 218 | -typedef enum { | ||
| 219 | - ACL_CANN_ATTR_UNDEFINED = -1, | ||
| 220 | - ACL_CANN_ATTR_INF_NAN = 0, | ||
| 221 | - ACL_CANN_ATTR_BF16 = 1, | ||
| 222 | - ACL_CANN_ATTR_JIT_COMPILE = 2 | ||
| 223 | -} aclCannAttr; | ||
| 224 | - | ||
| 225 | -typedef enum { | ||
| 226 | - ACL_DEVICE_INFO_UNDEFINED = -1, | ||
| 227 | - ACL_DEVICE_INFO_AI_CORE_NUM = 0, | ||
| 228 | - ACL_DEVICE_INFO_VECTOR_CORE_NUM = 1, | ||
| 229 | - ACL_DEVICE_INFO_L2_SIZE = 2 | ||
| 230 | -} aclDeviceInfo; | ||
| 231 | - | ||
| 232 | -/** | ||
| 233 | - * @ingroup AscendCL | ||
| 234 | - * @brief Converts data of type aclFloat16 to data of type float | ||
| 235 | - * | ||
| 236 | - * @param value [IN] Data to be converted | ||
| 237 | - * | ||
| 238 | - * @retval Transformed data | ||
| 239 | - */ | ||
| 240 | -ACL_FUNC_VISIBILITY float aclFloat16ToFloat(aclFloat16 value); | ||
| 241 | - | ||
| 242 | -/** | ||
| 243 | - * @ingroup AscendCL | ||
| 244 | - * @brief Converts data of type float to data of type aclFloat16 | ||
| 245 | - * | ||
| 246 | - * @param value [IN] Data to be converted | ||
| 247 | - * | ||
| 248 | - * @retval Transformed data | ||
| 249 | - */ | ||
| 250 | -ACL_FUNC_VISIBILITY aclFloat16 aclFloatToFloat16(float value); | ||
| 251 | - | ||
| 252 | -/** | ||
| 253 | - * @ingroup AscendCL | ||
| 254 | - * @brief create data of aclDataBuffer | ||
| 255 | - * | ||
| 256 | - * @param data [IN] pointer to data | ||
| 257 | - * @li Need to be managed by the user, | ||
| 258 | - * call aclrtMalloc interface to apply for memory, | ||
| 259 | - * call aclrtFree interface to release memory | ||
| 260 | - * | ||
| 261 | - * @param size [IN] size of data in bytes | ||
| 262 | - * | ||
| 263 | - * @retval pointer to created instance. nullptr if run out of memory | ||
| 264 | - * | ||
| 265 | - * @see aclrtMalloc | aclrtFree | ||
| 266 | - */ | ||
| 267 | -ACL_FUNC_VISIBILITY aclDataBuffer *aclCreateDataBuffer(void *data, size_t size); | ||
| 268 | - | ||
| 269 | -/** | ||
| 270 | - * @ingroup AscendCL | ||
| 271 | - * @brief destroy data of aclDataBuffer | ||
| 272 | - * | ||
| 273 | - * @par Function | ||
| 274 | - * Only the aclDataBuffer type data is destroyed here. | ||
| 275 | - * The memory of the data passed in when the aclDataDataBuffer interface | ||
| 276 | - * is called to create aclDataBuffer type data must be released by the user | ||
| 277 | - * | ||
| 278 | - * @param dataBuffer [IN] pointer to the aclDataBuffer | ||
| 279 | - * | ||
| 280 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 281 | - * @retval OtherValues Failure | ||
| 282 | - * | ||
| 283 | - * @see aclCreateDataBuffer | ||
| 284 | - */ | ||
| 285 | -ACL_FUNC_VISIBILITY aclError aclDestroyDataBuffer(const aclDataBuffer *dataBuffer); | ||
| 286 | - | ||
| 287 | -/** | ||
| 288 | - * @ingroup AscendCL | ||
| 289 | - * @brief update new data of aclDataBuffer | ||
| 290 | - * | ||
| 291 | - * @param dataBuffer [OUT] pointer to aclDataBuffer | ||
| 292 | - * @li The old data need to be released by the user, otherwise it may occur memory leak leakage | ||
| 293 | - * call aclGetDataBufferAddr interface to get old data address | ||
| 294 | - * call aclrtFree interface to release memory | ||
| 295 | - * | ||
| 296 | - * @param data [IN] pointer to new data | ||
| 297 | - * @li Need to be managed by the user, | ||
| 298 | - * call aclrtMalloc interface to apply for memory, | ||
| 299 | - * call aclrtFree interface to release memory | ||
| 300 | - * | ||
| 301 | - * @param size [IN] size of data in bytes | ||
| 302 | - * | ||
| 303 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 304 | - * @retval OtherValues Failure | ||
| 305 | - * | ||
| 306 | - * @see aclrtMalloc | aclrtFree | aclGetDataBufferAddr | ||
| 307 | - */ | ||
| 308 | -ACL_FUNC_VISIBILITY aclError aclUpdateDataBuffer(aclDataBuffer *dataBuffer, void *data, size_t size); | ||
| 309 | - | ||
| 310 | -/** | ||
| 311 | - * @ingroup AscendCL | ||
| 312 | - * @brief get data address from aclDataBuffer | ||
| 313 | - * | ||
| 314 | - * @param dataBuffer [IN] pointer to the data of aclDataBuffer | ||
| 315 | - * | ||
| 316 | - * @retval data address | ||
| 317 | - */ | ||
| 318 | -ACL_FUNC_VISIBILITY void *aclGetDataBufferAddr(const aclDataBuffer *dataBuffer); | ||
| 319 | - | ||
| 320 | -/** | ||
| 321 | - * @ingroup AscendCL | ||
| 322 | - * @brief get data size of aclDataBuffer | ||
| 323 | - * | ||
| 324 | - * @param dataBuffer [IN] pointer to the data of aclDataBuffer | ||
| 325 | - * | ||
| 326 | - * @retval data size | ||
| 327 | - */ | ||
| 328 | -ACL_DEPRECATED_MESSAGE("aclGetDataBufferSize is deprecated, use aclGetDataBufferSizeV2 instead") | ||
| 329 | -ACL_FUNC_VISIBILITY uint32_t aclGetDataBufferSize(const aclDataBuffer *dataBuffer); | ||
| 330 | - | ||
| 331 | -/** | ||
| 332 | - * @ingroup AscendCL | ||
| 333 | - * @brief get data size of aclDataBuffer to replace aclGetDataBufferSize | ||
| 334 | - * | ||
| 335 | - * @param dataBuffer [IN] pointer to the data of aclDataBuffer | ||
| 336 | - * | ||
| 337 | - * @retval data size | ||
| 338 | - */ | ||
| 339 | -ACL_FUNC_VISIBILITY size_t aclGetDataBufferSizeV2(const aclDataBuffer *dataBuffer); | ||
| 340 | - | ||
| 341 | -/** | ||
| 342 | - * @ingroup AscendCL | ||
| 343 | - * @brief get size of aclDataType | ||
| 344 | - * | ||
| 345 | - * @param dataType [IN] aclDataType data the size to get | ||
| 346 | - * | ||
| 347 | - * @retval size of the aclDataType | ||
| 348 | - */ | ||
| 349 | -ACL_FUNC_VISIBILITY size_t aclDataTypeSize(aclDataType dataType); | ||
| 350 | - | ||
| 351 | -// interfaces of tensor desc | ||
| 352 | -/** | ||
| 353 | - * @ingroup AscendCL | ||
| 354 | - * @brief create data aclTensorDesc | ||
| 355 | - * | ||
| 356 | - * @param dataType [IN] Data types described by tensor | ||
| 357 | - * @param numDims [IN] the number of dimensions of the shape | ||
| 358 | - * @param dims [IN] the size of the specified dimension | ||
| 359 | - * @param format [IN] tensor format | ||
| 360 | - * | ||
| 361 | - * @retval aclTensorDesc pointer. | ||
| 362 | - * @retval nullptr if param is invalid or run out of memory | ||
| 363 | - */ | ||
| 364 | -ACL_FUNC_VISIBILITY aclTensorDesc *aclCreateTensorDesc(aclDataType dataType, | ||
| 365 | - int numDims, | ||
| 366 | - const int64_t *dims, | ||
| 367 | - aclFormat format); | ||
| 368 | - | ||
| 369 | -/** | ||
| 370 | - * @ingroup AscendCL | ||
| 371 | - * @brief destroy data aclTensorDesc | ||
| 372 | - * | ||
| 373 | - * @param desc [IN] pointer to the data of aclTensorDesc to destroy | ||
| 374 | - */ | ||
| 375 | -ACL_FUNC_VISIBILITY void aclDestroyTensorDesc(const aclTensorDesc *desc); | ||
| 376 | - | ||
| 377 | -/** | ||
| 378 | - * @ingroup AscendCL | ||
| 379 | - * @brief set tensor shape range for aclTensorDesc | ||
| 380 | - * | ||
| 381 | - * @param desc [OUT] pointer to the data of aclTensorDesc | ||
| 382 | - * @param dimsCount [IN] the number of dimensions of the shape | ||
| 383 | - * @param dimsRange [IN] the range of dimensions of the shape | ||
| 384 | - * | ||
| 385 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 386 | - * @retval OtherValues Failure | ||
| 387 | - */ | ||
| 388 | -ACL_FUNC_VISIBILITY aclError aclSetTensorShapeRange(aclTensorDesc* desc, | ||
| 389 | - size_t dimsCount, | ||
| 390 | - int64_t dimsRange[][ACL_TENSOR_SHAPE_RANGE_NUM]); | ||
| 391 | - | ||
| 392 | -/** | ||
| 393 | - * @ingroup AscendCL | ||
| 394 | - * @brief set value range for aclTensorDesc | ||
| 395 | - * | ||
| 396 | - * @param desc [OUT] pointer to the data of aclTensorDesc | ||
| 397 | - * @param valueCount [IN] the number of value | ||
| 398 | - * @param valueRange [IN] the range of value | ||
| 399 | - * | ||
| 400 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 401 | - * @retval OtherValues Failure | ||
| 402 | - */ | ||
| 403 | -ACL_FUNC_VISIBILITY aclError aclSetTensorValueRange(aclTensorDesc* desc, | ||
| 404 | - size_t valueCount, | ||
| 405 | - int64_t valueRange[][ACL_TENSOR_VALUE_RANGE_NUM]); | ||
| 406 | -/** | ||
| 407 | - * @ingroup AscendCL | ||
| 408 | - * @brief get data type specified by the tensor description | ||
| 409 | - * | ||
| 410 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 411 | - * | ||
| 412 | - * @retval data type specified by the tensor description. | ||
| 413 | - * @retval ACL_DT_UNDEFINED if description is null | ||
| 414 | - */ | ||
| 415 | -ACL_FUNC_VISIBILITY aclDataType aclGetTensorDescType(const aclTensorDesc *desc); | ||
| 416 | - | ||
| 417 | -/** | ||
| 418 | - * @ingroup AscendCL | ||
| 419 | - * @brief get data format specified by the tensor description | ||
| 420 | - * | ||
| 421 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 422 | - * | ||
| 423 | - * @retval data format specified by the tensor description. | ||
| 424 | - * @retval ACL_FORMAT_UNDEFINED if description is null | ||
| 425 | - */ | ||
| 426 | -ACL_FUNC_VISIBILITY aclFormat aclGetTensorDescFormat(const aclTensorDesc *desc); | ||
| 427 | - | ||
| 428 | -/** | ||
| 429 | - * @ingroup AscendCL | ||
| 430 | - * @brief get tensor size specified by the tensor description | ||
| 431 | - * | ||
| 432 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 433 | - * | ||
| 434 | - * @retval data size specified by the tensor description. | ||
| 435 | - * @retval 0 if description is null | ||
| 436 | - */ | ||
| 437 | -ACL_FUNC_VISIBILITY size_t aclGetTensorDescSize(const aclTensorDesc *desc); | ||
| 438 | - | ||
| 439 | -/** | ||
| 440 | - * @ingroup AscendCL | ||
| 441 | - * @brief get element count specified by the tensor description | ||
| 442 | - * | ||
| 443 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 444 | - * | ||
| 445 | - * @retval element count specified by the tensor description. | ||
| 446 | - * @retval 0 if description is null | ||
| 447 | - */ | ||
| 448 | -ACL_FUNC_VISIBILITY size_t aclGetTensorDescElementCount(const aclTensorDesc *desc); | ||
| 449 | - | ||
| 450 | -/** | ||
| 451 | - * @ingroup AscendCL | ||
| 452 | - * @brief get number of dims specified by the tensor description | ||
| 453 | - * | ||
| 454 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 455 | - * | ||
| 456 | - * @retval number of dims specified by the tensor description. | ||
| 457 | - * @retval 0 if description is null | ||
| 458 | - * @retval ACL_UNKNOWN_RANK if the tensor dim is -2 | ||
| 459 | - */ | ||
| 460 | -ACL_FUNC_VISIBILITY size_t aclGetTensorDescNumDims(const aclTensorDesc *desc); | ||
| 461 | - | ||
| 462 | -/** | ||
| 463 | - * @ingroup AscendCL | ||
| 464 | - * @brief Get the size of the specified dim in the tensor description | ||
| 465 | - * | ||
| 466 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 467 | - * @param index [IN] index of dims, start from 0. | ||
| 468 | - * | ||
| 469 | - * @retval dim specified by the tensor description and index. | ||
| 470 | - * @retval -1 if description or index is invalid | ||
| 471 | - */ | ||
| 472 | -ACL_DEPRECATED_MESSAGE("aclGetTensorDescDim is deprecated, use aclGetTensorDescDimV2 instead") | ||
| 473 | -ACL_FUNC_VISIBILITY int64_t aclGetTensorDescDim(const aclTensorDesc *desc, size_t index); | ||
| 474 | - | ||
| 475 | -/** | ||
| 476 | - * @ingroup AscendCL | ||
| 477 | - * @brief Get the size of the specified dim in the tensor description | ||
| 478 | - * | ||
| 479 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 480 | - * @param index [IN] index of dims, start from 0. | ||
| 481 | - * @param dimSize [OUT] size of the specified dim. | ||
| 482 | - * | ||
| 483 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 484 | - * @retval OtherValues Failure | ||
| 485 | - */ | ||
| 486 | -ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimV2(const aclTensorDesc *desc, size_t index, int64_t *dimSize); | ||
| 487 | - | ||
| 488 | -/** | ||
| 489 | - * @ingroup AscendCL | ||
| 490 | - * @brief Get the range of the specified dim in the tensor description | ||
| 491 | - * | ||
| 492 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 493 | - * @param index [IN] index of dims, start from 0. | ||
| 494 | - * @param dimRangeNum [IN] number of dimRange. | ||
| 495 | - * @param dimRange [OUT] range of the specified dim. | ||
| 496 | - * | ||
| 497 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 498 | - * @retval OtherValues Failure | ||
| 499 | - */ | ||
| 500 | -ACL_FUNC_VISIBILITY aclError aclGetTensorDescDimRange(const aclTensorDesc *desc, | ||
| 501 | - size_t index, | ||
| 502 | - size_t dimRangeNum, | ||
| 503 | - int64_t *dimRange); | ||
| 504 | - | ||
| 505 | -/** | ||
| 506 | - * @ingroup AscendCL | ||
| 507 | - * @brief set tensor description name | ||
| 508 | - * | ||
| 509 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 510 | - * @param name [IN] tensor description name | ||
| 511 | - */ | ||
| 512 | -ACL_FUNC_VISIBILITY void aclSetTensorDescName(aclTensorDesc *desc, const char *name); | ||
| 513 | - | ||
| 514 | -/** | ||
| 515 | - * @ingroup AscendCL | ||
| 516 | - * @brief get tensor description name | ||
| 517 | - * | ||
| 518 | - * @param desc [IN] pointer to the instance of aclTensorDesc | ||
| 519 | - * | ||
| 520 | - * @retval tensor description name. | ||
| 521 | - * @retval empty string if description is null | ||
| 522 | - */ | ||
| 523 | -ACL_FUNC_VISIBILITY const char *aclGetTensorDescName(aclTensorDesc *desc); | ||
| 524 | - | ||
| 525 | -/** | ||
| 526 | - * @ingroup AscendCL | ||
| 527 | - * @brief Convert the format in the source aclTensorDesc according to | ||
| 528 | - * the specified dstFormat to generate a new target aclTensorDesc. | ||
| 529 | - * The format in the source aclTensorDesc remains unchanged. | ||
| 530 | - * | ||
| 531 | - * @param srcDesc [IN] pointer to the source tensor desc | ||
| 532 | - * @param dstFormat [IN] destination format | ||
| 533 | - * @param dstDesc [OUT] pointer to the pointer to the destination tensor desc | ||
| 534 | - * | ||
| 535 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 536 | - * @retval OtherValues Failure | ||
| 537 | - */ | ||
| 538 | -ACL_FUNC_VISIBILITY aclError aclTransTensorDescFormat(const aclTensorDesc *srcDesc, aclFormat dstFormat, | ||
| 539 | - aclTensorDesc **dstDesc); | ||
| 540 | - | ||
| 541 | -/** | ||
| 542 | - * @ingroup AscendCL | ||
| 543 | - * @brief Set the storage format specified by the tensor description | ||
| 544 | - * | ||
| 545 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 546 | - * @param format [IN] the storage format | ||
| 547 | - * | ||
| 548 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 549 | - * @retval OtherValues Failure | ||
| 550 | - */ | ||
| 551 | -ACL_DEPRECATED_MESSAGE("aclSetTensorStorageFormat is deprecated, use aclSetTensorFormat instead") | ||
| 552 | -ACL_FUNC_VISIBILITY aclError aclSetTensorStorageFormat(aclTensorDesc *desc, aclFormat format); | ||
| 553 | - | ||
| 554 | -/** | ||
| 555 | - * @ingroup AscendCL | ||
| 556 | - * @brief Set the storage shape specified by the tensor description | ||
| 557 | - * | ||
| 558 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 559 | - * @param numDims [IN] the number of dimensions of the shape | ||
| 560 | - * @param dims [IN] the size of the specified dimension | ||
| 561 | - * | ||
| 562 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 563 | - * @retval OtherValues Failure | ||
| 564 | - */ | ||
| 565 | -ACL_DEPRECATED_MESSAGE("aclSetTensorStorageShape is deprecated, use aclSetTensorShape instead") | ||
| 566 | -ACL_FUNC_VISIBILITY aclError aclSetTensorStorageShape(aclTensorDesc *desc, int numDims, const int64_t *dims); | ||
| 567 | - | ||
| 568 | -/** | ||
| 569 | - * @ingroup AscendCL | ||
| 570 | - * @brief Set the format specified by the tensor description | ||
| 571 | - * | ||
| 572 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 573 | - * @param format [IN] the storage format | ||
| 574 | - * | ||
| 575 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 576 | - * @retval OtherValues Failure | ||
| 577 | - */ | ||
| 578 | -ACL_FUNC_VISIBILITY aclError aclSetTensorFormat(aclTensorDesc *desc, aclFormat format); | ||
| 579 | - | ||
| 580 | -/** | ||
| 581 | - * @ingroup AscendCL | ||
| 582 | - * @brief Set the shape specified by the tensor description | ||
| 583 | - * | ||
| 584 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 585 | - * @param numDims [IN] the number of dimensions of the shape | ||
| 586 | - * @param dims [IN] the size of the specified dimension | ||
| 587 | - * | ||
| 588 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 589 | - * @retval OtherValues Failure | ||
| 590 | - */ | ||
| 591 | -ACL_FUNC_VISIBILITY aclError aclSetTensorShape(aclTensorDesc *desc, int numDims, const int64_t *dims); | ||
| 592 | - | ||
| 593 | -/** | ||
| 594 | - * @ingroup AscendCL | ||
| 595 | - * @brief Set the original format specified by the tensor description | ||
| 596 | - * | ||
| 597 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 598 | - * @param format [IN] the storage format | ||
| 599 | - * | ||
| 600 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 601 | - * @retval OtherValues Failure | ||
| 602 | - */ | ||
| 603 | -ACL_FUNC_VISIBILITY aclError aclSetTensorOriginFormat(aclTensorDesc *desc, aclFormat format); | ||
| 604 | - | ||
| 605 | -/** | ||
| 606 | - * @ingroup AscendCL | ||
| 607 | - * @brief Set the original shape specified by the tensor description | ||
| 608 | - * | ||
| 609 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 610 | - * @param numDims [IN] the number of dimensions of the shape | ||
| 611 | - * @param dims [IN] the size of the specified dimension | ||
| 612 | - * | ||
| 613 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 614 | - * @retval OtherValues Failure | ||
| 615 | - */ | ||
| 616 | -ACL_FUNC_VISIBILITY aclError aclSetTensorOriginShape(aclTensorDesc *desc, int numDims, const int64_t *dims); | ||
| 617 | - | ||
| 618 | -/** | ||
| 619 | - * @ingroup AscendCL | ||
| 620 | - * @brief get op description info | ||
| 621 | - * | ||
| 622 | - * @param desc [IN] pointer to tensor description | ||
| 623 | - * @param index [IN] index of tensor | ||
| 624 | - * | ||
| 625 | - * @retval null for failed. | ||
| 626 | - * @retval OtherValues success. | ||
| 627 | -*/ | ||
| 628 | -ACL_FUNC_VISIBILITY aclTensorDesc *aclGetTensorDescByIndex(aclTensorDesc *desc, size_t index); | ||
| 629 | - | ||
| 630 | -/** | ||
| 631 | - * @ingroup AscendCL | ||
| 632 | - * @brief get address of tensor | ||
| 633 | - * | ||
| 634 | - * @param desc [IN] pointer to tensor description | ||
| 635 | - * | ||
| 636 | - * @retval null for failed | ||
| 637 | - * @retval OtherValues success | ||
| 638 | -*/ | ||
| 639 | -ACL_FUNC_VISIBILITY void *aclGetTensorDescAddress(const aclTensorDesc *desc); | ||
| 640 | - | ||
| 641 | -/** | ||
| 642 | - * @ingroup AscendCL | ||
| 643 | - * @brief Set the dynamic input name specified by the tensor description | ||
| 644 | - * | ||
| 645 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 646 | - * @param dynamicInputName [IN] pointer to the dynamic input name | ||
| 647 | - * | ||
| 648 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 649 | - * @retval OtherValues Failure | ||
| 650 | - */ | ||
| 651 | -ACL_FUNC_VISIBILITY aclError aclSetTensorDynamicInput(aclTensorDesc *desc, const char *dynamicInputName); | ||
| 652 | - | ||
| 653 | -/** | ||
| 654 | - * @ingroup AscendCL | ||
| 655 | - * @brief Set const data specified by the tensor description | ||
| 656 | - * | ||
| 657 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 658 | - * @param dataBuffer [IN] pointer to the const databuffer | ||
| 659 | - * @param length [IN] the length of const databuffer | ||
| 660 | - * | ||
| 661 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 662 | - * @retval OtherValues Failure | ||
| 663 | - */ | ||
| 664 | -ACL_FUNC_VISIBILITY aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length); | ||
| 665 | - | ||
| 666 | -/** | ||
| 667 | - * @ingroup AscendCL | ||
| 668 | - * @brief Set tensor memory type specified by the tensor description | ||
| 669 | - * | ||
| 670 | - * @param desc [OUT] pointer to the instance of aclTensorDesc | ||
| 671 | - * @param memType [IN] ACL_MEMTYPE_DEVICE means device, ACL_MEMTYPE_HOST or | ||
| 672 | - * ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT means host | ||
| 673 | - * | ||
| 674 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 675 | - * @retval OtherValues Failure | ||
| 676 | - */ | ||
| 677 | -ACL_FUNC_VISIBILITY aclError aclSetTensorPlaceMent(aclTensorDesc *desc, aclMemType memType); | ||
| 678 | - | ||
| 679 | -/** | ||
| 680 | - * @ingroup AscendCL | ||
| 681 | - * @brief an interface for users to output APP logs | ||
| 682 | - * | ||
| 683 | - * @param logLevel [IN] the level of current log | ||
| 684 | - * @param func [IN] the function where the log is located | ||
| 685 | - * @param file [IN] the file where the log is located | ||
| 686 | - * @param line [IN] Number of source lines where the log is located | ||
| 687 | - * @param fmt [IN] the format of current log | ||
| 688 | - * @param ... [IN] the value of current log | ||
| 689 | - */ | ||
| 690 | -ACL_FUNC_VISIBILITY void aclAppLog(aclLogLevel logLevel, const char *func, const char *file, uint32_t line, | ||
| 691 | - const char *fmt, ...); | ||
| 692 | - | ||
| 693 | -/** | ||
| 694 | - * @ingroup AscendCL | ||
| 695 | - * @brief get soc name | ||
| 696 | - * | ||
| 697 | - * @retval null for failed | ||
| 698 | - * @retval OtherValues success | ||
| 699 | -*/ | ||
| 700 | -ACL_FUNC_VISIBILITY const char *aclrtGetSocName(); | ||
| 701 | - | ||
| 702 | - | ||
| 703 | - aclAppLog(level, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__) | ||
| 704 | - | ||
| 705 | -/** | ||
| 706 | - * @ingroup AscendCL | ||
| 707 | - * @brief Get a list of the available CANN attributes in current environment | ||
| 708 | - * | ||
| 709 | - * @param cannAttrList [OUT] list of the available CANN attributes | ||
| 710 | - * @param num [OUT] the number of the available CANN attributes | ||
| 711 | - * | ||
| 712 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 713 | - * @retval OtherValues Failure | ||
| 714 | - */ | ||
| 715 | -ACL_FUNC_VISIBILITY aclError aclGetCannAttributeList(const aclCannAttr **cannAttrList, size_t *num); | ||
| 716 | - | ||
| 717 | -/** | ||
| 718 | - * @ingroup AscendCL | ||
| 719 | - * @brief Check whether the specified CANN attribute is available in current | ||
| 720 | - * environment | ||
| 721 | - * | ||
| 722 | - * @param cannAttr [IN] CANN attributes to query | ||
| 723 | - * @param num [OUT] 0/1: 0 represents unavailable , 1 available | ||
| 724 | - * | ||
| 725 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 726 | - * @retval OtherValues Failure | ||
| 727 | - */ | ||
| 728 | -ACL_FUNC_VISIBILITY aclError aclGetCannAttribute(aclCannAttr cannAttr, int32_t *value); | ||
| 729 | - | ||
| 730 | -/** | ||
| 731 | - * @ingroup AscendCL | ||
| 732 | - * @brief Get capability value of the specified device | ||
| 733 | - * | ||
| 734 | - * @param deviceId [IN] device id | ||
| 735 | - * @param deviceInfo [IN] device capability to query | ||
| 736 | - * @param value [OUT] returned device capability value | ||
| 737 | - * | ||
| 738 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 739 | - * @retval OtherValues Failure | ||
| 740 | - */ | ||
| 741 | -ACL_FUNC_VISIBILITY aclError aclGetDeviceCapability(uint32_t deviceId, aclDeviceInfo deviceInfo, int64_t *value); | ||
| 742 | - | ||
| 743 | - | ||
| 744 | -} | ||
| 745 | - | ||
| 746 | - | ||
| 747 | - | ||
Dthird_party/acl/inc/acl/acl_mdl.h+0-1668
Dthird_party/acl/inc/acl/acl_op.h+0-605
| @@ -1,605 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_op.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extern "C" { | ||
| 18 | - | ||
| 19 | - | ||
| 20 | -typedef struct aclopHandle aclopHandle; | ||
| 21 | -typedef struct aclopAttr aclopAttr; | ||
| 22 | -typedef struct aclopKernelDesc aclopKernelDesc; | ||
| 23 | - | ||
| 24 | -typedef void (*aclDataDeallocator)(void *data, size_t length); | ||
| 25 | - | ||
| 26 | -static const int ACL_COMPILE_FLAG_BIN_SELECTOR = 1; | ||
| 27 | - | ||
| 28 | -typedef enum aclEngineType { | ||
| 29 | - ACL_ENGINE_SYS, | ||
| 30 | - ACL_ENGINE_AICORE, | ||
| 31 | - ACL_ENGINE_VECTOR, | ||
| 32 | -} aclopEngineType; | ||
| 33 | - | ||
| 34 | -/** | ||
| 35 | - * @ingroup AscendCL | ||
| 36 | - * @brief Set base directory that contains single op models | ||
| 37 | - * | ||
| 38 | - * @par Restriction | ||
| 39 | - * The aclopSetModelDir interface can be called only once in a process. | ||
| 40 | - * @param modelDir [IN] path of the directory | ||
| 41 | - * | ||
| 42 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 43 | - * @retval OtherValues Failure | ||
| 44 | - */ | ||
| 45 | -ACL_FUNC_VISIBILITY aclError aclopSetModelDir(const char *modelDir); | ||
| 46 | - | ||
| 47 | -/** | ||
| 48 | - * @ingroup AscendCL | ||
| 49 | - * @brief load single op models from memory | ||
| 50 | - * | ||
| 51 | - * @par Restriction | ||
| 52 | - * The aclopLoad interface can be called more than one times in a process. | ||
| 53 | - * @param model [IN] address of single op models | ||
| 54 | - * @param modelSize [IN] size of single op models | ||
| 55 | - * | ||
| 56 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 57 | - * @retval OtherValues Failure | ||
| 58 | - */ | ||
| 59 | -ACL_FUNC_VISIBILITY aclError aclopLoad(const void *model, size_t modelSize); | ||
| 60 | - | ||
| 61 | -/** | ||
| 62 | - * @ingroup AscendCL | ||
| 63 | - * @brief create data of type aclopAttr | ||
| 64 | - * | ||
| 65 | - * @retval pointer to created instance. | ||
| 66 | - * @retval nullptr if run out of memory | ||
| 67 | - */ | ||
| 68 | -ACL_FUNC_VISIBILITY aclopAttr *aclopCreateAttr(); | ||
| 69 | - | ||
| 70 | -/** | ||
| 71 | - * @ingroup AscendCL | ||
| 72 | - * @brief destroy data of typ aclopAttr | ||
| 73 | - * | ||
| 74 | - * @param attr [IN] pointer to the instance of aclopAttr | ||
| 75 | - */ | ||
| 76 | -ACL_FUNC_VISIBILITY void aclopDestroyAttr(const aclopAttr *attr); | ||
| 77 | - | ||
| 78 | -/** | ||
| 79 | - * @ingroup AscendCL | ||
| 80 | - * @brief set an attribute. the type of the attribute is bool | ||
| 81 | - * | ||
| 82 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 83 | - * @param attrName [IN] attribute name | ||
| 84 | - * @param attrValue [IN] attribute value | ||
| 85 | - * false if attrValue is 0, true otherwise. | ||
| 86 | - * | ||
| 87 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 88 | - * @retval OtherValues Failure | ||
| 89 | - */ | ||
| 90 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrBool(aclopAttr *attr, const char *attrName, uint8_t attrValue); | ||
| 91 | - | ||
| 92 | -/** | ||
| 93 | - * @ingroup AscendCL | ||
| 94 | - * @brief set an attribute. the type of the attribute is int64_t | ||
| 95 | - * | ||
| 96 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 97 | - * @param attrName [IN] attribute name | ||
| 98 | - * @param attrValue [IN] attribute value | ||
| 99 | - * | ||
| 100 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 101 | - * @retval OtherValues Failure | ||
| 102 | - */ | ||
| 103 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrInt(aclopAttr *attr, const char *attrName, int64_t attrValue); | ||
| 104 | - | ||
| 105 | -/** | ||
| 106 | - * @ingroup AscendCL | ||
| 107 | - * @brief set an attribute. the type of the attribute is float | ||
| 108 | - * | ||
| 109 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 110 | - * @param attrName [IN] attribute name | ||
| 111 | - * @param attrValue [IN] attribute value | ||
| 112 | - * | ||
| 113 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 114 | - * @retval OtherValues Failure | ||
| 115 | - */ | ||
| 116 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrFloat(aclopAttr *attr, const char *attrName, float attrValue); | ||
| 117 | - | ||
| 118 | -/** | ||
| 119 | - * @ingroup AscendCL | ||
| 120 | - * @brief set an attribute. the type of the attribute is string | ||
| 121 | - * | ||
| 122 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 123 | - * @param attrName [IN] attribute name | ||
| 124 | - * @param attrValue [IN] attribute value | ||
| 125 | - * | ||
| 126 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 127 | - * @retval OtherValues Failure | ||
| 128 | - */ | ||
| 129 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrString(aclopAttr *attr, const char *attrName, const char *attrValue); | ||
| 130 | - | ||
| 131 | -/** | ||
| 132 | - * @ingroup AscendCL | ||
| 133 | - * @brief set an attribute. the type of the attribute is aclDataType | ||
| 134 | - * | ||
| 135 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 136 | - * @param attrName [IN] attribute name | ||
| 137 | - * @param attrValue [IN] attribute value | ||
| 138 | - * | ||
| 139 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 140 | - * @retval OtherValues Failure | ||
| 141 | - */ | ||
| 142 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrDataType(aclopAttr *attr, const char *attrName, aclDataType attrValue); | ||
| 143 | - | ||
| 144 | -/** | ||
| 145 | - * @ingroup AscendCL | ||
| 146 | - * @brief set an attribute. the type of the attribute is list of aclDataType | ||
| 147 | - * | ||
| 148 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 149 | - * @param attrName [IN] attribute name | ||
| 150 | - * @param numValues [IN] number of values. false if attrValue is 0, true otherwise. | ||
| 151 | - * @param values [IN] pointer to values | ||
| 152 | - * | ||
| 153 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 154 | - * @retval OtherValues Failure | ||
| 155 | - */ | ||
| 156 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrListDataType(aclopAttr *attr, const char *attrName, int numValues, | ||
| 157 | - const aclDataType values[]); | ||
| 158 | - | ||
| 159 | -/** | ||
| 160 | - * @ingroup AscendCL | ||
| 161 | - * @brief set an attribute. the type of the attribute is list of bools | ||
| 162 | - * | ||
| 163 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 164 | - * @param attrName [IN] attribute name | ||
| 165 | - * @param numValues [IN] number of values. false if attrValue is 0, true otherwise. | ||
| 166 | - * @param values [IN] pointer to values | ||
| 167 | - * | ||
| 168 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 169 | - * @retval OtherValues Failure | ||
| 170 | - */ | ||
| 171 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrListBool(aclopAttr *attr, const char *attrName, int numValues, | ||
| 172 | - const uint8_t *values); | ||
| 173 | - | ||
| 174 | -/** | ||
| 175 | - * @ingroup AscendCL | ||
| 176 | - * @brief set an attribute. the type of the attribute is list of ints | ||
| 177 | - * | ||
| 178 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 179 | - * @param attrName [IN] attribute name | ||
| 180 | - * @param numValues [IN] number of values | ||
| 181 | - * @param values [IN] pointer to values | ||
| 182 | - * | ||
| 183 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 184 | - * @retval OtherValues Failure | ||
| 185 | - */ | ||
| 186 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrListInt(aclopAttr *attr, const char *attrName, int numValues, | ||
| 187 | - const int64_t *values); | ||
| 188 | - | ||
| 189 | -/** | ||
| 190 | - * @ingroup AscendCL | ||
| 191 | - * @brief set an attribute. the type of the attribute is list of floats | ||
| 192 | - * | ||
| 193 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 194 | - * @param attrName [IN] attribute name | ||
| 195 | - * @param numValues [IN] number of values | ||
| 196 | - * @param values [IN] pointer to values | ||
| 197 | - * | ||
| 198 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 199 | - * @retval OtherValues Failure | ||
| 200 | - */ | ||
| 201 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrListFloat(aclopAttr *attr, const char *attrName, int numValues, | ||
| 202 | - const float *values); | ||
| 203 | - | ||
| 204 | -/** | ||
| 205 | - * @ingroup AscendCL | ||
| 206 | - * @brief set an attribute. the type of the attribute is list of strings | ||
| 207 | - * | ||
| 208 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 209 | - * @param attrName [IN] attribute name | ||
| 210 | - * @param numValues [IN] number of values | ||
| 211 | - * @param values [IN] pointer to values | ||
| 212 | - * | ||
| 213 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 214 | - * @retval OtherValues Failure | ||
| 215 | - */ | ||
| 216 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrListString(aclopAttr *attr, const char *attrName, int numValues, | ||
| 217 | - const char **values); | ||
| 218 | - | ||
| 219 | -/** | ||
| 220 | - * @ingroup AscendCL | ||
| 221 | - * @brief set an attribute. the type of the attribute is list of list of ints | ||
| 222 | - * | ||
| 223 | - * @param attr [OUT] pointer to the instance of aclopAttr | ||
| 224 | - * @param attrName [IN] attribute name | ||
| 225 | - * @param numLists [IN] number of lists | ||
| 226 | - * @param numValues [IN] pointer to number of values of each list | ||
| 227 | - * @param values [IN] pointer to values | ||
| 228 | - * | ||
| 229 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 230 | - * @retval OtherValues Failure | ||
| 231 | - */ | ||
| 232 | -ACL_FUNC_VISIBILITY aclError aclopSetAttrListListInt(aclopAttr *attr, | ||
| 233 | - const char *attrName, | ||
| 234 | - int numLists, | ||
| 235 | - const int *numValues, | ||
| 236 | - const int64_t *const values[]); | ||
| 237 | - | ||
| 238 | -/** | ||
| 239 | - * @ingroup AscendCL | ||
| 240 | - * @brief Load and execute the specified operator asynchronously | ||
| 241 | - * | ||
| 242 | - * @par Restriction | ||
| 243 | - * @li The input and output organization of each operator is different, | ||
| 244 | - * and the application needs to organize the operator strictly | ||
| 245 | - * according to the operator input and output parameters when calling. | ||
| 246 | - * @li When the user calls aclopExecute, | ||
| 247 | - * the ACL finds the corresponding task according to the optype, | ||
| 248 | - * the description of the input tesnsor, | ||
| 249 | - * the description of the output tesnsor, and attr, and issues the execution. | ||
| 250 | - * | ||
| 251 | - * @param opType [IN] type of op | ||
| 252 | - * @param numInputs [IN] number of inputs | ||
| 253 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 254 | - * @param inputs [IN] pointer to array of input buffers | ||
| 255 | - * @param numOutputs [IN] number of outputs | ||
| 256 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 257 | - * @param outputs [OUT] pointer to array of output buffers | ||
| 258 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 259 | - * may pass nullptr if the op has no attribute | ||
| 260 | - * @param stream [IN] stream | ||
| 261 | - * | ||
| 262 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 263 | - * @retval OtherValues Failure | ||
| 264 | - */ | ||
| 265 | -ACL_DEPRECATED_MESSAGE("aclopExecute is deprecated, use aclopExecuteV2 instead") | ||
| 266 | -ACL_FUNC_VISIBILITY aclError aclopExecute(const char *opType, | ||
| 267 | - int numInputs, | ||
| 268 | - const aclTensorDesc *const inputDesc[], | ||
| 269 | - const aclDataBuffer *const inputs[], | ||
| 270 | - int numOutputs, | ||
| 271 | - const aclTensorDesc *const outputDesc[], | ||
| 272 | - aclDataBuffer *const outputs[], | ||
| 273 | - const aclopAttr *attr, | ||
| 274 | - aclrtStream stream); | ||
| 275 | - | ||
| 276 | -/** | ||
| 277 | - * @ingroup AscendCL | ||
| 278 | - * @brief Load and execute the specified operator | ||
| 279 | - * The difference with aclopExecute is that aclopExecuteV2 will refresh outputDesc | ||
| 280 | - * | ||
| 281 | - * @par Restriction | ||
| 282 | - * @li The input and output organization of each operator is different, | ||
| 283 | - * and the application needs to organize the operator strictly | ||
| 284 | - * according to the operator input and output parameters when calling. | ||
| 285 | - * @li When the user calls aclopExecuteV2, | ||
| 286 | - * the ACL finds the corresponding task according to the optype, | ||
| 287 | - * the description of the input tesnsor, | ||
| 288 | - * the description of the output tesnsor, and attr, and issues the execution. | ||
| 289 | - * | ||
| 290 | - * @param opType [IN] type of op | ||
| 291 | - * @param numInputs [IN] number of inputs | ||
| 292 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 293 | - * @param inputs [IN] pointer to array of input buffers | ||
| 294 | - * @param numOutputs [IN] number of outputs | ||
| 295 | - * @param outputDesc [IN|OUT] pointer to array of output tensor descriptions | ||
| 296 | - * @param outputs [OUT] pointer to array of output buffers | ||
| 297 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 298 | - * may pass nullptr if the op has no attribute | ||
| 299 | - * @param stream [IN] stream | ||
| 300 | - * | ||
| 301 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 302 | - * @retval OtherValues Failure | ||
| 303 | - */ | ||
| 304 | -ACL_FUNC_VISIBILITY aclError aclopExecuteV2(const char *opType, | ||
| 305 | - int numInputs, | ||
| 306 | - aclTensorDesc *inputDesc[], | ||
| 307 | - aclDataBuffer *inputs[], | ||
| 308 | - int numOutputs, | ||
| 309 | - aclTensorDesc *outputDesc[], | ||
| 310 | - aclDataBuffer *outputs[], | ||
| 311 | - aclopAttr *attr, | ||
| 312 | - aclrtStream stream); | ||
| 313 | - | ||
| 314 | -/** | ||
| 315 | - * @ingroup AscendCL | ||
| 316 | - * @brief create a instance of aclopHandle. | ||
| 317 | - * | ||
| 318 | - * @param opType [IN] type of op | ||
| 319 | - * @param numInputs [IN] number of inputs | ||
| 320 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 321 | - * @param numOutputs [IN] number of outputs | ||
| 322 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 323 | - * @param opAttr [IN] pointer to instance of aclopAttr. | ||
| 324 | - * may pass nullptr if the op has no attribute | ||
| 325 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 326 | - * | ||
| 327 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 328 | - * @retval OtherValues Failure | ||
| 329 | - */ | ||
| 330 | -ACL_FUNC_VISIBILITY aclError aclopCreateHandle(const char *opType, | ||
| 331 | - int numInputs, | ||
| 332 | - const aclTensorDesc *const inputDesc[], | ||
| 333 | - int numOutputs, | ||
| 334 | - const aclTensorDesc *const outputDesc[], | ||
| 335 | - const aclopAttr *opAttr, | ||
| 336 | - aclopHandle **handle); | ||
| 337 | - | ||
| 338 | -/** | ||
| 339 | - * @ingroup AscendCL | ||
| 340 | - * @brief destroy aclopHandle instance | ||
| 341 | - * | ||
| 342 | - * @param handle [IN] pointer to the instance of aclopHandle | ||
| 343 | - */ | ||
| 344 | -ACL_FUNC_VISIBILITY void aclopDestroyHandle(aclopHandle *handle); | ||
| 345 | - | ||
| 346 | -/** | ||
| 347 | - * @ingroup AscendCL | ||
| 348 | - * @brief execute an op with the handle. | ||
| 349 | - * can save op model matching cost compared with aclopExecute | ||
| 350 | - * | ||
| 351 | - * @param handle [IN] pointer to the instance of aclopHandle. | ||
| 352 | - * The aclopCreateHandle interface has been called | ||
| 353 | - * in advance to create aclopHandle type data. | ||
| 354 | - * @param numInputs [IN] number of inputs | ||
| 355 | - * @param inputs [IN] pointer to array of input buffers. | ||
| 356 | - * The aclCreateDataBuffer interface has been called | ||
| 357 | - * in advance to create aclDataBuffer type data. | ||
| 358 | - * @param numOutputs [IN] number of outputs | ||
| 359 | - * @param outputs [OUT] pointer to array of output buffers | ||
| 360 | - * @param stream [IN] stream | ||
| 361 | - * | ||
| 362 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 363 | - * @retval OtherValues Failure | ||
| 364 | - * | ||
| 365 | - * @see aclopCreateHandle | aclCreateDataBuffer | ||
| 366 | - */ | ||
| 367 | -ACL_FUNC_VISIBILITY aclError aclopExecWithHandle(aclopHandle *handle, | ||
| 368 | - int numInputs, | ||
| 369 | - const aclDataBuffer *const inputs[], | ||
| 370 | - int numOutputs, | ||
| 371 | - aclDataBuffer *const outputs[], | ||
| 372 | - aclrtStream stream); | ||
| 373 | - | ||
| 374 | -/** | ||
| 375 | - * @ingroup AscendCL | ||
| 376 | - * @brief cast data type | ||
| 377 | - * | ||
| 378 | - * @param srcDesc [IN] source tensor desc | ||
| 379 | - * @param srcBuffer [IN] source tensor buffer | ||
| 380 | - * @param dstDesc [IN] destination tensor desc | ||
| 381 | - * @param dstBuffer [OUT] destination tensor buffer | ||
| 382 | - * @param truncate [IN] do not truncate if value is 0, truncate otherwise | ||
| 383 | - * @param stream [IN] stream | ||
| 384 | - * | ||
| 385 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 386 | - * @retval OtherValues Failure | ||
| 387 | - */ | ||
| 388 | -ACL_FUNC_VISIBILITY aclError aclopCast(const aclTensorDesc *srcDesc, | ||
| 389 | - const aclDataBuffer *srcBuffer, | ||
| 390 | - const aclTensorDesc *dstDesc, | ||
| 391 | - aclDataBuffer *dstBuffer, | ||
| 392 | - uint8_t truncate, | ||
| 393 | - aclrtStream stream); | ||
| 394 | - | ||
| 395 | -/** | ||
| 396 | - * @ingroup AscendCL | ||
| 397 | - * @brief create a handle for casting datatype | ||
| 398 | - * | ||
| 399 | - * @param srcDesc [IN] source tensor desc | ||
| 400 | - * @param dstDesc [IN] destination tensor desc | ||
| 401 | - * @param truncate [IN] do not truncate if value is 0, truncate otherwise | ||
| 402 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 403 | - * | ||
| 404 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 405 | - * @retval OtherValues Failure | ||
| 406 | - */ | ||
| 407 | -ACL_FUNC_VISIBILITY aclError aclopCreateHandleForCast(aclTensorDesc *srcDesc, | ||
| 408 | - aclTensorDesc *dstDesc, | ||
| 409 | - uint8_t truncate, | ||
| 410 | - aclopHandle **handle); | ||
| 411 | - | ||
| 412 | - | ||
| 413 | -/** | ||
| 414 | - * @ingroup AscendCL | ||
| 415 | - * @brief create kernel | ||
| 416 | - * | ||
| 417 | - * @param opType [IN] op type | ||
| 418 | - * @param kernelId [IN] kernel id | ||
| 419 | - * @param kernelName [IN] kernel name | ||
| 420 | - * @param binData [IN] kernel bin data | ||
| 421 | - * @param binSize [IN] kernel bin size | ||
| 422 | - * @param enginetype [IN] enigne type | ||
| 423 | - * @param deallocator [IN] callback function for deallocating bin data, | ||
| 424 | - * null if bin data to be deallocated by caller | ||
| 425 | - * | ||
| 426 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 427 | - * @retval OtherValues Failure | ||
| 428 | - * | ||
| 429 | - * @see aclopCompile | ||
| 430 | - */ | ||
| 431 | -ACL_FUNC_VISIBILITY aclError aclopCreateKernel(const char *opType, | ||
| 432 | - const char *kernelId, | ||
| 433 | - const char *kernelName, | ||
| 434 | - void *binData, | ||
| 435 | - int binSize, | ||
| 436 | - aclopEngineType enginetype, | ||
| 437 | - aclDataDeallocator deallocator); | ||
| 438 | - | ||
| 439 | - | ||
| 440 | -/** | ||
| 441 | - * @ingroup AscendCL | ||
| 442 | - * @brief create kernel | ||
| 443 | - * | ||
| 444 | - * @param numInputs [IN] number of inputs | ||
| 445 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 446 | - * @param numOutputs [IN] number of outputs | ||
| 447 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 448 | - * @param opAttr [IN] pointer to instance of aclopAttr | ||
| 449 | - * @param aclopKernelDesc [IN] pointer to instance of aclopKernelDesc | ||
| 450 | - * | ||
| 451 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 452 | - * @retval OtherValues Failure | ||
| 453 | - */ | ||
| 454 | -typedef aclError (*aclopCompileFunc)(int numInputs, | ||
| 455 | - const aclTensorDesc *const inputDesc[], | ||
| 456 | - int numOutputs, | ||
| 457 | - const aclTensorDesc *const outputDesc[], | ||
| 458 | - const aclopAttr *opAttr, | ||
| 459 | - aclopKernelDesc *aclopKernelDesc); | ||
| 460 | - | ||
| 461 | -/** | ||
| 462 | - * @ingroup AscendCL | ||
| 463 | - * @brief register compile function | ||
| 464 | - * | ||
| 465 | - * @param opType [IN] op type | ||
| 466 | - * @param func [IN] compile function | ||
| 467 | - * | ||
| 468 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 469 | - * @retval OtherValues Failure | ||
| 470 | - * | ||
| 471 | - * @see aclopUnregisterCompileFunc | ||
| 472 | - */ | ||
| 473 | -ACL_FUNC_VISIBILITY aclError aclopRegisterCompileFunc(const char *opType, aclopCompileFunc func); | ||
| 474 | - | ||
| 475 | -/** | ||
| 476 | - * @ingroup AscendCL | ||
| 477 | - * @brief unregister compile function | ||
| 478 | - * | ||
| 479 | - * @param opType [IN] op type | ||
| 480 | - * | ||
| 481 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 482 | - * @retval OtherValues Failure | ||
| 483 | - */ | ||
| 484 | -ACL_FUNC_VISIBILITY aclError aclopUnregisterCompileFunc(const char *opType); | ||
| 485 | - | ||
| 486 | -/** | ||
| 487 | - * @ingroup AscendCL | ||
| 488 | - * @brief set kernel args | ||
| 489 | - * | ||
| 490 | - * @param kernelDesc [IN] pointer to instance of aclopKernelDesc | ||
| 491 | - * @param kernelId [IN] kernel id | ||
| 492 | - * @param blockDim [IN] block dim | ||
| 493 | - * @param args [IN] args | ||
| 494 | - * @param argSize [IN] size in bytes of args | ||
| 495 | - * | ||
| 496 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 497 | - * @retval OtherValues Failure | ||
| 498 | - */ | ||
| 499 | -ACL_FUNC_VISIBILITY aclError aclopSetKernelArgs(aclopKernelDesc *kernelDesc, | ||
| 500 | - const char *kernelId, | ||
| 501 | - uint32_t blockDim, | ||
| 502 | - const void *args, | ||
| 503 | - uint32_t argSize); | ||
| 504 | - | ||
| 505 | -/** | ||
| 506 | - * @ingroup AscendCL | ||
| 507 | - * @brief set workspace sizes | ||
| 508 | - * | ||
| 509 | - * @param kernelDesc [IN] pointer to instance of aclopKernelDesc | ||
| 510 | - * @param numWorkspaces [IN] number of workspaces | ||
| 511 | - * @param workspaceSizes [IN] pointer to array of sizes of workspaces | ||
| 512 | - * | ||
| 513 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 514 | - * @retval OtherValues Failure | ||
| 515 | - */ | ||
| 516 | -ACL_FUNC_VISIBILITY aclError aclopSetKernelWorkspaceSizes(aclopKernelDesc *kernelDesc, int numWorkspaces, | ||
| 517 | - size_t *workspaceSizes); | ||
| 518 | - | ||
| 519 | -/** | ||
| 520 | - * @ingroup AscendCL | ||
| 521 | - * @brief compile op with dynamic shape | ||
| 522 | - * | ||
| 523 | - * @param opType [IN] op type | ||
| 524 | - * @param numInputs [IN] number of inputs | ||
| 525 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 526 | - * @param numOutputs [IN] number of outputs | ||
| 527 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 528 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 529 | - * may pass nullptr if the op has no attribute | ||
| 530 | - * | ||
| 531 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 532 | - * @retval OtherValues Failure | ||
| 533 | - */ | ||
| 534 | -ACL_FUNC_VISIBILITY aclError aclopUpdateParams(const char *opType, | ||
| 535 | - int numInputs, | ||
| 536 | - const aclTensorDesc *const inputDesc[], | ||
| 537 | - int numOutputs, | ||
| 538 | - const aclTensorDesc *const outputDesc[], | ||
| 539 | - const aclopAttr *attr); | ||
| 540 | - | ||
| 541 | -/** | ||
| 542 | - * @ingroup AscendCL | ||
| 543 | - * @brief set max op queue num | ||
| 544 | - * | ||
| 545 | - * @param maxOpNum [IN] number of max op queue | ||
| 546 | - * | ||
| 547 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 548 | - * @retval OtherValues Failure | ||
| 549 | - */ | ||
| 550 | -ACL_FUNC_VISIBILITY aclError aclopSetMaxOpQueueNum(uint64_t maxOpNum); | ||
| 551 | - | ||
| 552 | -/** | ||
| 553 | - * @ingroup AscendCL | ||
| 554 | - * @brief inferShape the specified operator synchronously | ||
| 555 | - * | ||
| 556 | - * @param opType [IN] type of op | ||
| 557 | - * @param numInputs [IN] number of inputs | ||
| 558 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 559 | - * @param inputs [IN] pointer to array of input buffers | ||
| 560 | - * @param numOutputs [IN] number of outputs | ||
| 561 | - * @param outputDesc [OUT] pointer to array of output tensor descriptions | ||
| 562 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 563 | - * may pass nullptr if the op has no attribute | ||
| 564 | - * | ||
| 565 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 566 | - * @retval OtherValues Failure | ||
| 567 | - */ | ||
| 568 | -ACL_FUNC_VISIBILITY aclError aclopInferShape(const char *opType, | ||
| 569 | - int numInputs, | ||
| 570 | - aclTensorDesc *inputDesc[], | ||
| 571 | - aclDataBuffer *inputs[], | ||
| 572 | - int numOutputs, | ||
| 573 | - aclTensorDesc *outputDesc[], | ||
| 574 | - aclopAttr *attr); | ||
| 575 | - | ||
| 576 | - | ||
| 577 | - | ||
| 578 | -/** | ||
| 579 | - * @ingroup AscendCL | ||
| 580 | - * @brief Enable the dump function of the corresponding dump type. | ||
| 581 | - * | ||
| 582 | - * @param dumpType [IN] type of dump | ||
| 583 | - * @param path [IN] dump path | ||
| 584 | - * | ||
| 585 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 586 | - * @retval OtherValues Failure | ||
| 587 | - */ | ||
| 588 | -ACL_FUNC_VISIBILITY aclError aclopStartDumpArgs(uint32_t dumpType, const char *path); | ||
| 589 | - | ||
| 590 | -/** | ||
| 591 | - * @ingroup AscendCL | ||
| 592 | - * @brief Disable the dump function of the corresponding dump type. | ||
| 593 | - * | ||
| 594 | - * @param dumpType [IN] type of dump | ||
| 595 | - * | ||
| 596 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 597 | - * @retval OtherValues Failure | ||
| 598 | - */ | ||
| 599 | -ACL_FUNC_VISIBILITY aclError aclopStopDumpArgs(uint32_t dumpType); | ||
| 600 | - | ||
| 601 | - | ||
| 602 | -} | ||
| 603 | - | ||
| 604 | - | ||
| 605 | - | ||
Dthird_party/acl/inc/acl/acl_op_compiler.h+0-236
| @@ -1,236 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_op_compiler.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extern "C" { | ||
| 18 | - | ||
| 19 | - | ||
| 20 | -typedef enum aclCompileType { | ||
| 21 | - ACL_COMPILE_SYS, | ||
| 22 | - ACL_COMPILE_UNREGISTERED | ||
| 23 | -} aclopCompileType; | ||
| 24 | - | ||
| 25 | -typedef enum { | ||
| 26 | - ACL_PRECISION_MODE, | ||
| 27 | - ACL_AICORE_NUM, | ||
| 28 | - ACL_AUTO_TUNE_MODE, // The auto_tune_mode has been discarded | ||
| 29 | - ACL_OP_SELECT_IMPL_MODE, | ||
| 30 | - ACL_OPTYPELIST_FOR_IMPLMODE, | ||
| 31 | - ACL_OP_DEBUG_LEVEL, | ||
| 32 | - ACL_DEBUG_DIR, | ||
| 33 | - ACL_OP_COMPILER_CACHE_MODE, | ||
| 34 | - ACL_OP_COMPILER_CACHE_DIR, | ||
| 35 | - ACL_OP_PERFORMANCE_MODE, | ||
| 36 | - ACL_OP_JIT_COMPILE, | ||
| 37 | - ACL_OP_DETERMINISTIC, | ||
| 38 | - ACL_CUSTOMIZE_DTYPES, | ||
| 39 | - ACL_OP_PRECISION_MODE, | ||
| 40 | - ACL_ALLOW_HF32, | ||
| 41 | - ACL_PRECISION_MODE_V2, | ||
| 42 | - ACL_OP_DEBUG_OPTION | ||
| 43 | -} aclCompileOpt; | ||
| 44 | - | ||
| 45 | -typedef enum aclCompileFlag { | ||
| 46 | - ACL_OP_COMPILE_DEFAULT, | ||
| 47 | - ACL_OP_COMPILE_FUZZ | ||
| 48 | -} aclOpCompileFlag; | ||
| 49 | - | ||
| 50 | -typedef struct aclGraphDumpOption aclGraphDumpOption; | ||
| 51 | - | ||
| 52 | -/** | ||
| 53 | - * @ingroup AscendCL | ||
| 54 | - * @brief compile op | ||
| 55 | - * | ||
| 56 | - * @param opType [IN] op type | ||
| 57 | - * @param numInputs [IN] number of inputs | ||
| 58 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 59 | - * @param numOutputs [IN] number of outputs | ||
| 60 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 61 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 62 | - * may pass nullptr if the op has no attribute | ||
| 63 | - * @param engineType [IN] engine type | ||
| 64 | - * @param compileFlag [IN] compile flag | ||
| 65 | - * @param opPath [IN] path of op | ||
| 66 | - * | ||
| 67 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 68 | - * @retval OtherValues Failure | ||
| 69 | - */ | ||
| 70 | -ACL_FUNC_VISIBILITY aclError aclopCompile(const char *opType, | ||
| 71 | - int numInputs, | ||
| 72 | - const aclTensorDesc *const inputDesc[], | ||
| 73 | - int numOutputs, | ||
| 74 | - const aclTensorDesc *const outputDesc[], | ||
| 75 | - const aclopAttr *attr, | ||
| 76 | - aclopEngineType engineType, | ||
| 77 | - aclopCompileType compileFlag, | ||
| 78 | - const char *opPath); | ||
| 79 | - | ||
| 80 | -/** | ||
| 81 | - * @ingroup AscendCL | ||
| 82 | - * @brief compile and execute op | ||
| 83 | - * | ||
| 84 | - * @param opType [IN] op type | ||
| 85 | - * @param numInputs [IN] number of inputs | ||
| 86 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 87 | - * @param inputs [IN] pointer to array of input buffers | ||
| 88 | - * @param numOutputs [IN] number of outputs | ||
| 89 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 90 | - * @param outputs [IN] pointer to array of outputs buffers | ||
| 91 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 92 | - * may pass nullptr if the op has no attribute | ||
| 93 | - * @param engineType [IN] engine type | ||
| 94 | - * @param compileFlag [IN] compile flag | ||
| 95 | - * @param opPath [IN] path of op | ||
| 96 | - * @param stream [IN] stream handle | ||
| 97 | - * | ||
| 98 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 99 | - * @retval OtherValues Failure | ||
| 100 | - */ | ||
| 101 | -ACL_FUNC_VISIBILITY aclError aclopCompileAndExecute(const char *opType, | ||
| 102 | - int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[], | ||
| 103 | - int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], | ||
| 104 | - const aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, | ||
| 105 | - const char *opPath, aclrtStream stream); | ||
| 106 | - | ||
| 107 | - | ||
| 108 | -/** | ||
| 109 | - * @ingroup AscendCL | ||
| 110 | - * @brief compile and execute op | ||
| 111 | - * | ||
| 112 | - * @param opType [IN] op type | ||
| 113 | - * @param numInputs [IN] number of inputs | ||
| 114 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 115 | - * @param inputs [IN] pointer to array of input buffers | ||
| 116 | - * @param numOutputs [IN] number of outputs | ||
| 117 | - * @param outputDesc [IN|OUT] pointer to array of output tensor descriptions | ||
| 118 | - * @param outputs [IN] pointer to array of outputs buffers | ||
| 119 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 120 | - * may pass nullptr if the op has no attribute | ||
| 121 | - * @param engineType [IN] engine type | ||
| 122 | - * @param compileFlag [IN] compile flag | ||
| 123 | - * @param opPath [IN] path of op | ||
| 124 | - * @param stream [IN] stream handle | ||
| 125 | - * | ||
| 126 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 127 | - * @retval OtherValues Failure | ||
| 128 | - */ | ||
| 129 | -ACL_FUNC_VISIBILITY aclError aclopCompileAndExecuteV2(const char *opType, | ||
| 130 | - int numInputs, aclTensorDesc *inputDesc[], aclDataBuffer *inputs[], | ||
| 131 | - int numOutputs, aclTensorDesc *outputDesc[], aclDataBuffer *outputs[], | ||
| 132 | - aclopAttr *attr, aclopEngineType engineType, aclopCompileType compileFlag, | ||
| 133 | - const char *opPath, aclrtStream stream); | ||
| 134 | - | ||
| 135 | -/** | ||
| 136 | - * @ingroup AscendCL | ||
| 137 | - * @brief set compile option | ||
| 138 | - * | ||
| 139 | - * @param aclCompileOpt [IN] compile option | ||
| 140 | - * @param value [IN] pointer for the option value | ||
| 141 | - * | ||
| 142 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 143 | - * @retval OtherValues Failure | ||
| 144 | - */ | ||
| 145 | -ACL_FUNC_VISIBILITY aclError aclSetCompileopt(aclCompileOpt opt, const char *value); | ||
| 146 | - | ||
| 147 | -/** | ||
| 148 | - * @ingroup AscendCL | ||
| 149 | - * @brief get compile option value size | ||
| 150 | - * | ||
| 151 | - * @param aclCompileOpt [IN] compile option | ||
| 152 | - * | ||
| 153 | - * @retval size of compile option value | ||
| 154 | - */ | ||
| 155 | -ACL_FUNC_VISIBILITY size_t aclGetCompileoptSize(aclCompileOpt opt); | ||
| 156 | - | ||
| 157 | -/** | ||
| 158 | - * @ingroup AscendCL | ||
| 159 | - * @brief get compile option | ||
| 160 | - * | ||
| 161 | - * @param aclCompileOpt [IN] compile option | ||
| 162 | - * @param value [OUT] pointer for the option value | ||
| 163 | - * @param length [IN] length of value | ||
| 164 | - * | ||
| 165 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 166 | - * @retval OtherValues Failure | ||
| 167 | - */ | ||
| 168 | -ACL_FUNC_VISIBILITY aclError aclGetCompileopt(aclCompileOpt opt, char *value, size_t length); | ||
| 169 | - | ||
| 170 | -/** | ||
| 171 | - * @ingroup AscendCL | ||
| 172 | - * @brief set compile flag | ||
| 173 | - * | ||
| 174 | - * @param flag [IN] compile flag, ACL_OP_COMPILE_DEFAULT means compile with default mode | ||
| 175 | - * ACL_OP_COMPILE_FUZZ means compile with fuzz mode | ||
| 176 | - * | ||
| 177 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 178 | - * @retval OtherValues Failure | ||
| 179 | - */ | ||
| 180 | -ACL_FUNC_VISIBILITY aclError aclopSetCompileFlag(aclOpCompileFlag flag); | ||
| 181 | - | ||
| 182 | -/** | ||
| 183 | - * @ingroup AscendCL | ||
| 184 | - * @brief generate graph and dump | ||
| 185 | - * | ||
| 186 | - * @param opType [IN] op type | ||
| 187 | - * @param numInputs [IN] number of inputs | ||
| 188 | - * @param inputDesc [IN] pointer to array of input tensor descriptions | ||
| 189 | - * @param inputs [IN] pointer to array of input buffers | ||
| 190 | - * @param numOutputs [IN] number of outputs | ||
| 191 | - * @param outputDesc [IN] pointer to array of output tensor descriptions | ||
| 192 | - * @param outputs [IN] pointer to array of outputs buffers | ||
| 193 | - * @param attr [IN] pointer to instance of aclopAttr. | ||
| 194 | - * may pass nullptr if the op has no attribute | ||
| 195 | - * @param engineType [IN] engine type | ||
| 196 | - * @param graphDumpPath [IN] dump path, if the suffix is ".txt", it means file path, else it means directory path | ||
| 197 | - * @param graphDumpOpt [IN] dump option, nullptr is supported | ||
| 198 | - * | ||
| 199 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 200 | - * @retval OtherValues Failure | ||
| 201 | - */ | ||
| 202 | -ACL_FUNC_VISIBILITY aclError aclGenGraphAndDumpForOp(const char *opType, | ||
| 203 | - int numInputs, const aclTensorDesc *const inputDesc[], const aclDataBuffer *const inputs[], | ||
| 204 | - int numOutputs, const aclTensorDesc *const outputDesc[], aclDataBuffer *const outputs[], | ||
| 205 | - const aclopAttr *attr, aclopEngineType engineType, | ||
| 206 | - const char *graphDumpPath, const aclGraphDumpOption *graphDumpOpt); | ||
| 207 | - | ||
| 208 | -/** | ||
| 209 | - * @ingroup AscendCL | ||
| 210 | - * @brief Create the graph dump option | ||
| 211 | - * | ||
| 212 | - * @retval null for failed | ||
| 213 | - * @retval OtherValues success | ||
| 214 | - * | ||
| 215 | - * @see aclDestroyGraphDumpOpt | ||
| 216 | - */ | ||
| 217 | -ACL_FUNC_VISIBILITY aclGraphDumpOption *aclCreateGraphDumpOpt(); | ||
| 218 | - | ||
| 219 | -/** | ||
| 220 | - * @ingroup AscendCL | ||
| 221 | - * @brief Destroy graph dump option | ||
| 222 | - * | ||
| 223 | - * @param graphDumpOpt [IN] pointer to the graph dump option | ||
| 224 | - * | ||
| 225 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 226 | - * @retval OtherValues Failure | ||
| 227 | - * | ||
| 228 | - * @see aclCreateGraphDumpOpt | ||
| 229 | - */ | ||
| 230 | -ACL_FUNC_VISIBILITY aclError aclDestroyGraphDumpOpt(const aclGraphDumpOption *graphDumpOpt); | ||
| 231 | - | ||
| 232 | - | ||
| 233 | -} | ||
| 234 | - | ||
| 235 | - | ||
| 236 | - | ||
Dthird_party/acl/inc/acl/acl_prof.h+0-489
| @@ -1,489 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_prof.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | -extern "C" { | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | -/** | ||
| 40 | - * @deprecated please use aclprofGetOpTypeLen and aclprofGetOpTNameLen instead | ||
| 41 | - */ | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | -typedef enum { | ||
| 46 | - ACL_AICORE_ARITHMETIC_UTILIZATION = 0, | ||
| 47 | - ACL_AICORE_PIPE_UTILIZATION = 1, | ||
| 48 | - ACL_AICORE_MEMORY_BANDWIDTH = 2, | ||
| 49 | - ACL_AICORE_L0B_AND_WIDTH = 3, | ||
| 50 | - ACL_AICORE_RESOURCE_CONFLICT_RATIO = 4, | ||
| 51 | - ACL_AICORE_MEMORY_UB = 5, | ||
| 52 | - ACL_AICORE_L2_CACHE = 6, | ||
| 53 | - ACL_AICORE_PIPE_EXECUTE_UTILIZATION = 7, | ||
| 54 | - ACL_AICORE_MEMORY_ACCESS = 8, | ||
| 55 | - ACL_AICORE_NONE = 0xFF | ||
| 56 | -} aclprofAicoreMetrics; | ||
| 57 | - | ||
| 58 | -typedef enum { | ||
| 59 | - ACL_STEP_START = 0, // step start | ||
| 60 | - ACL_STEP_END = 1 // step end | ||
| 61 | -} aclprofStepTag; | ||
| 62 | - | ||
| 63 | -typedef enum { | ||
| 64 | - ACL_PROF_ARGS_MIN = 0, | ||
| 65 | - ACL_PROF_STORAGE_LIMIT, | ||
| 66 | - ACL_PROF_AIV_METRICS, | ||
| 67 | - ACL_PROF_SYS_HARDWARE_MEM_FREQ, | ||
| 68 | - ACL_PROF_LLC_MODE, | ||
| 69 | - ACL_PROF_SYS_IO_FREQ, | ||
| 70 | - ACL_PROF_SYS_INTERCONNECTION_FREQ, | ||
| 71 | - ACL_PROF_DVPP_FREQ, | ||
| 72 | - ACL_PROF_HOST_SYS, | ||
| 73 | - ACL_PROF_HOST_SYS_USAGE, | ||
| 74 | - ACL_PROF_HOST_SYS_USAGE_FREQ, | ||
| 75 | - ACL_PROF_ARGS_MAX | ||
| 76 | -} aclprofConfigType; | ||
| 77 | - | ||
| 78 | -typedef struct aclprofConfig aclprofConfig; | ||
| 79 | -typedef struct aclprofStopConfig aclprofStopConfig; | ||
| 80 | -typedef struct aclprofAicoreEvents aclprofAicoreEvents; | ||
| 81 | -typedef struct aclprofSubscribeConfig aclprofSubscribeConfig; | ||
| 82 | -typedef struct aclprofStepInfo aclprofStepInfo; | ||
| 83 | - | ||
| 84 | -/** | ||
| 85 | - * @ingroup AscendCL | ||
| 86 | - * @brief profiling initialize | ||
| 87 | - * | ||
| 88 | - * @param profilerResultPath [IN] path of profiling result | ||
| 89 | - * @param length [IN] length of profilerResultPath | ||
| 90 | - * | ||
| 91 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 92 | - * @retval OtherValues Failure | ||
| 93 | - * | ||
| 94 | - * @see aclprofFinalize | ||
| 95 | - */ | ||
| 96 | -MSVP_PROF_API aclError aclprofInit(const char *profilerResultPath, size_t length); | ||
| 97 | - | ||
| 98 | -/** | ||
| 99 | - * @ingroup AscendCL | ||
| 100 | - * @brief set config value | ||
| 101 | - * | ||
| 102 | - * @param configType [IN] config type | ||
| 103 | - * @param val [IN] pointer to config | ||
| 104 | - * @param valLen [IN] length of config | ||
| 105 | - * | ||
| 106 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 107 | - * @retval OtherValues Failure | ||
| 108 | - * | ||
| 109 | - * @see aclprofSetConfig | ||
| 110 | - */ | ||
| 111 | -MSVP_PROF_API aclError aclprofSetConfig(aclprofConfigType configType, const char *config, size_t configLength); | ||
| 112 | - | ||
| 113 | -/** | ||
| 114 | - * @ingroup AscendCL | ||
| 115 | - * @brief profiling finalize | ||
| 116 | - * | ||
| 117 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 118 | - * @retval OtherValues Failure | ||
| 119 | - * | ||
| 120 | - * @see aclprofInit | ||
| 121 | - */ | ||
| 122 | -MSVP_PROF_API aclError aclprofFinalize(); | ||
| 123 | - | ||
| 124 | -/** | ||
| 125 | - * @ingroup AscendCL | ||
| 126 | - * @brief Start profiling modules by profilerConfig | ||
| 127 | - * | ||
| 128 | - * @param profilerConfig [IN] config of profiling | ||
| 129 | - * | ||
| 130 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 131 | - * @retval OtherValues Failure | ||
| 132 | - * | ||
| 133 | - * @see aclprofStop | ||
| 134 | - */ | ||
| 135 | -MSVP_PROF_API aclError aclprofStart(const aclprofConfig *profilerConfig); | ||
| 136 | - | ||
| 137 | -/** | ||
| 138 | - * @ingroup AscendCL | ||
| 139 | - * @brief Create data of type aclprofConfig | ||
| 140 | - * | ||
| 141 | - * @param deviceIdList [IN] list of device id | ||
| 142 | - * @param deviceNums [IN] number of devices | ||
| 143 | - * @param aicoreMetrics [IN] type of aicore metrics | ||
| 144 | - * @param aicoreEvents [IN] pointer to aicore events, only support NULL now | ||
| 145 | - * @param dataTypeConfig [IN] config modules need profiling | ||
| 146 | - * | ||
| 147 | - * @retval the aclprofConfig pointer | ||
| 148 | - * | ||
| 149 | - * @see aclprofDestroyConfig | ||
| 150 | - */ | ||
| 151 | -MSVP_PROF_API aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdList, uint32_t deviceNums, | ||
| 152 | - aclprofAicoreMetrics aicoreMetrics, const aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig); | ||
| 153 | - | ||
| 154 | -/** | ||
| 155 | - * @ingroup AscendCL | ||
| 156 | - * @brief Destroy data of type aclprofConfig | ||
| 157 | - * | ||
| 158 | - * @param profilerConfig [IN] config of profiling | ||
| 159 | - * | ||
| 160 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 161 | - * @retval OtherValues Failure | ||
| 162 | - * | ||
| 163 | - * @see aclprofCreateConfig | ||
| 164 | - */ | ||
| 165 | -MSVP_PROF_API aclError aclprofDestroyConfig(const aclprofConfig *profilerConfig); | ||
| 166 | - | ||
| 167 | -/** | ||
| 168 | - * @ingroup AscendCL | ||
| 169 | - * @brief stop profiling modules by stopProfilingConfig | ||
| 170 | - * | ||
| 171 | - * @param profilerConfig [IN] pointer to stop config of profiling | ||
| 172 | - * | ||
| 173 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 174 | - * @retval OtherValues Failure | ||
| 175 | - * | ||
| 176 | - * @see aclprofStart | ||
| 177 | - */ | ||
| 178 | -MSVP_PROF_API aclError aclprofStop(const aclprofConfig *profilerConfig); | ||
| 179 | - | ||
| 180 | -/** | ||
| 181 | - * @ingroup AscendCL | ||
| 182 | - * @brief subscribe profiling data of model | ||
| 183 | - * | ||
| 184 | - * @param modelId [IN] the model id subscribed | ||
| 185 | - * @param profSubscribeConfig [IN] pointer to config of model subscribe | ||
| 186 | - * | ||
| 187 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 188 | - * @retval OtherValues Failure | ||
| 189 | - * | ||
| 190 | - * @see aclprofModelUnSubscribe | ||
| 191 | - */ | ||
| 192 | -MSVP_PROF_API aclError aclprofModelSubscribe(uint32_t modelId, | ||
| 193 | - const aclprofSubscribeConfig *profSubscribeConfig); | ||
| 194 | - | ||
| 195 | -/** | ||
| 196 | - * @ingroup AscendCL | ||
| 197 | - * @brief unsubscribe profiling data of model | ||
| 198 | - * | ||
| 199 | - * @param modelId [IN] the model id unsubscribed | ||
| 200 | - * | ||
| 201 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 202 | - * @retval OtherValues Failure | ||
| 203 | - * | ||
| 204 | - * @see aclprofModelSubscribe | ||
| 205 | - */ | ||
| 206 | -MSVP_PROF_API aclError aclprofModelUnSubscribe(uint32_t modelId); | ||
| 207 | - | ||
| 208 | -/** | ||
| 209 | - * @ingroup AscendCL | ||
| 210 | - * @brief create subscribe config | ||
| 211 | - * | ||
| 212 | - * @param timeInfoSwitch [IN] switch whether get time info from model | ||
| 213 | - * @param aicoreMetrics [IN] aicore metrics | ||
| 214 | - * @param fd [IN] pointer to write pipe | ||
| 215 | - * | ||
| 216 | - * @retval the aclprofSubscribeConfig pointer | ||
| 217 | - * | ||
| 218 | - * @see aclprofDestroySubscribeConfig | ||
| 219 | - */ | ||
| 220 | -MSVP_PROF_API aclprofSubscribeConfig *aclprofCreateSubscribeConfig(int8_t timeInfoSwitch, | ||
| 221 | - aclprofAicoreMetrics aicoreMetrics, void *fd); | ||
| 222 | - | ||
| 223 | -/** | ||
| 224 | - * @ingroup AscendCL | ||
| 225 | - * @brief destroy subscribe config | ||
| 226 | - * | ||
| 227 | - * @param profSubscribeConfig [IN] subscribe config | ||
| 228 | - * | ||
| 229 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 230 | - * @retval OtherValues Failure | ||
| 231 | - * | ||
| 232 | - * @see aclprofCreateSubscribeConfig | ||
| 233 | - */ | ||
| 234 | -MSVP_PROF_API aclError aclprofDestroySubscribeConfig(const aclprofSubscribeConfig *profSubscribeConfig); | ||
| 235 | - | ||
| 236 | -/** | ||
| 237 | - * @ingroup AscendCL | ||
| 238 | - * @brief create subscribe config | ||
| 239 | - * | ||
| 240 | - * @param opDescSize [OUT] size of op desc | ||
| 241 | - * | ||
| 242 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 243 | - * @retval OtherValues Failure | ||
| 244 | - */ | ||
| 245 | -MSVP_PROF_API aclError aclprofGetOpDescSize(size_t *opDescSize); | ||
| 246 | - | ||
| 247 | -/** | ||
| 248 | - * @ingroup AscendCL | ||
| 249 | - * @brief get op number from subscription data | ||
| 250 | - * | ||
| 251 | - * @param opInfo [IN] pointer to subscription data | ||
| 252 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 253 | - * @param opNumber [OUT] op number of subscription data | ||
| 254 | - * | ||
| 255 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 256 | - * @retval OtherValues Failure | ||
| 257 | - */ | ||
| 258 | -MSVP_PROF_API aclError aclprofGetOpNum(const void *opInfo, size_t opInfoLen, uint32_t *opNumber); | ||
| 259 | - | ||
| 260 | -/** | ||
| 261 | - * @ingroup AscendCL | ||
| 262 | - * @brief get length op type from subscription data | ||
| 263 | - * | ||
| 264 | - * @param opInfo [IN] pointer to subscription data | ||
| 265 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 266 | - * @param index [IN] index of op array in opInfo | ||
| 267 | - * @param opTypeLen [OUT] actual length of op type string | ||
| 268 | - * | ||
| 269 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 270 | - * @retval OtherValues Failure | ||
| 271 | - */ | ||
| 272 | -MSVP_PROF_API aclError aclprofGetOpTypeLen(const void *opInfo, size_t opInfoLen, uint32_t index, | ||
| 273 | - size_t *opTypeLen); | ||
| 274 | - | ||
| 275 | -/** | ||
| 276 | - * @ingroup AscendCL | ||
| 277 | - * @brief get op type from subscription data | ||
| 278 | - * | ||
| 279 | - * @param opInfo [IN] pointer to subscription data | ||
| 280 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 281 | - * @param index [IN] index of op array in opInfo | ||
| 282 | - * @param opType [OUT] obtained op type string | ||
| 283 | - * @param opTypeLen [IN] obtained length of op type string | ||
| 284 | - * | ||
| 285 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 286 | - * @retval OtherValues Failure | ||
| 287 | - */ | ||
| 288 | -MSVP_PROF_API aclError aclprofGetOpType(const void *opInfo, size_t opInfoLen, uint32_t index, | ||
| 289 | - char *opType, size_t opTypeLen); | ||
| 290 | - | ||
| 291 | -/** | ||
| 292 | - * @ingroup AscendCL | ||
| 293 | - * @brief get length op name from subscription data | ||
| 294 | - * | ||
| 295 | - * @param opInfo [IN] pointer to subscription data | ||
| 296 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 297 | - * @param index [IN] index of op array in opInfo | ||
| 298 | - * @param opNameLen [OUT] actual length of op name string | ||
| 299 | - * | ||
| 300 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 301 | - * @retval OtherValues Failure | ||
| 302 | - */ | ||
| 303 | -MSVP_PROF_API aclError aclprofGetOpNameLen(const void *opInfo, size_t opInfoLen, uint32_t index, | ||
| 304 | - size_t *opNameLen); | ||
| 305 | - | ||
| 306 | -/** | ||
| 307 | - * @ingroup AscendCL | ||
| 308 | - * @brief get op type from subscription data | ||
| 309 | - * | ||
| 310 | - * @param opInfo [IN] pointer to subscription data | ||
| 311 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 312 | - * @param index [IN] index of op array in opInfo | ||
| 313 | - * @param opName [OUT] obtained op name string | ||
| 314 | - * @param opNameLen [IN] obtained length of op name string | ||
| 315 | - * | ||
| 316 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 317 | - * @retval OtherValues Failure | ||
| 318 | - */ | ||
| 319 | -MSVP_PROF_API aclError aclprofGetOpName(const void *opInfo, size_t opInfoLen, uint32_t index, | ||
| 320 | - char *opName, size_t opNameLen); | ||
| 321 | - | ||
| 322 | -/** | ||
| 323 | - * @ingroup AscendCL | ||
| 324 | - * @brief get start time of specified op from subscription data | ||
| 325 | - * | ||
| 326 | - * @param opInfo [IN] pointer to subscription data | ||
| 327 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 328 | - * @param index [IN] index of op array in opInfo | ||
| 329 | - * | ||
| 330 | - * @retval start time(us) of specified op with timestamp | ||
| 331 | - * @retval 0 for failed | ||
| 332 | - */ | ||
| 333 | -MSVP_PROF_API uint64_t aclprofGetOpStart(const void *opInfo, size_t opInfoLen, uint32_t index); | ||
| 334 | - | ||
| 335 | -/** | ||
| 336 | - * @ingroup AscendCL | ||
| 337 | - * @brief get end time of specified op from subscription data | ||
| 338 | - * | ||
| 339 | - * @param opInfo [IN] pointer to subscription data | ||
| 340 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 341 | - * @param index [IN] index of op array in opInfo | ||
| 342 | - * | ||
| 343 | - * @retval end time(us) of specified op with timestamp | ||
| 344 | - * @retval 0 for failed | ||
| 345 | - */ | ||
| 346 | -MSVP_PROF_API uint64_t aclprofGetOpEnd(const void *opInfo, size_t opInfoLen, uint32_t index); | ||
| 347 | - | ||
| 348 | -/** | ||
| 349 | - * @ingroup AscendCL | ||
| 350 | - * @brief get excution time of specified op from subscription data | ||
| 351 | - * | ||
| 352 | - * @param opInfo [IN] pointer to subscription data | ||
| 353 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 354 | - * @param index [IN] index of op array in opInfo | ||
| 355 | - * | ||
| 356 | - * @retval execution time(us) of specified op with timestamp | ||
| 357 | - * @retval 0 for failed | ||
| 358 | - */ | ||
| 359 | -MSVP_PROF_API uint64_t aclprofGetOpDuration(const void *opInfo, size_t opInfoLen, uint32_t index); | ||
| 360 | - | ||
| 361 | -/** | ||
| 362 | - * @ingroup AscendCL | ||
| 363 | - * @brief get model id from subscription data | ||
| 364 | - * | ||
| 365 | - * @param opInfo [IN] pointer to subscription data | ||
| 366 | - * @param opInfoLen [IN] memory size of subscription data | ||
| 367 | - * | ||
| 368 | - * @retval model id of subscription data | ||
| 369 | - * @retval 0 for failed | ||
| 370 | - */ | ||
| 371 | -MSVP_PROF_API size_t aclprofGetModelId(const void *opInfo, size_t opInfoLen, uint32_t index); | ||
| 372 | - | ||
| 373 | -/** | ||
| 374 | - * @ingroup AscendCL | ||
| 375 | - * @brief | ||
| 376 | - * | ||
| 377 | - * @param stepInfo [IN] pointer to stepInfo data | ||
| 378 | - * @param aclprofstepTag [IN] start or end flag | ||
| 379 | - * @param stream [IN] steam info | ||
| 380 | - * | ||
| 381 | - * @retval 0 for failed | ||
| 382 | - */ | ||
| 383 | -MSVP_PROF_API aclError aclprofGetStepTimestamp(aclprofStepInfo* stepInfo, aclprofStepTag tag, aclrtStream stream); | ||
| 384 | - | ||
| 385 | - /** | ||
| 386 | - * @ingroup AscendCL | ||
| 387 | - * @brief create pointer to aclprofStepInfo data | ||
| 388 | - * | ||
| 389 | - * | ||
| 390 | - * @retval aclprofStepInfo pointer | ||
| 391 | - */ | ||
| 392 | -MSVP_PROF_API aclprofStepInfo* aclprofCreateStepInfo(); | ||
| 393 | - | ||
| 394 | - /** | ||
| 395 | - * @ingroup AscendCL | ||
| 396 | - * @brief destroy aclprofStepInfo pointer | ||
| 397 | - * | ||
| 398 | - * | ||
| 399 | - * @retval void | ||
| 400 | - */ | ||
| 401 | -MSVP_PROF_API void aclprofDestroyStepInfo(aclprofStepInfo* stepinfo); | ||
| 402 | - | ||
| 403 | -/** | ||
| 404 | -* @ingroup AscendCL | ||
| 405 | -* @brief create pointer to aclprofstamp | ||
| 406 | -* | ||
| 407 | -* | ||
| 408 | -* @retval aclprofStamp pointer | ||
| 409 | -*/ | ||
| 410 | -MSVP_PROF_API void *aclprofCreateStamp(); | ||
| 411 | - | ||
| 412 | -/** | ||
| 413 | -* @ingroup AscendCL | ||
| 414 | -* @brief destory stamp pointer | ||
| 415 | -* | ||
| 416 | -* | ||
| 417 | -* @retval void | ||
| 418 | -*/ | ||
| 419 | -MSVP_PROF_API void aclprofDestroyStamp(void *stamp); | ||
| 420 | - | ||
| 421 | -/** | ||
| 422 | -* @ingroup AscendCL | ||
| 423 | -* @brief Record push timestamp | ||
| 424 | -* | ||
| 425 | -* @retval ACL_SUCCESS The function is successfully executed. | ||
| 426 | -* @retval OtherValues Failure | ||
| 427 | -*/ | ||
| 428 | -MSVP_PROF_API aclError aclprofPush(void *stamp); | ||
| 429 | - | ||
| 430 | -/** | ||
| 431 | -* @ingroup AscendCL | ||
| 432 | -* @brief Record pop timestamp | ||
| 433 | -* | ||
| 434 | -* | ||
| 435 | -* @retval ACL_SUCCESS The function is successfully executed. | ||
| 436 | -* @retval OtherValues Failure | ||
| 437 | -*/ | ||
| 438 | -MSVP_PROF_API aclError aclprofPop(); | ||
| 439 | - | ||
| 440 | -/** | ||
| 441 | -* @ingroup AscendCL | ||
| 442 | -* @brief Record range start timestamp | ||
| 443 | -* | ||
| 444 | -* @retval ACL_SUCCESS The function is successfully executed. | ||
| 445 | -* @retval OtherValues Failure | ||
| 446 | -*/ | ||
| 447 | -MSVP_PROF_API aclError aclprofRangeStart(void *stamp, uint32_t *rangeId); | ||
| 448 | - | ||
| 449 | -/** | ||
| 450 | -* @ingroup AscendCL | ||
| 451 | -* @brief Record range end timestamp | ||
| 452 | -* | ||
| 453 | -* @retval ACL_SUCCESS The function is successfully executed. | ||
| 454 | -* @retval OtherValues Failure | ||
| 455 | -*/ | ||
| 456 | -MSVP_PROF_API aclError aclprofRangeStop(uint32_t rangeId); | ||
| 457 | - | ||
| 458 | -/** | ||
| 459 | -* @ingroup AscendCL | ||
| 460 | -* @brief set message to stamp | ||
| 461 | -* | ||
| 462 | -* | ||
| 463 | -* @retval void | ||
| 464 | -*/ | ||
| 465 | -MSVP_PROF_API aclError aclprofSetStampTraceMessage(void *stamp, const char *msg, uint32_t msgLen); | ||
| 466 | - | ||
| 467 | -/** | ||
| 468 | -* @ingroup AscendCL | ||
| 469 | -* @brief Record mark timestamp | ||
| 470 | -* | ||
| 471 | -* @retval ACL_SUCCESS The function is successfully executed. | ||
| 472 | -* @retval OtherValues Failure | ||
| 473 | -*/ | ||
| 474 | -MSVP_PROF_API aclError aclprofMark(void *stamp); | ||
| 475 | - | ||
| 476 | -/** | ||
| 477 | -* @ingroup AscendCL | ||
| 478 | -* @brief Record markEx timestamp | ||
| 479 | -* | ||
| 480 | -* @retval ACL_SUCCESS The function is successfully executed. | ||
| 481 | -* @retval OtherValues Failure | ||
| 482 | -*/ | ||
| 483 | -MSVP_PROF_API aclError aclprofMarkEx(const char *msg, size_t msgLen, aclrtStream stream); | ||
| 484 | - | ||
| 485 | - | ||
| 486 | -} | ||
| 487 | - | ||
| 488 | - | ||
| 489 | - | ||
Dthird_party/acl/inc/acl/acl_rt.h+0-2450
Dthird_party/acl/inc/acl/acl_rt_allocator.h+0-148
| @@ -1,148 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_rt_allocator.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -extern "C" { | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -typedef void *aclrtAllocatorDesc; | ||
| 20 | -typedef void *aclrtAllocator; | ||
| 21 | -typedef void *aclrtAllocatorBlock; | ||
| 22 | -typedef void *aclrtAllocatorAddr; | ||
| 23 | - | ||
| 24 | -typedef void *(*aclrtAllocatorAllocFunc)(aclrtAllocator allocator, size_t size); | ||
| 25 | -typedef void (*aclrtAllocatorFreeFunc)(aclrtAllocator allocator, aclrtAllocatorBlock block); | ||
| 26 | -typedef void *(*aclrtAllocatorAllocAdviseFunc)(aclrtAllocator allocator, size_t size, aclrtAllocatorAddr addr); | ||
| 27 | -typedef void *(*aclrtAllocatorGetAddrFromBlockFunc)(aclrtAllocatorBlock block); | ||
| 28 | - | ||
| 29 | -/** | ||
| 30 | - * @ingroup AscendCL | ||
| 31 | - * @brief Create allocator description | ||
| 32 | - * | ||
| 33 | - * @retval null for failed | ||
| 34 | - * @retval OtherValues success | ||
| 35 | - * | ||
| 36 | - * @see aclrtAllocatorDestroyDesc | ||
| 37 | - */ | ||
| 38 | -ACL_FUNC_VISIBILITY aclrtAllocatorDesc aclrtAllocatorCreateDesc(); | ||
| 39 | - | ||
| 40 | -/** | ||
| 41 | - * @ingroup AscendCL | ||
| 42 | - * @brief Relese allocator description | ||
| 43 | - * | ||
| 44 | - * @param allocatorDesc [IN] allocator description | ||
| 45 | - * | ||
| 46 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 47 | - * @retval OtherValues Failure | ||
| 48 | - * | ||
| 49 | - * @see aclrtAllocatorCreateDesc | ||
| 50 | - */ | ||
| 51 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorDestroyDesc(aclrtAllocatorDesc allocatorDesc); | ||
| 52 | - | ||
| 53 | -/** | ||
| 54 | - * @ingroup AscendCL | ||
| 55 | - * @brief Register allocator object to allocator description | ||
| 56 | - * | ||
| 57 | - * @param allocatorDesc [IN] allocator description | ||
| 58 | - * @param allocator [IN] allocator object handle | ||
| 59 | - * | ||
| 60 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 61 | - * @retval OtherValues Failure | ||
| 62 | - */ | ||
| 63 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetObjToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocator allocator); | ||
| 64 | - | ||
| 65 | -/** | ||
| 66 | - * @ingroup AscendCL | ||
| 67 | - * @brief Register the function pointer of alloc memory to the allocator description | ||
| 68 | - * | ||
| 69 | - * @param allocatorDesc [IN] allocator description | ||
| 70 | - * @param func [IN] the function pointer of alloc memory | ||
| 71 | - * | ||
| 72 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 73 | - * @retval OtherValues Failure | ||
| 74 | - */ | ||
| 75 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetAllocFuncToDesc(aclrtAllocatorDesc allocatorDesc, | ||
| 76 | - aclrtAllocatorAllocFunc func); | ||
| 77 | - | ||
| 78 | -/** | ||
| 79 | - * @ingroup AscendCL | ||
| 80 | - * @brief Register the function pointer of free memory to the allocator description | ||
| 81 | - * | ||
| 82 | - * @param allocatorDesc [IN] allocator description | ||
| 83 | - * @param func [IN] free memory function pointer | ||
| 84 | - * | ||
| 85 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 86 | - * @retval OtherValues Failure | ||
| 87 | - */ | ||
| 88 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetFreeFuncToDesc(aclrtAllocatorDesc allocatorDesc, | ||
| 89 | - aclrtAllocatorFreeFunc func); | ||
| 90 | - | ||
| 91 | -/** | ||
| 92 | - * @ingroup AscendCL | ||
| 93 | - * @brief Register the function pointer of alloc suggested memory to the allocator description | ||
| 94 | - * | ||
| 95 | - * @param allocatorDesc [IN] allocator description | ||
| 96 | - * @param func [IN] the function pointer of alloc suggested memory | ||
| 97 | - * | ||
| 98 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 99 | - * @retval OtherValues Failure | ||
| 100 | - */ | ||
| 101 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetAllocAdviseFuncToDesc(aclrtAllocatorDesc allocatorDesc, | ||
| 102 | - aclrtAllocatorAllocAdviseFunc func); | ||
| 103 | - | ||
| 104 | -/** | ||
| 105 | - * @ingroup AscendCL | ||
| 106 | - * @brief Register the function pointer of get address from block to the allocator description | ||
| 107 | - * | ||
| 108 | - * @param allocatorDesc [IN] allocator description | ||
| 109 | - * @param func [IN] the function pointer of get address from block | ||
| 110 | - * | ||
| 111 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 112 | - * @retval OtherValues Failure | ||
| 113 | - */ | ||
| 114 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorSetGetAddrFromBlockFuncToDesc(aclrtAllocatorDesc allocatorDesc, | ||
| 115 | - aclrtAllocatorGetAddrFromBlockFunc func); | ||
| 116 | - | ||
| 117 | -/** | ||
| 118 | - * @ingroup AscendCL | ||
| 119 | - * @brief Register allocator description to acl by stream | ||
| 120 | - * | ||
| 121 | - * @param stream [IN] stream handle | ||
| 122 | - * @param allocatorDesc [IN] allocator description | ||
| 123 | - * | ||
| 124 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 125 | - * @retval OtherValues Failure | ||
| 126 | - * | ||
| 127 | - * @see aclrtAllocatorUnregister | ||
| 128 | - */ | ||
| 129 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorRegister(aclrtStream stream, aclrtAllocatorDesc allocatorDesc); | ||
| 130 | - | ||
| 131 | -/** | ||
| 132 | - * @ingroup AscendCL | ||
| 133 | - * @brief Unregister allocator description from acl by stream | ||
| 134 | - * | ||
| 135 | - * @param stream [IN] stream handle | ||
| 136 | - * | ||
| 137 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 138 | - * @retval OtherValues Failure | ||
| 139 | - * | ||
| 140 | - * @see aclrtAllocatorRegister | ||
| 141 | - */ | ||
| 142 | -ACL_FUNC_VISIBILITY aclError aclrtAllocatorUnregister(aclrtStream stream); | ||
| 143 | - | ||
| 144 | - | ||
| 145 | -} | ||
| 146 | - | ||
| 147 | - | ||
| 148 | - | ||
Dthird_party/acl/inc/acl/acl_sk.h+0-132
| @@ -1,132 +0,0 @@ | |||
| 1 | - | ||
| 2 | - | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - | ||
| 6 | - | ||
| 7 | - | ||
| 8 | -enum class aclskOptionType : uint32_t { | ||
| 9 | - PRELOAD_CODE = 0, | ||
| 10 | - SPLIT_MODE = 1, | ||
| 11 | - STREAM_FUSION = 2, | ||
| 12 | - DCCI_DISABLE_ON_KERNEL = 3, | ||
| 13 | - DEBUG_SYNC_ALL = 4, | ||
| 14 | - KERNEL_MAP = 5, | ||
| 15 | - CONSTANT_CODEGEN = 6, // 常量化代码生成选项 | ||
| 16 | - AUTO_OP_PARALLEL = 7, // 优化多流算子排布 | ||
| 17 | - DCCI_BEFORE_KERNEL_START = 8, | ||
| 18 | - DEBUG_OP_EXEC_TRACE = 9, | ||
| 19 | - DEBUG_CROSS_CORE_SYNC_CHECK = 10, | ||
| 20 | - OPT_EXTEND_OPTION = 11, // 扩展选项,预留后续使用 | ||
| 21 | - DEBUG_EXTEND_OPTION = 12, // 扩展选项,预留后续使用 | ||
| 22 | - DCCI_AFTER_KERNEL_END = 13, | ||
| 23 | - AGGRESSIVE_OPT_STRATEGIES = 14, // value memory wait breaker policy | ||
| 24 | - SK_OPTION_MAX = 0xFFFFFFFF | ||
| 25 | -}; | ||
| 26 | - | ||
| 27 | -struct aclskPreloadOption { | ||
| 28 | - uint32_t preloadMode; | ||
| 29 | -}; | ||
| 30 | - | ||
| 31 | -struct aclskSplitModeOption { | ||
| 32 | - uint32_t splitCnt; | ||
| 33 | -}; | ||
| 34 | - | ||
| 35 | -struct aclskStreamFusionOption { | ||
| 36 | - uint32_t streamFusion; | ||
| 37 | -}; | ||
| 38 | - | ||
| 39 | -struct aclskDcciOption { | ||
| 40 | - char** kernelNames; | ||
| 41 | - size_t kernelCnt; | ||
| 42 | -}; | ||
| 43 | - | ||
| 44 | -struct aclskDebugSyncAllOption { | ||
| 45 | - uint32_t debugSyncAll; | ||
| 46 | -}; | ||
| 47 | - | ||
| 48 | -struct aclskDebugDcciAllOption { | ||
| 49 | - uint32_t debugDcciAll; | ||
| 50 | -}; | ||
| 51 | - | ||
| 52 | -struct aclskKernelMap { | ||
| 53 | - char* globalName; | ||
| 54 | - char* sknlNames[4]; | ||
| 55 | -}; | ||
| 56 | - | ||
| 57 | -struct aclskKernelMapOption { | ||
| 58 | - aclskKernelMap* kernelMaps; | ||
| 59 | - size_t numKernels; | ||
| 60 | -}; | ||
| 61 | - | ||
| 62 | -struct aclskAutoOpParallelOption { | ||
| 63 | - uint32_t enableAutoOpParallel; | ||
| 64 | -}; | ||
| 65 | - | ||
| 66 | -struct aclskDebugOpExecTraceOption { | ||
| 67 | - uint32_t enableOpExecTrace; | ||
| 68 | -}; | ||
| 69 | - | ||
| 70 | -struct aclskDebugCrossCoreSyncCheckOption { | ||
| 71 | - uint32_t enableCrossCoreSyncCheck; | ||
| 72 | -}; | ||
| 73 | - | ||
| 74 | -struct aclskExtendOption { | ||
| 75 | - char* value; | ||
| 76 | -}; | ||
| 77 | - | ||
| 78 | -/** | ||
| 79 | - * aggressiveOpts.valueBreakerBypass is a bitmask-style value-memory wait policy: | ||
| 80 | - * - ACLSK_VALUE_BREAKER_BYPASS_NONE (0b00): reject write/wait pairing relation, keep wait unfusible | ||
| 81 | - * - ACLSK_VALUE_BREAKER_BYPASS_PAIRED_WAIT (0b01): for paired write+wait, existing rule must pass or SK exits | ||
| 82 | - * - ACLSK_VALUE_BREAKER_BYPASS_UNPAIRED_WAIT (0b10): for waits whose writes are outside modelRI, allow wait fusion | ||
| 83 | - */ | ||
| 84 | -enum aclskValueBreakerBypassFlag : uint32_t { | ||
| 85 | - ACLSK_VALUE_BREAKER_BYPASS_NONE = 0b00U, | ||
| 86 | - ACLSK_VALUE_BREAKER_BYPASS_PAIRED_WAIT = 0b01U, | ||
| 87 | - ACLSK_VALUE_BREAKER_BYPASS_UNPAIRED_WAIT = 0b10U | ||
| 88 | -}; | ||
| 89 | - | ||
| 90 | -struct aclskAggressiveOptStrategies { | ||
| 91 | - uint32_t eventBreakerBypass; | ||
| 92 | - uint32_t valueBreakerBypass; | ||
| 93 | - uint32_t taskBreakerBypass; | ||
| 94 | -}; | ||
| 95 | - | ||
| 96 | -/** | ||
| 97 | - * 常量化代码生成选项 | ||
| 98 | - * enableConstant: 1 启用常量化, 0 禁用常量化 | ||
| 99 | - */ | ||
| 100 | -struct aclskConstantCodegenOption { | ||
| 101 | - uint32_t enableConstant; | ||
| 102 | -}; | ||
| 103 | - | ||
| 104 | -struct aclskOption { | ||
| 105 | - aclskOptionType optionType; | ||
| 106 | - union { | ||
| 107 | - aclskPreloadOption preload; | ||
| 108 | - aclskSplitModeOption splitMode; | ||
| 109 | - aclskStreamFusionOption streamFusion; | ||
| 110 | - aclskDcciOption disableKernelDcci; | ||
| 111 | - aclskDebugSyncAllOption debugSync; | ||
| 112 | - aclskKernelMapOption kernelMap; | ||
| 113 | - aclskConstantCodegenOption constantCodegen; | ||
| 114 | - aclskAutoOpParallelOption autoOpParallel; | ||
| 115 | - aclskDcciOption dcciBeforeKernelStart; | ||
| 116 | - aclskDebugOpExecTraceOption debugOpExecTrace; | ||
| 117 | - aclskDebugCrossCoreSyncCheckOption debugCrossCoreSyncCheck; | ||
| 118 | - aclskExtendOption optExtend; | ||
| 119 | - aclskExtendOption debugExtend; | ||
| 120 | - aclskDcciOption dcciAfterKernelEnd; | ||
| 121 | - aclskAggressiveOptStrategies aggressiveOpts; | ||
| 122 | - }; | ||
| 123 | -}; | ||
| 124 | - | ||
| 125 | -typedef struct aclskOptions { | ||
| 126 | - aclskOption *options; | ||
| 127 | - size_t numOptions; | ||
| 128 | -}; | ||
| 129 | - | ||
| 130 | -ACL_FUNC_VISIBILITY aclError aclskOptimize(aclmdlRI model, aclskOptions *options); | ||
| 131 | - | ||
| 132 | - | ||
Dthird_party/acl/inc/acl/acl_tdt.h+0-345
| @@ -1,345 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_tdt.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extern "C" { | ||
| 18 | - | ||
| 19 | - | ||
| 20 | -enum acltdtTensorType { | ||
| 21 | - ACL_TENSOR_DATA_UNDEFINED = -1, | ||
| 22 | - ACL_TENSOR_DATA_TENSOR, | ||
| 23 | - ACL_TENSOR_DATA_END_OF_SEQUENCE, | ||
| 24 | - ACL_TENSOR_DATA_ABNORMAL, | ||
| 25 | - ACL_TENSOR_DATA_SLICE_TENSOR, | ||
| 26 | - ACL_TENSOR_DATA_END_TENSOR | ||
| 27 | -}; | ||
| 28 | - | ||
| 29 | -typedef struct acltdtDataItem acltdtDataItem; | ||
| 30 | -typedef struct acltdtDataset acltdtDataset; | ||
| 31 | -typedef struct acltdtChannelHandle acltdtChannelHandle; | ||
| 32 | - | ||
| 33 | -/** | ||
| 34 | - * @ingroup AscendCL | ||
| 35 | - * @brief Get tensor type from item | ||
| 36 | - * | ||
| 37 | - * @param dataItem [IN] pointer to the data item | ||
| 38 | - * | ||
| 39 | - * @retval Tensor type. | ||
| 40 | - * @retval ACL_DT_UNDEFINED if dataItem is null | ||
| 41 | - */ | ||
| 42 | -ACL_FUNC_VISIBILITY acltdtTensorType acltdtGetTensorTypeFromItem(const acltdtDataItem *dataItem); | ||
| 43 | - | ||
| 44 | -/** | ||
| 45 | - * @ingroup AscendCL | ||
| 46 | - * @brief Get data type from item | ||
| 47 | - * | ||
| 48 | - * @param dataItem [IN] pointer to the data item | ||
| 49 | - * | ||
| 50 | - * @retval Data type. | ||
| 51 | - * @retval ACL_DT_UNDEFINED if dataItem is null | ||
| 52 | - */ | ||
| 53 | -ACL_FUNC_VISIBILITY aclDataType acltdtGetDataTypeFromItem(const acltdtDataItem *dataItem); | ||
| 54 | - | ||
| 55 | -/** | ||
| 56 | - * @ingroup AscendCL | ||
| 57 | - * @brief Get data address from item | ||
| 58 | - * | ||
| 59 | - * @param dataItem [IN] pointer to data item | ||
| 60 | - * | ||
| 61 | - * @retval null for failed | ||
| 62 | - * @retval OtherValues success | ||
| 63 | -*/ | ||
| 64 | -ACL_FUNC_VISIBILITY void *acltdtGetDataAddrFromItem(const acltdtDataItem *dataItem); | ||
| 65 | - | ||
| 66 | -/** | ||
| 67 | - * @ingroup AscendCL | ||
| 68 | - * @brief Get data size from item | ||
| 69 | - * | ||
| 70 | - * @param dataItem [IN] pointer to data item | ||
| 71 | - * | ||
| 72 | - * @retval 0 for failed | ||
| 73 | - * @retval OtherValues success | ||
| 74 | -*/ | ||
| 75 | -ACL_FUNC_VISIBILITY size_t acltdtGetDataSizeFromItem(const acltdtDataItem *dataItem); | ||
| 76 | - | ||
| 77 | -/** | ||
| 78 | - * @ingroup AscendCL | ||
| 79 | - * @brief Get dim's number from item | ||
| 80 | - * | ||
| 81 | - * @param dataItem [IN] pointer to data item | ||
| 82 | - * | ||
| 83 | - * @retval 0 for failed | ||
| 84 | - * @retval OtherValues success | ||
| 85 | -*/ | ||
| 86 | -ACL_FUNC_VISIBILITY size_t acltdtGetDimNumFromItem(const acltdtDataItem *dataItem); | ||
| 87 | - | ||
| 88 | -/** | ||
| 89 | - * @ingroup AscendCL | ||
| 90 | - * @brief Get slice info from item | ||
| 91 | - * | ||
| 92 | - * @param dataItem [IN] pointer to data item | ||
| 93 | - * @param sliceNum [OUT] pointer to the sliceNum of dataItem | ||
| 94 | - * @param sliceId [OUT] pointer to the sliceId of dataItem | ||
| 95 | - * | ||
| 96 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 97 | - * @retval OtherValues Failure | ||
| 98 | -*/ | ||
| 99 | -ACL_FUNC_VISIBILITY aclError acltdtGetSliceInfoFromItem(const acltdtDataItem *dataItem, size_t *sliceNum, | ||
| 100 | - size_t* sliceId); | ||
| 101 | - | ||
| 102 | -/** | ||
| 103 | - * @ingroup AscendCL | ||
| 104 | - * @brief Get dims from item | ||
| 105 | - * | ||
| 106 | - * @param dataItem [IN] the struct of data item | ||
| 107 | - * @param dims [IN|OUT] pointer to the dims of dataItem | ||
| 108 | - * @param dimNum [IN] the size of the dims | ||
| 109 | - * | ||
| 110 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 111 | - * @retval OtherValues Failure | ||
| 112 | - */ | ||
| 113 | -ACL_FUNC_VISIBILITY aclError acltdtGetDimsFromItem(const acltdtDataItem *dataItem, int64_t *dims, size_t dimNum); | ||
| 114 | - | ||
| 115 | -/** | ||
| 116 | - * @ingroup AscendCL | ||
| 117 | - * @brief Create the struct of data item | ||
| 118 | - * | ||
| 119 | - * @param tdtType [IN] Tdt tensor type | ||
| 120 | - * @param dims [IN] pointer of tdtDataItem's dims | ||
| 121 | - * @param dimNum [IN] Dim number | ||
| 122 | - * @param dataType [IN] Data type | ||
| 123 | - * @param data [IN] Data pointer | ||
| 124 | - * @param size [IN] Data size | ||
| 125 | - * | ||
| 126 | - * @retval null for failed | ||
| 127 | - * @retval OtherValues success | ||
| 128 | - * | ||
| 129 | - * @see acltdtDestroyDataItem | ||
| 130 | - */ | ||
| 131 | -ACL_FUNC_VISIBILITY acltdtDataItem *acltdtCreateDataItem(acltdtTensorType tdtType, | ||
| 132 | - const int64_t *dims, | ||
| 133 | - size_t dimNum, | ||
| 134 | - aclDataType dataType, | ||
| 135 | - void *data, | ||
| 136 | - size_t size); | ||
| 137 | - | ||
| 138 | -/** | ||
| 139 | - * @ingroup AscendCL | ||
| 140 | - * @brief Destroy the struct of data item | ||
| 141 | - * | ||
| 142 | - * @param dataItem [IN] pointer to the data item | ||
| 143 | - * | ||
| 144 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 145 | - * @retval OtherValues Failure | ||
| 146 | - * | ||
| 147 | - * @see acltdtCreateDataItem | ||
| 148 | - */ | ||
| 149 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyDataItem(acltdtDataItem *dataItem); | ||
| 150 | - | ||
| 151 | -/** | ||
| 152 | - * @ingroup AscendCL | ||
| 153 | - * @brief Create the tdt dataset | ||
| 154 | - * | ||
| 155 | - * @retval null for failed | ||
| 156 | - * @retval OtherValues success | ||
| 157 | - * | ||
| 158 | - * @see acltdtDestroyDataset | ||
| 159 | - */ | ||
| 160 | -ACL_FUNC_VISIBILITY acltdtDataset *acltdtCreateDataset(); | ||
| 161 | - | ||
| 162 | -/** | ||
| 163 | - * @ingroup AscendCL | ||
| 164 | - * @brief Destroy the tdt dataset | ||
| 165 | - * | ||
| 166 | - * @param dataset [IN] pointer to the dataset | ||
| 167 | - * | ||
| 168 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 169 | - * @retval OtherValues Failure | ||
| 170 | - * | ||
| 171 | - * @see acltdtCreateDataset | ||
| 172 | - */ | ||
| 173 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyDataset(acltdtDataset *dataset); | ||
| 174 | - | ||
| 175 | -/** | ||
| 176 | - * @ingroup AscendCL | ||
| 177 | - * @brief Get the data item | ||
| 178 | - * | ||
| 179 | - * @param dataset [IN] pointer to the dataset | ||
| 180 | - * @param index [IN] index of the dataset | ||
| 181 | - * | ||
| 182 | - * @retval null for failed | ||
| 183 | - * @retval OtherValues success | ||
| 184 | - * | ||
| 185 | - * @see acltdtAddDataItem | ||
| 186 | - */ | ||
| 187 | -ACL_FUNC_VISIBILITY acltdtDataItem *acltdtGetDataItem(const acltdtDataset *dataset, size_t index); | ||
| 188 | - | ||
| 189 | -/** | ||
| 190 | - * @ingroup AscendCL | ||
| 191 | - * @brief Get the data item | ||
| 192 | - * | ||
| 193 | - * @param dataset [OUT] pointer to the dataset | ||
| 194 | - * @param dataItem [IN] pointer to the data item | ||
| 195 | - * | ||
| 196 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 197 | - * @retval OtherValues Failure | ||
| 198 | - * | ||
| 199 | - * @see acltdtGetDataItem | ||
| 200 | - */ | ||
| 201 | -ACL_FUNC_VISIBILITY aclError acltdtAddDataItem(acltdtDataset *dataset, acltdtDataItem *dataItem); | ||
| 202 | - | ||
| 203 | -/** | ||
| 204 | - * @ingroup AscendCL | ||
| 205 | - * @brief Get the size of dataset | ||
| 206 | - * | ||
| 207 | - * @param dataset [IN] pointer to the dataset | ||
| 208 | - * | ||
| 209 | - * @retval 0 for failed | ||
| 210 | - * @retval OtherValues success | ||
| 211 | - */ | ||
| 212 | -ACL_FUNC_VISIBILITY size_t acltdtGetDatasetSize(const acltdtDataset *dataset); | ||
| 213 | - | ||
| 214 | -/** | ||
| 215 | - * @ingroup AscendCL | ||
| 216 | - * @brief Get the name of dataset | ||
| 217 | - * | ||
| 218 | - * @param dataset [IN] pointer to the dataset | ||
| 219 | - * | ||
| 220 | - * @retval null for failed | ||
| 221 | - * @retval OtherValues success | ||
| 222 | - */ | ||
| 223 | -ACL_FUNC_VISIBILITY const char *acltdtGetDatasetName(const acltdtDataset *dataset); | ||
| 224 | - | ||
| 225 | -/** | ||
| 226 | - * @ingroup AscendCL | ||
| 227 | - * @brief Stop the channel | ||
| 228 | - * | ||
| 229 | - * @param handle [IN] pointer to the channel handle | ||
| 230 | - * | ||
| 231 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 232 | - * @retval OtherValues Failure | ||
| 233 | - * | ||
| 234 | - * @see acltdtCreateChannel | acltdtDestroyChannel | ||
| 235 | - */ | ||
| 236 | -ACL_FUNC_VISIBILITY aclError acltdtStopChannel(acltdtChannelHandle *handle); | ||
| 237 | - | ||
| 238 | -/** | ||
| 239 | - * @ingroup AscendCL | ||
| 240 | - * @brief Create the channel | ||
| 241 | - * | ||
| 242 | - * @param deviceId [IN] the device id | ||
| 243 | - * @param name [IN] the name of channel | ||
| 244 | - * | ||
| 245 | - * @retval null for failed | ||
| 246 | - * @retval OtherValues success | ||
| 247 | - * | ||
| 248 | - * @see acltdtStopChannel | acltdtDestroyChannel | ||
| 249 | - */ | ||
| 250 | -ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannel(uint32_t deviceId, const char *name); | ||
| 251 | - | ||
| 252 | -/** | ||
| 253 | - * @ingroup AscendCL | ||
| 254 | - * @brief Create the channel with max size | ||
| 255 | - * | ||
| 256 | - * @param deviceId [IN] the device id | ||
| 257 | - * @param name [IN] the name of channel | ||
| 258 | - * @param capacity [IN] the capacity of channel | ||
| 259 | - * | ||
| 260 | - * @retval null for failed | ||
| 261 | - * @retval OtherValues success | ||
| 262 | - * | ||
| 263 | - * @see acltdtDestroyChannel | ||
| 264 | - */ | ||
| 265 | -ACL_FUNC_VISIBILITY acltdtChannelHandle *acltdtCreateChannelWithCapacity(uint32_t deviceId, | ||
| 266 | - const char *name, | ||
| 267 | - size_t capacity); | ||
| 268 | - | ||
| 269 | -/** | ||
| 270 | - * @ingroup AscendCL | ||
| 271 | - * @brief Destroy the channel | ||
| 272 | - * | ||
| 273 | - * @param handle [IN] pointer to the channel handle | ||
| 274 | - * | ||
| 275 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 276 | - * @retval OtherValues Failure | ||
| 277 | - * | ||
| 278 | - * @see acltdtCreateChannel | acltdtStopChannel | ||
| 279 | - */ | ||
| 280 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyChannel(acltdtChannelHandle *handle); | ||
| 281 | - | ||
| 282 | -/** | ||
| 283 | - * @ingroup AscendCL | ||
| 284 | - * @brief clean the channel | ||
| 285 | - * | ||
| 286 | - * @param handle [IN] pointer to the channel handle | ||
| 287 | - * | ||
| 288 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 289 | - * @retval OtherValues Failure | ||
| 290 | - * | ||
| 291 | - */ | ||
| 292 | -ACL_FUNC_VISIBILITY aclError acltdtCleanChannel(acltdtChannelHandle *handle); | ||
| 293 | - | ||
| 294 | -/** | ||
| 295 | - * @ingroup AscendCL | ||
| 296 | - * @brief Send tensor to device | ||
| 297 | - * | ||
| 298 | - * @param handle [IN] pointer to the channel handle | ||
| 299 | - * @param dataset [IN] pointer to the dataset | ||
| 300 | - * @param timeout [IN] timeout/ms | ||
| 301 | - * | ||
| 302 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 303 | - * @retval OtherValues Failure | ||
| 304 | - * | ||
| 305 | - * @see acltdtReceiveTensor | ||
| 306 | - */ | ||
| 307 | -ACL_FUNC_VISIBILITY aclError acltdtSendTensor(const acltdtChannelHandle *handle, | ||
| 308 | - const acltdtDataset *dataset, | ||
| 309 | - int32_t timeout); | ||
| 310 | - | ||
| 311 | -/** | ||
| 312 | - * @ingroup AscendCL | ||
| 313 | - * @brief Receive tensor from device | ||
| 314 | - * | ||
| 315 | - * @param handle [IN] pointer to the channel handle | ||
| 316 | - * @param dataset [OUT] pointer to the dataset | ||
| 317 | - * @param timeout [IN] timeout/ms | ||
| 318 | - * | ||
| 319 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 320 | - * @retval OtherValues Failure | ||
| 321 | - * | ||
| 322 | - * @see acltdtSendTensor | ||
| 323 | - */ | ||
| 324 | -ACL_FUNC_VISIBILITY aclError acltdtReceiveTensor(const acltdtChannelHandle *handle, | ||
| 325 | - acltdtDataset *dataset, | ||
| 326 | - int32_t timeout); | ||
| 327 | - | ||
| 328 | -/** | ||
| 329 | - * @ingroup AscendCL | ||
| 330 | - * @brief query the size of the channel | ||
| 331 | - * | ||
| 332 | - * @param handle [IN] pointer to the channel handle | ||
| 333 | - * @param size [OUT] current size of this channel | ||
| 334 | - * | ||
| 335 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 336 | - * @retval OtherValues Failure | ||
| 337 | - * | ||
| 338 | - */ | ||
| 339 | -ACL_FUNC_VISIBILITY aclError acltdtQueryChannelSize(const acltdtChannelHandle *handle, size_t *size); | ||
| 340 | - | ||
| 341 | - | ||
| 342 | -} | ||
| 343 | - | ||
| 344 | - | ||
| 345 | - | ||
Dthird_party/acl/inc/acl/acl_tdt_queue.h+0-611
| @@ -1,611 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_tdt_queue.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extern "C" { | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | -typedef void *acltdtBuf; | ||
| 29 | -typedef struct tagMemQueueAttr acltdtQueueAttr; | ||
| 30 | -typedef struct acltdtQueueRouteList acltdtQueueRouteList; | ||
| 31 | -typedef struct acltdtQueueRouteQueryInfo acltdtQueueRouteQueryInfo; | ||
| 32 | -typedef struct acltdtQueueRoute acltdtQueueRoute; | ||
| 33 | - | ||
| 34 | -typedef enum { | ||
| 35 | - ACL_TDT_QUEUE_NAME_PTR = 0, | ||
| 36 | - ACL_TDT_QUEUE_DEPTH_UINT32 | ||
| 37 | -} acltdtQueueAttrType; | ||
| 38 | - | ||
| 39 | -typedef enum { | ||
| 40 | - ACL_TDT_QUEUE_ROUTE_SRC_UINT32 = 0, | ||
| 41 | - ACL_TDT_QUEUE_ROUTE_DST_UINT32, | ||
| 42 | - ACL_TDT_QUEUE_ROUTE_STATUS_INT32 | ||
| 43 | -} acltdtQueueRouteParamType; | ||
| 44 | - | ||
| 45 | -typedef enum { | ||
| 46 | - ACL_TDT_QUEUE_ROUTE_QUERY_SRC = 0, | ||
| 47 | - ACL_TDT_QUEUE_ROUTE_QUERY_DST = 1, | ||
| 48 | - ACL_TDT_QUEUE_ROUTE_QUERY_SRC_AND_DST = 2, | ||
| 49 | - ACL_TDT_QUEUE_ROUTE_QUERY_ABNORMAL = 100 | ||
| 50 | -} acltdtQueueRouteQueryMode; | ||
| 51 | - | ||
| 52 | -typedef enum { | ||
| 53 | - ACL_TDT_QUEUE_ROUTE_QUERY_MODE_ENUM = 0, | ||
| 54 | - ACL_TDT_QUEUE_ROUTE_QUERY_SRC_ID_UINT32, | ||
| 55 | - ACL_TDT_QUEUE_ROUTE_QUERY_DST_ID_UINT32 | ||
| 56 | -} acltdtQueueRouteQueryInfoParamType; | ||
| 57 | - | ||
| 58 | -typedef enum { | ||
| 59 | - ACL_TDT_NORMAL_MEM = 0, | ||
| 60 | - ACL_TDT_DVPP_MEM | ||
| 61 | -} acltdtAllocBufType; | ||
| 62 | - | ||
| 63 | -/** | ||
| 64 | - * @ingroup AscendCL | ||
| 65 | - * @brief create queue | ||
| 66 | - * | ||
| 67 | - * @param attr [IN] pointer to the queue attr | ||
| 68 | - * @param qid [OUT] pointer to the qid | ||
| 69 | - * | ||
| 70 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 71 | - * @retval OtherValues Failure | ||
| 72 | - * | ||
| 73 | - * @see acltdtDestroyQueue | ||
| 74 | - */ | ||
| 75 | -ACL_FUNC_VISIBILITY aclError acltdtCreateQueue(const acltdtQueueAttr *attr, uint32_t *qid); | ||
| 76 | - | ||
| 77 | -/** | ||
| 78 | - * @ingroup AscendCL | ||
| 79 | - * @brief destroy queue | ||
| 80 | - * | ||
| 81 | - * @param qid [IN] qid which to be destroyed | ||
| 82 | - * | ||
| 83 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 84 | - * @retval OtherValues Failure | ||
| 85 | - * | ||
| 86 | - * @see acltdtCreateQueue | ||
| 87 | - */ | ||
| 88 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyQueue(uint32_t qid); | ||
| 89 | - | ||
| 90 | -/** | ||
| 91 | - * @ingroup AscendCL | ||
| 92 | - * @brief enqueue function | ||
| 93 | - * | ||
| 94 | - * @param qid [IN] qid | ||
| 95 | - * @param buf [IN] acltdtBuf | ||
| 96 | - * @param timeout [IN] timeout, -1 means blocking | ||
| 97 | - * | ||
| 98 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 99 | - * @retval OtherValues Failure | ||
| 100 | - * | ||
| 101 | - * @see acltdtDequeue | ||
| 102 | - */ | ||
| 103 | -ACL_FUNC_VISIBILITY aclError acltdtEnqueue(uint32_t qid, acltdtBuf buf, int32_t timeout); | ||
| 104 | - | ||
| 105 | -/** | ||
| 106 | - * @ingroup AscendCL | ||
| 107 | - * @brief dequeue function | ||
| 108 | - * | ||
| 109 | - * @param qid [IN] qid | ||
| 110 | - * @param buf [OUT] pointer to the acltdtBuf | ||
| 111 | - * @param timeout [IN] timeout, -1 means blocking | ||
| 112 | - * | ||
| 113 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 114 | - * @retval OtherValues Failure | ||
| 115 | - * | ||
| 116 | - * @see acltdtEnqueue | ||
| 117 | - */ | ||
| 118 | -ACL_FUNC_VISIBILITY aclError acltdtDequeue(uint32_t qid, acltdtBuf *buf, int32_t timeout); | ||
| 119 | - | ||
| 120 | -/** | ||
| 121 | - * @ingroup AscendCL | ||
| 122 | - * @brief enqueue function | ||
| 123 | - * | ||
| 124 | - * @param qid [IN] qid | ||
| 125 | - * @param data [IN] the pointer to data buf | ||
| 126 | - * @param dataSize [IN] the size of data buf | ||
| 127 | - * @param userData [IN] the pointer to user data buf | ||
| 128 | - * @param userDataSize [IN] the size of user data buf | ||
| 129 | - * @param timeout [IN] timeout, -1 means blocking | ||
| 130 | - * @param rsv [IN] reserved param | ||
| 131 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 132 | - * @retval OtherValues Failure | ||
| 133 | - * | ||
| 134 | - * @see acltdtDequeueData | ||
| 135 | - */ | ||
| 136 | -ACL_FUNC_VISIBILITY aclError acltdtEnqueueData(uint32_t qid, const void *data, size_t dataSize, | ||
| 137 | - const void *userData, size_t userDataSize, int32_t timeout, uint32_t rsv); | ||
| 138 | - | ||
| 139 | -/** | ||
| 140 | - * @ingroup AscendCL | ||
| 141 | - * @brief dequeue function | ||
| 142 | - * | ||
| 143 | - * @param qid [IN] qid | ||
| 144 | - * @param data [IN|OUT] the pointer to data buf | ||
| 145 | - * @param dataSize [IN] the size of data buf | ||
| 146 | - * @param retDataSize [OUT] the return size of data buf | ||
| 147 | - * @param userData [IN|OUT] the pointer to user data buf | ||
| 148 | - * @param userDataSize [IN] the size of user data buf | ||
| 149 | - * @param timeout [IN] timeout, -1 means blocking | ||
| 150 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 151 | - * @retval OtherValues Failure | ||
| 152 | - * | ||
| 153 | - * @see acltdtEnqueueData | ||
| 154 | - */ | ||
| 155 | -ACL_FUNC_VISIBILITY aclError acltdtDequeueData(uint32_t qid, void *data, size_t dataSize, size_t *retDataSize, | ||
| 156 | - void *userData, size_t userDataSize, int32_t timeout); | ||
| 157 | - | ||
| 158 | -/** | ||
| 159 | - * @ingroup AscendCL | ||
| 160 | - * @brief grant queue to other process | ||
| 161 | - * | ||
| 162 | - * @param qid [IN] qid | ||
| 163 | - * @param pid [IN] pid of dst process | ||
| 164 | - * @param permission [IN] permission of queue | ||
| 165 | - * @param timeout [IN] timeout, -1 means blocking | ||
| 166 | - * | ||
| 167 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 168 | - * @retval OtherValues Failure | ||
| 169 | - * | ||
| 170 | - * @see ACL_TDT_QUEUE_PERMISSION_MANAGE | ACL_TDT_QUEUE_PERMISSION_DEQUEUE | ACL_TDT_QUEUE_PERMISSION_ENQUEUE | ||
| 171 | - */ | ||
| 172 | -ACL_FUNC_VISIBILITY aclError acltdtGrantQueue(uint32_t qid, int32_t pid, uint32_t permission, int32_t timeout); | ||
| 173 | - | ||
| 174 | -/** | ||
| 175 | - * @ingroup AscendCL | ||
| 176 | - * @brief attach queue in current process | ||
| 177 | - * | ||
| 178 | - * @param qid [IN] qid | ||
| 179 | - * @param timeout [IN] timeout, -1 means blocking | ||
| 180 | - * @param permission [OUT] permission of queue | ||
| 181 | - * | ||
| 182 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 183 | - * @retval OtherValues Failure | ||
| 184 | - * | ||
| 185 | - * @see acltdtGrantQueue | ||
| 186 | - */ | ||
| 187 | -ACL_FUNC_VISIBILITY aclError acltdtAttachQueue(uint32_t qid, int32_t timeout, uint32_t *permission); | ||
| 188 | - | ||
| 189 | -/** | ||
| 190 | - * @ingroup AscendCL | ||
| 191 | - * @brief bind queue routes | ||
| 192 | - * | ||
| 193 | - * @param qRouteList [IN|OUT] pointer to the route list | ||
| 194 | - * | ||
| 195 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 196 | - * @retval OtherValues Failure | ||
| 197 | - */ | ||
| 198 | -ACL_FUNC_VISIBILITY aclError acltdtBindQueueRoutes(acltdtQueueRouteList *qRouteList); | ||
| 199 | - | ||
| 200 | -/** | ||
| 201 | - * @ingroup AscendCL | ||
| 202 | - * @brief unbind queue routes | ||
| 203 | - * | ||
| 204 | - * @param qRouteList [IN|OUT] pointer to the route list | ||
| 205 | - * | ||
| 206 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 207 | - * @retval OtherValues Failure | ||
| 208 | - */ | ||
| 209 | -ACL_FUNC_VISIBILITY aclError acltdtUnbindQueueRoutes(acltdtQueueRouteList *qRouteList); | ||
| 210 | - | ||
| 211 | -/** | ||
| 212 | - * @ingroup AscendCL | ||
| 213 | - * @brief query queue routes according to query mode | ||
| 214 | - * | ||
| 215 | - * @param queryInfo [IN] pointer to the queue route query info | ||
| 216 | - * @param qRouteList [IN|OUT] pointer to the route list | ||
| 217 | - * | ||
| 218 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 219 | - * @retval OtherValues Failure | ||
| 220 | - */ | ||
| 221 | -ACL_FUNC_VISIBILITY aclError acltdtQueryQueueRoutes(const acltdtQueueRouteQueryInfo *queryInfo, | ||
| 222 | - acltdtQueueRouteList *qRouteList); | ||
| 223 | - | ||
| 224 | -/** | ||
| 225 | - * @ingroup AscendCL | ||
| 226 | - * @brief alloc acltdtBuf | ||
| 227 | - * | ||
| 228 | - * @param size [IN] alloc buf size | ||
| 229 | - * @param type [IN] reserved parameters, need to set zero currently | ||
| 230 | - * @param buf [OUT] pointer to the acltdtBuf | ||
| 231 | - * | ||
| 232 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 233 | - * @retval OtherValues Failure | ||
| 234 | - * | ||
| 235 | - * @see acltdtFreeBuf | ||
| 236 | - */ | ||
| 237 | -ACL_FUNC_VISIBILITY aclError acltdtAllocBuf(size_t size, uint32_t type, acltdtBuf *buf); | ||
| 238 | - | ||
| 239 | -/** | ||
| 240 | - * @ingroup AscendCL | ||
| 241 | - * @brief free acltdtBuf | ||
| 242 | - * | ||
| 243 | - * @param buf [IN] pointer to the acltdtBuf | ||
| 244 | - * | ||
| 245 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 246 | - * @retval OtherValues Failure | ||
| 247 | - * | ||
| 248 | - * @see acltdtAllocBuf | ||
| 249 | - */ | ||
| 250 | -ACL_FUNC_VISIBILITY aclError acltdtFreeBuf(acltdtBuf buf); | ||
| 251 | - | ||
| 252 | -/** | ||
| 253 | - * @ingroup AscendCL | ||
| 254 | - * @brief get data buf address | ||
| 255 | - * | ||
| 256 | - * @param buf [IN] acltdtBuf | ||
| 257 | - * @param dataPtr [OUT] pointer to the data ptr which is acquired from acltdtBuf | ||
| 258 | - * @param size [OUT] pointer to the size | ||
| 259 | - * | ||
| 260 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 261 | - * @retval OtherValues Failure | ||
| 262 | - * | ||
| 263 | - * @see acltdtAllocBuf | ||
| 264 | - */ | ||
| 265 | -ACL_FUNC_VISIBILITY aclError acltdtGetBufData(const acltdtBuf buf, void **dataPtr, size_t *size); | ||
| 266 | - | ||
| 267 | -/** | ||
| 268 | - * @ingroup AscendCL | ||
| 269 | - * @brief set data buf effective len | ||
| 270 | - * | ||
| 271 | - * @param buf [IN] acltdtBuf | ||
| 272 | - * @param len [IN] set effective len to data buf which must be smaller than size acquired by acltdtGetBufData | ||
| 273 | - * | ||
| 274 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 275 | - * @retval OtherValues Failure | ||
| 276 | - * | ||
| 277 | - * @see acltdtGetBufData acltdtGetBufDataLen | ||
| 278 | - */ | ||
| 279 | -ACL_FUNC_VISIBILITY aclError acltdtSetBufDataLen(acltdtBuf buf, size_t len); | ||
| 280 | - | ||
| 281 | -/** | ||
| 282 | - * @ingroup AscendCL | ||
| 283 | - * @brief get data buf effective len | ||
| 284 | - * | ||
| 285 | - * @param buf [IN] acltdtBuf | ||
| 286 | - * @param len [OUT] get effective len which is set by acltdtSetBufDataLen | ||
| 287 | - * | ||
| 288 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 289 | - * @retval OtherValues Failure | ||
| 290 | - * | ||
| 291 | - * @see acltdtSetBufDataLen | ||
| 292 | - */ | ||
| 293 | -ACL_FUNC_VISIBILITY aclError acltdtGetBufDataLen(acltdtBuf buf, size_t *len); | ||
| 294 | - | ||
| 295 | -/** | ||
| 296 | - * @ingroup AscendCL | ||
| 297 | - * @brief append acltdtBuf to acltdtBuf chain | ||
| 298 | - * | ||
| 299 | - * @param headBuf [IN] acltdtBuf chain head | ||
| 300 | - * @param buf [IN] acltdtBuf will be appended | ||
| 301 | - * | ||
| 302 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 303 | - * @retval OtherValues Failure | ||
| 304 | - * | ||
| 305 | - */ | ||
| 306 | -ACL_FUNC_VISIBILITY aclError acltdtAppendBufChain(acltdtBuf headBuf, acltdtBuf buf); | ||
| 307 | - | ||
| 308 | -/** | ||
| 309 | - * @ingroup AscendCL | ||
| 310 | - * @brief get acltdtBuf chain total size | ||
| 311 | - * | ||
| 312 | - * @param headBuf [IN] acltdtBuf chain head | ||
| 313 | - * @param num [OUT] acltdtBuf chain total size | ||
| 314 | - * | ||
| 315 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 316 | - * @retval OtherValues Failure | ||
| 317 | - * | ||
| 318 | - * @see acltdtAppendBufChain | ||
| 319 | - */ | ||
| 320 | -ACL_FUNC_VISIBILITY aclError acltdtGetBufChainNum(acltdtBuf headBuf, uint32_t *num); | ||
| 321 | - | ||
| 322 | -/** | ||
| 323 | - * @ingroup AscendCL | ||
| 324 | - * @brief get acltdtBuf from acltdtBuf chain by index | ||
| 325 | - * | ||
| 326 | - * @param headBuf [IN] acltdtBuf chain head | ||
| 327 | - * @param index [IN] the index which is smaller than num acquired from acltdtGetBufChainNum | ||
| 328 | - * @param buf [OUT] the acltdtBuf from acltdtBuf on index | ||
| 329 | - * | ||
| 330 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 331 | - * @retval OtherValues Failure | ||
| 332 | - * | ||
| 333 | - * @see acltdtAppendBufChain acltdtGetBufChainNum | ||
| 334 | - */ | ||
| 335 | -ACL_FUNC_VISIBILITY aclError acltdtGetBufFromChain(acltdtBuf headBuf, uint32_t index, acltdtBuf *buf); | ||
| 336 | - | ||
| 337 | -/** | ||
| 338 | - * @ingroup AscendCL | ||
| 339 | - * @brief get private data buf address and size | ||
| 340 | - * | ||
| 341 | - * @param buf [IN] acltdtBuf | ||
| 342 | - * @param dataPtr [IN/OUT] pointer to the user ptr | ||
| 343 | - * @param size [IN] the current private data area size, less than or equal to 96B | ||
| 344 | - * @param offset [IN] address offset, less than or equal to 96B | ||
| 345 | - * | ||
| 346 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 347 | - * @retval OtherValues Failure | ||
| 348 | - * | ||
| 349 | - * @see acltdtGetBufUserData | ||
| 350 | - */ | ||
| 351 | -ACL_FUNC_VISIBILITY aclError acltdtGetBufUserData(const acltdtBuf buf, void *dataPtr, size_t size, size_t offset); | ||
| 352 | - | ||
| 353 | -/** | ||
| 354 | - * @ingroup AscendCL | ||
| 355 | - * @brief set private data buf address and size | ||
| 356 | - * | ||
| 357 | - * @param buf [OUT] acltdtBuf | ||
| 358 | - * @param dataPtr [IN] pointer to the user ptr | ||
| 359 | - * @param size [IN] the current private data area size, less than or equal to 96B | ||
| 360 | - * @param offset [IN] address offset, less than or equal to 96B | ||
| 361 | - * | ||
| 362 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 363 | - * @retval OtherValues Failure | ||
| 364 | - * | ||
| 365 | - * @see acltdtSetBufUserData | ||
| 366 | - */ | ||
| 367 | -ACL_FUNC_VISIBILITY aclError acltdtSetBufUserData(acltdtBuf buf, const void *dataPtr, size_t size, size_t offset); | ||
| 368 | - | ||
| 369 | -/** | ||
| 370 | - * @ingroup AscendCL | ||
| 371 | - * @brief copy buf ref | ||
| 372 | - * | ||
| 373 | - * @param buf [IN] acltdtBuf | ||
| 374 | - * @param newBuf [OUT] Make a reference copy of the data area of buf and | ||
| 375 | - * create a new buf header pointing to the same data area | ||
| 376 | - * | ||
| 377 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 378 | - * @retval OtherValues Failure | ||
| 379 | - * | ||
| 380 | - * @see acltdtCopyBufRef | ||
| 381 | - */ | ||
| 382 | -ACL_FUNC_VISIBILITY aclError acltdtCopyBufRef(const acltdtBuf buf, acltdtBuf *newBuf); | ||
| 383 | - | ||
| 384 | -/** | ||
| 385 | - * @ingroup AscendCL | ||
| 386 | - * @brief Create the queue attr | ||
| 387 | - * | ||
| 388 | - * @retval null for failed | ||
| 389 | - * @retval OtherValues success | ||
| 390 | - * | ||
| 391 | - * @see acltdtDestroyQueueAttr | ||
| 392 | - */ | ||
| 393 | -ACL_FUNC_VISIBILITY acltdtQueueAttr *acltdtCreateQueueAttr(); | ||
| 394 | - | ||
| 395 | -/** | ||
| 396 | - * @ingroup AscendCL | ||
| 397 | - * @brief Destroy the queue attr | ||
| 398 | - * | ||
| 399 | - * @param attr [IN] pointer to the queue attr | ||
| 400 | - * | ||
| 401 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 402 | - * @retval OtherValues Failure | ||
| 403 | - * | ||
| 404 | - * @see acltdtCreateQueueAttr | ||
| 405 | - */ | ||
| 406 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueAttr(const acltdtQueueAttr *attr); | ||
| 407 | - | ||
| 408 | -/** | ||
| 409 | - * @ingroup AscendCL | ||
| 410 | - * @brief Set parameter for queue attr | ||
| 411 | - * | ||
| 412 | - * @param attr [IN|OUT] pointer to the queue attr | ||
| 413 | - * @param type [IN] parameter type | ||
| 414 | - * @param len [IN] parameter length | ||
| 415 | - * @param param [IN] pointer to parameter value | ||
| 416 | - * | ||
| 417 | - * @retval ACL_SUCCESS for success, other for failure | ||
| 418 | - * | ||
| 419 | - * @see acltdtCreateQueueAttr | ||
| 420 | - */ | ||
| 421 | -ACL_FUNC_VISIBILITY aclError acltdtSetQueueAttr(acltdtQueueAttr *attr, | ||
| 422 | - acltdtQueueAttrType type, | ||
| 423 | - size_t len, | ||
| 424 | - const void *param); | ||
| 425 | - | ||
| 426 | -/** | ||
| 427 | - * @ingroup AscendCL | ||
| 428 | - * | ||
| 429 | - * @brief Get parameter for queue attr. | ||
| 430 | - * | ||
| 431 | - * @param attr [IN] pointer to the queue attr | ||
| 432 | - * @param type [IN] parameter type | ||
| 433 | - * @param len [IN] parameter length | ||
| 434 | - * @param paramRetSize [OUT] pointer to parameter real length | ||
| 435 | - * @param param [OUT] pointer to parameter value | ||
| 436 | - * | ||
| 437 | - * @retval ACL_SUCCESS for success, other for failure | ||
| 438 | - * | ||
| 439 | - * @see acltdtCreateQueueAttr | ||
| 440 | - */ | ||
| 441 | -ACL_FUNC_VISIBILITY aclError acltdtGetQueueAttr(const acltdtQueueAttr *attr, | ||
| 442 | - acltdtQueueAttrType type, | ||
| 443 | - size_t len, | ||
| 444 | - size_t *paramRetSize, | ||
| 445 | - void *param); | ||
| 446 | - | ||
| 447 | -/** | ||
| 448 | - * @ingroup AscendCL | ||
| 449 | - * @brief Create the queue route | ||
| 450 | - * | ||
| 451 | - * @param srcId [IN] src id of queue route | ||
| 452 | - * @param dstId [IN] dst id of queue route | ||
| 453 | - * | ||
| 454 | - * @retval null for failed | ||
| 455 | - * @retval OtherValues success | ||
| 456 | - * | ||
| 457 | - * @see acltdtDestroyQueueRoute | ||
| 458 | - */ | ||
| 459 | -ACL_FUNC_VISIBILITY acltdtQueueRoute* acltdtCreateQueueRoute(uint32_t srcId, uint32_t dstId); | ||
| 460 | - | ||
| 461 | -/** | ||
| 462 | - * @ingroup AscendCL | ||
| 463 | - * @brief Destroy the queue attr | ||
| 464 | - * | ||
| 465 | - * @param route [IN] pointer to the queue route | ||
| 466 | - * | ||
| 467 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 468 | - * @retval OtherValues Failure | ||
| 469 | - * | ||
| 470 | - * @see acltdtCreateQueueRoute | ||
| 471 | - */ | ||
| 472 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueRoute(const acltdtQueueRoute *route); | ||
| 473 | - | ||
| 474 | -/** | ||
| 475 | - * @ingroup AscendCL | ||
| 476 | - * | ||
| 477 | - * @brief Get parameter for queue route. | ||
| 478 | - * | ||
| 479 | - * @param route [IN] pointer to the queue route | ||
| 480 | - * @param type [IN] parameter type | ||
| 481 | - * @param len [IN] parameter length | ||
| 482 | - * @param paramRetSize [OUT] pointer to parameter real length | ||
| 483 | - * @param param [OUT] pointer to parameter value | ||
| 484 | - * | ||
| 485 | - * @retval ACL_SUCCESS for success, other for failure | ||
| 486 | - * | ||
| 487 | - * @see acltdtCreateQueueRoute | ||
| 488 | - */ | ||
| 489 | -ACL_FUNC_VISIBILITY aclError acltdtGetQueueRouteParam(const acltdtQueueRoute *route, | ||
| 490 | - acltdtQueueRouteParamType type, | ||
| 491 | - size_t len, | ||
| 492 | - size_t *paramRetSize, | ||
| 493 | - void *param); | ||
| 494 | - | ||
| 495 | -/** | ||
| 496 | - * @ingroup AscendCL | ||
| 497 | - * @brief Create the queue route list | ||
| 498 | - * | ||
| 499 | - * @retval null for failed | ||
| 500 | - * @retval OtherValues success | ||
| 501 | - * | ||
| 502 | - * @see acltdtDestroyQueueRouteList | ||
| 503 | - */ | ||
| 504 | -ACL_FUNC_VISIBILITY acltdtQueueRouteList* acltdtCreateQueueRouteList(); | ||
| 505 | - | ||
| 506 | -/** | ||
| 507 | - * @ingroup AscendCL | ||
| 508 | - * @brief Destroy the queue route list | ||
| 509 | - * | ||
| 510 | - * @param routeList [IN] pointer to the queue route list | ||
| 511 | - * | ||
| 512 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 513 | - * @retval OtherValues Failure | ||
| 514 | - * | ||
| 515 | - * @see acltdtCreateQueueRouteList | ||
| 516 | - */ | ||
| 517 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueRouteList(const acltdtQueueRouteList *routeList); | ||
| 518 | - | ||
| 519 | -/** | ||
| 520 | - * @ingroup AscendCL | ||
| 521 | - * @brief add queue route to the route list | ||
| 522 | - * | ||
| 523 | - * @param routeList [IN|OUT] pointer to the queue route list | ||
| 524 | - * @param route [IN] pointer to the queue route | ||
| 525 | - * | ||
| 526 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 527 | - * @retval OtherValues Failure | ||
| 528 | - * | ||
| 529 | - * @see acltdtCreateQueueRouteList | acltdtCreateQueueRoute | ||
| 530 | - * | ||
| 531 | - */ | ||
| 532 | -ACL_FUNC_VISIBILITY aclError acltdtAddQueueRoute(acltdtQueueRouteList *routeList, const acltdtQueueRoute *route); | ||
| 533 | - | ||
| 534 | -/** | ||
| 535 | - * @ingroup AscendCL | ||
| 536 | - * @brief get queue route from route list | ||
| 537 | - * | ||
| 538 | - * @param routeList [IN] pointer to the queue route list | ||
| 539 | - * @param index [IN] index of queue route in route list | ||
| 540 | - * @param route [IN|OUT] pointer to the queue route | ||
| 541 | - * | ||
| 542 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 543 | - * @retval OtherValues Failure | ||
| 544 | - * | ||
| 545 | - * @see acltdtCreateQueueRouteList | acltdtCreateQueueRoute | ||
| 546 | - * | ||
| 547 | - */ | ||
| 548 | -ACL_FUNC_VISIBILITY aclError acltdtGetQueueRoute(const acltdtQueueRouteList *routeList, | ||
| 549 | - size_t index, | ||
| 550 | - acltdtQueueRoute *route); | ||
| 551 | - | ||
| 552 | -/** | ||
| 553 | - * @ingroup AscendCL | ||
| 554 | - * @brief get queue route num from route list | ||
| 555 | - * | ||
| 556 | - * @param routeList [IN] pointer to the queue route list | ||
| 557 | - * | ||
| 558 | - * @retval the number of queue route | ||
| 559 | - * | ||
| 560 | - */ | ||
| 561 | -ACL_FUNC_VISIBILITY size_t acltdtGetQueueRouteNum(const acltdtQueueRouteList *routeList); | ||
| 562 | - | ||
| 563 | -/** | ||
| 564 | - * @ingroup AscendCL | ||
| 565 | - * @brief Create the queue route query info | ||
| 566 | - * | ||
| 567 | - * @retval null for failed | ||
| 568 | - * @retval OtherValues success | ||
| 569 | - * | ||
| 570 | - * @see acltdtDestroyQueueRouteQueryInfo | ||
| 571 | - */ | ||
| 572 | -ACL_FUNC_VISIBILITY acltdtQueueRouteQueryInfo* acltdtCreateQueueRouteQueryInfo(); | ||
| 573 | - | ||
| 574 | -/** | ||
| 575 | - * @ingroup AscendCL | ||
| 576 | - * @brief Destroy the queue route query info | ||
| 577 | - * | ||
| 578 | - * @param info [IN] pointer to the queue route info | ||
| 579 | - * | ||
| 580 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 581 | - * @retval OtherValues Failure | ||
| 582 | - * | ||
| 583 | - * @see acltdtCreateQueueRouteQueryInfo | ||
| 584 | - * | ||
| 585 | - */ | ||
| 586 | -ACL_FUNC_VISIBILITY aclError acltdtDestroyQueueRouteQueryInfo(const acltdtQueueRouteQueryInfo *info); | ||
| 587 | - | ||
| 588 | -/** | ||
| 589 | - * @ingroup AscendCL | ||
| 590 | - * @brief Set parameter for queue route info | ||
| 591 | - * | ||
| 592 | - * @param attr [IN|OUT] pointer to the queue route info | ||
| 593 | - * @param type [IN] parameter type | ||
| 594 | - * @param len [IN] parameter length | ||
| 595 | - * @param param [IN] pointer to parameter value | ||
| 596 | - * | ||
| 597 | - * @retval ACL_SUCCESS for success, other for failure | ||
| 598 | - * | ||
| 599 | - * @see acltdtCreateQueueRouteQueryInfo | ||
| 600 | - */ | ||
| 601 | -ACL_FUNC_VISIBILITY aclError acltdtSetQueueRouteQueryInfo(acltdtQueueRouteQueryInfo *param, | ||
| 602 | - acltdtQueueRouteQueryInfoParamType type, | ||
| 603 | - size_t len, | ||
| 604 | - const void *value); | ||
| 605 | - | ||
| 606 | - | ||
| 607 | - | ||
| 608 | -} | ||
| 609 | - | ||
| 610 | - | ||
| 611 | - | ||
Dthird_party/acl/inc/acl/error_codes/rt_error_codes.h+0-153
| @@ -1,153 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file rt_error_codes.h | ||
| 3 | -* | ||
| 4 | -* Copyright (C) Huawei Technologies Co., Ltd. 2019-2020. All Rights Reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extern "C" { | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - | ||
| 63 | - | ||
| 64 | - | ||
| 65 | - | ||
| 66 | - | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - | ||
| 72 | - | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - | ||
| 77 | - | ||
| 78 | - | ||
| 79 | - | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - | ||
| 88 | - | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - | ||
| 92 | - | ||
| 93 | - | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - | ||
| 102 | - | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - | ||
| 107 | - | ||
| 108 | - | ||
| 109 | - | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - | ||
| 120 | - | ||
| 121 | - | ||
| 122 | - | ||
| 123 | - | ||
| 124 | - | ||
| 125 | - | ||
| 126 | - | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - | ||
| 130 | - | ||
| 131 | - | ||
| 132 | - | ||
| 133 | - | ||
| 134 | - | ||
| 135 | - | ||
| 136 | - | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - | ||
| 140 | - | ||
| 141 | - | ||
| 142 | - | ||
| 143 | - | ||
| 144 | - | ||
| 145 | - | ||
| 146 | - | ||
| 147 | - | ||
| 148 | - | ||
| 149 | - | ||
| 150 | - | ||
| 151 | -} | ||
| 152 | - | ||
| 153 | - | ||
Dthird_party/acl/inc/acl/ops/acl_cblas.h+0-424
| @@ -1,424 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | -* @file acl_cblas.h | ||
| 3 | -* | ||
| 4 | -* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved. | ||
| 5 | -* | ||
| 6 | -* This program is distributed in the hope that it will be useful, | ||
| 7 | -* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | -*/ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -extern "C" { | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -typedef enum aclTransType { | ||
| 20 | - ACL_TRANS_N, | ||
| 21 | - ACL_TRANS_T, | ||
| 22 | - ACL_TRANS_NZ, | ||
| 23 | - ACL_TRANS_NZ_T | ||
| 24 | -} aclTransType; | ||
| 25 | - | ||
| 26 | -typedef enum aclComputeType { | ||
| 27 | - ACL_COMPUTE_HIGH_PRECISION, | ||
| 28 | - ACL_COMPUTE_LOW_PRECISION | ||
| 29 | -} aclComputeType; | ||
| 30 | - | ||
| 31 | -/** | ||
| 32 | - * @ingroup AscendCL | ||
| 33 | - * @brief perform the matrix-vector multiplication | ||
| 34 | - * | ||
| 35 | - * @param transA [IN] transpose type of matrix A | ||
| 36 | - * @param m [IN] number of rows of matrix A | ||
| 37 | - * @param n [IN] number of columns of matrix A | ||
| 38 | - * @param alpha [IN] pointer to scalar used for multiplication. | ||
| 39 | - * of same type as dataTypeC | ||
| 40 | - * @param a [IN] pointer to matrix A | ||
| 41 | - * @param lda [IN] leading dimension used to store the matrix A | ||
| 42 | - * @param dataTypeA [IN] datatype of matrix A | ||
| 43 | - * @param x [IN] pointer to vector x | ||
| 44 | - * @param incx [IN] stride between consecutive elements of vector x | ||
| 45 | - * @param dataTypeX [IN] datatype of vector x | ||
| 46 | - * @param beta [IN] pointer to scalar used for multiplication. | ||
| 47 | - * of same type as dataTypeC If beta == 0, | ||
| 48 | - * then y does not have to be a valid input | ||
| 49 | - * @param y [IN|OUT] pointer to vector y | ||
| 50 | - * @param incy [IN] stride between consecutive elements of vector y | ||
| 51 | - * @param dataTypeY [IN] datatype of vector y | ||
| 52 | - * @param type [IN] computation type | ||
| 53 | - * @param stream [IN] stream | ||
| 54 | - * | ||
| 55 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 56 | - * @retval OtherValues Failure | ||
| 57 | -*/ | ||
| 58 | -ACL_FUNC_VISIBILITY aclError aclblasGemvEx(aclTransType transA, int m, int n, | ||
| 59 | - const void *alpha, const void *a, int lda, aclDataType dataTypeA, | ||
| 60 | - const void *x, int incx, aclDataType dataTypeX, | ||
| 61 | - const void *beta, void *y, int incy, aclDataType dataTypeY, | ||
| 62 | - aclComputeType type, aclrtStream stream); | ||
| 63 | - | ||
| 64 | -/** | ||
| 65 | - * @ingroup AscendCL | ||
| 66 | - * @brief create a handle for performing the matrix-vector multiplication | ||
| 67 | - * | ||
| 68 | - * @param transA [IN] transpose type of matrix A | ||
| 69 | - * @param m [IN] number of rows of matrix A | ||
| 70 | - * @param n [IN] number of columns of matrix A | ||
| 71 | - * @param dataTypeA [IN] datatype of matrix A | ||
| 72 | - * @param dataTypeX [IN] datatype of vector x | ||
| 73 | - * @param dataTypeY [IN] datatype of vector y | ||
| 74 | - * @param type [IN] computation type | ||
| 75 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 76 | - * | ||
| 77 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 78 | - * @retval OtherValues Failure | ||
| 79 | -*/ | ||
| 80 | -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemvEx(aclTransType transA, | ||
| 81 | - int m, | ||
| 82 | - int n, | ||
| 83 | - aclDataType dataTypeA, | ||
| 84 | - aclDataType dataTypeX, | ||
| 85 | - aclDataType dataTypeY, | ||
| 86 | - aclComputeType type, | ||
| 87 | - aclopHandle **handle); | ||
| 88 | - | ||
| 89 | -/** | ||
| 90 | - * @ingroup AscendCL | ||
| 91 | - * @brief perform the matrix-vector multiplication | ||
| 92 | - * | ||
| 93 | - * @param transA [IN] transpose type of matrix A | ||
| 94 | - * @param m [IN] number of rows of matrix A | ||
| 95 | - * @param n [IN] number of columns of matrix A | ||
| 96 | - * @param alpha [IN] pointer to scalar used for multiplication | ||
| 97 | - * @param a [IN] pointer to matrix A | ||
| 98 | - * @param lda [IN] leading dimension used to store the matrix A | ||
| 99 | - * @param x [IN] pointer to vector x | ||
| 100 | - * @param incx [IN] stride between consecutive elements of vector x | ||
| 101 | - * @param beta [IN] pointer to scalar used for multiplication. | ||
| 102 | - * If beta value == 0, | ||
| 103 | - * then y does not have to be a valid input | ||
| 104 | - * @param y [IN|OUT] pointer to vector y | ||
| 105 | - * @param incy [IN] stride between consecutive elements of vector y | ||
| 106 | - * @param type [IN] computation type | ||
| 107 | - * @param stream [IN] stream | ||
| 108 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 109 | - * @retval OtherValues Failure | ||
| 110 | - */ | ||
| 111 | -ACL_FUNC_VISIBILITY aclError aclblasHgemv(aclTransType transA, | ||
| 112 | - int m, | ||
| 113 | - int n, | ||
| 114 | - const aclFloat16 *alpha, | ||
| 115 | - const aclFloat16 *a, | ||
| 116 | - int lda, | ||
| 117 | - const aclFloat16 *x, | ||
| 118 | - int incx, | ||
| 119 | - const aclFloat16 *beta, | ||
| 120 | - aclFloat16 *y, | ||
| 121 | - int incy, | ||
| 122 | - aclComputeType type, | ||
| 123 | - aclrtStream stream); | ||
| 124 | - | ||
| 125 | -/** | ||
| 126 | - * @ingroup AscendCL | ||
| 127 | - * @brief create a handle for performing the matrix-vector multiplication | ||
| 128 | - * | ||
| 129 | - * @param transA [IN] transpose type of matrix A | ||
| 130 | - * @param m [IN] number of rows of matrix A | ||
| 131 | - * @param n [IN] number of columns of matrix A | ||
| 132 | - * @param type [IN] computation type | ||
| 133 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 134 | - * | ||
| 135 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 136 | - * @retval OtherValues Failure | ||
| 137 | - */ | ||
| 138 | -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemv(aclTransType transA, | ||
| 139 | - int m, | ||
| 140 | - int n, | ||
| 141 | - aclComputeType type, | ||
| 142 | - aclopHandle **handle); | ||
| 143 | - | ||
| 144 | -/** | ||
| 145 | - * @ingroup AscendCL | ||
| 146 | - * @brief perform the matrix-vector multiplication | ||
| 147 | - * | ||
| 148 | - * @param transA [IN] transpose type of matrix A | ||
| 149 | - * @param m [IN] number of rows of matrix A | ||
| 150 | - * @param n [IN] number of columns of matrix A | ||
| 151 | - * @param alpha [IN] pointer to scalar used for multiplication | ||
| 152 | - * @param a [IN] pointer to matrix A | ||
| 153 | - * @param lda [IN] leading dimension used to store the matrix A | ||
| 154 | - * @param x [IN] pointer to vector x | ||
| 155 | - * @param incx [IN] stride between consecutive elements of vector x | ||
| 156 | - * @param beta [IN] pointer to scalar used for multiplication. | ||
| 157 | - * If beta value == 0, | ||
| 158 | - * then y does not have to be a valid input | ||
| 159 | - * @param y [IN|OUT] pointer to vector y | ||
| 160 | - * @param incy [IN] stride between consecutive elements of vector y | ||
| 161 | - * @param type [IN] computation type | ||
| 162 | - * @param stream [IN] stream | ||
| 163 | - * | ||
| 164 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 165 | - * @retval OtherValues Failure | ||
| 166 | - */ | ||
| 167 | -ACL_FUNC_VISIBILITY aclError aclblasS8gemv(aclTransType transA, | ||
| 168 | - int m, | ||
| 169 | - int n, | ||
| 170 | - const int32_t *alpha, | ||
| 171 | - const int8_t *a, | ||
| 172 | - int lda, | ||
| 173 | - const int8_t *x, | ||
| 174 | - int incx, | ||
| 175 | - const int32_t *beta, | ||
| 176 | - int32_t *y, | ||
| 177 | - int incy, | ||
| 178 | - aclComputeType type, | ||
| 179 | - aclrtStream stream); | ||
| 180 | - | ||
| 181 | -/** | ||
| 182 | - * @ingroup AscendCL | ||
| 183 | - * @brief create a handle for performing the matrix-vector multiplication | ||
| 184 | - * | ||
| 185 | - * @param transA [IN] transpose type of matrix A | ||
| 186 | - * @param m [IN] number of rows of matrix A | ||
| 187 | - * @param n [IN] number of columns of matrix A | ||
| 188 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 189 | - * @param type [IN] computation type | ||
| 190 | - * | ||
| 191 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 192 | - * @retval OtherValues Failure | ||
| 193 | - */ | ||
| 194 | -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemv(aclTransType transA, | ||
| 195 | - int m, | ||
| 196 | - int n, | ||
| 197 | - aclComputeType type, | ||
| 198 | - aclopHandle **handle); | ||
| 199 | - | ||
| 200 | -/** | ||
| 201 | - * @ingroup AscendCL | ||
| 202 | - * @brief perform the matrix-matrix multiplication | ||
| 203 | - * | ||
| 204 | - * @param transA [IN] transpose type of matrix A | ||
| 205 | - * @param transB [IN] transpose type of matrix B | ||
| 206 | - * @param transC [IN] transpose type of matrix C | ||
| 207 | - * @param m [IN] number of rows of matrix A and matrix C | ||
| 208 | - * @param n [IN] number of columns of matrix B and matrix C | ||
| 209 | - * @param k [IN] number of columns of matrix A and rows of matrix B | ||
| 210 | - * @param alpha [IN] pointer to scalar used for multiplication. of same type as dataTypeC | ||
| 211 | - * @param matrixA [IN] pointer to matrix A | ||
| 212 | - * @param lda [IN] leading dimension array used to store matrix A | ||
| 213 | - * @param dataTypeA [IN] datatype of matrix A | ||
| 214 | - * @param matrixB [IN] pointer to matrix B | ||
| 215 | - * @param ldb [IN] leading dimension array used to store matrix B | ||
| 216 | - * @param dataTypeB [IN] datatype of matrix B | ||
| 217 | - * @param beta [IN] pointer to scalar used for multiplication. | ||
| 218 | - * of same type as dataTypeC If beta == 0, | ||
| 219 | - * then matrixC does not have to be a valid input | ||
| 220 | - * @param matrixC [IN|OUT] pointer to matrix C | ||
| 221 | - * @param ldc [IN] leading dimension array used to store matrix C | ||
| 222 | - * @param dataTypeC [IN] datatype of matrix C | ||
| 223 | - * @param type [IN] computation type | ||
| 224 | - * @param stream [IN] stream | ||
| 225 | - * | ||
| 226 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 227 | - * @retval OtherValues Failure | ||
| 228 | - */ | ||
| 229 | -ACL_FUNC_VISIBILITY aclError aclblasGemmEx(aclTransType transA, | ||
| 230 | - aclTransType transB, | ||
| 231 | - aclTransType transC, | ||
| 232 | - int m, | ||
| 233 | - int n, | ||
| 234 | - int k, | ||
| 235 | - const void *alpha, | ||
| 236 | - const void *matrixA, | ||
| 237 | - int lda, | ||
| 238 | - aclDataType dataTypeA, | ||
| 239 | - const void *matrixB, | ||
| 240 | - int ldb, | ||
| 241 | - aclDataType dataTypeB, | ||
| 242 | - const void *beta, | ||
| 243 | - void *matrixC, | ||
| 244 | - int ldc, | ||
| 245 | - aclDataType dataTypeC, | ||
| 246 | - aclComputeType type, | ||
| 247 | - aclrtStream stream); | ||
| 248 | - | ||
| 249 | - | ||
| 250 | -/** | ||
| 251 | - * @ingroup AscendCL | ||
| 252 | - * @brief create a handle for performing the matrix-matrix multiplication | ||
| 253 | - * | ||
| 254 | - * @param transA [IN] transpose type of matrix A | ||
| 255 | - * @param transB [IN] transpose type of matrix B | ||
| 256 | - * @param transC [IN] transpose type of matrix C | ||
| 257 | - * @param m [IN] number of rows of matrix A and matrix C | ||
| 258 | - * @param n [IN] number of columns of matrix B and matrix C | ||
| 259 | - * @param k [IN] number of columns of matrix A and rows of matrix B | ||
| 260 | - * @param dataTypeA [IN] datatype of matrix A | ||
| 261 | - * @param dataTypeB [IN] datatype of matrix B | ||
| 262 | - * @param dataTypeC [IN] datatype of matrix C | ||
| 263 | - * @param type [IN] computation type | ||
| 264 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 265 | - * @param type [IN] computation type | ||
| 266 | - * | ||
| 267 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 268 | - * @retval OtherValues Failure | ||
| 269 | - */ | ||
| 270 | -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForGemmEx(aclTransType transA, | ||
| 271 | - aclTransType transB, | ||
| 272 | - aclTransType transC, | ||
| 273 | - int m, | ||
| 274 | - int n, | ||
| 275 | - int k, | ||
| 276 | - aclDataType dataTypeA, | ||
| 277 | - aclDataType dataTypeB, | ||
| 278 | - aclDataType dataTypeC, | ||
| 279 | - aclComputeType type, | ||
| 280 | - aclopHandle **handle); | ||
| 281 | - | ||
| 282 | - | ||
| 283 | -/** | ||
| 284 | - * @ingroup AscendCL | ||
| 285 | - * @brief perform the matrix-matrix multiplication | ||
| 286 | - * | ||
| 287 | - * @param transA [IN] transpose type of matrix A | ||
| 288 | - * @param transB [IN] transpose type of matrix B | ||
| 289 | - * @param transC [IN] transpose type of matrix C | ||
| 290 | - * @param m [IN] number of rows of matrix A and matrix C | ||
| 291 | - * @param n [IN] number of columns of matrix B and matrix C | ||
| 292 | - * @param k [IN] number of columns of matrix A and rows of matrix B | ||
| 293 | - * @param alpha [IN] pointer to scalar used for multiplication | ||
| 294 | - * @param matrixA [IN] pointer to matrix A | ||
| 295 | - * @param lda [IN] leading dimension used to store the matrix A | ||
| 296 | - * @param matrixB [IN] pointer to matrix B | ||
| 297 | - * @param ldb [IN] leading dimension used to store the matrix B | ||
| 298 | - * @param beta [IN] pointer to scalar used for multiplication. | ||
| 299 | - * If beta value == 0, | ||
| 300 | - * then matrixC does not have to be a valid input | ||
| 301 | - * @param matrixC [IN|OUT] pointer to matrix C | ||
| 302 | - * @param ldc [IN] leading dimension used to store the matrix C | ||
| 303 | - * @param type [IN] computation type | ||
| 304 | - * @param stream [IN] stream | ||
| 305 | - * | ||
| 306 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 307 | - * @retval OtherValues Failure | ||
| 308 | - */ | ||
| 309 | -ACL_FUNC_VISIBILITY aclError aclblasHgemm(aclTransType transA, | ||
| 310 | - aclTransType transB, | ||
| 311 | - aclTransType transC, | ||
| 312 | - int m, | ||
| 313 | - int n, | ||
| 314 | - int k, | ||
| 315 | - const aclFloat16 *alpha, | ||
| 316 | - const aclFloat16 *matrixA, | ||
| 317 | - int lda, | ||
| 318 | - const aclFloat16 *matrixB, | ||
| 319 | - int ldb, | ||
| 320 | - const aclFloat16 *beta, | ||
| 321 | - aclFloat16 *matrixC, | ||
| 322 | - int ldc, | ||
| 323 | - aclComputeType type, | ||
| 324 | - aclrtStream stream); | ||
| 325 | - | ||
| 326 | -/** | ||
| 327 | - * @ingroup AscendCL | ||
| 328 | - * @brief create a handle for performing the matrix-matrix multiplication | ||
| 329 | - * | ||
| 330 | - * @param transA [IN] transpose type of matrix A | ||
| 331 | - * @param transB [IN] transpose type of matrix B | ||
| 332 | - * @param transC [IN] transpose type of matrix C | ||
| 333 | - * @param m [IN] number of rows of matrix A and matrix C | ||
| 334 | - * @param n [IN] number of columns of matrix B and matrix C | ||
| 335 | - * @param k [IN] number of columns of matrix A and rows of matrix B | ||
| 336 | - * @param type [IN] computation type | ||
| 337 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 338 | - * | ||
| 339 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 340 | - * @retval OtherValues Failure | ||
| 341 | - */ | ||
| 342 | -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForHgemm(aclTransType transA, | ||
| 343 | - aclTransType transB, | ||
| 344 | - aclTransType transC, | ||
| 345 | - int m, | ||
| 346 | - int n, | ||
| 347 | - int k, | ||
| 348 | - aclComputeType type, | ||
| 349 | - aclopHandle **handle); | ||
| 350 | - | ||
| 351 | -/** | ||
| 352 | - * @ingroup AscendCL | ||
| 353 | - * @brief perform the matrix-matrix multiplication | ||
| 354 | - * | ||
| 355 | - * @param transA [IN] transpose type of matrix A | ||
| 356 | - * @param transB [IN] transpose type of matrix B | ||
| 357 | - * @param transC [IN] transpose type of matrix C | ||
| 358 | - * @param m [IN] number of rows of matrix A and matrix C | ||
| 359 | - * @param n [IN] number of columns of matrix B and matrix C | ||
| 360 | - * @param k [IN] number of columns of matrix A and rows of matrix B | ||
| 361 | - * @param alpha [IN] pointer to scalar used for multiplication | ||
| 362 | - * @param matrixA [IN] pointer to matrix A | ||
| 363 | - * @param lda [IN] leading dimension used to store the matrix A | ||
| 364 | - * @param matrixB [IN] pointer to matrix B | ||
| 365 | - * @param ldb [IN] leading dimension used to store the matrix B | ||
| 366 | - * @param beta [IN] pointer to scalar used for multiplication. | ||
| 367 | - * If beta value == 0, | ||
| 368 | - * then matrixC does not have to be a valid input | ||
| 369 | - * @param matrixC [IN|OUT] pointer to matrix C | ||
| 370 | - * @param ldc [IN] leading dimension used to store the matrix C | ||
| 371 | - * @param type [IN] computation type | ||
| 372 | - * @param stream [IN] stream | ||
| 373 | - * | ||
| 374 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 375 | - * @retval OtherValues Failure | ||
| 376 | - */ | ||
| 377 | -ACL_FUNC_VISIBILITY aclError aclblasS8gemm(aclTransType transA, | ||
| 378 | - aclTransType transB, | ||
| 379 | - aclTransType transC, | ||
| 380 | - int m, | ||
| 381 | - int n, | ||
| 382 | - int k, | ||
| 383 | - const int32_t *alpha, | ||
| 384 | - const int8_t *matrixA, | ||
| 385 | - int lda, | ||
| 386 | - const int8_t *matrixB, | ||
| 387 | - int ldb, | ||
| 388 | - const int32_t *beta, | ||
| 389 | - int32_t *matrixC, | ||
| 390 | - int ldc, | ||
| 391 | - aclComputeType type, | ||
| 392 | - aclrtStream stream); | ||
| 393 | - | ||
| 394 | - | ||
| 395 | -/** | ||
| 396 | - * @ingroup AscendCL | ||
| 397 | - * @brief create a handle for performing the matrix-matrix multiplication | ||
| 398 | - * | ||
| 399 | - * @param transA [IN] transpose type of matrix A | ||
| 400 | - * @param transB [IN] transpose type of matrix B | ||
| 401 | - * @param transC [IN] transpose type of matrix C | ||
| 402 | - * @param m [IN] number of rows of matrix A and matrix C | ||
| 403 | - * @param n [IN] number of columns of matrix B and matrix C | ||
| 404 | - * @param k [IN] number of columns of matrix A and rows of matrix B | ||
| 405 | - * @param type [IN] computation type | ||
| 406 | - * @param handle [OUT] pointer to the pointer to the handle | ||
| 407 | - * | ||
| 408 | - * @retval ACL_SUCCESS The function is successfully executed. | ||
| 409 | - * @retval OtherValues Failure | ||
| 410 | - */ | ||
| 411 | -ACL_FUNC_VISIBILITY aclError aclblasCreateHandleForS8gemm(aclTransType transA, | ||
| 412 | - aclTransType transB, | ||
| 413 | - aclTransType transC, | ||
| 414 | - int m, | ||
| 415 | - int n, | ||
| 416 | - int k, | ||
| 417 | - aclComputeType type, | ||
| 418 | - aclopHandle **handle); | ||
| 419 | - | ||
| 420 | - | ||
| 421 | -} | ||
| 422 | - | ||
| 423 | - | ||
| 424 | - | ||
| @@ -0,0 +1 @@ | |||
| 1 | +Subproject commit a74342b574f03ffe45e059c1a0fa74e50ccf5733 | ||
| @@ -0,0 +1 @@ | |||
| 1 | +Subproject commit 6ff8fe3b4722857da8ceeef10c026b88f0997f83 | ||
| @@ -0,0 +1 @@ | |||
| 1 | +Subproject commit 6cce8b2417de63cfb5726489fa894199dc8a77e1 | ||
| @@ -34,6 +34,8 @@ | |||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | +static constexpr size_t kMaxModuleNum = 128; | ||
| 38 | + | ||
| 37 | std::string format_size(uint64_t size) | 39 | std::string format_size(uint64_t size) |
| 38 | { | 40 | { |
| 39 | std::ostringstream os; | 41 | std::ostringstream os; |
| @@ -905,11 +907,11 @@ void setAllocatorSettings(const std::string& settings) | |||
| 905 | 907 | ||
| 906 | bool saveDevMemUsageInfo(const int& device) | 908 | bool saveDevMemUsageInfo(const int& device) |
| 907 | { | 909 | { |
| 908 | - aclrtMemUsageInfo memUsageInfo[MAX_MODULE_NUM] = {0}; | 910 | + aclrtMemUsageInfo memUsageInfo[kMaxModuleNum] = {0}; |
| 909 | size_t moduleCount = 0; | 911 | size_t moduleCount = 0; |
| 910 | 912 | ||
| 911 | // Get the memory usage information | 913 | // Get the memory usage information |
| 912 | - aclError ret = c10_npu::acl::AclrtGetMemUsageInfo(device, memUsageInfo, MAX_MODULE_NUM, &moduleCount); | 914 | + aclError ret = c10_npu::acl::AclrtGetMemUsageInfo(device, memUsageInfo, kMaxModuleNum, &moduleCount); |
| 913 | if (ret != ACL_ERROR_NONE) { | 915 | if (ret != ACL_ERROR_NONE) { |
| 914 | TORCH_NPU_MEMORY_LOGE("AclrtGetMemUsageInfo failed, ret:%d", ret); | 916 | TORCH_NPU_MEMORY_LOGE("AclrtGetMemUsageInfo failed, ret:%d", ret); |
| 915 | return false; | 917 | return false; |
| @@ -932,13 +934,13 @@ bool saveDevMemUsageInfo(const int& device) | |||
| 932 | 934 | ||
| 933 | csv_file << "moduleName,curMemSize(MB),memPeakSize(MB)\n" << std::fixed << std::setprecision(kPrecision); | 935 | csv_file << "moduleName,curMemSize(MB),memPeakSize(MB)\n" << std::fixed << std::setprecision(kPrecision); |
| 934 | 936 | ||
| 935 | - // moduleCount is unreliable, so limit i to MAX_MODULE_NUM | 937 | + // moduleCount is unreliable, so limit i to kMaxModuleNum |
| 936 | - for (size_t i = 0; i < moduleCount && i < MAX_MODULE_NUM; ++i) { | 938 | + for (size_t i = 0; i < moduleCount && i < kMaxModuleNum; ++i) { |
| 937 | csv_file << memUsageInfo[i].name << "," << static_cast<double>(memUsageInfo[i].curMemSize) / kMB << "," | 939 | csv_file << memUsageInfo[i].name << "," << static_cast<double>(memUsageInfo[i].curMemSize) / kMB << "," |
| 938 | << static_cast<double>(memUsageInfo[i].memPeakSize) / kMB << "\n"; | 940 | << static_cast<double>(memUsageInfo[i].memPeakSize) / kMB << "\n"; |
| 939 | } | 941 | } |
| 940 | - if (moduleCount > MAX_MODULE_NUM) { | 942 | + if (moduleCount > kMaxModuleNum) { |
| 941 | - TORCH_NPU_MEMORY_LOGW("The number of modules exceeds the maximum limit: %zu > %zu", moduleCount, MAX_MODULE_NUM); | 943 | + TORCH_NPU_MEMORY_LOGW("The number of modules exceeds the maximum limit: %zu > %zu", moduleCount, kMaxModuleNum); |
| 942 | } | 944 | } |
| 943 | csv_file.close(); | 945 | csv_file.close(); |
| 944 | 946 | ||
| @@ -969,7 +971,7 @@ private: | |||
| 969 | }; | 971 | }; |
| 970 | 972 | ||
| 971 | struct handle_str { | 973 | struct handle_str { |
| 972 | - char data[ACL_IPC_HANDLE_SIZE]; | 974 | + char data[kAclIpcHandleSize]; |
| 973 | }; | 975 | }; |
| 974 | 976 | ||
| 975 | // handle for ptr | 977 | // handle for ptr |
| @@ -1560,12 +1562,12 @@ public: | |||
| 1560 | auto it = ipc_handle_map.find(base_ptr); | 1562 | auto it = ipc_handle_map.find(base_ptr); |
| 1561 | if (it == ipc_handle_map.end()) { | 1563 | if (it == ipc_handle_map.end()) { |
| 1562 | NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemGetExportKey( | 1564 | NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemGetExportKey( |
| 1563 | - base_ptr, base_size, handle.data, ACL_IPC_HANDLE_SIZE, ACL_RT_IPC_MEM_EXPORT_FLAG_DISABLE_PID_VALIDATION)); | 1565 | + base_ptr, base_size, handle.data, kAclIpcHandleSize, ACL_RT_IPC_MEM_EXPORT_FLAG_DISABLE_PID_VALIDATION)); |
| 1564 | ipc_handle_map[base_ptr] = handle; | 1566 | ipc_handle_map[base_ptr] = handle; |
| 1565 | } else { | 1567 | } else { |
| 1566 | handle = it->second; | 1568 | handle = it->second; |
| 1567 | } | 1569 | } |
| 1568 | - ss.write((char*)&handle, ACL_IPC_HANDLE_SIZE); | 1570 | + ss.write((char*)&handle, kAclIpcHandleSize); |
| 1569 | } else { | 1571 | } else { |
| 1570 | ss.put(SHAREABLE_NPU_EXPANDABLE_SEGMENT); | 1572 | ss.put(SHAREABLE_NPU_EXPANDABLE_SEGMENT); |
| 1571 | auto full_range = block->expandable_segment_->share( | 1573 | auto full_range = block->expandable_segment_->share( |
| @@ -3698,7 +3700,7 @@ public: | |||
| 3698 | { | 3700 | { |
| 3699 | int type = SHAREABLE_NPU_MALLOC; | 3701 | int type = SHAREABLE_NPU_MALLOC; |
| 3700 | std::istringstream ss(handle); | 3702 | std::istringstream ss(handle); |
| 3701 | - if (handle.size() != ACL_IPC_HANDLE_SIZE) { | 3703 | + if (handle.size() != kAclIpcHandleSize) { |
| 3702 | auto version = ss.get(); | 3704 | auto version = ss.get(); |
| 3703 | TORCH_CHECK( | 3705 | TORCH_CHECK( |
| 3704 | version <= SHAREABLE_HANDLE_VERSION, | 3706 | version <= SHAREABLE_HANDLE_VERSION, |
| @@ -3710,10 +3712,10 @@ public: | |||
| 3710 | // SHAREABLE_NPU_MALLOC | 3712 | // SHAREABLE_NPU_MALLOC |
| 3711 | if (type == SHAREABLE_NPU_MALLOC) { | 3713 | if (type == SHAREABLE_NPU_MALLOC) { |
| 3712 | handle_str handle_r; | 3714 | handle_str handle_r; |
| 3713 | - ss.read(handle_r.data, ACL_IPC_HANDLE_SIZE); | 3715 | + ss.read(handle_r.data, kAclIpcHandleSize); |
| 3714 | NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemImportByKey( | 3716 | NPU_CHECK_ERROR(c10_npu::acl::AclrtIpcMemImportByKey( |
| 3715 | &npu_ipc_ptr_, handle_r.data, ACL_RT_IPC_MEM_IMPORT_FLAG_ENABLE_PEER_ACCESS)); | 3717 | &npu_ipc_ptr_, handle_r.data, ACL_RT_IPC_MEM_IMPORT_FLAG_ENABLE_PEER_ACCESS)); |
| 3716 | - handle_s.assign(handle_r.data, ACL_IPC_HANDLE_SIZE); | 3718 | + handle_s.assign(handle_r.data, kAclIpcHandleSize); |
| 3717 | } else if (type == SHAREABLE_NPU_EXPANDABLE_SEGMENT) { | 3719 | } else if (type == SHAREABLE_NPU_EXPANDABLE_SEGMENT) { |
| 3718 | expandable_segment_ = | 3720 | expandable_segment_ = |
| 3719 | ExpandableSegment::fromShared(device, ss) | 3721 | ExpandableSegment::fromShared(device, ss) |
| @@ -46,6 +46,7 @@ inline std::shared_ptr<npu_logging::Logger>& GetLoggerMem() | |||
| 46 | std::string format_size(uint64_t size); | 46 | std::string format_size(uint64_t size); |
| 47 | 47 | ||
| 48 | namespace c10_npu { | 48 | namespace c10_npu { |
| 49 | +constexpr size_t kAclIpcHandleSize = 65; | ||
| 49 | namespace NPUCachingAllocator { | 50 | namespace NPUCachingAllocator { |
| 50 | 51 | ||
| 51 | C10_NPU_API std::mutex* getFreeMutex(); | 52 | C10_NPU_API std::mutex* getFreeMutex(); |
| @@ -28,7 +28,7 @@ void apply_cache_op_info(aclrtStream stream, bool enabled) | |||
| 28 | } | 28 | } |
| 29 | aclrtStreamAttrValue val; | 29 | aclrtStreamAttrValue val; |
| 30 | val.cacheOpInfoSwitch = static_cast<uint32_t>(enabled ? 1u : 0u); | 30 | val.cacheOpInfoSwitch = static_cast<uint32_t>(enabled ? 1u : 0u); |
| 31 | - int32_t ret = c10_npu::acl::AclrtSetStreamAttribute(stream, aclrtStreamAttr::ACL_STREAM_ATTR_CACHE_OP_IFNO, | 31 | + int32_t ret = c10_npu::acl::AclrtSetStreamAttribute(stream, aclrtStreamAttr::ACL_STREAM_ATTR_CACHE_OP_INFO, |
| 32 | &val); | 32 | &val); |
| 33 | if (ret == ACL_ERROR_RT_PARAM_INVALID) { | 33 | if (ret == ACL_ERROR_RT_PARAM_INVALID) { |
| 34 | ASCEND_LOGW("Report shape function is disabled due to incompatible CANN version."); | 34 | ASCEND_LOGW("Report shape function is disabled due to incompatible CANN version."); |
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | -#include "third_party/acl/inc/acl/acl_sk.h" | 9 | +#include "third_party/acl/inc/acl/super_kernel.h" |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| @@ -273,7 +273,7 @@ aclError AclrtValueWait(void* event, aclrtStream stream) | |||
| 273 | func = (AclrtValueWaitFunc)TORCH_NPU_GET_FUNC(aclrtValueWait); | 273 | func = (AclrtValueWaitFunc)TORCH_NPU_GET_FUNC(aclrtValueWait); |
| 274 | } | 274 | } |
| 275 | TORCH_CHECK(func, "Failed to find function aclrtValueWait", PTA_ERROR(ErrCode::NOT_FOUND)); | 275 | TORCH_CHECK(func, "Failed to find function aclrtValueWait", PTA_ERROR(ErrCode::NOT_FOUND)); |
| 276 | - return func(event, 1, ACL_VALUE_WAIT_EQ, stream); | 276 | + return func(event, 1, ACL_STREAM_WAIT_VALUE_EQ, stream); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | aclError AclrtValueWrite(void* event, uint64_t value, aclrtStream stream) | 279 | aclError AclrtValueWrite(void* event, uint64_t value, aclrtStream stream) |
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | -#include "third_party/acl/inc/acl/acl_sk.h" | 3 | +#include "third_party/acl/inc/acl/super_kernel.h" |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| @@ -21,4 +21,4 @@ aclError AclskScopeBegin(const char *scopeName, aclrtStream stream); | |||
| 21 | */ | 21 | */ |
| 22 | aclError AclskScopeEnd(const char *scopeName, aclrtStream stream); | 22 | aclError AclskScopeEnd(const char *scopeName, aclrtStream stream); |
| 23 | } // namespace skapi | 23 | } // namespace skapi |
| 24 | -} // namespace c10_npu | 24 | +} // namespace c10_npu |
| @@ -212,7 +212,7 @@ static PyObject* THNPStorage_newSharedNpu(PyObject* _unused, PyObject* args) | |||
| 212 | npu_event.block(c10_npu::getCurrentNPUStream(device)); | 212 | npu_event.block(c10_npu::getCurrentNPUStream(device)); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | - std::string s_handle = THNPStorage_bytesAsHandleString(_handle, ACL_IPC_HANDLE_SIZE); | 215 | + std::string s_handle = THNPStorage_bytesAsHandleString(_handle, c10_npu::kAclIpcHandleSize); |
| 216 | if (s_handle.empty()) { | 216 | if (s_handle.empty()) { |
| 217 | return nullptr; | 217 | return nullptr; |
| 218 | } | 218 | } |
| @@ -317,4 +317,4 @@ PyMethodDef* reductions_functions() | |||
| 317 | } // namespace reductions | 317 | } // namespace reductions |
| 318 | } // namespace torch_npu | 318 | } // namespace torch_npu |
| 319 | 319 | ||
| 320 | -#endif | 320 | +#endif |
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -#include "third_party/acl/inc/acl/acl_sk.h" | 8 | +#include "third_party/acl/inc/acl/super_kernel.h" |
| 9 | 9 | ||
| 10 | struct PyFuncStruct { | 10 | struct PyFuncStruct { |
| 11 | PyFuncStruct(PyObject *pyFunc, PyObject *pyFuncArgs) | 11 | PyFuncStruct(PyObject *pyFunc, PyObject *pyFuncArgs) |
| @@ -31,4 +31,4 @@ struct ThreadArgs { | |||
| 31 | 31 | ||
| 32 | aclrtContext context; | 32 | aclrtContext context; |
| 33 | bool exitFlag; | 33 | bool exitFlag; |
| 34 | -}; | 34 | +}; |
| @@ -62,6 +62,8 @@ | |||
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | +constexpr int32_t kDeviceUtilizationNotSupport = -1; | ||
| 66 | + | ||
| 65 | struct NPUDeviceProp { | 67 | struct NPUDeviceProp { |
| 66 | std::string name; | 68 | std::string name; |
| 67 | size_t totalGlobalMem = 0; | 69 | size_t totalGlobalMem = 0; |
| @@ -1010,16 +1012,16 @@ PyObject* THNPModule_getDeviceUtilizationRate_wrap( | |||
| 1010 | int32_t vector = util_info.vectorUtilization; | 1012 | int32_t vector = util_info.vectorUtilization; |
| 1011 | int32_t util_rate = 0; | 1013 | int32_t util_rate = 0; |
| 1012 | // 如果vector和cube谁支持,就返回谁的使用率,如果都支持计算(vector*1+cube*1)/2 | 1014 | // 如果vector和cube谁支持,就返回谁的使用率,如果都支持计算(vector*1+cube*1)/2 |
| 1013 | - if (cube == DEVICE_UTILIZATION_NOT_SUPPORT && | 1015 | + if (cube == kDeviceUtilizationNotSupport && |
| 1014 | - vector != DEVICE_UTILIZATION_NOT_SUPPORT) { | 1016 | + vector != kDeviceUtilizationNotSupport) { |
| 1015 | util_rate = vector; | 1017 | util_rate = vector; |
| 1016 | } else if ( | 1018 | } else if ( |
| 1017 | - cube != DEVICE_UTILIZATION_NOT_SUPPORT && | 1019 | + cube != kDeviceUtilizationNotSupport && |
| 1018 | - vector == DEVICE_UTILIZATION_NOT_SUPPORT) { | 1020 | + vector == kDeviceUtilizationNotSupport) { |
| 1019 | util_rate = cube; | 1021 | util_rate = cube; |
| 1020 | } else if ( | 1022 | } else if ( |
| 1021 | - cube != DEVICE_UTILIZATION_NOT_SUPPORT && | 1023 | + cube != kDeviceUtilizationNotSupport && |
| 1022 | - vector != DEVICE_UTILIZATION_NOT_SUPPORT) { | 1024 | + vector != kDeviceUtilizationNotSupport) { |
| 1023 | util_rate = (cube + vector) / 2; | 1025 | util_rate = (cube + vector) / 2; |
| 1024 | } | 1026 | } |
| 1025 | TORCH_CHECK( | 1027 | TORCH_CHECK( |
| @@ -22,6 +22,10 @@ void* StressDetector::localHcclComm = nullptr; | |||
| 22 | constexpr int kDetectSucceeded = 0; | 22 | constexpr int kDetectSucceeded = 0; |
| 23 | constexpr int kDetectFailed = 1; | 23 | constexpr int kDetectFailed = 1; |
| 24 | constexpr int kDetectFailedWithHardwareFailure = 2; | 24 | constexpr int kDetectFailedWithHardwareFailure = 2; |
| 25 | +constexpr int kAclnnStressBitFail = 574006; | ||
| 26 | +constexpr int kAclnnClearDeviceStateFail = 574007; | ||
| 27 | +constexpr int kAclnnStressLowBitFail = 574008; | ||
| 28 | +constexpr int kAclnnStressHighBitFail = 574009; | ||
| 25 | 29 | ||
| 26 | // Persistent worker thread implementation | 30 | // Persistent worker thread implementation |
| 27 | void StressDetector::worker_thread() | 31 | void StressDetector::worker_thread() |
| @@ -96,14 +100,14 @@ int StressDetector::transfer_result(int detectResult) | |||
| 96 | ret = kDetectSucceeded; | 100 | ret = kDetectSucceeded; |
| 97 | ASCEND_LOGI("Stress detect test case execution succeeded, device id is %d.", device_id); | 101 | ASCEND_LOGI("Stress detect test case execution succeeded, device id is %d.", device_id); |
| 98 | break; | 102 | break; |
| 99 | - case ACLNN_STRESS_BIT_FAIL: | 103 | + case kAclnnStressBitFail: |
| 100 | - case ACLNN_STRESS_LOW_BIT_FAIL: | 104 | + case kAclnnStressLowBitFail: |
| 101 | - case ACLNN_STRESS_HIGH_BIT_FAIL: | 105 | + case kAclnnStressHighBitFail: |
| 102 | ret = kDetectFailedWithHardwareFailure; | 106 | ret = kDetectFailedWithHardwareFailure; |
| 103 | ASCEND_LOGW("Stress detect failed due to hardware malfunction, device id is %d, error code is %d.", device_id, detectResult); | 107 | ASCEND_LOGW("Stress detect failed due to hardware malfunction, device id is %d, error code is %d.", device_id, detectResult); |
| 104 | TORCH_NPU_WARN("Stress detect failed due to hardware malfunction, device id is ", device_id, ", error code is ", detectResult); | 108 | TORCH_NPU_WARN("Stress detect failed due to hardware malfunction, device id is ", device_id, ", error code is ", detectResult); |
| 105 | break; | 109 | break; |
| 106 | - case ACLNN_CLEAR_DEVICE_STATE_FAIL: | 110 | + case kAclnnClearDeviceStateFail: |
| 107 | ASCEND_LOGW("Stress detect error. Error code is 574007. Error message is Voltage recovery failed, device id is %d.", device_id); | 111 | ASCEND_LOGW("Stress detect error. Error code is 574007. Error message is Voltage recovery failed, device id is %d.", device_id); |
| 108 | TORCH_CHECK(false, "Stress detect error. Error code is 574007. Error message is Voltage recovery failed.", PTA_ERROR(ErrCode::ACL)); | 112 | TORCH_CHECK(false, "Stress detect error. Error code is 574007. Error message is Voltage recovery failed.", PTA_ERROR(ErrCode::ACL)); |
| 109 | break; | 113 | break; |
| @@ -187,4 +191,4 @@ void StressDetector::stop_worker_thread() | |||
| 187 | if (stress_detect_thread.joinable()) { | 191 | if (stress_detect_thread.joinable()) { |
| 188 | stress_detect_thread.join(); // Wait for the thread to exit | 192 | stress_detect_thread.join(); // Wait for the thread to exit |
| 189 | } | 193 | } |
| 190 | -} | 194 | +} |