Merged
DV121 DV122适配:ops-math 部分算子新增ascend960dt/960pr平台支持 #7033
huairuchenAdd on 15 days ago
DV121 DV122适配:ops-math 部分算子新增ascend960dt/960pr平台支持 #7033
Merged
Merged fromhuairuchen/ops-mathdv122-960-adapt-batch1intocann/ops-mathmaster
Total: 39 files changed+2353-25
| @@ -44,6 +44,7 @@ public: | |||
| 44 | this->AICore().AddConfig("ascend950"); | 44 | this->AICore().AddConfig("ascend950"); |
| 45 | this->AICore().AddConfig("ascend350"); | 45 | this->AICore().AddConfig("ascend350"); |
| 46 | this->AICore().AddConfig("ascend960dt"); | 46 | this->AICore().AddConfig("ascend960dt"); |
| 47 | + this->AICore().AddConfig("ascend960pr"); | ||
| 47 | } | 48 | } |
| 48 | }; | 49 | }; |
| 49 | 50 | ||
| @@ -58,7 +58,9 @@ ge::graphStatus ChunkCatTiling::GetPlatformInfo() | |||
| 58 | OP_CHECK_IF(ubSize_ == 0, OP_LOGE(context_, "ubSize is 0"), return ge::GRAPH_FAILED); | 58 | OP_CHECK_IF(ubSize_ == 0, OP_LOGE(context_, "ubSize is 0"), return ge::GRAPH_FAILED); |
| 59 | sysWorkspaceSize_ = ascendcPlatform.GetLibApiWorkSpaceSize(); | 59 | sysWorkspaceSize_ = ascendcPlatform.GetLibApiWorkSpaceSize(); |
| 60 | isRegBase = Ops::Base::IsRegbaseSocVersion(context_); | 60 | isRegBase = Ops::Base::IsRegbaseSocVersion(context_); |
| 61 | - isAscend960dt_ = ascendcPlatform.GetCurNpuArch() == NpuArch::DAV_9201; | 61 | + // Ascend960 (DAV_9201/9202) 共用同一套 tiling 适配逻辑 |
| 62 | + isAscend960dt_ = ascendcPlatform.GetCurNpuArch() == NpuArch::DAV_9201 || | ||
| 63 | + ascendcPlatform.GetCurNpuArch() == NpuArch::DAV_9202; | ||
| 62 | return ge::GRAPH_SUCCESS; | 64 | return ge::GRAPH_SUCCESS; |
| 63 | } | 65 | } |
| 64 | 66 | ||
| @@ -0,0 +1,292 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "ChunkCat", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "ChunkCat_fp16_fp16", | ||
| 6 | + "inputs": [ | ||
| 7 | + [ | ||
| 8 | + { | ||
| 9 | + "name": "x", | ||
| 10 | + "index": 0, | ||
| 11 | + "dtype": "float16", | ||
| 12 | + "format": "ND", | ||
| 13 | + "paramType": "dynamic", | ||
| 14 | + "shape": [ | ||
| 15 | + -2 | ||
| 16 | + ] | ||
| 17 | + } | ||
| 18 | + ] | ||
| 19 | + ], | ||
| 20 | + "outputs": [ | ||
| 21 | + { | ||
| 22 | + "name": "y", | ||
| 23 | + "index": 0, | ||
| 24 | + "dtype": "float16", | ||
| 25 | + "format": "ND", | ||
| 26 | + "paramType": "required", | ||
| 27 | + "shape": [ | ||
| 28 | + -2 | ||
| 29 | + ] | ||
| 30 | + } | ||
| 31 | + ], | ||
| 32 | + "attrs": [ | ||
| 33 | + { | ||
| 34 | + "name": "dim", | ||
| 35 | + "dtype": "int", | ||
| 36 | + "value": null | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + "name": "num_chunks", | ||
| 40 | + "dtype": "int", | ||
| 41 | + "value": null | ||
| 42 | + } | ||
| 43 | + ] | ||
| 44 | + }, | ||
| 45 | + { | ||
| 46 | + "bin_filename": "ChunkCat_fp16_bf16", | ||
| 47 | + "inputs": [ | ||
| 48 | + [ | ||
| 49 | + { | ||
| 50 | + "name": "x", | ||
| 51 | + "index": 0, | ||
| 52 | + "dtype": "float16", | ||
| 53 | + "format": "ND", | ||
| 54 | + "paramType": "dynamic", | ||
| 55 | + "shape": [ | ||
| 56 | + -2 | ||
| 57 | + ] | ||
| 58 | + } | ||
| 59 | + ] | ||
| 60 | + ], | ||
| 61 | + "outputs": [ | ||
| 62 | + { | ||
| 63 | + "name": "y", | ||
| 64 | + "index": 0, | ||
| 65 | + "dtype": "bfloat16", | ||
| 66 | + "format": "ND", | ||
| 67 | + "paramType": "required", | ||
| 68 | + "shape": [ | ||
| 69 | + -2 | ||
| 70 | + ] | ||
| 71 | + } | ||
| 72 | + ], | ||
| 73 | + "attrs": [ | ||
| 74 | + { | ||
| 75 | + "name": "dim", | ||
| 76 | + "dtype": "int", | ||
| 77 | + "value": null | ||
| 78 | + }, | ||
| 79 | + { | ||
| 80 | + "name": "num_chunks", | ||
| 81 | + "dtype": "int", | ||
| 82 | + "value": null | ||
| 83 | + } | ||
| 84 | + ] | ||
| 85 | + }, | ||
| 86 | + { | ||
| 87 | + "bin_filename": "ChunkCat_fp16_fp32", | ||
| 88 | + "inputs": [ | ||
| 89 | + [ | ||
| 90 | + { | ||
| 91 | + "name": "x", | ||
| 92 | + "index": 0, | ||
| 93 | + "dtype": "float16", | ||
| 94 | + "format": "ND", | ||
| 95 | + "paramType": "dynamic", | ||
| 96 | + "shape": [ | ||
| 97 | + -2 | ||
| 98 | + ] | ||
| 99 | + } | ||
| 100 | + ] | ||
| 101 | + ], | ||
| 102 | + "outputs": [ | ||
| 103 | + { | ||
| 104 | + "name": "y", | ||
| 105 | + "index": 0, | ||
| 106 | + "dtype": "float32", | ||
| 107 | + "format": "ND", | ||
| 108 | + "paramType": "required", | ||
| 109 | + "shape": [ | ||
| 110 | + -2 | ||
| 111 | + ] | ||
| 112 | + } | ||
| 113 | + ], | ||
| 114 | + "attrs": [ | ||
| 115 | + { | ||
| 116 | + "name": "dim", | ||
| 117 | + "dtype": "int", | ||
| 118 | + "value": null | ||
| 119 | + }, | ||
| 120 | + { | ||
| 121 | + "name": "num_chunks", | ||
| 122 | + "dtype": "int", | ||
| 123 | + "value": null | ||
| 124 | + } | ||
| 125 | + ] | ||
| 126 | + }, | ||
| 127 | + { | ||
| 128 | + "bin_filename": "ChunkCat_bf16_fp16", | ||
| 129 | + "inputs": [ | ||
| 130 | + [ | ||
| 131 | + { | ||
| 132 | + "name": "x", | ||
| 133 | + "index": 0, | ||
| 134 | + "dtype": "bfloat16", | ||
| 135 | + "format": "ND", | ||
| 136 | + "paramType": "dynamic", | ||
| 137 | + "shape": [ | ||
| 138 | + -2 | ||
| 139 | + ] | ||
| 140 | + } | ||
| 141 | + ] | ||
| 142 | + ], | ||
| 143 | + "outputs": [ | ||
| 144 | + { | ||
| 145 | + "name": "y", | ||
| 146 | + "index": 0, | ||
| 147 | + "dtype": "float16", | ||
| 148 | + "format": "ND", | ||
| 149 | + "paramType": "required", | ||
| 150 | + "shape": [ | ||
| 151 | + -2 | ||
| 152 | + ] | ||
| 153 | + } | ||
| 154 | + ], | ||
| 155 | + "attrs": [ | ||
| 156 | + { | ||
| 157 | + "name": "dim", | ||
| 158 | + "dtype": "int", | ||
| 159 | + "value": null | ||
| 160 | + }, | ||
| 161 | + { | ||
| 162 | + "name": "num_chunks", | ||
| 163 | + "dtype": "int", | ||
| 164 | + "value": null | ||
| 165 | + } | ||
| 166 | + ] | ||
| 167 | + }, | ||
| 168 | + { | ||
| 169 | + "bin_filename": "ChunkCat_bf16_bf16", | ||
| 170 | + "inputs": [ | ||
| 171 | + [ | ||
| 172 | + { | ||
| 173 | + "name": "x", | ||
| 174 | + "index": 0, | ||
| 175 | + "dtype": "bfloat16", | ||
| 176 | + "format": "ND", | ||
| 177 | + "paramType": "dynamic", | ||
| 178 | + "shape": [ | ||
| 179 | + -2 | ||
| 180 | + ] | ||
| 181 | + } | ||
| 182 | + ] | ||
| 183 | + ], | ||
| 184 | + "outputs": [ | ||
| 185 | + { | ||
| 186 | + "name": "y", | ||
| 187 | + "index": 0, | ||
| 188 | + "dtype": "bfloat16", | ||
| 189 | + "format": "ND", | ||
| 190 | + "paramType": "required", | ||
| 191 | + "shape": [ | ||
| 192 | + -2 | ||
| 193 | + ] | ||
| 194 | + } | ||
| 195 | + ], | ||
| 196 | + "attrs": [ | ||
| 197 | + { | ||
| 198 | + "name": "dim", | ||
| 199 | + "dtype": "int", | ||
| 200 | + "value": null | ||
| 201 | + }, | ||
| 202 | + { | ||
| 203 | + "name": "num_chunks", | ||
| 204 | + "dtype": "int", | ||
| 205 | + "value": null | ||
| 206 | + } | ||
| 207 | + ] | ||
| 208 | + }, | ||
| 209 | + { | ||
| 210 | + "bin_filename": "ChunkCat_bf16_fp32", | ||
| 211 | + "inputs": [ | ||
| 212 | + [ | ||
| 213 | + { | ||
| 214 | + "name": "x", | ||
| 215 | + "index": 0, | ||
| 216 | + "dtype": "bfloat16", | ||
| 217 | + "format": "ND", | ||
| 218 | + "paramType": "dynamic", | ||
| 219 | + "shape": [ | ||
| 220 | + -2 | ||
| 221 | + ] | ||
| 222 | + } | ||
| 223 | + ] | ||
| 224 | + ], | ||
| 225 | + "outputs": [ | ||
| 226 | + { | ||
| 227 | + "name": "y", | ||
| 228 | + "index": 0, | ||
| 229 | + "dtype": "float32", | ||
| 230 | + "format": "ND", | ||
| 231 | + "paramType": "required", | ||
| 232 | + "shape": [ | ||
| 233 | + -2 | ||
| 234 | + ] | ||
| 235 | + } | ||
| 236 | + ], | ||
| 237 | + "attrs": [ | ||
| 238 | + { | ||
| 239 | + "name": "dim", | ||
| 240 | + "dtype": "int", | ||
| 241 | + "value": null | ||
| 242 | + }, | ||
| 243 | + { | ||
| 244 | + "name": "num_chunks", | ||
| 245 | + "dtype": "int", | ||
| 246 | + "value": null | ||
| 247 | + } | ||
| 248 | + ] | ||
| 249 | + }, | ||
| 250 | + { | ||
| 251 | + "bin_filename": "ChunkCat_fp32_fp32", | ||
| 252 | + "inputs": [ | ||
| 253 | + [ | ||
| 254 | + { | ||
| 255 | + "name": "x", | ||
| 256 | + "index": 0, | ||
| 257 | + "dtype": "float32", | ||
| 258 | + "format": "ND", | ||
| 259 | + "paramType": "dynamic", | ||
| 260 | + "shape": [ | ||
| 261 | + -2 | ||
| 262 | + ] | ||
| 263 | + } | ||
| 264 | + ] | ||
| 265 | + ], | ||
| 266 | + "outputs": [ | ||
| 267 | + { | ||
| 268 | + "name": "y", | ||
| 269 | + "index": 0, | ||
| 270 | + "dtype": "float32", | ||
| 271 | + "format": "ND", | ||
| 272 | + "paramType": "required", | ||
| 273 | + "shape": [ | ||
| 274 | + -2 | ||
| 275 | + ] | ||
| 276 | + } | ||
| 277 | + ], | ||
| 278 | + "attrs": [ | ||
| 279 | + { | ||
| 280 | + "name": "dim", | ||
| 281 | + "dtype": "int", | ||
| 282 | + "value": null | ||
| 283 | + }, | ||
| 284 | + { | ||
| 285 | + "name": "num_chunks", | ||
| 286 | + "dtype": "int", | ||
| 287 | + "value": null | ||
| 288 | + } | ||
| 289 | + ] | ||
| 290 | + } | ||
| 291 | + ] | ||
| 292 | +} | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | +; 该文件主要影响 opc 工具 编译二进制kernel时, --simplified_key_mode 选项中填写的值,格式如下所示: | ||
| 2 | +; [某算子] | ||
| 3 | +; default=xx | ||
| 4 | +; ascendxx=xx | ||
| 5 | +; 其中,default为默认mode,ascendxx为可选mode,如果不同芯片有差异化要求时,需要配置; | ||
| 6 | +; 1)如果没有配置:非ascendC算子继续按空处理,即opc编译命令中不添加 --simplified_key_mode 选项,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 7 | +; 2)如果仅有default配置:各个版本按default配置 | ||
| 8 | +; 3)如果仅有某些平台的配置,没有default配置:对应平台的按照配置的值传递,非对应平台的:非AscendC算子继续按空处理,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 9 | +; 4)如果default配置和平台配置都有:对应平台的使用平台的配置,非对应的平台的以default值配置。 | ||
| 10 | +; 5)对于自定义simplified key的情况,需要在binary_simplified_key_mode.ini 文件中显式配置为None,不传入 --simplified_key_mode 选项,由opc工具和FE框架自行判断使用何种模式 | ||
| 11 | +; 6)是否是AscendC算子,由 ops/built-in/tbe/op_info_cfg/parser/ascendc_config.json 中配置的算子名字和对于的平台决定 | ||
| 12 | +[ChunkCat] | ||
| 13 | +default=0 | ||
| @@ -12,7 +12,7 @@ | |||
| 12 | * \file chunk_cat.cpp | 12 | * \file chunk_cat.cpp |
| 13 | * \brief | 13 | * \brief |
| 14 | */ | 14 | */ |
| 15 | -#if __CCE_AICORE__ == 310 || __NPU_ARCH__ == 9201 | 15 | +#if __CCE_AICORE__ == 310 || __NPU_ARCH__ == 9201 || __NPU_ARCH__ == 9202 |
| 16 | #include "chunk_cat_arch35.h" | 16 | #include "chunk_cat_arch35.h" |
| 17 | #else | 17 | #else |
| 18 | #include "chunk_cat.h" | 18 | #include "chunk_cat.h" |
| @@ -24,7 +24,7 @@ extern "C" __global__ __aicore__ void chunk_cat(GM_ADDR x, GM_ADDR y, GM_ADDR wo | |||
| 24 | AscendC::TPipe pipe; | 24 | AscendC::TPipe pipe; |
| 25 | REGISTER_TILING_DEFAULT(ChunkCatTilingData); | 25 | REGISTER_TILING_DEFAULT(ChunkCatTilingData); |
| 26 | GET_TILING_DATA_WITH_STRUCT(ChunkCatTilingData, tilingData, tiling); | 26 | GET_TILING_DATA_WITH_STRUCT(ChunkCatTilingData, tilingData, tiling); |
| 27 | -#if __CCE_AICORE__ == 310 || __NPU_ARCH__ == 9201 | 27 | +#if __CCE_AICORE__ == 310 || __NPU_ARCH__ == 9201 || __NPU_ARCH__ == 9202 |
| 28 | ChunkCatArch35<DTYPE_X, DTYPE_Y> op(&pipe); | 28 | ChunkCatArch35<DTYPE_X, DTYPE_Y> op(&pipe); |
| 29 | op.Init(x, y, tilingData); | 29 | op.Init(x, y, tilingData); |
| 30 | op.Process(); | 30 | op.Process(); |
| @@ -371,7 +371,7 @@ private: | |||
| 371 | uint16_t rowLoop1 = 0; | 371 | uint16_t rowLoop1 = 0; |
| 372 | uint16_t rowLoop2 = 0; | 372 | uint16_t rowLoop2 = 0; |
| 373 | // 部分pad情况下pad部分 | 373 | // 部分pad情况下pad部分 |
| 374 | -#if __NPU_ARCH__ == 9201 | 374 | +#if __NPU_ARCH__ == 9201 || __NPU_ARCH__ == 9202 |
| 375 | uint32_t colLen0 = 0; | 375 | uint32_t colLen0 = 0; |
| 376 | uint32_t colLen1 = 0; | 376 | uint32_t colLen1 = 0; |
| 377 | uint16_t colLoop1 = 0; | 377 | uint16_t colLoop1 = 0; |
| @@ -404,7 +404,7 @@ private: | |||
| 404 | } | 404 | } |
| 405 | } | 405 | } |
| 406 | uint32_t rowNum = GetVRegSize() / sizeof(T2) / srcLen; | 406 | uint32_t rowNum = GetVRegSize() / sizeof(T2) / srcLen; |
| 407 | -#if __NPU_ARCH__ == 9201 | 407 | +#if __NPU_ARCH__ == 9201 || __NPU_ARCH__ == 9202 |
| 408 | if constexpr (IS_SCATTER) { | 408 | if constexpr (IS_SCATTER) { |
| 409 | if constexpr (std::is_same_v<T2, bfloat16_t> || std::is_same_v<T2, half>) { | 409 | if constexpr (std::is_same_v<T2, bfloat16_t> || std::is_same_v<T2, half>) { |
| 410 | uint32_t rowNumSafe = srcLen < UINT16_LIMIT ? (UINT16_LIMIT - srcLen) / rowStride + 1 : rowNum; | 410 | uint32_t rowNumSafe = srcLen < UINT16_LIMIT ? (UINT16_LIMIT - srcLen) / rowStride + 1 : rowNum; |
| @@ -150,7 +150,7 @@ public: | |||
| 150 | #if __CCE_AICORE__ == 310 | 150 | #if __CCE_AICORE__ == 310 |
| 151 | AscendC::DataCopyPad<T1, PaddingMode::Compact>(srcLocal_[localOffset], srcGlobal_[gmOffset], copyParams, | 151 | AscendC::DataCopyPad<T1, PaddingMode::Compact>(srcLocal_[localOffset], srcGlobal_[gmOffset], copyParams, |
| 152 | padParams); | 152 | padParams); |
| 153 | -#elif __NPU_ARCH__ == 9201 | 153 | +#elif __NPU_ARCH__ == 9201 || __NPU_ARCH__ == 9202 |
| 154 | AscendC::DataCopyPad<T1, PaddingMode::Compact>(srcLocal_[localOffset], srcGlobal_[gmOffset], copyParams, | 154 | AscendC::DataCopyPad<T1, PaddingMode::Compact>(srcLocal_[localOffset], srcGlobal_[gmOffset], copyParams, |
| 155 | padParams, true); | 155 | padParams, true); |
| 156 | #else | 156 | #else |
| @@ -207,7 +207,7 @@ public: | |||
| 207 | // 1.3.1 | 207 | // 1.3.1 |
| 208 | blockLen = (remainderCol - tensorInfo.startOffset) * sizeof(T1); | 208 | blockLen = (remainderCol - tensorInfo.startOffset) * sizeof(T1); |
| 209 | int64_t localOffsetPart = 0; | 209 | int64_t localOffsetPart = 0; |
| 210 | -#if __CCE_AICORE__ == 310 || __NPU_ARCH__ == 9201 | 210 | +#if __CCE_AICORE__ == 310 || __NPU_ARCH__ == 9201 || __NPU_ARCH__ == 9202 |
| 211 | localOffsetPart = localOffset + GetAlign((tensorInfo.chunkRow - ubLoopInfo.rowStart) * tensorInfo.splitCol, | 211 | localOffsetPart = localOffset + GetAlign((tensorInfo.chunkRow - ubLoopInfo.rowStart) * tensorInfo.splitCol, |
| 212 | srcEleUbBlock_); | 212 | srcEleUbBlock_); |
| 213 | #else | 213 | #else |
| @@ -55,7 +55,9 @@ bool IsSecondLastAxisAiCoreSupport(op::DataType dataType, int64_t size, int64_t | |||
| 55 | return false; | 55 | return false; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - const bool isArch35 = GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_3510; | 58 | + // Ascend960 (DAV_9201/9202) 与 Ascend950 共用 arch35 UB 规格 |
| 59 | + const auto curArch = GetCurrentPlatformInfo().GetCurNpuArch(); | ||
| 60 | + const bool isArch35 = curArch == NpuArch::DAV_3510 || curArch == NpuArch::DAV_9201 || curArch == NpuArch::DAV_9202; | ||
| 59 | const int64_t ubSize = isArch35 ? ARCH35_UB_SIZE : ARCH22_UB_SIZE; | 61 | const int64_t ubSize = isArch35 ? ARCH35_UB_SIZE : ARCH22_UB_SIZE; |
| 60 | int64_t ubSizeT2 = 0; | 62 | int64_t ubSizeT2 = 0; |
| 61 | if (dataType == DataType::DT_FLOAT16 || dataType == DataType::DT_BF16) { | 63 | if (dataType == DataType::DT_FLOAT16 || dataType == DataType::DT_BF16) { |
| @@ -0,0 +1,167 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "UnfoldGrad", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "UnfoldGrad_250a5853", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "grad_out", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float16", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ] | ||
| 16 | + }, | ||
| 17 | + { | ||
| 18 | + "name": "input_sizes", | ||
| 19 | + "index": 1, | ||
| 20 | + "dtype": "int64", | ||
| 21 | + "format": "ND", | ||
| 22 | + "paramType": "required", | ||
| 23 | + "shape": [ | ||
| 24 | + -2 | ||
| 25 | + ] | ||
| 26 | + } | ||
| 27 | + ], | ||
| 28 | + "outputs": [ | ||
| 29 | + { | ||
| 30 | + "name": "grad_in", | ||
| 31 | + "index": 0, | ||
| 32 | + "dtype": "float16", | ||
| 33 | + "format": "ND", | ||
| 34 | + "paramType": "required", | ||
| 35 | + "shape": [ | ||
| 36 | + -2 | ||
| 37 | + ] | ||
| 38 | + } | ||
| 39 | + ], | ||
| 40 | + "attrs": [ | ||
| 41 | + { | ||
| 42 | + "name": "dim", | ||
| 43 | + "dtype": "int", | ||
| 44 | + "value": null | ||
| 45 | + }, | ||
| 46 | + { | ||
| 47 | + "name": "size", | ||
| 48 | + "dtype": "int", | ||
| 49 | + "value": null | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + "name": "step", | ||
| 53 | + "dtype": "int", | ||
| 54 | + "value": null | ||
| 55 | + } | ||
| 56 | + ] | ||
| 57 | + }, | ||
| 58 | + { | ||
| 59 | + "bin_filename": "UnfoldGrad_0f47731e", | ||
| 60 | + "inputs": [ | ||
| 61 | + { | ||
| 62 | + "name": "grad_out", | ||
| 63 | + "index": 0, | ||
| 64 | + "dtype": "bfloat16", | ||
| 65 | + "format": "ND", | ||
| 66 | + "paramType": "required", | ||
| 67 | + "shape": [ | ||
| 68 | + -2 | ||
| 69 | + ] | ||
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + "name": "input_sizes", | ||
| 73 | + "index": 1, | ||
| 74 | + "dtype": "int64", | ||
| 75 | + "format": "ND", | ||
| 76 | + "paramType": "required", | ||
| 77 | + "shape": [ | ||
| 78 | + -2 | ||
| 79 | + ] | ||
| 80 | + } | ||
| 81 | + ], | ||
| 82 | + "outputs": [ | ||
| 83 | + { | ||
| 84 | + "name": "grad_in", | ||
| 85 | + "index": 0, | ||
| 86 | + "dtype": "bfloat16", | ||
| 87 | + "format": "ND", | ||
| 88 | + "paramType": "required", | ||
| 89 | + "shape": [ | ||
| 90 | + -2 | ||
| 91 | + ] | ||
| 92 | + } | ||
| 93 | + ], | ||
| 94 | + "attrs": [ | ||
| 95 | + { | ||
| 96 | + "name": "dim", | ||
| 97 | + "dtype": "int", | ||
| 98 | + "value": null | ||
| 99 | + }, | ||
| 100 | + { | ||
| 101 | + "name": "size", | ||
| 102 | + "dtype": "int", | ||
| 103 | + "value": null | ||
| 104 | + }, | ||
| 105 | + { | ||
| 106 | + "name": "step", | ||
| 107 | + "dtype": "int", | ||
| 108 | + "value": null | ||
| 109 | + } | ||
| 110 | + ] | ||
| 111 | + }, | ||
| 112 | + { | ||
| 113 | + "bin_filename": "UnfoldGrad_071cdc8b", | ||
| 114 | + "inputs": [ | ||
| 115 | + { | ||
| 116 | + "name": "grad_out", | ||
| 117 | + "index": 0, | ||
| 118 | + "dtype": "float32", | ||
| 119 | + "format": "ND", | ||
| 120 | + "paramType": "required", | ||
| 121 | + "shape": [ | ||
| 122 | + -2 | ||
| 123 | + ] | ||
| 124 | + }, | ||
| 125 | + { | ||
| 126 | + "name": "input_sizes", | ||
| 127 | + "index": 1, | ||
| 128 | + "dtype": "int64", | ||
| 129 | + "format": "ND", | ||
| 130 | + "paramType": "required", | ||
| 131 | + "shape": [ | ||
| 132 | + -2 | ||
| 133 | + ] | ||
| 134 | + } | ||
| 135 | + ], | ||
| 136 | + "outputs": [ | ||
| 137 | + { | ||
| 138 | + "name": "grad_in", | ||
| 139 | + "index": 0, | ||
| 140 | + "dtype": "float32", | ||
| 141 | + "format": "ND", | ||
| 142 | + "paramType": "required", | ||
| 143 | + "shape": [ | ||
| 144 | + -2 | ||
| 145 | + ] | ||
| 146 | + } | ||
| 147 | + ], | ||
| 148 | + "attrs": [ | ||
| 149 | + { | ||
| 150 | + "name": "dim", | ||
| 151 | + "dtype": "int", | ||
| 152 | + "value": null | ||
| 153 | + }, | ||
| 154 | + { | ||
| 155 | + "name": "size", | ||
| 156 | + "dtype": "int", | ||
| 157 | + "value": null | ||
| 158 | + }, | ||
| 159 | + { | ||
| 160 | + "name": "step", | ||
| 161 | + "dtype": "int", | ||
| 162 | + "value": null | ||
| 163 | + } | ||
| 164 | + ] | ||
| 165 | + } | ||
| 166 | + ] | ||
| 167 | +} | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | +; 该文件主要影响 opc 工具 编译二进制kernel时, --simplified_key_mode 选项中填写的值,格式如下所示: | ||
| 2 | +; [某算子] | ||
| 3 | +; default=xx | ||
| 4 | +; ascendxx=xx | ||
| 5 | +; 其中,default为默认mode,ascendxx为可选mode,如果不同芯片有差异化要求时,需要配置; | ||
| 6 | +; 1)如果没有配置:非ascendC算子继续按空处理,即opc编译命令中不添加 --simplified_key_mode 选项,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 7 | +; 2)如果仅有default配置:各个版本按default配置 | ||
| 8 | +; 3)如果仅有某些平台的配置,没有default配置:对应平台的按照配置的值传递,非对应平台的:非AscendC算子继续按空处理,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 9 | +; 4)如果default配置和平台配置都有:对应平台的使用平台的配置,非对应的平台的以default值配置。 | ||
| 10 | +; 5)对于自定义simplified key的情况,需要在binary_simplified_key_mode.ini 文件中显式配置为None,不传入 --simplified_key_mode 选项,由opc工具和FE框架自行判断使用何种模式 | ||
| 11 | +; 6)是否是AscendC算子,由 ops/build-in/tbe/op_info_cfg/parser/ascendc_config.json 中配置的算子名字和对于的平台决定 | ||
| 12 | +[UnfoldGrad] | ||
| 13 | +simplified_key_mode=0 | ||
| @@ -0,0 +1,167 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "UnfoldGrad", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "UnfoldGrad_250a5853", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "grad_out", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float16", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ] | ||
| 16 | + }, | ||
| 17 | + { | ||
| 18 | + "name": "input_sizes", | ||
| 19 | + "index": 1, | ||
| 20 | + "dtype": "int64", | ||
| 21 | + "format": "ND", | ||
| 22 | + "paramType": "required", | ||
| 23 | + "shape": [ | ||
| 24 | + -2 | ||
| 25 | + ] | ||
| 26 | + } | ||
| 27 | + ], | ||
| 28 | + "outputs": [ | ||
| 29 | + { | ||
| 30 | + "name": "grad_in", | ||
| 31 | + "index": 0, | ||
| 32 | + "dtype": "float16", | ||
| 33 | + "format": "ND", | ||
| 34 | + "paramType": "required", | ||
| 35 | + "shape": [ | ||
| 36 | + -2 | ||
| 37 | + ] | ||
| 38 | + } | ||
| 39 | + ], | ||
| 40 | + "attrs": [ | ||
| 41 | + { | ||
| 42 | + "name": "dim", | ||
| 43 | + "dtype": "int", | ||
| 44 | + "value": null | ||
| 45 | + }, | ||
| 46 | + { | ||
| 47 | + "name": "size", | ||
| 48 | + "dtype": "int", | ||
| 49 | + "value": null | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + "name": "step", | ||
| 53 | + "dtype": "int", | ||
| 54 | + "value": null | ||
| 55 | + } | ||
| 56 | + ] | ||
| 57 | + }, | ||
| 58 | + { | ||
| 59 | + "bin_filename": "UnfoldGrad_0f47731e", | ||
| 60 | + "inputs": [ | ||
| 61 | + { | ||
| 62 | + "name": "grad_out", | ||
| 63 | + "index": 0, | ||
| 64 | + "dtype": "bfloat16", | ||
| 65 | + "format": "ND", | ||
| 66 | + "paramType": "required", | ||
| 67 | + "shape": [ | ||
| 68 | + -2 | ||
| 69 | + ] | ||
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + "name": "input_sizes", | ||
| 73 | + "index": 1, | ||
| 74 | + "dtype": "int64", | ||
| 75 | + "format": "ND", | ||
| 76 | + "paramType": "required", | ||
| 77 | + "shape": [ | ||
| 78 | + -2 | ||
| 79 | + ] | ||
| 80 | + } | ||
| 81 | + ], | ||
| 82 | + "outputs": [ | ||
| 83 | + { | ||
| 84 | + "name": "grad_in", | ||
| 85 | + "index": 0, | ||
| 86 | + "dtype": "bfloat16", | ||
| 87 | + "format": "ND", | ||
| 88 | + "paramType": "required", | ||
| 89 | + "shape": [ | ||
| 90 | + -2 | ||
| 91 | + ] | ||
| 92 | + } | ||
| 93 | + ], | ||
| 94 | + "attrs": [ | ||
| 95 | + { | ||
| 96 | + "name": "dim", | ||
| 97 | + "dtype": "int", | ||
| 98 | + "value": null | ||
| 99 | + }, | ||
| 100 | + { | ||
| 101 | + "name": "size", | ||
| 102 | + "dtype": "int", | ||
| 103 | + "value": null | ||
| 104 | + }, | ||
| 105 | + { | ||
| 106 | + "name": "step", | ||
| 107 | + "dtype": "int", | ||
| 108 | + "value": null | ||
| 109 | + } | ||
| 110 | + ] | ||
| 111 | + }, | ||
| 112 | + { | ||
| 113 | + "bin_filename": "UnfoldGrad_071cdc8b", | ||
| 114 | + "inputs": [ | ||
| 115 | + { | ||
| 116 | + "name": "grad_out", | ||
| 117 | + "index": 0, | ||
| 118 | + "dtype": "float32", | ||
| 119 | + "format": "ND", | ||
| 120 | + "paramType": "required", | ||
| 121 | + "shape": [ | ||
| 122 | + -2 | ||
| 123 | + ] | ||
| 124 | + }, | ||
| 125 | + { | ||
| 126 | + "name": "input_sizes", | ||
| 127 | + "index": 1, | ||
| 128 | + "dtype": "int64", | ||
| 129 | + "format": "ND", | ||
| 130 | + "paramType": "required", | ||
| 131 | + "shape": [ | ||
| 132 | + -2 | ||
| 133 | + ] | ||
| 134 | + } | ||
| 135 | + ], | ||
| 136 | + "outputs": [ | ||
| 137 | + { | ||
| 138 | + "name": "grad_in", | ||
| 139 | + "index": 0, | ||
| 140 | + "dtype": "float32", | ||
| 141 | + "format": "ND", | ||
| 142 | + "paramType": "required", | ||
| 143 | + "shape": [ | ||
| 144 | + -2 | ||
| 145 | + ] | ||
| 146 | + } | ||
| 147 | + ], | ||
| 148 | + "attrs": [ | ||
| 149 | + { | ||
| 150 | + "name": "dim", | ||
| 151 | + "dtype": "int", | ||
| 152 | + "value": null | ||
| 153 | + }, | ||
| 154 | + { | ||
| 155 | + "name": "size", | ||
| 156 | + "dtype": "int", | ||
| 157 | + "value": null | ||
| 158 | + }, | ||
| 159 | + { | ||
| 160 | + "name": "step", | ||
| 161 | + "dtype": "int", | ||
| 162 | + "value": null | ||
| 163 | + } | ||
| 164 | + ] | ||
| 165 | + } | ||
| 166 | + ] | ||
| 167 | +} | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | +; 该文件主要影响 opc 工具 编译二进制kernel时, --simplified_key_mode 选项中填写的值,格式如下所示: | ||
| 2 | +; [某算子] | ||
| 3 | +; default=xx | ||
| 4 | +; ascendxx=xx | ||
| 5 | +; 其中,default为默认mode,ascendxx为可选mode,如果不同芯片有差异化要求时,需要配置; | ||
| 6 | +; 1)如果没有配置:非ascendC算子继续按空处理,即opc编译命令中不添加 --simplified_key_mode 选项,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 7 | +; 2)如果仅有default配置:各个版本按default配置 | ||
| 8 | +; 3)如果仅有某些平台的配置,没有default配置:对应平台的按照配置的值传递,非对应平台的:非AscendC算子继续按空处理,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 9 | +; 4)如果default配置和平台配置都有:对应平台的使用平台的配置,非对应的平台的以default值配置。 | ||
| 10 | +; 5)对于自定义simplified key的情况,需要在binary_simplified_key_mode.ini 文件中显式配置为None,不传入 --simplified_key_mode 选项,由opc工具和FE框架自行判断使用何种模式 | ||
| 11 | +; 6)是否是AscendC算子,由 ops/build-in/tbe/op_info_cfg/parser/ascendc_config.json 中配置的算子名字和对于的平台决定 | ||
| 12 | +[UnfoldGrad] | ||
| 13 | +simplified_key_mode=0 | ||
| @@ -43,6 +43,8 @@ public: | |||
| 43 | this->AICore().AddConfig("ascend910b"); | 43 | this->AICore().AddConfig("ascend910b"); |
| 44 | this->AICore().AddConfig("ascend910_93"); | 44 | this->AICore().AddConfig("ascend910_93"); |
| 45 | this->AICore().AddConfig("ascend950"); | 45 | this->AICore().AddConfig("ascend950"); |
| 46 | + this->AICore().AddConfig("ascend960dt"); | ||
| 47 | + this->AICore().AddConfig("ascend960pr"); | ||
| 46 | } | 48 | } |
| 47 | }; | 49 | }; |
| 48 | 50 | ||
| @@ -56,8 +56,10 @@ public: | |||
| 56 | this->AICore().AddConfig("ascend910b", aicore_config); | 56 | this->AICore().AddConfig("ascend910b", aicore_config); |
| 57 | this->AICore().AddConfig("ascend910_93", aicore_config); | 57 | this->AICore().AddConfig("ascend910_93", aicore_config); |
| 58 | this->AICore().AddConfig("ascend950", aicore_config); | 58 | this->AICore().AddConfig("ascend950", aicore_config); |
| 59 | + this->AICore().AddConfig("ascend960dt", aicore_config); | ||
| 60 | + this->AICore().AddConfig("ascend960pr", aicore_config); | ||
| 59 | } | 61 | } |
| 60 | }; | 62 | }; |
| 61 | 63 | ||
| 62 | OP_ADD(AmpUpdateScale); | 64 | OP_ADD(AmpUpdateScale); |
| 63 | -} | 65 | +} // namespace ops |
| @@ -0,0 +1,227 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "AmpUpdateScale", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "AmpUpdateScale_6993687eb06b70ac5aa102ddd4bef1c4", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "current_scale", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float32", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ] | ||
| 16 | + }, | ||
| 17 | + { | ||
| 18 | + "name": "growth_tracker", | ||
| 19 | + "index": 1, | ||
| 20 | + "dtype": "int32", | ||
| 21 | + "format": "ND", | ||
| 22 | + "paramType": "required", | ||
| 23 | + "shape": [ | ||
| 24 | + -2 | ||
| 25 | + ] | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "name": "found_inf", | ||
| 29 | + "index": 2, | ||
| 30 | + "dtype": "float32", | ||
| 31 | + "format": "ND", | ||
| 32 | + "paramType": "required", | ||
| 33 | + "shape": [ | ||
| 34 | + -2 | ||
| 35 | + ] | ||
| 36 | + } | ||
| 37 | + ], | ||
| 38 | + "outputs": [ | ||
| 39 | + { | ||
| 40 | + "name": "updated_scale", | ||
| 41 | + "index": 0, | ||
| 42 | + "dtype": "float32", | ||
| 43 | + "format": "ND", | ||
| 44 | + "paramType": "required", | ||
| 45 | + "shape": [ | ||
| 46 | + -2 | ||
| 47 | + ] | ||
| 48 | + }, | ||
| 49 | + { | ||
| 50 | + "name": "updated_growth_tracker", | ||
| 51 | + "index": 1, | ||
| 52 | + "dtype": "int32", | ||
| 53 | + "format": "ND", | ||
| 54 | + "paramType": "required", | ||
| 55 | + "shape": [ | ||
| 56 | + -2 | ||
| 57 | + ] | ||
| 58 | + } | ||
| 59 | + ], | ||
| 60 | + "attrs": [ | ||
| 61 | + { | ||
| 62 | + "name": "growth_factor", | ||
| 63 | + "dtype": "float", | ||
| 64 | + "value": 0.0 | ||
| 65 | + }, | ||
| 66 | + { | ||
| 67 | + "name": "backoff_factor", | ||
| 68 | + "dtype": "float", | ||
| 69 | + "value": 0.0 | ||
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + "name": "growth_interval", | ||
| 73 | + "dtype": "int", | ||
| 74 | + "value": 0 | ||
| 75 | + } | ||
| 76 | + ] | ||
| 77 | + }, | ||
| 78 | + { | ||
| 79 | + "bin_filename": "AmpUpdateScale_float16", | ||
| 80 | + "inputs": [ | ||
| 81 | + { | ||
| 82 | + "name": "current_scale", | ||
| 83 | + "index": 0, | ||
| 84 | + "dtype": "float16", | ||
| 85 | + "format": "ND", | ||
| 86 | + "paramType": "required", | ||
| 87 | + "shape": [ | ||
| 88 | + -2 | ||
| 89 | + ] | ||
| 90 | + }, | ||
| 91 | + { | ||
| 92 | + "name": "growth_tracker", | ||
| 93 | + "index": 1, | ||
| 94 | + "dtype": "int32", | ||
| 95 | + "format": "ND", | ||
| 96 | + "paramType": "required", | ||
| 97 | + "shape": [ | ||
| 98 | + -2 | ||
| 99 | + ] | ||
| 100 | + }, | ||
| 101 | + { | ||
| 102 | + "name": "found_inf", | ||
| 103 | + "index": 2, | ||
| 104 | + "dtype": "float16", | ||
| 105 | + "format": "ND", | ||
| 106 | + "paramType": "required", | ||
| 107 | + "shape": [ | ||
| 108 | + -2 | ||
| 109 | + ] | ||
| 110 | + } | ||
| 111 | + ], | ||
| 112 | + "outputs": [ | ||
| 113 | + { | ||
| 114 | + "name": "updated_scale", | ||
| 115 | + "index": 0, | ||
| 116 | + "dtype": "float16", | ||
| 117 | + "format": "ND", | ||
| 118 | + "paramType": "required", | ||
| 119 | + "shape": [ | ||
| 120 | + -2 | ||
| 121 | + ] | ||
| 122 | + }, | ||
| 123 | + { | ||
| 124 | + "name": "updated_growth_tracker", | ||
| 125 | + "index": 1, | ||
| 126 | + "dtype": "int32", | ||
| 127 | + "format": "ND", | ||
| 128 | + "paramType": "required", | ||
| 129 | + "shape": [ | ||
| 130 | + -2 | ||
| 131 | + ] | ||
| 132 | + } | ||
| 133 | + ], | ||
| 134 | + "attrs": [ | ||
| 135 | + { | ||
| 136 | + "name": "growth_factor", | ||
| 137 | + "dtype": "float", | ||
| 138 | + "value": 0.0 | ||
| 139 | + }, | ||
| 140 | + { | ||
| 141 | + "name": "backoff_factor", | ||
| 142 | + "dtype": "float", | ||
| 143 | + "value": 0.0 | ||
| 144 | + }, | ||
| 145 | + { | ||
| 146 | + "name": "growth_interval", | ||
| 147 | + "dtype": "int", | ||
| 148 | + "value": 0 | ||
| 149 | + } | ||
| 150 | + ] | ||
| 151 | + }, | ||
| 152 | + { | ||
| 153 | + "bin_filename": "AmpUpdateScale_bfloat16", | ||
| 154 | + "inputs": [ | ||
| 155 | + { | ||
| 156 | + "name": "current_scale", | ||
| 157 | + "index": 0, | ||
| 158 | + "dtype": "bfloat16", | ||
| 159 | + "format": "ND", | ||
| 160 | + "paramType": "required", | ||
| 161 | + "shape": [ | ||
| 162 | + -2 | ||
| 163 | + ] | ||
| 164 | + }, | ||
| 165 | + { | ||
| 166 | + "name": "growth_tracker", | ||
| 167 | + "index": 1, | ||
| 168 | + "dtype": "int32", | ||
| 169 | + "format": "ND", | ||
| 170 | + "paramType": "required", | ||
| 171 | + "shape": [ | ||
| 172 | + -2 | ||
| 173 | + ] | ||
| 174 | + }, | ||
| 175 | + { | ||
| 176 | + "name": "found_inf", | ||
| 177 | + "index": 2, | ||
| 178 | + "dtype": "bfloat16", | ||
| 179 | + "format": "ND", | ||
| 180 | + "paramType": "required", | ||
| 181 | + "shape": [ | ||
| 182 | + -2 | ||
| 183 | + ] | ||
| 184 | + } | ||
| 185 | + ], | ||
| 186 | + "outputs": [ | ||
| 187 | + { | ||
| 188 | + "name": "updated_scale", | ||
| 189 | + "index": 0, | ||
| 190 | + "dtype": "bfloat16", | ||
| 191 | + "format": "ND", | ||
| 192 | + "paramType": "required", | ||
| 193 | + "shape": [ | ||
| 194 | + -2 | ||
| 195 | + ] | ||
| 196 | + }, | ||
| 197 | + { | ||
| 198 | + "name": "updated_growth_tracker", | ||
| 199 | + "index": 1, | ||
| 200 | + "dtype": "int32", | ||
| 201 | + "format": "ND", | ||
| 202 | + "paramType": "required", | ||
| 203 | + "shape": [ | ||
| 204 | + -2 | ||
| 205 | + ] | ||
| 206 | + } | ||
| 207 | + ], | ||
| 208 | + "attrs": [ | ||
| 209 | + { | ||
| 210 | + "name": "growth_factor", | ||
| 211 | + "dtype": "float", | ||
| 212 | + "value": 0.0 | ||
| 213 | + }, | ||
| 214 | + { | ||
| 215 | + "name": "backoff_factor", | ||
| 216 | + "dtype": "float", | ||
| 217 | + "value": 0.0 | ||
| 218 | + }, | ||
| 219 | + { | ||
| 220 | + "name": "growth_interval", | ||
| 221 | + "dtype": "int", | ||
| 222 | + "value": 0 | ||
| 223 | + } | ||
| 224 | + ] | ||
| 225 | + } | ||
| 226 | + ] | ||
| 227 | +} | ||
| @@ -0,0 +1,227 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "AmpUpdateScale", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "AmpUpdateScale_6993687eb06b70ac5aa102ddd4bef1c4", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "current_scale", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float32", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ] | ||
| 16 | + }, | ||
| 17 | + { | ||
| 18 | + "name": "growth_tracker", | ||
| 19 | + "index": 1, | ||
| 20 | + "dtype": "int32", | ||
| 21 | + "format": "ND", | ||
| 22 | + "paramType": "required", | ||
| 23 | + "shape": [ | ||
| 24 | + -2 | ||
| 25 | + ] | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "name": "found_inf", | ||
| 29 | + "index": 2, | ||
| 30 | + "dtype": "float32", | ||
| 31 | + "format": "ND", | ||
| 32 | + "paramType": "required", | ||
| 33 | + "shape": [ | ||
| 34 | + -2 | ||
| 35 | + ] | ||
| 36 | + } | ||
| 37 | + ], | ||
| 38 | + "outputs": [ | ||
| 39 | + { | ||
| 40 | + "name": "updated_scale", | ||
| 41 | + "index": 0, | ||
| 42 | + "dtype": "float32", | ||
| 43 | + "format": "ND", | ||
| 44 | + "paramType": "required", | ||
| 45 | + "shape": [ | ||
| 46 | + -2 | ||
| 47 | + ] | ||
| 48 | + }, | ||
| 49 | + { | ||
| 50 | + "name": "updated_growth_tracker", | ||
| 51 | + "index": 1, | ||
| 52 | + "dtype": "int32", | ||
| 53 | + "format": "ND", | ||
| 54 | + "paramType": "required", | ||
| 55 | + "shape": [ | ||
| 56 | + -2 | ||
| 57 | + ] | ||
| 58 | + } | ||
| 59 | + ], | ||
| 60 | + "attrs": [ | ||
| 61 | + { | ||
| 62 | + "name": "growth_factor", | ||
| 63 | + "dtype": "float", | ||
| 64 | + "value": 0.0 | ||
| 65 | + }, | ||
| 66 | + { | ||
| 67 | + "name": "backoff_factor", | ||
| 68 | + "dtype": "float", | ||
| 69 | + "value": 0.0 | ||
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + "name": "growth_interval", | ||
| 73 | + "dtype": "int", | ||
| 74 | + "value": 0 | ||
| 75 | + } | ||
| 76 | + ] | ||
| 77 | + }, | ||
| 78 | + { | ||
| 79 | + "bin_filename": "AmpUpdateScale_float16", | ||
| 80 | + "inputs": [ | ||
| 81 | + { | ||
| 82 | + "name": "current_scale", | ||
| 83 | + "index": 0, | ||
| 84 | + "dtype": "float16", | ||
| 85 | + "format": "ND", | ||
| 86 | + "paramType": "required", | ||
| 87 | + "shape": [ | ||
| 88 | + -2 | ||
| 89 | + ] | ||
| 90 | + }, | ||
| 91 | + { | ||
| 92 | + "name": "growth_tracker", | ||
| 93 | + "index": 1, | ||
| 94 | + "dtype": "int32", | ||
| 95 | + "format": "ND", | ||
| 96 | + "paramType": "required", | ||
| 97 | + "shape": [ | ||
| 98 | + -2 | ||
| 99 | + ] | ||
| 100 | + }, | ||
| 101 | + { | ||
| 102 | + "name": "found_inf", | ||
| 103 | + "index": 2, | ||
| 104 | + "dtype": "float16", | ||
| 105 | + "format": "ND", | ||
| 106 | + "paramType": "required", | ||
| 107 | + "shape": [ | ||
| 108 | + -2 | ||
| 109 | + ] | ||
| 110 | + } | ||
| 111 | + ], | ||
| 112 | + "outputs": [ | ||
| 113 | + { | ||
| 114 | + "name": "updated_scale", | ||
| 115 | + "index": 0, | ||
| 116 | + "dtype": "float16", | ||
| 117 | + "format": "ND", | ||
| 118 | + "paramType": "required", | ||
| 119 | + "shape": [ | ||
| 120 | + -2 | ||
| 121 | + ] | ||
| 122 | + }, | ||
| 123 | + { | ||
| 124 | + "name": "updated_growth_tracker", | ||
| 125 | + "index": 1, | ||
| 126 | + "dtype": "int32", | ||
| 127 | + "format": "ND", | ||
| 128 | + "paramType": "required", | ||
| 129 | + "shape": [ | ||
| 130 | + -2 | ||
| 131 | + ] | ||
| 132 | + } | ||
| 133 | + ], | ||
| 134 | + "attrs": [ | ||
| 135 | + { | ||
| 136 | + "name": "growth_factor", | ||
| 137 | + "dtype": "float", | ||
| 138 | + "value": 0.0 | ||
| 139 | + }, | ||
| 140 | + { | ||
| 141 | + "name": "backoff_factor", | ||
| 142 | + "dtype": "float", | ||
| 143 | + "value": 0.0 | ||
| 144 | + }, | ||
| 145 | + { | ||
| 146 | + "name": "growth_interval", | ||
| 147 | + "dtype": "int", | ||
| 148 | + "value": 0 | ||
| 149 | + } | ||
| 150 | + ] | ||
| 151 | + }, | ||
| 152 | + { | ||
| 153 | + "bin_filename": "AmpUpdateScale_bfloat16", | ||
| 154 | + "inputs": [ | ||
| 155 | + { | ||
| 156 | + "name": "current_scale", | ||
| 157 | + "index": 0, | ||
| 158 | + "dtype": "bfloat16", | ||
| 159 | + "format": "ND", | ||
| 160 | + "paramType": "required", | ||
| 161 | + "shape": [ | ||
| 162 | + -2 | ||
| 163 | + ] | ||
| 164 | + }, | ||
| 165 | + { | ||
| 166 | + "name": "growth_tracker", | ||
| 167 | + "index": 1, | ||
| 168 | + "dtype": "int32", | ||
| 169 | + "format": "ND", | ||
| 170 | + "paramType": "required", | ||
| 171 | + "shape": [ | ||
| 172 | + -2 | ||
| 173 | + ] | ||
| 174 | + }, | ||
| 175 | + { | ||
| 176 | + "name": "found_inf", | ||
| 177 | + "index": 2, | ||
| 178 | + "dtype": "bfloat16", | ||
| 179 | + "format": "ND", | ||
| 180 | + "paramType": "required", | ||
| 181 | + "shape": [ | ||
| 182 | + -2 | ||
| 183 | + ] | ||
| 184 | + } | ||
| 185 | + ], | ||
| 186 | + "outputs": [ | ||
| 187 | + { | ||
| 188 | + "name": "updated_scale", | ||
| 189 | + "index": 0, | ||
| 190 | + "dtype": "bfloat16", | ||
| 191 | + "format": "ND", | ||
| 192 | + "paramType": "required", | ||
| 193 | + "shape": [ | ||
| 194 | + -2 | ||
| 195 | + ] | ||
| 196 | + }, | ||
| 197 | + { | ||
| 198 | + "name": "updated_growth_tracker", | ||
| 199 | + "index": 1, | ||
| 200 | + "dtype": "int32", | ||
| 201 | + "format": "ND", | ||
| 202 | + "paramType": "required", | ||
| 203 | + "shape": [ | ||
| 204 | + -2 | ||
| 205 | + ] | ||
| 206 | + } | ||
| 207 | + ], | ||
| 208 | + "attrs": [ | ||
| 209 | + { | ||
| 210 | + "name": "growth_factor", | ||
| 211 | + "dtype": "float", | ||
| 212 | + "value": 0.0 | ||
| 213 | + }, | ||
| 214 | + { | ||
| 215 | + "name": "backoff_factor", | ||
| 216 | + "dtype": "float", | ||
| 217 | + "value": 0.0 | ||
| 218 | + }, | ||
| 219 | + { | ||
| 220 | + "name": "growth_interval", | ||
| 221 | + "dtype": "int", | ||
| 222 | + "value": 0 | ||
| 223 | + } | ||
| 224 | + ] | ||
| 225 | + } | ||
| 226 | + ] | ||
| 227 | +} | ||
| @@ -9,9 +9,9 @@ | |||
| 9 | # ---------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------- |
| 10 | 10 | ||
| 11 | # 设置算子定义时支持的芯片类型 | 11 | # 设置算子定义时支持的芯片类型 |
| 12 | -set(SUPPORT_COMPUTE_UNIT "ascend910b" "ascend910_93" "ascend950") | 12 | +set(SUPPORT_COMPUTE_UNIT "ascend910b" "ascend910_93" "ascend950" "ascend960dt" "ascend960pr") |
| 13 | # 设置每种芯片类型对应的tiling文件目录,即采用op_host目录下哪个文件夹下的tiling文件编译 | 13 | # 设置每种芯片类型对应的tiling文件目录,即采用op_host目录下哪个文件夹下的tiling文件编译 |
| 14 | -set(SUPPORT_TILING_DIR "arch22" "arch22" "arch35") | 14 | +set(SUPPORT_TILING_DIR "arch22" "arch22" "arch35" "arch35" "arch35") |
| 15 | add_all_modules_sources(OPTYPE cdist_grad ACLNNTYPE aclnn_exclude COMPUTE_UNIT ${SUPPORT_COMPUTE_UNIT} TILING_DIR ${SUPPORT_TILING_DIR}) | 15 | add_all_modules_sources(OPTYPE cdist_grad ACLNNTYPE aclnn_exclude COMPUTE_UNIT ${SUPPORT_COMPUTE_UNIT} TILING_DIR ${SUPPORT_TILING_DIR}) |
| 16 | 16 | ||
| 17 | # L0 op source is in op_api/, picked up by GLOB for the default path | 17 | # L0 op source is in op_api/, picked up by GLOB for the default path |
| @@ -26,6 +26,7 @@ | |||
| 26 | #include "opdev/op_dfx.h" | 26 | #include "opdev/op_dfx.h" |
| 27 | #include "opdev/op_executor.h" | 27 | #include "opdev/op_executor.h" |
| 28 | #include "opdev/common_types.h" | 28 | #include "opdev/common_types.h" |
| 29 | +#include "opdev/platform.h" | ||
| 29 | #include "opdev/data_type_utils.h" | 30 | #include "opdev/data_type_utils.h" |
| 30 | #include "opdev/op_log.h" | 31 | #include "opdev/op_log.h" |
| 31 | #include "opdev/shape_utils.h" | 32 | #include "opdev/shape_utils.h" |
| @@ -202,9 +203,9 @@ aclnnStatus aclnnCdistBackwardGetWorkspaceSize(const aclTensor* grad, const aclT | |||
| 202 | gradContiguous != nullptr && x1Contiguous != nullptr && x2Contiguous != nullptr && cdistContiguous != nullptr, | 203 | gradContiguous != nullptr && x1Contiguous != nullptr && x2Contiguous != nullptr && cdistContiguous != nullptr, |
| 203 | ACLNN_ERR_INNER_NULLPTR); | 204 | ACLNN_ERR_INNER_NULLPTR); |
| 204 | 205 | ||
| 205 | - SocVersion socVersion = GetCurrentPlatformInfo().GetSocVersion(); | 206 | + // BF16 先转 FP32 仅 arch22(DAV_2201,即 Ascend910B/Ascend910_93)需要,与原 SocVersion 判断等价 |
| 206 | bool needCast = x1->GetDataType() == op::DataType::DT_BF16 && | 207 | bool needCast = x1->GetDataType() == op::DataType::DT_BF16 && |
| 207 | - (socVersion == SocVersion::ASCEND910B || socVersion == SocVersion::ASCEND910_93); | 208 | + GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_2201; |
| 208 | 209 | ||
| 209 | if (needCast) { | 210 | if (needCast) { |
| 210 | gradContiguous = l0op::Cast(gradContiguous, op::DataType::DT_FLOAT, uniqueExecutor.get()); | 211 | gradContiguous = l0op::Cast(gradContiguous, op::DataType::DT_FLOAT, uniqueExecutor.get()); |
| @@ -37,6 +37,8 @@ public: | |||
| 37 | .DynamicShapeSupportFlag(true) | 37 | .DynamicShapeSupportFlag(true) |
| 38 | .ExtendCfgInfo("opFile.value", "cdist_grad_apt"); | 38 | .ExtendCfgInfo("opFile.value", "cdist_grad_apt"); |
| 39 | this->AICore().AddConfig("ascend950", aicoreConfig); | 39 | this->AICore().AddConfig("ascend950", aicoreConfig); |
| 40 | + this->AICore().AddConfig("ascend960dt", aicoreConfig); | ||
| 41 | + this->AICore().AddConfig("ascend960pr", aicoreConfig); | ||
| 40 | 42 | ||
| 41 | OpAICoreConfig aicore910bConfig; | 43 | OpAICoreConfig aicore910bConfig; |
| 42 | aicore910bConfig.DynamicCompileStaticFlag(true) | 44 | aicore910bConfig.DynamicCompileStaticFlag(true) |
| @@ -0,0 +1,50 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "CdistGrad", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "CdistGrad_6d3844989f83c1de15cb106d07138083", | ||
| 6 | + "inputs": [ | ||
| 7 | + { "name": "grad", "index": 0, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 8 | + { "name": "x1", "index": 1, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 9 | + { "name": "x2", "index": 2, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 10 | + { "name": "cdist", "index": 3, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 11 | + ], | ||
| 12 | + "outputs": [ | ||
| 13 | + { "name": "y", "index": 0, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 14 | + ], | ||
| 15 | + "attrs": [ | ||
| 16 | + { "name": "p", "dtype": "float", "value": null } | ||
| 17 | + ] | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "bin_filename": "CdistGrad_876161686b0bc0b329614d9b9c3b5adc", | ||
| 21 | + "inputs": [ | ||
| 22 | + { "name": "grad", "index": 0, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 23 | + { "name": "x1", "index": 1, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 24 | + { "name": "x2", "index": 2, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 25 | + { "name": "cdist", "index": 3, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 26 | + ], | ||
| 27 | + "outputs": [ | ||
| 28 | + { "name": "y", "index": 0, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 29 | + ], | ||
| 30 | + "attrs": [ | ||
| 31 | + { "name": "p", "dtype": "float", "value": null } | ||
| 32 | + ] | ||
| 33 | + }, | ||
| 34 | + { | ||
| 35 | + "bin_filename": "CdistGrad_632f457d4787205a3df995bf22221bbe", | ||
| 36 | + "inputs": [ | ||
| 37 | + { "name": "grad", "index": 0, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 38 | + { "name": "x1", "index": 1, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 39 | + { "name": "x2", "index": 2, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 40 | + { "name": "cdist", "index": 3, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 41 | + ], | ||
| 42 | + "outputs": [ | ||
| 43 | + { "name": "y", "index": 0, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 44 | + ], | ||
| 45 | + "attrs": [ | ||
| 46 | + { "name": "p", "dtype": "float", "value": null } | ||
| 47 | + ] | ||
| 48 | + } | ||
| 49 | + ] | ||
| 50 | +} | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | +[CdistGrad] | ||
| 2 | +default=0 | ||
| @@ -0,0 +1,50 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "CdistGrad", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "CdistGrad_6d3844989f83c1de15cb106d07138083", | ||
| 6 | + "inputs": [ | ||
| 7 | + { "name": "grad", "index": 0, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 8 | + { "name": "x1", "index": 1, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 9 | + { "name": "x2", "index": 2, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 10 | + { "name": "cdist", "index": 3, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 11 | + ], | ||
| 12 | + "outputs": [ | ||
| 13 | + { "name": "y", "index": 0, "dtype": "float16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 14 | + ], | ||
| 15 | + "attrs": [ | ||
| 16 | + { "name": "p", "dtype": "float", "value": null } | ||
| 17 | + ] | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "bin_filename": "CdistGrad_876161686b0bc0b329614d9b9c3b5adc", | ||
| 21 | + "inputs": [ | ||
| 22 | + { "name": "grad", "index": 0, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 23 | + { "name": "x1", "index": 1, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 24 | + { "name": "x2", "index": 2, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 25 | + { "name": "cdist", "index": 3, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 26 | + ], | ||
| 27 | + "outputs": [ | ||
| 28 | + { "name": "y", "index": 0, "dtype": "bfloat16", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 29 | + ], | ||
| 30 | + "attrs": [ | ||
| 31 | + { "name": "p", "dtype": "float", "value": null } | ||
| 32 | + ] | ||
| 33 | + }, | ||
| 34 | + { | ||
| 35 | + "bin_filename": "CdistGrad_632f457d4787205a3df995bf22221bbe", | ||
| 36 | + "inputs": [ | ||
| 37 | + { "name": "grad", "index": 0, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 38 | + { "name": "x1", "index": 1, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 39 | + { "name": "x2", "index": 2, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" }, | ||
| 40 | + { "name": "cdist", "index": 3, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 41 | + ], | ||
| 42 | + "outputs": [ | ||
| 43 | + { "name": "y", "index": 0, "dtype": "float32", "format": "ND", "paramType": "required", "shape": [-2], "format_match_mode": "FormatAgnostic" } | ||
| 44 | + ], | ||
| 45 | + "attrs": [ | ||
| 46 | + { "name": "p", "dtype": "float", "value": null } | ||
| 47 | + ] | ||
| 48 | + } | ||
| 49 | + ] | ||
| 50 | +} | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | +[CdistGrad] | ||
| 2 | +default=0 | ||
Amath/transform_bias_rescale_qkv/op_host/config/ascend960dt/transform_bias_rescale_qkv_binary.json+212-0
| @@ -0,0 +1,212 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "TransformBiasRescaleQkv", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "TransformBiasRescaleQkv_float32", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "qkv", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float32", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ], | ||
| 16 | + "format_match_mode": "FormatAgnostic" | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + "name": "qkv_bias", | ||
| 20 | + "index": 1, | ||
| 21 | + "dtype": "float32", | ||
| 22 | + "format": "ND", | ||
| 23 | + "paramType": "required", | ||
| 24 | + "shape": [ | ||
| 25 | + -2 | ||
| 26 | + ], | ||
| 27 | + "format_match_mode": "FormatAgnostic" | ||
| 28 | + } | ||
| 29 | + ], | ||
| 30 | + "outputs": [ | ||
| 31 | + { | ||
| 32 | + "name": "q", | ||
| 33 | + "index": 0, | ||
| 34 | + "dtype": "float32", | ||
| 35 | + "format": "ND", | ||
| 36 | + "paramType": "required", | ||
| 37 | + "shape": [ | ||
| 38 | + -2 | ||
| 39 | + ], | ||
| 40 | + "format_match_mode": "FormatAgnostic" | ||
| 41 | + }, | ||
| 42 | + { | ||
| 43 | + "name": "k", | ||
| 44 | + "index": 1, | ||
| 45 | + "dtype": "float32", | ||
| 46 | + "format": "ND", | ||
| 47 | + "paramType": "required", | ||
| 48 | + "shape": [ | ||
| 49 | + -2 | ||
| 50 | + ], | ||
| 51 | + "format_match_mode": "FormatAgnostic" | ||
| 52 | + }, | ||
| 53 | + { | ||
| 54 | + "name": "v", | ||
| 55 | + "index": 2, | ||
| 56 | + "dtype": "float32", | ||
| 57 | + "format": "ND", | ||
| 58 | + "paramType": "required", | ||
| 59 | + "shape": [ | ||
| 60 | + -2 | ||
| 61 | + ], | ||
| 62 | + "format_match_mode": "FormatAgnostic" | ||
| 63 | + } | ||
| 64 | + ], | ||
| 65 | + "attrs": [ | ||
| 66 | + { | ||
| 67 | + "name": "num_heads", | ||
| 68 | + "dtype": "int", | ||
| 69 | + "value": 0 | ||
| 70 | + } | ||
| 71 | + ] | ||
| 72 | + }, | ||
| 73 | + { | ||
| 74 | + "bin_filename": "TransformBiasRescaleQkv_float16", | ||
| 75 | + "inputs": [ | ||
| 76 | + { | ||
| 77 | + "name": "qkv", | ||
| 78 | + "index": 0, | ||
| 79 | + "dtype": "float16", | ||
| 80 | + "format": "ND", | ||
| 81 | + "paramType": "required", | ||
| 82 | + "shape": [ | ||
| 83 | + -2 | ||
| 84 | + ], | ||
| 85 | + "format_match_mode": "FormatAgnostic" | ||
| 86 | + }, | ||
| 87 | + { | ||
| 88 | + "name": "qkv_bias", | ||
| 89 | + "index": 1, | ||
| 90 | + "dtype": "float16", | ||
| 91 | + "format": "ND", | ||
| 92 | + "paramType": "required", | ||
| 93 | + "shape": [ | ||
| 94 | + -2 | ||
| 95 | + ], | ||
| 96 | + "format_match_mode": "FormatAgnostic" | ||
| 97 | + } | ||
| 98 | + ], | ||
| 99 | + "outputs": [ | ||
| 100 | + { | ||
| 101 | + "name": "q", | ||
| 102 | + "index": 0, | ||
| 103 | + "dtype": "float16", | ||
| 104 | + "format": "ND", | ||
| 105 | + "paramType": "required", | ||
| 106 | + "shape": [ | ||
| 107 | + -2 | ||
| 108 | + ], | ||
| 109 | + "format_match_mode": "FormatAgnostic" | ||
| 110 | + }, | ||
| 111 | + { | ||
| 112 | + "name": "k", | ||
| 113 | + "index": 1, | ||
| 114 | + "dtype": "float16", | ||
| 115 | + "format": "ND", | ||
| 116 | + "paramType": "required", | ||
| 117 | + "shape": [ | ||
| 118 | + -2 | ||
| 119 | + ], | ||
| 120 | + "format_match_mode": "FormatAgnostic" | ||
| 121 | + }, | ||
| 122 | + { | ||
| 123 | + "name": "v", | ||
| 124 | + "index": 2, | ||
| 125 | + "dtype": "float16", | ||
| 126 | + "format": "ND", | ||
| 127 | + "paramType": "required", | ||
| 128 | + "shape": [ | ||
| 129 | + -2 | ||
| 130 | + ], | ||
| 131 | + "format_match_mode": "FormatAgnostic" | ||
| 132 | + } | ||
| 133 | + ], | ||
| 134 | + "attrs": [ | ||
| 135 | + { | ||
| 136 | + "name": "num_heads", | ||
| 137 | + "dtype": "int", | ||
| 138 | + "value": 0 | ||
| 139 | + } | ||
| 140 | + ] | ||
| 141 | + }, | ||
| 142 | + { | ||
| 143 | + "bin_filename": "TransformBiasRescaleQkv_bfloat16", | ||
| 144 | + "inputs": [ | ||
| 145 | + { | ||
| 146 | + "name": "qkv", | ||
| 147 | + "index": 0, | ||
| 148 | + "dtype": "bfloat16", | ||
| 149 | + "format": "ND", | ||
| 150 | + "paramType": "required", | ||
| 151 | + "shape": [ | ||
| 152 | + -2 | ||
| 153 | + ], | ||
| 154 | + "format_match_mode": "FormatAgnostic" | ||
| 155 | + }, | ||
| 156 | + { | ||
| 157 | + "name": "qkv_bias", | ||
| 158 | + "index": 1, | ||
| 159 | + "dtype": "bfloat16", | ||
| 160 | + "format": "ND", | ||
| 161 | + "paramType": "required", | ||
| 162 | + "shape": [ | ||
| 163 | + -2 | ||
| 164 | + ], | ||
| 165 | + "format_match_mode": "FormatAgnostic" | ||
| 166 | + } | ||
| 167 | + ], | ||
| 168 | + "outputs": [ | ||
| 169 | + { | ||
| 170 | + "name": "q", | ||
| 171 | + "index": 0, | ||
| 172 | + "dtype": "bfloat16", | ||
| 173 | + "format": "ND", | ||
| 174 | + "paramType": "required", | ||
| 175 | + "shape": [ | ||
| 176 | + -2 | ||
| 177 | + ], | ||
| 178 | + "format_match_mode": "FormatAgnostic" | ||
| 179 | + }, | ||
| 180 | + { | ||
| 181 | + "name": "k", | ||
| 182 | + "index": 1, | ||
| 183 | + "dtype": "bfloat16", | ||
| 184 | + "format": "ND", | ||
| 185 | + "paramType": "required", | ||
| 186 | + "shape": [ | ||
| 187 | + -2 | ||
| 188 | + ], | ||
| 189 | + "format_match_mode": "FormatAgnostic" | ||
| 190 | + }, | ||
| 191 | + { | ||
| 192 | + "name": "v", | ||
| 193 | + "index": 2, | ||
| 194 | + "dtype": "bfloat16", | ||
| 195 | + "format": "ND", | ||
| 196 | + "paramType": "required", | ||
| 197 | + "shape": [ | ||
| 198 | + -2 | ||
| 199 | + ], | ||
| 200 | + "format_match_mode": "FormatAgnostic" | ||
| 201 | + } | ||
| 202 | + ], | ||
| 203 | + "attrs": [ | ||
| 204 | + { | ||
| 205 | + "name": "num_heads", | ||
| 206 | + "dtype": "int", | ||
| 207 | + "value": 0 | ||
| 208 | + } | ||
| 209 | + ] | ||
| 210 | + } | ||
| 211 | + ] | ||
| 212 | +} | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | +; 该文件主要影响 opc 工具 编译二进制kernel时, --simplified_key_mode 选项中填写的值,格式如下所示: | ||
| 2 | +; [某算子] | ||
| 3 | +; default=xx | ||
| 4 | +; ascendxx=xx | ||
| 5 | +; 其中,default为默认mode,ascendxx为可选mode,如果不同芯片有差异化要求时,需要配置; | ||
| 6 | +; 1)如果没有配置:非ascendC算子继续按空处理,即opc编译命令中不添加 --simplified_key_mode 选项,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 7 | +; 2)如果仅有default配置:各个版本按default配置 | ||
| 8 | +; 3)如果仅有某些平台的配置,没有default配置:对应平台的按照配置的值传递,非对应平台的:非AscendC算子继续按空处理,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 9 | +; 4)如果default配置和平台配置都有:对应平台的使用平台的配置,非对应的平台的以default值配置。 | ||
| 10 | +; 5)对于自定义simplified key的情况,需要在binary_simplified_key_mode.ini 文件中显式配置为None,不传入 --simplified_key_mode 选项,由opc工具和FE框架自行判断使用何种模式 | ||
| 11 | +; 6)是否是AscendC算子,由 ops/build-in/tbe/op_info_cfg/parser/ascendc_config.json 中配置的算子名字和对于的平台决定 | ||
| 12 | +[TransformBiasRescaleQkv] | ||
| 13 | +default=0 | ||
Amath/transform_bias_rescale_qkv/op_host/config/ascend960pr/transform_bias_rescale_qkv_binary.json+212-0
| @@ -0,0 +1,212 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "TransformBiasRescaleQkv", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "TransformBiasRescaleQkv_float32", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "qkv", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float32", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ], | ||
| 16 | + "format_match_mode": "FormatAgnostic" | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + "name": "qkv_bias", | ||
| 20 | + "index": 1, | ||
| 21 | + "dtype": "float32", | ||
| 22 | + "format": "ND", | ||
| 23 | + "paramType": "required", | ||
| 24 | + "shape": [ | ||
| 25 | + -2 | ||
| 26 | + ], | ||
| 27 | + "format_match_mode": "FormatAgnostic" | ||
| 28 | + } | ||
| 29 | + ], | ||
| 30 | + "outputs": [ | ||
| 31 | + { | ||
| 32 | + "name": "q", | ||
| 33 | + "index": 0, | ||
| 34 | + "dtype": "float32", | ||
| 35 | + "format": "ND", | ||
| 36 | + "paramType": "required", | ||
| 37 | + "shape": [ | ||
| 38 | + -2 | ||
| 39 | + ], | ||
| 40 | + "format_match_mode": "FormatAgnostic" | ||
| 41 | + }, | ||
| 42 | + { | ||
| 43 | + "name": "k", | ||
| 44 | + "index": 1, | ||
| 45 | + "dtype": "float32", | ||
| 46 | + "format": "ND", | ||
| 47 | + "paramType": "required", | ||
| 48 | + "shape": [ | ||
| 49 | + -2 | ||
| 50 | + ], | ||
| 51 | + "format_match_mode": "FormatAgnostic" | ||
| 52 | + }, | ||
| 53 | + { | ||
| 54 | + "name": "v", | ||
| 55 | + "index": 2, | ||
| 56 | + "dtype": "float32", | ||
| 57 | + "format": "ND", | ||
| 58 | + "paramType": "required", | ||
| 59 | + "shape": [ | ||
| 60 | + -2 | ||
| 61 | + ], | ||
| 62 | + "format_match_mode": "FormatAgnostic" | ||
| 63 | + } | ||
| 64 | + ], | ||
| 65 | + "attrs": [ | ||
| 66 | + { | ||
| 67 | + "name": "num_heads", | ||
| 68 | + "dtype": "int", | ||
| 69 | + "value": 0 | ||
| 70 | + } | ||
| 71 | + ] | ||
| 72 | + }, | ||
| 73 | + { | ||
| 74 | + "bin_filename": "TransformBiasRescaleQkv_float16", | ||
| 75 | + "inputs": [ | ||
| 76 | + { | ||
| 77 | + "name": "qkv", | ||
| 78 | + "index": 0, | ||
| 79 | + "dtype": "float16", | ||
| 80 | + "format": "ND", | ||
| 81 | + "paramType": "required", | ||
| 82 | + "shape": [ | ||
| 83 | + -2 | ||
| 84 | + ], | ||
| 85 | + "format_match_mode": "FormatAgnostic" | ||
| 86 | + }, | ||
| 87 | + { | ||
| 88 | + "name": "qkv_bias", | ||
| 89 | + "index": 1, | ||
| 90 | + "dtype": "float16", | ||
| 91 | + "format": "ND", | ||
| 92 | + "paramType": "required", | ||
| 93 | + "shape": [ | ||
| 94 | + -2 | ||
| 95 | + ], | ||
| 96 | + "format_match_mode": "FormatAgnostic" | ||
| 97 | + } | ||
| 98 | + ], | ||
| 99 | + "outputs": [ | ||
| 100 | + { | ||
| 101 | + "name": "q", | ||
| 102 | + "index": 0, | ||
| 103 | + "dtype": "float16", | ||
| 104 | + "format": "ND", | ||
| 105 | + "paramType": "required", | ||
| 106 | + "shape": [ | ||
| 107 | + -2 | ||
| 108 | + ], | ||
| 109 | + "format_match_mode": "FormatAgnostic" | ||
| 110 | + }, | ||
| 111 | + { | ||
| 112 | + "name": "k", | ||
| 113 | + "index": 1, | ||
| 114 | + "dtype": "float16", | ||
| 115 | + "format": "ND", | ||
| 116 | + "paramType": "required", | ||
| 117 | + "shape": [ | ||
| 118 | + -2 | ||
| 119 | + ], | ||
| 120 | + "format_match_mode": "FormatAgnostic" | ||
| 121 | + }, | ||
| 122 | + { | ||
| 123 | + "name": "v", | ||
| 124 | + "index": 2, | ||
| 125 | + "dtype": "float16", | ||
| 126 | + "format": "ND", | ||
| 127 | + "paramType": "required", | ||
| 128 | + "shape": [ | ||
| 129 | + -2 | ||
| 130 | + ], | ||
| 131 | + "format_match_mode": "FormatAgnostic" | ||
| 132 | + } | ||
| 133 | + ], | ||
| 134 | + "attrs": [ | ||
| 135 | + { | ||
| 136 | + "name": "num_heads", | ||
| 137 | + "dtype": "int", | ||
| 138 | + "value": 0 | ||
| 139 | + } | ||
| 140 | + ] | ||
| 141 | + }, | ||
| 142 | + { | ||
| 143 | + "bin_filename": "TransformBiasRescaleQkv_bfloat16", | ||
| 144 | + "inputs": [ | ||
| 145 | + { | ||
| 146 | + "name": "qkv", | ||
| 147 | + "index": 0, | ||
| 148 | + "dtype": "bfloat16", | ||
| 149 | + "format": "ND", | ||
| 150 | + "paramType": "required", | ||
| 151 | + "shape": [ | ||
| 152 | + -2 | ||
| 153 | + ], | ||
| 154 | + "format_match_mode": "FormatAgnostic" | ||
| 155 | + }, | ||
| 156 | + { | ||
| 157 | + "name": "qkv_bias", | ||
| 158 | + "index": 1, | ||
| 159 | + "dtype": "bfloat16", | ||
| 160 | + "format": "ND", | ||
| 161 | + "paramType": "required", | ||
| 162 | + "shape": [ | ||
| 163 | + -2 | ||
| 164 | + ], | ||
| 165 | + "format_match_mode": "FormatAgnostic" | ||
| 166 | + } | ||
| 167 | + ], | ||
| 168 | + "outputs": [ | ||
| 169 | + { | ||
| 170 | + "name": "q", | ||
| 171 | + "index": 0, | ||
| 172 | + "dtype": "bfloat16", | ||
| 173 | + "format": "ND", | ||
| 174 | + "paramType": "required", | ||
| 175 | + "shape": [ | ||
| 176 | + -2 | ||
| 177 | + ], | ||
| 178 | + "format_match_mode": "FormatAgnostic" | ||
| 179 | + }, | ||
| 180 | + { | ||
| 181 | + "name": "k", | ||
| 182 | + "index": 1, | ||
| 183 | + "dtype": "bfloat16", | ||
| 184 | + "format": "ND", | ||
| 185 | + "paramType": "required", | ||
| 186 | + "shape": [ | ||
| 187 | + -2 | ||
| 188 | + ], | ||
| 189 | + "format_match_mode": "FormatAgnostic" | ||
| 190 | + }, | ||
| 191 | + { | ||
| 192 | + "name": "v", | ||
| 193 | + "index": 2, | ||
| 194 | + "dtype": "bfloat16", | ||
| 195 | + "format": "ND", | ||
| 196 | + "paramType": "required", | ||
| 197 | + "shape": [ | ||
| 198 | + -2 | ||
| 199 | + ], | ||
| 200 | + "format_match_mode": "FormatAgnostic" | ||
| 201 | + } | ||
| 202 | + ], | ||
| 203 | + "attrs": [ | ||
| 204 | + { | ||
| 205 | + "name": "num_heads", | ||
| 206 | + "dtype": "int", | ||
| 207 | + "value": 0 | ||
| 208 | + } | ||
| 209 | + ] | ||
| 210 | + } | ||
| 211 | + ] | ||
| 212 | +} | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | +; 该文件主要影响 opc 工具 编译二进制kernel时, --simplified_key_mode 选项中填写的值,格式如下所示: | ||
| 2 | +; [某算子] | ||
| 3 | +; default=xx | ||
| 4 | +; ascendxx=xx | ||
| 5 | +; 其中,default为默认mode,ascendxx为可选mode,如果不同芯片有差异化要求时,需要配置; | ||
| 6 | +; 1)如果没有配置:非ascendC算子继续按空处理,即opc编译命令中不添加 --simplified_key_mode 选项,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 7 | +; 2)如果仅有default配置:各个版本按default配置 | ||
| 8 | +; 3)如果仅有某些平台的配置,没有default配置:对应平台的按照配置的值传递,非对应平台的:非AscendC算子继续按空处理,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 9 | +; 4)如果default配置和平台配置都有:对应平台的使用平台的配置,非对应的平台的以default值配置。 | ||
| 10 | +; 5)对于自定义simplified key的情况,需要在binary_simplified_key_mode.ini 文件中显式配置为None,不传入 --simplified_key_mode 选项,由opc工具和FE框架自行判断使用何种模式 | ||
| 11 | +; 6)是否是AscendC算子,由 ops/build-in/tbe/op_info_cfg/parser/ascendc_config.json 中配置的算子名字和对于的平台决定 | ||
| 12 | +[TransformBiasRescaleQkv] | ||
| 13 | +default=0 | ||
| @@ -61,8 +61,10 @@ public: | |||
| 61 | this->AICore().AddConfig("ascend910b"); | 61 | this->AICore().AddConfig("ascend910b"); |
| 62 | this->AICore().AddConfig("ascend910_93"); | 62 | this->AICore().AddConfig("ascend910_93"); |
| 63 | this->AICore().AddConfig("ascend950"); | 63 | this->AICore().AddConfig("ascend950"); |
| 64 | + this->AICore().AddConfig("ascend960dt"); | ||
| 65 | + this->AICore().AddConfig("ascend960pr"); | ||
| 64 | 66 | ||
| 65 | - OpAICoreConfig config_kirin = GetKirinCoreConfig(); | 67 | + OpAICoreConfig config_kirin = GetKirinCoreConfig(); |
| 66 | this->AICore().AddConfig("kirinx90", config_kirin); | 68 | this->AICore().AddConfig("kirinx90", config_kirin); |
| 67 | this->AICore().AddConfig("kirin9030", config_kirin); | 69 | this->AICore().AddConfig("kirin9030", config_kirin); |
| 68 | } | 70 | } |
| @@ -112,4 +114,4 @@ private: | |||
| 112 | }; | 114 | }; |
| 113 | 115 | ||
| 114 | OP_ADD(TransformBiasRescaleQkv); | 116 | OP_ADD(TransformBiasRescaleQkv); |
| 115 | -} // namespace ops | 117 | +} // namespace ops |
| @@ -8,8 +8,8 @@ | |||
| 8 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 9 | # --------------------------------------------------------------------------------------------------------- | 9 | # --------------------------------------------------------------------------------------------------------- |
| 10 | 10 | ||
| 11 | -set(SUPPORT_COMPUTE_UNIT "ascend950" "ascend350") | 11 | +set(SUPPORT_COMPUTE_UNIT "ascend950" "ascend350" "ascend960dt" "ascend960pr") |
| 12 | -set(SUPPORT_TILING_DIR "arch35" "arch35") | 12 | +set(SUPPORT_TILING_DIR "arch35" "arch35" "arch35" "arch35") |
| 13 | add_all_modules_sources(OPTYPE drop_out_v3_grad ACLNNTYPE aclnn_exclude | 13 | add_all_modules_sources(OPTYPE drop_out_v3_grad ACLNNTYPE aclnn_exclude |
| 14 | COMPUTE_UNIT ${SUPPORT_COMPUTE_UNIT} | 14 | COMPUTE_UNIT ${SUPPORT_COMPUTE_UNIT} |
| 15 | TILING_DIR ${SUPPORT_TILING_DIR} | 15 | TILING_DIR ${SUPPORT_TILING_DIR} |
| @@ -44,12 +44,13 @@ static const std::initializer_list<op::DataType> DTYPE_SUPPORT_LIST = {op::DataT | |||
| 44 | // 对外接口mask仅支持uint8 | 44 | // 对外接口mask仅支持uint8 |
| 45 | static const std::initializer_list<op::DataType> MASK_DTYPE_SUPPORT_LIST = {op::DataType::DT_UINT8}; | 45 | static const std::initializer_list<op::DataType> MASK_DTYPE_SUPPORT_LIST = {op::DataType::DT_UINT8}; |
| 46 | 46 | ||
| 47 | -// 本算子仅在Ascend910_95上提供kernel实现,其余产品形态直接返回错误 | 47 | +// 本算子仅在 Ascend910_95/Ascend960(DAV_3510/9201/9202)上提供kernel实现,其余产品形态直接返回错误 |
| 48 | static inline bool CheckSocVersion() | 48 | static inline bool CheckSocVersion() |
| 49 | { | 49 | { |
| 50 | - if (op::GetCurrentPlatformInfo().GetCurNpuArch() != NpuArch::DAV_3510) { | 50 | + const auto curArch = op::GetCurrentPlatformInfo().GetCurNpuArch(); |
| 51 | + if (curArch != NpuArch::DAV_3510 && curArch != NpuArch::DAV_9201 && curArch != NpuArch::DAV_9202) { | ||
| 51 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "aclnnDropoutV3Grad is not supported in current socversion %d.", | 52 | OP_LOGE(ACLNN_ERR_PARAM_INVALID, "aclnnDropoutV3Grad is not supported in current socversion %d.", |
| 52 | - static_cast<int>(op::GetCurrentPlatformInfo().GetCurNpuArch())); | 53 | + static_cast<int>(curArch)); |
| 53 | return false; | 54 | return false; |
| 54 | } | 55 | } |
| 55 | return true; | 56 | return true; |
| @@ -0,0 +1,311 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "DropOutV3Grad", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "DropOutV3Grad_f32_uint8", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "grad_y", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float32", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ], | ||
| 16 | + "format_match_mode": "FormatAgnostic" | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + "name": "mask", | ||
| 20 | + "index": 1, | ||
| 21 | + "dtype": "uint8", | ||
| 22 | + "format": "ND", | ||
| 23 | + "paramType": "required", | ||
| 24 | + "shape": [ | ||
| 25 | + -2 | ||
| 26 | + ], | ||
| 27 | + "format_match_mode": "FormatAgnostic" | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + "name": "scale", | ||
| 31 | + "index": 2, | ||
| 32 | + "dtype": "float32", | ||
| 33 | + "format": "ND", | ||
| 34 | + "paramType": "required", | ||
| 35 | + "shape": [ | ||
| 36 | + -2 | ||
| 37 | + ], | ||
| 38 | + "format_match_mode": "FormatAgnostic" | ||
| 39 | + } | ||
| 40 | + ], | ||
| 41 | + "outputs": [ | ||
| 42 | + { | ||
| 43 | + "name": "grad_x", | ||
| 44 | + "index": 0, | ||
| 45 | + "dtype": "float32", | ||
| 46 | + "format": "ND", | ||
| 47 | + "paramType": "required", | ||
| 48 | + "shape": [ | ||
| 49 | + -2 | ||
| 50 | + ], | ||
| 51 | + "format_match_mode": "FormatAgnostic" | ||
| 52 | + } | ||
| 53 | + ] | ||
| 54 | + }, | ||
| 55 | + { | ||
| 56 | + "bin_filename": "DropOutV3Grad_f16_uint8", | ||
| 57 | + "inputs": [ | ||
| 58 | + { | ||
| 59 | + "name": "grad_y", | ||
| 60 | + "index": 0, | ||
| 61 | + "dtype": "float16", | ||
| 62 | + "format": "ND", | ||
| 63 | + "paramType": "required", | ||
| 64 | + "shape": [ | ||
| 65 | + -2 | ||
| 66 | + ], | ||
| 67 | + "format_match_mode": "FormatAgnostic" | ||
| 68 | + }, | ||
| 69 | + { | ||
| 70 | + "name": "mask", | ||
| 71 | + "index": 1, | ||
| 72 | + "dtype": "uint8", | ||
| 73 | + "format": "ND", | ||
| 74 | + "paramType": "required", | ||
| 75 | + "shape": [ | ||
| 76 | + -2 | ||
| 77 | + ], | ||
| 78 | + "format_match_mode": "FormatAgnostic" | ||
| 79 | + }, | ||
| 80 | + { | ||
| 81 | + "name": "scale", | ||
| 82 | + "index": 2, | ||
| 83 | + "dtype": "float32", | ||
| 84 | + "format": "ND", | ||
| 85 | + "paramType": "required", | ||
| 86 | + "shape": [ | ||
| 87 | + -2 | ||
| 88 | + ], | ||
| 89 | + "format_match_mode": "FormatAgnostic" | ||
| 90 | + } | ||
| 91 | + ], | ||
| 92 | + "outputs": [ | ||
| 93 | + { | ||
| 94 | + "name": "grad_x", | ||
| 95 | + "index": 0, | ||
| 96 | + "dtype": "float16", | ||
| 97 | + "format": "ND", | ||
| 98 | + "paramType": "required", | ||
| 99 | + "shape": [ | ||
| 100 | + -2 | ||
| 101 | + ], | ||
| 102 | + "format_match_mode": "FormatAgnostic" | ||
| 103 | + } | ||
| 104 | + ] | ||
| 105 | + }, | ||
| 106 | + { | ||
| 107 | + "bin_filename": "DropOutV3Grad_bf16_uint8", | ||
| 108 | + "inputs": [ | ||
| 109 | + { | ||
| 110 | + "name": "grad_y", | ||
| 111 | + "index": 0, | ||
| 112 | + "dtype": "bfloat16", | ||
| 113 | + "format": "ND", | ||
| 114 | + "paramType": "required", | ||
| 115 | + "shape": [ | ||
| 116 | + -2 | ||
| 117 | + ], | ||
| 118 | + "format_match_mode": "FormatAgnostic" | ||
| 119 | + }, | ||
| 120 | + { | ||
| 121 | + "name": "mask", | ||
| 122 | + "index": 1, | ||
| 123 | + "dtype": "uint8", | ||
| 124 | + "format": "ND", | ||
| 125 | + "paramType": "required", | ||
| 126 | + "shape": [ | ||
| 127 | + -2 | ||
| 128 | + ], | ||
| 129 | + "format_match_mode": "FormatAgnostic" | ||
| 130 | + }, | ||
| 131 | + { | ||
| 132 | + "name": "scale", | ||
| 133 | + "index": 2, | ||
| 134 | + "dtype": "float32", | ||
| 135 | + "format": "ND", | ||
| 136 | + "paramType": "required", | ||
| 137 | + "shape": [ | ||
| 138 | + -2 | ||
| 139 | + ], | ||
| 140 | + "format_match_mode": "FormatAgnostic" | ||
| 141 | + } | ||
| 142 | + ], | ||
| 143 | + "outputs": [ | ||
| 144 | + { | ||
| 145 | + "name": "grad_x", | ||
| 146 | + "index": 0, | ||
| 147 | + "dtype": "bfloat16", | ||
| 148 | + "format": "ND", | ||
| 149 | + "paramType": "required", | ||
| 150 | + "shape": [ | ||
| 151 | + -2 | ||
| 152 | + ], | ||
| 153 | + "format_match_mode": "FormatAgnostic" | ||
| 154 | + } | ||
| 155 | + ] | ||
| 156 | + }, | ||
| 157 | + { | ||
| 158 | + "bin_filename": "DropOutV3Grad_f32_uint1", | ||
| 159 | + "inputs": [ | ||
| 160 | + { | ||
| 161 | + "name": "grad_y", | ||
| 162 | + "index": 0, | ||
| 163 | + "dtype": "float32", | ||
| 164 | + "format": "ND", | ||
| 165 | + "paramType": "required", | ||
| 166 | + "shape": [ | ||
| 167 | + -2 | ||
| 168 | + ], | ||
| 169 | + "format_match_mode": "FormatAgnostic" | ||
| 170 | + }, | ||
| 171 | + { | ||
| 172 | + "name": "mask", | ||
| 173 | + "index": 1, | ||
| 174 | + "dtype": "uint1", | ||
| 175 | + "format": "ND", | ||
| 176 | + "paramType": "required", | ||
| 177 | + "shape": [ | ||
| 178 | + -2 | ||
| 179 | + ], | ||
| 180 | + "format_match_mode": "FormatAgnostic" | ||
| 181 | + }, | ||
| 182 | + { | ||
| 183 | + "name": "scale", | ||
| 184 | + "index": 2, | ||
| 185 | + "dtype": "float32", | ||
| 186 | + "format": "ND", | ||
| 187 | + "paramType": "required", | ||
| 188 | + "shape": [ | ||
| 189 | + -2 | ||
| 190 | + ], | ||
| 191 | + "format_match_mode": "FormatAgnostic" | ||
| 192 | + } | ||
| 193 | + ], | ||
| 194 | + "outputs": [ | ||
| 195 | + { | ||
| 196 | + "name": "grad_x", | ||
| 197 | + "index": 0, | ||
| 198 | + "dtype": "float32", | ||
| 199 | + "format": "ND", | ||
| 200 | + "paramType": "required", | ||
| 201 | + "shape": [ | ||
| 202 | + -2 | ||
| 203 | + ], | ||
| 204 | + "format_match_mode": "FormatAgnostic" | ||
| 205 | + } | ||
| 206 | + ] | ||
| 207 | + }, | ||
| 208 | + { | ||
| 209 | + "bin_filename": "DropOutV3Grad_f16_uint1", | ||
| 210 | + "inputs": [ | ||
| 211 | + { | ||
| 212 | + "name": "grad_y", | ||
| 213 | + "index": 0, | ||
| 214 | + "dtype": "float16", | ||
| 215 | + "format": "ND", | ||
| 216 | + "paramType": "required", | ||
| 217 | + "shape": [ | ||
| 218 | + -2 | ||
| 219 | + ], | ||
| 220 | + "format_match_mode": "FormatAgnostic" | ||
| 221 | + }, | ||
| 222 | + { | ||
| 223 | + "name": "mask", | ||
| 224 | + "index": 1, | ||
| 225 | + "dtype": "uint1", | ||
| 226 | + "format": "ND", | ||
| 227 | + "paramType": "required", | ||
| 228 | + "shape": [ | ||
| 229 | + -2 | ||
| 230 | + ], | ||
| 231 | + "format_match_mode": "FormatAgnostic" | ||
| 232 | + }, | ||
| 233 | + { | ||
| 234 | + "name": "scale", | ||
| 235 | + "index": 2, | ||
| 236 | + "dtype": "float32", | ||
| 237 | + "format": "ND", | ||
| 238 | + "paramType": "required", | ||
| 239 | + "shape": [ | ||
| 240 | + -2 | ||
| 241 | + ], | ||
| 242 | + "format_match_mode": "FormatAgnostic" | ||
| 243 | + } | ||
| 244 | + ], | ||
| 245 | + "outputs": [ | ||
| 246 | + { | ||
| 247 | + "name": "grad_x", | ||
| 248 | + "index": 0, | ||
| 249 | + "dtype": "float16", | ||
| 250 | + "format": "ND", | ||
| 251 | + "paramType": "required", | ||
| 252 | + "shape": [ | ||
| 253 | + -2 | ||
| 254 | + ], | ||
| 255 | + "format_match_mode": "FormatAgnostic" | ||
| 256 | + } | ||
| 257 | + ] | ||
| 258 | + }, | ||
| 259 | + { | ||
| 260 | + "bin_filename": "DropOutV3Grad_bf16_uint1", | ||
| 261 | + "inputs": [ | ||
| 262 | + { | ||
| 263 | + "name": "grad_y", | ||
| 264 | + "index": 0, | ||
| 265 | + "dtype": "bfloat16", | ||
| 266 | + "format": "ND", | ||
| 267 | + "paramType": "required", | ||
| 268 | + "shape": [ | ||
| 269 | + -2 | ||
| 270 | + ], | ||
| 271 | + "format_match_mode": "FormatAgnostic" | ||
| 272 | + }, | ||
| 273 | + { | ||
| 274 | + "name": "mask", | ||
| 275 | + "index": 1, | ||
| 276 | + "dtype": "uint1", | ||
| 277 | + "format": "ND", | ||
| 278 | + "paramType": "required", | ||
| 279 | + "shape": [ | ||
| 280 | + -2 | ||
| 281 | + ], | ||
| 282 | + "format_match_mode": "FormatAgnostic" | ||
| 283 | + }, | ||
| 284 | + { | ||
| 285 | + "name": "scale", | ||
| 286 | + "index": 2, | ||
| 287 | + "dtype": "float32", | ||
| 288 | + "format": "ND", | ||
| 289 | + "paramType": "required", | ||
| 290 | + "shape": [ | ||
| 291 | + -2 | ||
| 292 | + ], | ||
| 293 | + "format_match_mode": "FormatAgnostic" | ||
| 294 | + } | ||
| 295 | + ], | ||
| 296 | + "outputs": [ | ||
| 297 | + { | ||
| 298 | + "name": "grad_x", | ||
| 299 | + "index": 0, | ||
| 300 | + "dtype": "bfloat16", | ||
| 301 | + "format": "ND", | ||
| 302 | + "paramType": "required", | ||
| 303 | + "shape": [ | ||
| 304 | + -2 | ||
| 305 | + ], | ||
| 306 | + "format_match_mode": "FormatAgnostic" | ||
| 307 | + } | ||
| 308 | + ] | ||
| 309 | + } | ||
| 310 | + ] | ||
| 311 | +} | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | +[DropOutV3Grad] | ||
| 2 | +default=0 | ||
| @@ -0,0 +1,311 @@ | |||
| 1 | +{ | ||
| 2 | + "op_type": "DropOutV3Grad", | ||
| 3 | + "op_list": [ | ||
| 4 | + { | ||
| 5 | + "bin_filename": "DropOutV3Grad_f32_uint8", | ||
| 6 | + "inputs": [ | ||
| 7 | + { | ||
| 8 | + "name": "grad_y", | ||
| 9 | + "index": 0, | ||
| 10 | + "dtype": "float32", | ||
| 11 | + "format": "ND", | ||
| 12 | + "paramType": "required", | ||
| 13 | + "shape": [ | ||
| 14 | + -2 | ||
| 15 | + ], | ||
| 16 | + "format_match_mode": "FormatAgnostic" | ||
| 17 | + }, | ||
| 18 | + { | ||
| 19 | + "name": "mask", | ||
| 20 | + "index": 1, | ||
| 21 | + "dtype": "uint8", | ||
| 22 | + "format": "ND", | ||
| 23 | + "paramType": "required", | ||
| 24 | + "shape": [ | ||
| 25 | + -2 | ||
| 26 | + ], | ||
| 27 | + "format_match_mode": "FormatAgnostic" | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + "name": "scale", | ||
| 31 | + "index": 2, | ||
| 32 | + "dtype": "float32", | ||
| 33 | + "format": "ND", | ||
| 34 | + "paramType": "required", | ||
| 35 | + "shape": [ | ||
| 36 | + -2 | ||
| 37 | + ], | ||
| 38 | + "format_match_mode": "FormatAgnostic" | ||
| 39 | + } | ||
| 40 | + ], | ||
| 41 | + "outputs": [ | ||
| 42 | + { | ||
| 43 | + "name": "grad_x", | ||
| 44 | + "index": 0, | ||
| 45 | + "dtype": "float32", | ||
| 46 | + "format": "ND", | ||
| 47 | + "paramType": "required", | ||
| 48 | + "shape": [ | ||
| 49 | + -2 | ||
| 50 | + ], | ||
| 51 | + "format_match_mode": "FormatAgnostic" | ||
| 52 | + } | ||
| 53 | + ] | ||
| 54 | + }, | ||
| 55 | + { | ||
| 56 | + "bin_filename": "DropOutV3Grad_f16_uint8", | ||
| 57 | + "inputs": [ | ||
| 58 | + { | ||
| 59 | + "name": "grad_y", | ||
| 60 | + "index": 0, | ||
| 61 | + "dtype": "float16", | ||
| 62 | + "format": "ND", | ||
| 63 | + "paramType": "required", | ||
| 64 | + "shape": [ | ||
| 65 | + -2 | ||
| 66 | + ], | ||
| 67 | + "format_match_mode": "FormatAgnostic" | ||
| 68 | + }, | ||
| 69 | + { | ||
| 70 | + "name": "mask", | ||
| 71 | + "index": 1, | ||
| 72 | + "dtype": "uint8", | ||
| 73 | + "format": "ND", | ||
| 74 | + "paramType": "required", | ||
| 75 | + "shape": [ | ||
| 76 | + -2 | ||
| 77 | + ], | ||
| 78 | + "format_match_mode": "FormatAgnostic" | ||
| 79 | + }, | ||
| 80 | + { | ||
| 81 | + "name": "scale", | ||
| 82 | + "index": 2, | ||
| 83 | + "dtype": "float32", | ||
| 84 | + "format": "ND", | ||
| 85 | + "paramType": "required", | ||
| 86 | + "shape": [ | ||
| 87 | + -2 | ||
| 88 | + ], | ||
| 89 | + "format_match_mode": "FormatAgnostic" | ||
| 90 | + } | ||
| 91 | + ], | ||
| 92 | + "outputs": [ | ||
| 93 | + { | ||
| 94 | + "name": "grad_x", | ||
| 95 | + "index": 0, | ||
| 96 | + "dtype": "float16", | ||
| 97 | + "format": "ND", | ||
| 98 | + "paramType": "required", | ||
| 99 | + "shape": [ | ||
| 100 | + -2 | ||
| 101 | + ], | ||
| 102 | + "format_match_mode": "FormatAgnostic" | ||
| 103 | + } | ||
| 104 | + ] | ||
| 105 | + }, | ||
| 106 | + { | ||
| 107 | + "bin_filename": "DropOutV3Grad_bf16_uint8", | ||
| 108 | + "inputs": [ | ||
| 109 | + { | ||
| 110 | + "name": "grad_y", | ||
| 111 | + "index": 0, | ||
| 112 | + "dtype": "bfloat16", | ||
| 113 | + "format": "ND", | ||
| 114 | + "paramType": "required", | ||
| 115 | + "shape": [ | ||
| 116 | + -2 | ||
| 117 | + ], | ||
| 118 | + "format_match_mode": "FormatAgnostic" | ||
| 119 | + }, | ||
| 120 | + { | ||
| 121 | + "name": "mask", | ||
| 122 | + "index": 1, | ||
| 123 | + "dtype": "uint8", | ||
| 124 | + "format": "ND", | ||
| 125 | + "paramType": "required", | ||
| 126 | + "shape": [ | ||
| 127 | + -2 | ||
| 128 | + ], | ||
| 129 | + "format_match_mode": "FormatAgnostic" | ||
| 130 | + }, | ||
| 131 | + { | ||
| 132 | + "name": "scale", | ||
| 133 | + "index": 2, | ||
| 134 | + "dtype": "float32", | ||
| 135 | + "format": "ND", | ||
| 136 | + "paramType": "required", | ||
| 137 | + "shape": [ | ||
| 138 | + -2 | ||
| 139 | + ], | ||
| 140 | + "format_match_mode": "FormatAgnostic" | ||
| 141 | + } | ||
| 142 | + ], | ||
| 143 | + "outputs": [ | ||
| 144 | + { | ||
| 145 | + "name": "grad_x", | ||
| 146 | + "index": 0, | ||
| 147 | + "dtype": "bfloat16", | ||
| 148 | + "format": "ND", | ||
| 149 | + "paramType": "required", | ||
| 150 | + "shape": [ | ||
| 151 | + -2 | ||
| 152 | + ], | ||
| 153 | + "format_match_mode": "FormatAgnostic" | ||
| 154 | + } | ||
| 155 | + ] | ||
| 156 | + }, | ||
| 157 | + { | ||
| 158 | + "bin_filename": "DropOutV3Grad_f32_uint1", | ||
| 159 | + "inputs": [ | ||
| 160 | + { | ||
| 161 | + "name": "grad_y", | ||
| 162 | + "index": 0, | ||
| 163 | + "dtype": "float32", | ||
| 164 | + "format": "ND", | ||
| 165 | + "paramType": "required", | ||
| 166 | + "shape": [ | ||
| 167 | + -2 | ||
| 168 | + ], | ||
| 169 | + "format_match_mode": "FormatAgnostic" | ||
| 170 | + }, | ||
| 171 | + { | ||
| 172 | + "name": "mask", | ||
| 173 | + "index": 1, | ||
| 174 | + "dtype": "uint1", | ||
| 175 | + "format": "ND", | ||
| 176 | + "paramType": "required", | ||
| 177 | + "shape": [ | ||
| 178 | + -2 | ||
| 179 | + ], | ||
| 180 | + "format_match_mode": "FormatAgnostic" | ||
| 181 | + }, | ||
| 182 | + { | ||
| 183 | + "name": "scale", | ||
| 184 | + "index": 2, | ||
| 185 | + "dtype": "float32", | ||
| 186 | + "format": "ND", | ||
| 187 | + "paramType": "required", | ||
| 188 | + "shape": [ | ||
| 189 | + -2 | ||
| 190 | + ], | ||
| 191 | + "format_match_mode": "FormatAgnostic" | ||
| 192 | + } | ||
| 193 | + ], | ||
| 194 | + "outputs": [ | ||
| 195 | + { | ||
| 196 | + "name": "grad_x", | ||
| 197 | + "index": 0, | ||
| 198 | + "dtype": "float32", | ||
| 199 | + "format": "ND", | ||
| 200 | + "paramType": "required", | ||
| 201 | + "shape": [ | ||
| 202 | + -2 | ||
| 203 | + ], | ||
| 204 | + "format_match_mode": "FormatAgnostic" | ||
| 205 | + } | ||
| 206 | + ] | ||
| 207 | + }, | ||
| 208 | + { | ||
| 209 | + "bin_filename": "DropOutV3Grad_f16_uint1", | ||
| 210 | + "inputs": [ | ||
| 211 | + { | ||
| 212 | + "name": "grad_y", | ||
| 213 | + "index": 0, | ||
| 214 | + "dtype": "float16", | ||
| 215 | + "format": "ND", | ||
| 216 | + "paramType": "required", | ||
| 217 | + "shape": [ | ||
| 218 | + -2 | ||
| 219 | + ], | ||
| 220 | + "format_match_mode": "FormatAgnostic" | ||
| 221 | + }, | ||
| 222 | + { | ||
| 223 | + "name": "mask", | ||
| 224 | + "index": 1, | ||
| 225 | + "dtype": "uint1", | ||
| 226 | + "format": "ND", | ||
| 227 | + "paramType": "required", | ||
| 228 | + "shape": [ | ||
| 229 | + -2 | ||
| 230 | + ], | ||
| 231 | + "format_match_mode": "FormatAgnostic" | ||
| 232 | + }, | ||
| 233 | + { | ||
| 234 | + "name": "scale", | ||
| 235 | + "index": 2, | ||
| 236 | + "dtype": "float32", | ||
| 237 | + "format": "ND", | ||
| 238 | + "paramType": "required", | ||
| 239 | + "shape": [ | ||
| 240 | + -2 | ||
| 241 | + ], | ||
| 242 | + "format_match_mode": "FormatAgnostic" | ||
| 243 | + } | ||
| 244 | + ], | ||
| 245 | + "outputs": [ | ||
| 246 | + { | ||
| 247 | + "name": "grad_x", | ||
| 248 | + "index": 0, | ||
| 249 | + "dtype": "float16", | ||
| 250 | + "format": "ND", | ||
| 251 | + "paramType": "required", | ||
| 252 | + "shape": [ | ||
| 253 | + -2 | ||
| 254 | + ], | ||
| 255 | + "format_match_mode": "FormatAgnostic" | ||
| 256 | + } | ||
| 257 | + ] | ||
| 258 | + }, | ||
| 259 | + { | ||
| 260 | + "bin_filename": "DropOutV3Grad_bf16_uint1", | ||
| 261 | + "inputs": [ | ||
| 262 | + { | ||
| 263 | + "name": "grad_y", | ||
| 264 | + "index": 0, | ||
| 265 | + "dtype": "bfloat16", | ||
| 266 | + "format": "ND", | ||
| 267 | + "paramType": "required", | ||
| 268 | + "shape": [ | ||
| 269 | + -2 | ||
| 270 | + ], | ||
| 271 | + "format_match_mode": "FormatAgnostic" | ||
| 272 | + }, | ||
| 273 | + { | ||
| 274 | + "name": "mask", | ||
| 275 | + "index": 1, | ||
| 276 | + "dtype": "uint1", | ||
| 277 | + "format": "ND", | ||
| 278 | + "paramType": "required", | ||
| 279 | + "shape": [ | ||
| 280 | + -2 | ||
| 281 | + ], | ||
| 282 | + "format_match_mode": "FormatAgnostic" | ||
| 283 | + }, | ||
| 284 | + { | ||
| 285 | + "name": "scale", | ||
| 286 | + "index": 2, | ||
| 287 | + "dtype": "float32", | ||
| 288 | + "format": "ND", | ||
| 289 | + "paramType": "required", | ||
| 290 | + "shape": [ | ||
| 291 | + -2 | ||
| 292 | + ], | ||
| 293 | + "format_match_mode": "FormatAgnostic" | ||
| 294 | + } | ||
| 295 | + ], | ||
| 296 | + "outputs": [ | ||
| 297 | + { | ||
| 298 | + "name": "grad_x", | ||
| 299 | + "index": 0, | ||
| 300 | + "dtype": "bfloat16", | ||
| 301 | + "format": "ND", | ||
| 302 | + "paramType": "required", | ||
| 303 | + "shape": [ | ||
| 304 | + -2 | ||
| 305 | + ], | ||
| 306 | + "format_match_mode": "FormatAgnostic" | ||
| 307 | + } | ||
| 308 | + ] | ||
| 309 | + } | ||
| 310 | + ] | ||
| 311 | +} | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | +[DropOutV3Grad] | ||
| 2 | +default=0 | ||
| @@ -53,6 +53,8 @@ public: | |||
| 53 | .ExtendCfgInfo("opFile.value", "drop_out_v3_grad"); | 53 | .ExtendCfgInfo("opFile.value", "drop_out_v3_grad"); |
| 54 | this->AICore().AddConfig("ascend950", aicoreConfig); | 54 | this->AICore().AddConfig("ascend950", aicoreConfig); |
| 55 | this->AICore().AddConfig("ascend350", aicoreConfig); | 55 | this->AICore().AddConfig("ascend350", aicoreConfig); |
| 56 | + this->AICore().AddConfig("ascend960dt", aicoreConfig); | ||
| 57 | + this->AICore().AddConfig("ascend960pr", aicoreConfig); | ||
| 56 | } | 58 | } |
| 57 | }; | 59 | }; |
| 58 | 60 | ||
| @@ -167,8 +167,7 @@ static const aclTensor* uniformDoublePath(const aclTensor* uniformOut, double fr | |||
| 167 | static const aclTensor* uniformDavidPath(const aclTensor* selfRef, uint64_t seed, uint64_t offset, double from, | 167 | static const aclTensor* uniformDavidPath(const aclTensor* selfRef, uint64_t seed, uint64_t offset, double from, |
| 168 | double to, aclOpExecutor* executor) | 168 | double to, aclOpExecutor* executor) |
| 169 | { | 169 | { |
| 170 | - if (GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_3510 && | 170 | + if (IsRegBase(GetCurrentPlatformInfo().GetCurNpuArch()) && selfRef->GetDataType() != DataType::DT_DOUBLE) { |
| 171 | - selfRef->GetDataType() != DataType::DT_DOUBLE) { | ||
| 172 | if (!aclnnGetPytorchRandom()) { | 171 | if (!aclnnGetPytorchRandom()) { |
| 173 | OP_LOGD("compat mode, use V3 uniform"); | 172 | OP_LOGD("compat mode, use V3 uniform"); |
| 174 | int32_t uniformV3ScaleMode = 0; | 173 | int32_t uniformV3ScaleMode = 0; |
| @@ -189,8 +188,7 @@ static const aclTensor* uniformTensorDavidPath(const aclTensor* selfRef, const a | |||
| 189 | const aclTensor* offsetTensor, uint64_t offset, double from, double to, | 188 | const aclTensor* offsetTensor, uint64_t offset, double from, double to, |
| 190 | aclOpExecutor* executor) | 189 | aclOpExecutor* executor) |
| 191 | { | 190 | { |
| 192 | - if (GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_3510 && | 191 | + if (IsRegBase(GetCurrentPlatformInfo().GetCurNpuArch()) && selfRef->GetDataType() != DataType::DT_DOUBLE) { |
| 193 | - selfRef->GetDataType() != DataType::DT_DOUBLE) { | ||
| 194 | if (!aclnnGetPytorchRandom()) { | 192 | if (!aclnnGetPytorchRandom()) { |
| 195 | OP_LOGD("compat mode, use V3 uniform"); | 193 | OP_LOGD("compat mode, use V3 uniform"); |
| 196 | auto seedUint64 = l0op::Cast(seedTensor, op::DataType::DT_UINT64, executor); | 194 | auto seedUint64 = l0op::Cast(seedTensor, op::DataType::DT_UINT64, executor); |
| @@ -8,7 +8,7 @@ | |||
| 8 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 9 | # ---------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------- |
| 10 | 10 | ||
| 11 | -# StatelessExponential only supports ascend950, ascend350 and ascend960dt ascend960pr (arch35 / SIMT). | 11 | +# StatelessExponential only supports ascend950, ascend350, ascend960dt and ascend960pr (arch35 / SIMT). |
| 12 | # Kernel computation reuses sim_thread_exponential, so it must be listed as a | 12 | # Kernel computation reuses sim_thread_exponential, so it must be listed as a |
| 13 | # build dependency. | 13 | # build dependency. |
| 14 | set(SUPPORT_COMPUTE_UNIT "ascend950" "ascend350" "ascend960dt" "ascend960pr") | 14 | set(SUPPORT_COMPUTE_UNIT "ascend950" "ascend350" "ascend960dt" "ascend960pr") |
Arandom/stateless_exponential/op_host/config/ascend960pr/stateless_exponential_simplified_key.ini+13-0
| @@ -0,0 +1,13 @@ | |||
| 1 | +; 该文件主要影响 opc 工具 编译二进制kernel时, --simplified_key_mode 选项中填写的值,格式如下所示: | ||
| 2 | +; [某算子] | ||
| 3 | +; default=xx | ||
| 4 | +; ascendxx=xx | ||
| 5 | +; 其中,default为默认mode,ascendxx为可选mode,如果不同芯片有差异化要求时,需要配置; | ||
| 6 | +; 1)如果没有配置:非ascendC算子继续按空处理,即opc编译命令中不添加 --simplified_key_mode 选项,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 7 | +; 2)如果仅有default配置:各个版本按default配置 | ||
| 8 | +; 3)如果仅有某些平台的配置,没有default配置:对应平台的按照配置的值传递,非对应平台的:非AscendC算子继续按空处理,AscendC算子按照 simplified_key_mode=0 处理 | ||
| 9 | +; 4)如果default配置和平台配置都有:对应平台的使用平台的配置,非对应的平台的以default值配置。 | ||
| 10 | +; 5)对于自定义simplified key的情况,需要在binary_simplified_key_mode.ini 文件中显式配置为None,不传入 --simplified_key_mode 选项,由opc工具和FE框架自行判断使用何种模式 | ||
| 11 | +; 6)是否是AscendC算子,由 ops/built-in/tbe/op_info_cfg/parser/ascendc_config.json 中配置的算子名字和对于的平台决定 | ||
| 12 | +[StatelessExponential] | ||
| 13 | +default=0 | ||
| @@ -62,6 +62,7 @@ static inline bool IsArch22(NpuArch arch) { return arch == NpuArch::DAV_2201; } | |||
| 62 | 62 | ||
| 63 | static inline bool IsArch35(NpuArch arch) | 63 | static inline bool IsArch35(NpuArch arch) |
| 64 | { | 64 | { |
| 65 | + // Ascend960 (DAV_9201/9202) 与 Ascend950 共用 arch35 L0 实现路径 | ||
| 65 | return arch == NpuArch::DAV_3510 || arch == NpuArch::DAV_9201 || arch == NpuArch::DAV_9202; | 66 | return arch == NpuArch::DAV_3510 || arch == NpuArch::DAV_9201 || arch == NpuArch::DAV_9202; |
| 66 | } | 67 | } |
| 67 | 68 | ||