已合并
tilingdata重构 #5151
zhangxiyan7创建于 5月22日
tilingdata重构 #5151
已合并
从已删除 :master合入到cann/ops-nnmaster
共 65 个文件变更+3083-2872
| @@ -174,13 +174,13 @@ template <class CONV, class CONV_TILING> | |||
| 174 | __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | 174 | __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: |
| 175 | CalcStartAddrCommon(const uint32_t din, const uint32_t dout) | 175 | CalcStartAddrCommon(const uint32_t din, const uint32_t dout) |
| 176 | { | 176 | { |
| 177 | - hwIn = convTilingData->convRunInfo.hin * convTilingData->convRunInfo.win; | 177 | + hwIn = convTilingData->hin * convTilingData->win; |
| 178 | - hwOut = convTilingData->convRunInfo.hout * convTilingData->convRunInfo.wout; | 178 | + hwOut = convTilingData->hout * convTilingData->wout; |
| 179 | 179 | ||
| 180 | - convOps->fmapOneBatchSize = convTilingData->convRunInfo.cin * din * hwIn; | 180 | + convOps->fmapOneBatchSize = convTilingData->cin * din * hwIn; |
| 181 | - convOps->outputOneBatchSize = convTilingData->convRunInfo.cout * dout * hwOut; | 181 | + convOps->outputOneBatchSize = convTilingData->cout * dout * hwOut; |
| 182 | 182 | ||
| 183 | - if (convTilingData->convRunInfo.hasBias) { | 183 | + if (convTilingData->hasBias) { |
| 184 | biasStartAddr = convOps->nIdxStart; | 184 | biasStartAddr = convOps->nIdxStart; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| @@ -202,32 +202,32 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 202 | convOps->mIdxStart; | 202 | convOps->mIdxStart; |
| 203 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC || CONV::C_FORMAT == ConvFormat::NHWC) { | 203 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC || CONV::C_FORMAT == ConvFormat::NHWC) { |
| 204 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + | 204 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + |
| 205 | - convOps->mIdxStart * convTilingData->convRunInfo.cout + | 205 | + convOps->mIdxStart * convTilingData->cout + |
| 206 | convOps->nIdxStart; | 206 | convOps->nIdxStart; |
| 207 | } | 207 | } |
| 208 | if constexpr (CONV::C_FORMAT == ConvFormat::NCDHW) { | 208 | if constexpr (CONV::C_FORMAT == ConvFormat::NCDHW) { |
| 209 | outputStartAddr += doIdxStart * hwOut; | 209 | outputStartAddr += doIdxStart * hwOut; |
| 210 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC) { | 210 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC) { |
| 211 | - outputStartAddr += doIdxStart * hwOut * convTilingData->convRunInfo.cout; | 211 | + outputStartAddr += doIdxStart * hwOut * convTilingData->cout; |
| 212 | } | 212 | } |
| 213 | } else { | 213 | } else { |
| 214 | if constexpr (CONV::C_FORMAT == ConvFormat::NCDHW || CONV::C_FORMAT == ConvFormat::NCHW) { | 214 | if constexpr (CONV::C_FORMAT == ConvFormat::NCDHW || CONV::C_FORMAT == ConvFormat::NCHW) { |
| 215 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + | 215 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + |
| 216 | convOps->nIdxStart * dout * hwOut + | 216 | convOps->nIdxStart * dout * hwOut + |
| 217 | - convOps->hoIdxStart * convTilingData->convRunInfo.wout; | 217 | + convOps->hoIdxStart * convTilingData->wout; |
| 218 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC || CONV::C_FORMAT == ConvFormat::NHWC) { | 218 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC || CONV::C_FORMAT == ConvFormat::NHWC) { |
| 219 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + convOps->hoIdxStart * | 219 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + convOps->hoIdxStart * |
| 220 | - convTilingData->convRunInfo.wout * convTilingData->convRunInfo.cout + convOps->nIdxStart; | 220 | + convTilingData->wout * convTilingData->cout + convOps->nIdxStart; |
| 221 | } | 221 | } |
| 222 | if constexpr (CONV::C_FORMAT == ConvFormat::NCHW) { | 222 | if constexpr (CONV::C_FORMAT == ConvFormat::NCHW) { |
| 223 | outputStartAddr += convOps->woIdxStart; | 223 | outputStartAddr += convOps->woIdxStart; |
| 224 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NHWC) { | 224 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NHWC) { |
| 225 | - outputStartAddr += convOps->woIdxStart * convTilingData->convRunInfo.cout; | 225 | + outputStartAddr += convOps->woIdxStart * convTilingData->cout; |
| 226 | } | 226 | } |
| 227 | if constexpr (CONV::A_FORMAT == ConvFormat::NCDHW) { | 227 | if constexpr (CONV::A_FORMAT == ConvFormat::NCDHW) { |
| 228 | outputStartAddr += doIdxStart * hwOut; | 228 | outputStartAddr += doIdxStart * hwOut; |
| 229 | } else if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { | 229 | } else if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { |
| 230 | - outputStartAddr += doIdxStart * hwOut * convTilingData->convRunInfo.cout; | 230 | + outputStartAddr += doIdxStart * hwOut * convTilingData->cout; |
| 231 | } | 231 | } |
| 232 | } | 232 | } |
| 233 | } | 233 | } |
| @@ -240,7 +240,7 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 240 | CalcStartAddrCommon(din, dout); | 240 | CalcStartAddrCommon(din, dout); |
| 241 | 241 | ||
| 242 | if constexpr (CONV::DIS_CONTINUOUS) { | 242 | if constexpr (CONV::DIS_CONTINUOUS) { |
| 243 | - fmStartAddr = convOps->batchIdxStart * convTilingData->convRunInfo.cin; | 243 | + fmStartAddr = convOps->batchIdxStart * convTilingData->cin; |
| 244 | } else { | 244 | } else { |
| 245 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize; | 245 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize; |
| 246 | } | 246 | } |
| @@ -250,17 +250,17 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 250 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { | 250 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { |
| 251 | weightStartAddr = convOps->nIdxStart * convOps->k0; | 251 | weightStartAddr = convOps->nIdxStart * convOps->k0; |
| 252 | } else { | 252 | } else { |
| 253 | - weightStartAddr = convOps->nIdxStart * convTilingData->convRunInfo.cin * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 253 | + weightStartAddr = convOps->nIdxStart * convTilingData->cin * kd * convTilingData->kh * convTilingData->kw; |
| 254 | } | 254 | } |
| 255 | CalcOutputStartAddr(dout, doIdxStart); | 255 | CalcOutputStartAddr(dout, doIdxStart); |
| 256 | 256 | ||
| 257 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 257 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 258 | - if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || | 258 | + if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || |
| 259 | - convOps->convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 259 | + convOps->convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 260 | scaleStartAddr = convOps->nIdxStart; | 260 | scaleStartAddr = convOps->nIdxStart; |
| 261 | } | 261 | } |
| 262 | - if (convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || | 262 | + if (convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || |
| 263 | - convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 263 | + convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 264 | reluWeightStartAddr = convOps->nIdxStart; | 264 | reluWeightStartAddr = convOps->nIdxStart; |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| @@ -273,24 +273,24 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 273 | { | 273 | { |
| 274 | CalcStartAddrCommon(din, dout); | 274 | CalcStartAddrCommon(din, dout); |
| 275 | 275 | ||
| 276 | - int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->convRunInfo.strideH) - | 276 | + int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->strideH) - |
| 277 | - static_cast<int64_t>(convTilingData->convRunInfo.padTop); | 277 | + static_cast<int64_t>(convTilingData->padTop); |
| 278 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; | 278 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; |
| 279 | if constexpr (CONV::DIS_CONTINUOUS) { | 279 | if constexpr (CONV::DIS_CONTINUOUS) { |
| 280 | - fmStartAddr = convOps->singleCoreHiStartPos * convTilingData->convRunInfo.win * | 280 | + fmStartAddr = convOps->singleCoreHiStartPos * convTilingData->win * |
| 281 | - convTilingData->convRunInfo.batch * convTilingData->convRunInfo.cin + | 281 | + convTilingData->batch * convTilingData->cin + |
| 282 | - convOps->batchIdxStart * convTilingData->convRunInfo.cin; | 282 | + convOps->batchIdxStart * convTilingData->cin; |
| 283 | } else { | 283 | } else { |
| 284 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + convOps->singleCoreHiStartPos * | 284 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + convOps->singleCoreHiStartPos * |
| 285 | - convTilingData->convRunInfo.win; | 285 | + convTilingData->win; |
| 286 | } | 286 | } |
| 287 | convOps->singleCoreHiStartPos = hiStartPosTmp; | 287 | convOps->singleCoreHiStartPos = hiStartPosTmp; |
| 288 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW) { | 288 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW) { |
| 289 | - int64_t wiStartPosTmp = static_cast<int64_t>(convOps->woIdxStart * convTilingData->convRunInfo.strideW) - | 289 | + int64_t wiStartPosTmp = static_cast<int64_t>(convOps->woIdxStart * convTilingData->strideW) - |
| 290 | - static_cast<int64_t>(convTilingData->convRunInfo.padLeft); | 290 | + static_cast<int64_t>(convTilingData->padLeft); |
| 291 | convOps->singleCoreWiStartPos = wiStartPosTmp < 0 ? 0 : wiStartPosTmp; | 291 | convOps->singleCoreWiStartPos = wiStartPosTmp < 0 ? 0 : wiStartPosTmp; |
| 292 | if constexpr (CONV::DIS_CONTINUOUS) { | 292 | if constexpr (CONV::DIS_CONTINUOUS) { |
| 293 | - fmStartAddr += convOps->singleCoreWiStartPos * convTilingData->convRunInfo.batch * convTilingData->convRunInfo.cin; | 293 | + fmStartAddr += convOps->singleCoreWiStartPos * convTilingData->batch * convTilingData->cin; |
| 294 | } else { | 294 | } else { |
| 295 | fmStartAddr += convOps->singleCoreWiStartPos; | 295 | fmStartAddr += convOps->singleCoreWiStartPos; |
| 296 | } | 296 | } |
| @@ -300,7 +300,7 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 300 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { | 300 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { |
| 301 | weightStartAddr = convOps->nIdxStart * convOps->k0; | 301 | weightStartAddr = convOps->nIdxStart * convOps->k0; |
| 302 | } else { | 302 | } else { |
| 303 | - weightStartAddr = convOps->nIdxStart * convTilingData->convRunInfo.cin * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 303 | + weightStartAddr = convOps->nIdxStart * convTilingData->cin * kd * convTilingData->kh * convTilingData->kw; |
| 304 | } | 304 | } |
| 305 | CalcOutputStartAddr(dout, doIdxStart); | 305 | CalcOutputStartAddr(dout, doIdxStart); |
| 306 | 306 | ||
| @@ -317,7 +317,7 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 317 | 317 | ||
| 318 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize; | 318 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize; |
| 319 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { | 319 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { |
| 320 | - fmStartAddr += diIdxStart * hwIn * convTilingData->convRunInfo.cin; | 320 | + fmStartAddr += diIdxStart * hwIn * convTilingData->cin; |
| 321 | } | 321 | } |
| 322 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { | 322 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { |
| 323 | weightStartAddr = convOps->nIdxStart * convOps->k0; | 323 | weightStartAddr = convOps->nIdxStart * convOps->k0; |
| @@ -333,17 +333,17 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 333 | { | 333 | { |
| 334 | CalcStartAddrCommon(din, dout); | 334 | CalcStartAddrCommon(din, dout); |
| 335 | 335 | ||
| 336 | - int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->convRunInfo.strideH) - | 336 | + int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->strideH) - |
| 337 | - static_cast<int64_t>(convTilingData->convRunInfo.padTop); | 337 | + static_cast<int64_t>(convTilingData->padTop); |
| 338 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; | 338 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; |
| 339 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + convOps->singleCoreHiStartPos * | 339 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + convOps->singleCoreHiStartPos * |
| 340 | - convTilingData->convRunInfo.win * convTilingData->convRunInfo.cin; | 340 | + convTilingData->win * convTilingData->cin; |
| 341 | convOps->singleCoreHiStartPos = hiStartPosTmp; | 341 | convOps->singleCoreHiStartPos = hiStartPosTmp; |
| 342 | if constexpr (CONV::A_FORMAT == ConvFormat::NHWC) { | 342 | if constexpr (CONV::A_FORMAT == ConvFormat::NHWC) { |
| 343 | - int64_t wiStartPosTmp = static_cast<int64_t>(convOps->woIdxStart * convTilingData->convRunInfo.strideW) - | 343 | + int64_t wiStartPosTmp = static_cast<int64_t>(convOps->woIdxStart * convTilingData->strideW) - |
| 344 | - static_cast<int64_t>(convTilingData->convRunInfo.padLeft); | 344 | + static_cast<int64_t>(convTilingData->padLeft); |
| 345 | convOps->singleCoreWiStartPos = wiStartPosTmp; | 345 | convOps->singleCoreWiStartPos = wiStartPosTmp; |
| 346 | - fmStartAddr += Max(convOps->singleCoreWiStartPos, 0) * convTilingData->convRunInfo.cin; | 346 | + fmStartAddr += Max(convOps->singleCoreWiStartPos, 0) * convTilingData->cin; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { | 349 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z || CONV::B_FORMAT == ConvFormat::FRACTAL_Z_C04) { |
| @@ -354,7 +354,7 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 354 | CalcOutputStartAddr(dout, doIdxStart); | 354 | CalcOutputStartAddr(dout, doIdxStart); |
| 355 | 355 | ||
| 356 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { | 356 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { |
| 357 | - fmStartAddr += diIdxStart * hwIn * convTilingData->convRunInfo.cin; | 357 | + fmStartAddr += diIdxStart * hwIn * convTilingData->cin; |
| 358 | } | 358 | } |
| 359 | } | 359 | } |
| 360 | 360 | ||
| @@ -369,21 +369,21 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 369 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + diIdxStart * hwIn; | 369 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + diIdxStart * hwIn; |
| 370 | 370 | ||
| 371 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + | 371 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + |
| 372 | - convOps->mIdxStart * convTilingData->convRunInfo.cout + convOps->nIdxStart + | 372 | + convOps->mIdxStart * convTilingData->cout + convOps->nIdxStart + |
| 373 | - doIdxStart * hwOut * convTilingData->convRunInfo.cout; | 373 | + doIdxStart * hwOut * convTilingData->cout; |
| 374 | } else { | 374 | } else { |
| 375 | - int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->convRunInfo.strideH) - | 375 | + int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->strideH) - |
| 376 | - static_cast<int64_t>(convTilingData->convRunInfo.padTop); | 376 | + static_cast<int64_t>(convTilingData->padTop); |
| 377 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; | 377 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; |
| 378 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + convOps->singleCoreHiStartPos * | 378 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + convOps->singleCoreHiStartPos * |
| 379 | - convTilingData->convRunInfo.win + diIdxStart * hwIn; | 379 | + convTilingData->win + diIdxStart * hwIn; |
| 380 | convOps->singleCoreHiStartPos = hiStartPosTmp; | 380 | convOps->singleCoreHiStartPos = hiStartPosTmp; |
| 381 | 381 | ||
| 382 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + convOps->hoIdxStart * | 382 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + convOps->hoIdxStart * |
| 383 | - convTilingData->convRunInfo.wout * convTilingData->convRunInfo.cout + convOps->nIdxStart + | 383 | + convTilingData->wout * convTilingData->cout + convOps->nIdxStart + |
| 384 | - doIdxStart * hwOut * convTilingData->convRunInfo.cout; | 384 | + doIdxStart * hwOut * convTilingData->cout; |
| 385 | } | 385 | } |
| 386 | - weightStartAddr = convOps->nIdxStart * convTilingData->convRunInfo.cin * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 386 | + weightStartAddr = convOps->nIdxStart * convTilingData->cin * kd * convTilingData->kh * convTilingData->kw; |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | template <class CONV, class CONV_TILING> | 389 | template <class CONV, class CONV_TILING> |
| @@ -393,37 +393,37 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 393 | if constexpr (CONV::isQuant || CONV::IS_EXTEND_CONV2D) { | 393 | if constexpr (CONV::isQuant || CONV::IS_EXTEND_CONV2D) { |
| 394 | if (hasScale) { | 394 | if (hasScale) { |
| 395 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW || CONV::A_FORMAT == ConvFormat::NHWC) { | 395 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW || CONV::A_FORMAT == ConvFormat::NHWC) { |
| 396 | - if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 396 | + if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 397 | convOps->fixpipeParams.scale0.SetGlobalBuffer( | 397 | convOps->fixpipeParams.scale0.SetGlobalBuffer( |
| 398 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale0 + scaleStartAddr * | 398 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale0 + scaleStartAddr * |
| 399 | sizeof(typename CONV::SCALE_T))); | 399 | sizeof(typename CONV::SCALE_T))); |
| 400 | - } else if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { | 400 | + } else if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { |
| 401 | convOps->fixpipeParams.scale0.SetGlobalBuffer( | 401 | convOps->fixpipeParams.scale0.SetGlobalBuffer( |
| 402 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale0)); | 402 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale0)); |
| 403 | } | 403 | } |
| 404 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 404 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 405 | - if (convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 405 | + if (convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 406 | convOps->fixpipeParams.reluWeight0.SetGlobalBuffer( | 406 | convOps->fixpipeParams.reluWeight0.SetGlobalBuffer( |
| 407 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight0)); | 407 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight0)); |
| 408 | - } else if (convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 408 | + } else if (convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 409 | // copy relu_weight from om to gm | 409 | // copy relu_weight from om to gm |
| 410 | convOps->fixpipeParams.reluWeight0.SetGlobalBuffer( | 410 | convOps->fixpipeParams.reluWeight0.SetGlobalBuffer( |
| 411 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight0 + | 411 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight0 + |
| 412 | reluWeightStartAddr * sizeof(typename CONV::RELU_WEIGHT_T))); | 412 | reluWeightStartAddr * sizeof(typename CONV::RELU_WEIGHT_T))); |
| 413 | } | 413 | } |
| 414 | - if (convTilingData->convApiTiling.dualOutput) { | 414 | + if (convTilingData->dualOutput) { |
| 415 | - if (convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 415 | + if (convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 416 | convOps->fixpipeParams.scale1.SetGlobalBuffer( | 416 | convOps->fixpipeParams.scale1.SetGlobalBuffer( |
| 417 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale1 + scaleStartAddr * | 417 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale1 + scaleStartAddr * |
| 418 | sizeof(typename CONV::SCALE_T))); | 418 | sizeof(typename CONV::SCALE_T))); |
| 419 | - } else if (convOps->convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { | 419 | + } else if (convOps->convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { |
| 420 | convOps->fixpipeParams.scale1.SetGlobalBuffer( | 420 | convOps->fixpipeParams.scale1.SetGlobalBuffer( |
| 421 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale1)); | 421 | reinterpret_cast<__gm__ typename CONV::SCALE_T*>(extendParams->scale1)); |
| 422 | } | 422 | } |
| 423 | - if (convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 423 | + if (convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 424 | convOps->fixpipeParams.reluWeight1.SetGlobalBuffer( | 424 | convOps->fixpipeParams.reluWeight1.SetGlobalBuffer( |
| 425 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight1)); | 425 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight1)); |
| 426 | - } else if (convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 426 | + } else if (convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 427 | convOps->fixpipeParams.reluWeight1.SetGlobalBuffer( | 427 | convOps->fixpipeParams.reluWeight1.SetGlobalBuffer( |
| 428 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight1 + | 428 | reinterpret_cast<__gm__ typename CONV::RELU_WEIGHT_T*>(extendParams->reluWeight1 + |
| 429 | reluWeightStartAddr * sizeof(typename CONV::RELU_WEIGHT_T))); | 429 | reluWeightStartAddr * sizeof(typename CONV::RELU_WEIGHT_T))); |
| @@ -450,13 +450,13 @@ __aicore__ __forceinline__ void ConvCommon<CONV, CONV_TILING>:: | |||
| 450 | convOps->outputGm.SetGlobalBuffer( | 450 | convOps->outputGm.SetGlobalBuffer( |
| 451 | reinterpret_cast<__gm__ typename CONV::OUTPUT_T*>(y + outputStartAddr * sizeof(typename CONV::OUTPUT_T))); | 451 | reinterpret_cast<__gm__ typename CONV::OUTPUT_T*>(y + outputStartAddr * sizeof(typename CONV::OUTPUT_T))); |
| 452 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 452 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 453 | - if (convTilingData->convApiTiling.dualOutput) { | 453 | + if (convTilingData->dualOutput) { |
| 454 | convOps->output1Gm.SetGlobalBuffer( | 454 | convOps->output1Gm.SetGlobalBuffer( |
| 455 | reinterpret_cast<__gm__ typename CONV::OUTPUT1_T*>( | 455 | reinterpret_cast<__gm__ typename CONV::OUTPUT1_T*>( |
| 456 | extendParams->y1 + outputStartAddr * sizeof(typename CONV::OUTPUT1_T))); | 456 | extendParams->y1 + outputStartAddr * sizeof(typename CONV::OUTPUT1_T))); |
| 457 | } | 457 | } |
| 458 | } | 458 | } |
| 459 | - if (convTilingData->convRunInfo.hasBias) { | 459 | + if (convTilingData->hasBias) { |
| 460 | convOps->biasGm.SetGlobalBuffer( | 460 | convOps->biasGm.SetGlobalBuffer( |
| 461 | reinterpret_cast<__gm__ typename CONV::BIAS_T*>(bias + biasStartAddr * sizeof(typename CONV::BIAS_T))); | 461 | reinterpret_cast<__gm__ typename CONV::BIAS_T*>(bias + biasStartAddr * sizeof(typename CONV::BIAS_T))); |
| 462 | } | 462 | } |
| @@ -104,52 +104,52 @@ struct SetFixpipeParams { | |||
| 104 | static __aicore__ inline void call(Intf *self, const Extendconv2dFixpipeParams<typename Intf::ScaleT, typename Intf::ReluWeightT, typename Intf::ClipValue0T, typename Intf::ClipValue1T>& fixpipeParams) | 104 | static __aicore__ inline void call(Intf *self, const Extendconv2dFixpipeParams<typename Intf::ScaleT, typename Intf::ReluWeightT, typename Intf::ClipValue0T, typename Intf::ClipValue1T>& fixpipeParams) |
| 105 | { | 105 | { |
| 106 | if ASCEND_IS_AIC_CONV { | 106 | if ASCEND_IS_AIC_CONV { |
| 107 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { | 107 | + if (self->ctx.convTilingData->quantMode0 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { |
| 108 | self->ctx.scalegm.SetGlobalBuffer(fixpipeParams.scale0.GetPhyAddr(0), fixpipeParams.scale0.GetSize()); | 108 | self->ctx.scalegm.SetGlobalBuffer(fixpipeParams.scale0.GetPhyAddr(0), fixpipeParams.scale0.GetSize()); |
| 109 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { | 109 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { |
| 110 | self->ctx.deqScalar0 = fixpipeParams.scale0.GetValue(0); | 110 | self->ctx.deqScalar0 = fixpipeParams.scale0.GetValue(0); |
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | - if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 113 | + if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 114 | float m2 = fixpipeParams.reluWeight0.GetValue(0); | 114 | float m2 = fixpipeParams.reluWeight0.GetValue(0); |
| 115 | self->ctx.preReluScalar0 = reinterpret_cast<uint64_t&>(m2); | 115 | self->ctx.preReluScalar0 = reinterpret_cast<uint64_t&>(m2); |
| 116 | - } else if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 116 | + } else if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 117 | // copy from fixpipe paramIn to global tensor | 117 | // copy from fixpipe paramIn to global tensor |
| 118 | self->ctx.reluWeightGM.SetGlobalBuffer(fixpipeParams.reluWeight0.GetPhyAddr(0), | 118 | self->ctx.reluWeightGM.SetGlobalBuffer(fixpipeParams.reluWeight0.GetPhyAddr(0), |
| 119 | fixpipeParams.reluWeight0.GetSize()); | 119 | fixpipeParams.reluWeight0.GetSize()); |
| 120 | } | 120 | } |
| 121 | if constexpr (Intf::isExtendConv2d) { | 121 | if constexpr (Intf::isExtendConv2d) { |
| 122 | - if (self->ctx.convTilingData->convApiTiling.dualOutput && | 122 | + if (self->ctx.convTilingData->dualOutput && |
| 123 | - self->ctx.convTilingData->convApiTiling.quantMode1 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { | 123 | + self->ctx.convTilingData->quantMode1 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { |
| 124 | self->ctx.scale1gm.SetGlobalBuffer(fixpipeParams.scale1.GetPhyAddr(0), fixpipeParams.scale1.GetSize()); | 124 | self->ctx.scale1gm.SetGlobalBuffer(fixpipeParams.scale1.GetPhyAddr(0), fixpipeParams.scale1.GetSize()); |
| 125 | - if (self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { | 125 | + if (self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::SCALAR_QUANT)) { |
| 126 | self->ctx.deqScalar1 = fixpipeParams.scale1.GetValue(0); | 126 | self->ctx.deqScalar1 = fixpipeParams.scale1.GetValue(0); |
| 127 | } | 127 | } |
| 128 | - if (self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 128 | + if (self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 129 | float m2 = fixpipeParams.reluWeight1.GetValue(0); | 129 | float m2 = fixpipeParams.reluWeight1.GetValue(0); |
| 130 | self->ctx.preReluScalar1 = reinterpret_cast<uint64_t&>(m2); | 130 | self->ctx.preReluScalar1 = reinterpret_cast<uint64_t&>(m2); |
| 131 | - } else if (self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 131 | + } else if (self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 132 | self->ctx.reluWeight1GM.SetGlobalBuffer(fixpipeParams.reluWeight1.GetPhyAddr(0), | 132 | self->ctx.reluWeight1GM.SetGlobalBuffer(fixpipeParams.reluWeight1.GetPhyAddr(0), |
| 133 | fixpipeParams.reluWeight1.GetSize()); | 133 | fixpipeParams.reluWeight1.GetSize()); |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 != static_cast<uint8_t>(QuantModeType::NO_QUANT) || | 136 | + if (self->ctx.convTilingData->quantMode0 != static_cast<uint8_t>(QuantModeType::NO_QUANT) || |
| 137 | - self->ctx.convTilingData->convApiTiling.quantMode1 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { | 137 | + self->ctx.convTilingData->quantMode1 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { |
| 138 | self->ctx.isFirstIterate = true; | 138 | self->ctx.isFirstIterate = true; |
| 139 | } | 139 | } |
| 140 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || | 140 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || |
| 141 | - self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 141 | + self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 142 | self->ctx.enableVectorQuant = true; | 142 | self->ctx.enableVectorQuant = true; |
| 143 | } | 143 | } |
| 144 | - if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || | 144 | + if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || |
| 145 | - self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 145 | + self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 146 | self->ctx.enableVectorRelu = true; | 146 | self->ctx.enableVectorRelu = true; |
| 147 | } | 147 | } |
| 148 | } else { | 148 | } else { |
| 149 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { | 149 | + if (self->ctx.convTilingData->quantMode0 != static_cast<uint8_t>(QuantModeType::NO_QUANT)) { |
| 150 | self->ctx.isFirstIterate = true; | 150 | self->ctx.isFirstIterate = true; |
| 151 | } | 151 | } |
| 152 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 152 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 153 | self->ctx.enableVectorQuant = true; | 153 | self->ctx.enableVectorQuant = true; |
| 154 | } | 154 | } |
| 155 | } | 155 | } |
| @@ -175,7 +175,7 @@ struct GetTensorC { | |||
| 175 | if ASCEND_IS_AIC_CONV { | 175 | if ASCEND_IS_AIC_CONV { |
| 176 | self->ctx.copyOutIns.template CopyOut<TensorTypeT, config>(output0, ubInfo); | 176 | self->ctx.copyOutIns.template CopyOut<TensorTypeT, config>(output0, ubInfo); |
| 177 | if constexpr (Intf::isExtendConv2d) { | 177 | if constexpr (Intf::isExtendConv2d) { |
| 178 | - if (self->ctx.convTilingData->convApiTiling.dualOutput) { | 178 | + if (self->ctx.convTilingData->dualOutput) { |
| 179 | self->ctx.copyOutIns1.template CopyOut<GlobalTensor, config>(output1, ubInfo); | 179 | self->ctx.copyOutIns1.template CopyOut<GlobalTensor, config>(output1, ubInfo); |
| 180 | } | 180 | } |
| 181 | } | 181 | } |
| @@ -184,11 +184,11 @@ struct GetTensorC { | |||
| 184 | self->ctx.queueCL0.FreeTensor(self->ctx.cl0); | 184 | self->ctx.queueCL0.FreeTensor(self->ctx.cl0); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | - if (self->ctx.enableVectorQuant && !self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 187 | + if (self->ctx.enableVectorQuant && !self->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 188 | self->ctx.queueScaleL1.FreeTensor(self->ctx.scaleL1); | 188 | self->ctx.queueScaleL1.FreeTensor(self->ctx.scaleL1); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | - if (self->ctx.enableVectorRelu && !self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 191 | + if (self->ctx.enableVectorRelu && !self->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 192 | self->ctx.queueReluWeightL1.FreeTensor(self->ctx.reluWeightL1); | 192 | self->ctx.queueReluWeightL1.FreeTensor(self->ctx.reluWeightL1); |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| @@ -201,7 +201,7 @@ struct ConvPreProcess { | |||
| 201 | { | 201 | { |
| 202 | if ASCEND_IS_AIC_CONV { | 202 | if ASCEND_IS_AIC_CONV { |
| 203 | if constexpr (!Intf::isDeQuantFlag) { | 203 | if constexpr (!Intf::isDeQuantFlag) { |
| 204 | - if (self->ctx.convTilingData->convApiTiling.biasFullLoadFlag && self->ctx.enableBias) { | 204 | + if (self->ctx.convTilingData->biasFullLoadFlag && self->ctx.enableBias) { |
| 205 | self->ctx.biasL1 = self->ctx.queueBiasL1.template AllocTensor<typename Intf::BiasT>(); | 205 | self->ctx.biasL1 = self->ctx.queueBiasL1.template AllocTensor<typename Intf::BiasT>(); |
| 206 | uint64_t biasLoadNum = self->ctx.singleCoreCo; | 206 | uint64_t biasLoadNum = self->ctx.singleCoreCo; |
| 207 | if constexpr (Intf::groupOptPreloadFlag) { | 207 | if constexpr (Intf::groupOptPreloadFlag) { |
| @@ -212,7 +212,7 @@ struct ConvPreProcess { | |||
| 212 | self->ctx.queueBiasL1.EnQue(self->ctx.biasL1); | 212 | self->ctx.queueBiasL1.EnQue(self->ctx.biasL1); |
| 213 | self->ctx.biasL1 = self->ctx.queueBiasL1.template DeQue<typename Intf::BiasT>(); | 213 | self->ctx.biasL1 = self->ctx.queueBiasL1.template DeQue<typename Intf::BiasT>(); |
| 214 | } | 214 | } |
| 215 | - if (self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 215 | + if (self->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 216 | if (self->ctx.enableVectorQuant || self->ctx.enableVectorRelu) { | 216 | if (self->ctx.enableVectorQuant || self->ctx.enableVectorRelu) { |
| 217 | event_t eventId = static_cast<event_t>(self->ctx.pipe.FetchEventID(HardEvent::FIX_MTE2)); | 217 | event_t eventId = static_cast<event_t>(self->ctx.pipe.FetchEventID(HardEvent::FIX_MTE2)); |
| 218 | SetFlag<HardEvent::FIX_MTE2>(eventId); | 218 | SetFlag<HardEvent::FIX_MTE2>(eventId); |
| @@ -225,11 +225,11 @@ struct ConvPreProcess { | |||
| 225 | if (self->ctx.enableVectorQuant) { | 225 | if (self->ctx.enableVectorQuant) { |
| 226 | self->ctx.scaleL1 = self->ctx.queueScaleL1.template AllocTensor<typename Intf::ScaleT>(); | 226 | self->ctx.scaleL1 = self->ctx.queueScaleL1.template AllocTensor<typename Intf::ScaleT>(); |
| 227 | if constexpr (Intf::isExtendConv2d) { | 227 | if constexpr (Intf::isExtendConv2d) { |
| 228 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 228 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 229 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1FullLoad(self->ctx.scaleL1, self->ctx.scalegm, | 229 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1FullLoad(self->ctx.scaleL1, self->ctx.scalegm, |
| 230 | scaleLoadNum, 0); | 230 | scaleLoadNum, 0); |
| 231 | } | 231 | } |
| 232 | - if (self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 232 | + if (self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 233 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1FullLoad(self->ctx.scaleL1[self->ctx.scale1L1offset], | 233 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1FullLoad(self->ctx.scaleL1[self->ctx.scale1L1offset], |
| 234 | self->ctx.scale1gm, scaleLoadNum, 0); | 234 | self->ctx.scale1gm, scaleLoadNum, 0); |
| 235 | } | 235 | } |
| @@ -244,11 +244,11 @@ struct ConvPreProcess { | |||
| 244 | if (self->ctx.enableVectorRelu) { | 244 | if (self->ctx.enableVectorRelu) { |
| 245 | self->ctx.reluWeightL1 = | 245 | self->ctx.reluWeightL1 = |
| 246 | self->ctx.queueReluWeightL1.template AllocTensor<typename Intf::ReluWeightT>(); | 246 | self->ctx.queueReluWeightL1.template AllocTensor<typename Intf::ReluWeightT>(); |
| 247 | - if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 247 | + if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 248 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1FullLoad(self->ctx.reluWeightL1, | 248 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1FullLoad(self->ctx.reluWeightL1, |
| 249 | self->ctx.reluWeightGM, scaleLoadNum, 0); | 249 | self->ctx.reluWeightGM, scaleLoadNum, 0); |
| 250 | } | 250 | } |
| 251 | - if (self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 251 | + if (self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 252 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1FullLoad( | 252 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1FullLoad( |
| 253 | self->ctx.reluWeightL1[self->ctx.reluWeight1L1offset], | 253 | self->ctx.reluWeightL1[self->ctx.reluWeight1L1offset], |
| 254 | self->ctx.reluWeight1GM, scaleLoadNum, 0); | 254 | self->ctx.reluWeight1GM, scaleLoadNum, 0); |
| @@ -274,14 +274,14 @@ struct ConvPostProcess { | |||
| 274 | { | 274 | { |
| 275 | if ASCEND_IS_AIC_CONV { | 275 | if ASCEND_IS_AIC_CONV { |
| 276 | if constexpr (!Intf::isDeQuantFlag) { | 276 | if constexpr (!Intf::isDeQuantFlag) { |
| 277 | - if (self->ctx.convTilingData->convApiTiling.biasFullLoadFlag && self->ctx.enableBias) { | 277 | + if (self->ctx.convTilingData->biasFullLoadFlag && self->ctx.enableBias) { |
| 278 | self->ctx.queueBiasL1.FreeTensor(self->ctx.biasL1); | 278 | self->ctx.queueBiasL1.FreeTensor(self->ctx.biasL1); |
| 279 | } | 279 | } |
| 280 | - if (self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag && self->ctx.enableVectorQuant) { | 280 | + if (self->ctx.convTilingData->fixpParamsFullLoadFlag && self->ctx.enableVectorQuant) { |
| 281 | self->ctx.queueScaleL1.FreeTensor(self->ctx.scaleL1); | 281 | self->ctx.queueScaleL1.FreeTensor(self->ctx.scaleL1); |
| 282 | } | 282 | } |
| 283 | } | 283 | } |
| 284 | - if (self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag && self->ctx.enableVectorRelu) { | 284 | + if (self->ctx.convTilingData->fixpParamsFullLoadFlag && self->ctx.enableVectorRelu) { |
| 285 | self->ctx.queueReluWeightL1.FreeTensor(self->ctx.reluWeightL1); | 285 | self->ctx.queueReluWeightL1.FreeTensor(self->ctx.reluWeightL1); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| @@ -354,7 +354,7 @@ struct IterateAll { | |||
| 354 | const GlobalTensor<typename Intf::Output1T> &output1) { | 354 | const GlobalTensor<typename Intf::Output1T> &output1) { |
| 355 | if constexpr (Intf::formatOutput == ConvFormat::NHWC) { | 355 | if constexpr (Intf::formatOutput == ConvFormat::NHWC) { |
| 356 | if constexpr (Intf::isFixedPoint) { | 356 | if constexpr (Intf::isFixedPoint) { |
| 357 | - if (self->ctx.convTilingData->convApiTiling.dualOutput) { | 357 | + if (self->ctx.convTilingData->dualOutput) { |
| 358 | GetTensorC<Intf, ImplType>::template | 358 | GetTensorC<Intf, ImplType>::template |
| 359 | call<GlobalTensor, CFG_ROW_MAJOR_FIXED_POINT, sync>(self, output0, output1); | 359 | call<GlobalTensor, CFG_ROW_MAJOR_FIXED_POINT, sync>(self, output0, output1); |
| 360 | } else { | 360 | } else { |
| @@ -362,7 +362,7 @@ struct IterateAll { | |||
| 362 | call<GlobalTensor, CFG_ROW_MAJOR_FIXED_POINT, sync>(self, output0); | 362 | call<GlobalTensor, CFG_ROW_MAJOR_FIXED_POINT, sync>(self, output0); |
| 363 | } | 363 | } |
| 364 | } else { | 364 | } else { |
| 365 | - if (self->ctx.convTilingData->convApiTiling.dualOutput) { | 365 | + if (self->ctx.convTilingData->dualOutput) { |
| 366 | GetTensorC<Intf, ImplType>::template | 366 | GetTensorC<Intf, ImplType>::template |
| 367 | call<GlobalTensor, CFG_ROW_MAJOR, sync>(self, output0, output1); | 367 | call<GlobalTensor, CFG_ROW_MAJOR, sync>(self, output0, output1); |
| 368 | } else { | 368 | } else { |
| @@ -372,7 +372,7 @@ struct IterateAll { | |||
| 372 | } | 372 | } |
| 373 | } else { | 373 | } else { |
| 374 | if constexpr (Intf::isFixedPoint) { | 374 | if constexpr (Intf::isFixedPoint) { |
| 375 | - if (self->ctx.convTilingData->convApiTiling.dualOutput) { | 375 | + if (self->ctx.convTilingData->dualOutput) { |
| 376 | GetTensorC<Intf, ImplType>::template | 376 | GetTensorC<Intf, ImplType>::template |
| 377 | call<GlobalTensor, CFG_COLUMN_MAJOR_FIXED_POINT, sync>(self, output0, output1); | 377 | call<GlobalTensor, CFG_COLUMN_MAJOR_FIXED_POINT, sync>(self, output0, output1); |
| 378 | } else { | 378 | } else { |
| @@ -380,7 +380,7 @@ struct IterateAll { | |||
| 380 | call<GlobalTensor, CFG_COLUMN_MAJOR_FIXED_POINT, sync>(self, output0); | 380 | call<GlobalTensor, CFG_COLUMN_MAJOR_FIXED_POINT, sync>(self, output0); |
| 381 | } | 381 | } |
| 382 | } else { | 382 | } else { |
| 383 | - if (self->ctx.convTilingData->convApiTiling.dualOutput) { | 383 | + if (self->ctx.convTilingData->dualOutput) { |
| 384 | GetTensorC<Intf, ImplType>::template | 384 | GetTensorC<Intf, ImplType>::template |
| 385 | call<GlobalTensor, CFG_COLUMN_MAJOR, sync>(self, output0, output1); | 385 | call<GlobalTensor, CFG_COLUMN_MAJOR, sync>(self, output0, output1); |
| 386 | } else { | 386 | } else { |
| @@ -430,11 +430,11 @@ __aicore__ inline void InitBufferWithDoubleBuf(Intf *self) | |||
| 430 | self->ctx.wholeAl0Tensor = self->ctx.al0Buf.template Get<typename Intf::FmapT>(); | 430 | self->ctx.wholeAl0Tensor = self->ctx.al0Buf.template Get<typename Intf::FmapT>(); |
| 431 | self->ctx.wholeBl0Tensor = self->ctx.bl0Buf.template Get<typename Intf::WeightT>(); | 431 | self->ctx.wholeBl0Tensor = self->ctx.bl0Buf.template Get<typename Intf::WeightT>(); |
| 432 | 432 | ||
| 433 | - int8_t cl0db = (self->ctx.convTilingData->convApiTiling.pBufferFlag & 0x04) >> 2; | 433 | + int8_t cl0db = (self->ctx.convTilingData->pBufferFlag & 0x04) >> 2; |
| 434 | if constexpr (Intf::isInnerBatchFlag || Intf::isDeQuantFlag) { | 434 | if constexpr (Intf::isInnerBatchFlag || Intf::isDeQuantFlag) { |
| 435 | - uint64_t cl0Spacesize = self->ctx.convTilingData->convApiTiling.mStep * self->ctx.convTilingData->convApiTiling.nL0; | 435 | + uint64_t cl0Spacesize = self->ctx.convTilingData->mStep * self->ctx.convTilingData->nL0; |
| 436 | if constexpr (Intf::isInnerBatchFlag) { | 436 | if constexpr (Intf::isInnerBatchFlag) { |
| 437 | - cl0Spacesize *= self->ctx.convTilingData->convApiTiling.innerBatch; | 437 | + cl0Spacesize *= self->ctx.convTilingData->innerBatch; |
| 438 | } | 438 | } |
| 439 | if (!cl0db) { | 439 | if (!cl0db) { |
| 440 | self->ctx.pipe.InitBuffer(self->ctx.queueCL0, 1, cl0Spacesize * Intf::sizeOfL0c); | 440 | self->ctx.pipe.InitBuffer(self->ctx.queueCL0, 1, cl0Spacesize * Intf::sizeOfL0c); |
| @@ -446,10 +446,10 @@ __aicore__ inline void InitBufferWithDoubleBuf(Intf *self) | |||
| 446 | self->ctx.wholeCl0Tensor = self->ctx.l0cBuf.template Get<typename Intf::L0cT>(); | 446 | self->ctx.wholeCl0Tensor = self->ctx.l0cBuf.template Get<typename Intf::L0cT>(); |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | - if (!((self->ctx.convTilingData->convApiTiling.pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET)) { | 449 | + if (!((self->ctx.convTilingData->pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET)) { |
| 450 | - self->ctx.pipe.InitBuffer(self->ctx.queueAL1, 1, self->ctx.convTilingData->convApiTiling.aL1SpaceSize); | 450 | + self->ctx.pipe.InitBuffer(self->ctx.queueAL1, 1, self->ctx.convTilingData->aL1SpaceSize); |
| 451 | } else { | 451 | } else { |
| 452 | - self->ctx.pipe.InitBuffer(self->ctx.queueAL1, DOUBLE_BUF, self->ctx.convTilingData->convApiTiling.aL1SpaceSize); | 452 | + self->ctx.pipe.InitBuffer(self->ctx.queueAL1, DOUBLE_BUF, self->ctx.convTilingData->aL1SpaceSize); |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | if constexpr (!Intf::bL1DBFlag) { | 455 | if constexpr (!Intf::bL1DBFlag) { |
| @@ -466,7 +466,7 @@ __aicore__ inline void InitBufferWithDoubleBuf(Intf *self) | |||
| 466 | 466 | ||
| 467 | if constexpr (Intf::isDeQuantFlag) { | 467 | if constexpr (Intf::isDeQuantFlag) { |
| 468 | self->ctx.pipe.InitBuffer(self->ctx.mmadResUbBuf, | 468 | self->ctx.pipe.InitBuffer(self->ctx.mmadResUbBuf, |
| 469 | - self->ctx.convTilingData->convApiTiling.mUB * self->ctx.convTilingData->convApiTiling.nUB * Intf::sizeOfL0c); | 469 | + self->ctx.convTilingData->mUB * self->ctx.convTilingData->nUB * Intf::sizeOfL0c); |
| 470 | self->ctx.mmadResUbTensor = self->ctx.mmadResUbBuf.template Get<typename Intf::L0cT>(); | 470 | self->ctx.mmadResUbTensor = self->ctx.mmadResUbBuf.template Get<typename Intf::L0cT>(); |
| 471 | } | 471 | } |
| 472 | } | 472 | } |
| @@ -474,21 +474,21 @@ __aicore__ inline void InitBufferWithDoubleBuf(Intf *self) | |||
| 474 | template <class Intf> | 474 | template <class Intf> |
| 475 | __aicore__ inline void InitBuffer(Intf *self) | 475 | __aicore__ inline void InitBuffer(Intf *self) |
| 476 | { | 476 | { |
| 477 | - self->ctx.bL1SpaceSize = self->ctx.convTilingData->convApiTiling.nBL1 * self->ctx.convTilingData->convApiTiling.kBL1; | 477 | + self->ctx.bL1SpaceSize = self->ctx.convTilingData->nBL1 * self->ctx.convTilingData->kBL1; |
| 478 | 478 | ||
| 479 | InitBufferWithDoubleBuf<Intf>(self); | 479 | InitBufferWithDoubleBuf<Intf>(self); |
| 480 | 480 | ||
| 481 | if constexpr (!Intf::isDeQuantFlag) { | 481 | if constexpr (!Intf::isDeQuantFlag) { |
| 482 | - if (self->ctx.convTilingData->convApiTiling.hasBias) { | 482 | + if (self->ctx.convTilingData->hasBias) { |
| 483 | - uint64_t biasl1Spacesize = self->ctx.convTilingData->convApiTiling.biasFullLoadFlag ? AlignB( | 483 | + uint64_t biasl1Spacesize = self->ctx.convTilingData->biasFullLoadFlag ? AlignB( |
| 484 | self->ctx.singleCoreCo * Intf::sizeOfBias, BLOCK_L0_N * Intf::sizeOfBias) : | 484 | self->ctx.singleCoreCo * Intf::sizeOfBias, BLOCK_L0_N * Intf::sizeOfBias) : |
| 485 | - self->ctx.convTilingData->convApiTiling.nL0 * Intf::sizeOfBias; | 485 | + self->ctx.convTilingData->nL0 * Intf::sizeOfBias; |
| 486 | if constexpr (Intf::groupOptPreloadFlag) { | 486 | if constexpr (Intf::groupOptPreloadFlag) { |
| 487 | - if (self->ctx.convTilingData->convApiTiling.biasFullLoadFlag) { | 487 | + if (self->ctx.convTilingData->biasFullLoadFlag) { |
| 488 | - biasl1Spacesize = AlignB(self->ctx.convTilingData->convApiTiling.orgCo * Intf::sizeOfBias, BLOCK_L0_N * Intf::sizeOfBias); | 488 | + biasl1Spacesize = AlignB(self->ctx.convTilingData->orgCo * Intf::sizeOfBias, BLOCK_L0_N * Intf::sizeOfBias); |
| 489 | } | 489 | } |
| 490 | } | 490 | } |
| 491 | - uint64_t biasBTSpacesize = self->ctx.convTilingData->convApiTiling.nL0; | 491 | + uint64_t biasBTSpacesize = self->ctx.convTilingData->nL0; |
| 492 | self->ctx.pipe.InitBuffer(self->ctx.queueBiasL1, 1, AlignB(biasl1Spacesize, C0_SIZE)); | 492 | self->ctx.pipe.InitBuffer(self->ctx.queueBiasL1, 1, AlignB(biasl1Spacesize, C0_SIZE)); |
| 493 | self->ctx.pipe.InitBuffer( | 493 | self->ctx.pipe.InitBuffer( |
| 494 | self->ctx.queueBiasBT, 1, AlignB(biasBTSpacesize * Intf::sizeOfL0c, BT_SIZE)); | 494 | self->ctx.queueBiasBT, 1, AlignB(biasBTSpacesize * Intf::sizeOfL0c, BT_SIZE)); |
| @@ -496,50 +496,50 @@ __aicore__ inline void InitBuffer(Intf *self) | |||
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | if constexpr (Intf::isExtendConv2d) { | 498 | if constexpr (Intf::isExtendConv2d) { |
| 499 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || | 499 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || |
| 500 | - self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 500 | + self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 501 | uint64_t scaleL1SpaceSize = 0; | 501 | uint64_t scaleL1SpaceSize = 0; |
| 502 | - uint64_t scale0L1Size = self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag ? AlignB( | 502 | + uint64_t scale0L1Size = self->ctx.convTilingData->fixpParamsFullLoadFlag ? AlignB( |
| 503 | self->ctx.singleCoreCo * Intf::sizeOfScale, BLOCK_L0_N * Intf::sizeOfScale) : | 503 | self->ctx.singleCoreCo * Intf::sizeOfScale, BLOCK_L0_N * Intf::sizeOfScale) : |
| 504 | - self->ctx.convTilingData->convApiTiling.nL0 * Intf::sizeOfScale; | 504 | + self->ctx.convTilingData->nL0 * Intf::sizeOfScale; |
| 505 | if constexpr (Intf::groupOptPreloadFlag) { | 505 | if constexpr (Intf::groupOptPreloadFlag) { |
| 506 | - if (self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 506 | + if (self->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 507 | - scale0L1Size = AlignB(self->ctx.convTilingData->convApiTiling.orgCo * Intf::sizeOfScale, | 507 | + scale0L1Size = AlignB(self->ctx.convTilingData->orgCo * Intf::sizeOfScale, |
| 508 | BLOCK_L0_N * Intf::sizeOfScale); | 508 | BLOCK_L0_N * Intf::sizeOfScale); |
| 509 | } | 509 | } |
| 510 | } | 510 | } |
| 511 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 511 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 512 | scaleL1SpaceSize += scale0L1Size; | 512 | scaleL1SpaceSize += scale0L1Size; |
| 513 | } | 513 | } |
| 514 | - if (self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 514 | + if (self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 515 | self->ctx.scale1L1offset = scaleL1SpaceSize / Intf::sizeOfScale; | 515 | self->ctx.scale1L1offset = scaleL1SpaceSize / Intf::sizeOfScale; |
| 516 | scaleL1SpaceSize += scale0L1Size; | 516 | scaleL1SpaceSize += scale0L1Size; |
| 517 | } | 517 | } |
| 518 | self->ctx.pipe.InitBuffer(self->ctx.queueScaleL1, 1, AlignB(scaleL1SpaceSize, C0_SIZE)); | 518 | self->ctx.pipe.InitBuffer(self->ctx.queueScaleL1, 1, AlignB(scaleL1SpaceSize, C0_SIZE)); |
| 519 | } | 519 | } |
| 520 | - if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || | 520 | + if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || |
| 521 | - self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 521 | + self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 522 | uint32_t reluWeightL1SpaceSize = 0; | 522 | uint32_t reluWeightL1SpaceSize = 0; |
| 523 | - uint32_t reluWeight0L1Size = self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag ? AlignB( | 523 | + uint32_t reluWeight0L1Size = self->ctx.convTilingData->fixpParamsFullLoadFlag ? AlignB( |
| 524 | self->ctx.singleCoreCo * Intf::sizeOfReluWeight, BLOCK_L0_N * Intf::sizeOfReluWeight) : | 524 | self->ctx.singleCoreCo * Intf::sizeOfReluWeight, BLOCK_L0_N * Intf::sizeOfReluWeight) : |
| 525 | - self->ctx.convTilingData->convApiTiling.nL0 * Intf::sizeOfReluWeight; | 525 | + self->ctx.convTilingData->nL0 * Intf::sizeOfReluWeight; |
| 526 | - if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 526 | + if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 527 | reluWeightL1SpaceSize += reluWeight0L1Size; | 527 | reluWeightL1SpaceSize += reluWeight0L1Size; |
| 528 | } | 528 | } |
| 529 | - if (self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 529 | + if (self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 530 | self->ctx.reluWeight1L1offset = reluWeightL1SpaceSize / Intf::sizeOfReluWeight; | 530 | self->ctx.reluWeight1L1offset = reluWeightL1SpaceSize / Intf::sizeOfReluWeight; |
| 531 | reluWeightL1SpaceSize += reluWeight0L1Size; | 531 | reluWeightL1SpaceSize += reluWeight0L1Size; |
| 532 | } | 532 | } |
| 533 | self->ctx.pipe.InitBuffer(self->ctx.queueReluWeightL1, 1, AlignB(reluWeightL1SpaceSize, C0_SIZE)); | 533 | self->ctx.pipe.InitBuffer(self->ctx.queueReluWeightL1, 1, AlignB(reluWeightL1SpaceSize, C0_SIZE)); |
| 534 | } | 534 | } |
| 535 | } else if constexpr (Intf::isQuantScene) { | 535 | } else if constexpr (Intf::isQuantScene) { |
| 536 | - if (self->ctx.convTilingData->convApiTiling.hasScale != 0) { | 536 | + if (self->ctx.convTilingData->hasScale != 0) { |
| 537 | - uint64_t scaleL1SpaceSize = self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag ? AlignB( | 537 | + uint64_t scaleL1SpaceSize = self->ctx.convTilingData->fixpParamsFullLoadFlag ? AlignB( |
| 538 | self->ctx.singleCoreCo * Intf::sizeOfScale, BLOCK_L0_N * Intf::sizeOfScale) : | 538 | self->ctx.singleCoreCo * Intf::sizeOfScale, BLOCK_L0_N * Intf::sizeOfScale) : |
| 539 | - self->ctx.convTilingData->convApiTiling.nL0 * Intf::sizeOfScale; | 539 | + self->ctx.convTilingData->nL0 * Intf::sizeOfScale; |
| 540 | if constexpr (Intf::groupOptPreloadFlag) { | 540 | if constexpr (Intf::groupOptPreloadFlag) { |
| 541 | - if (self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 541 | + if (self->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 542 | - scaleL1SpaceSize = AlignB(self->ctx.convTilingData->convApiTiling.orgCo * Intf::sizeOfScale, BLOCK_L0_N * Intf::sizeOfScale); | 542 | + scaleL1SpaceSize = AlignB(self->ctx.convTilingData->orgCo * Intf::sizeOfScale, BLOCK_L0_N * Intf::sizeOfScale); |
| 543 | } | 543 | } |
| 544 | } | 544 | } |
| 545 | self->ctx.pipe.InitBuffer(self->ctx.queueScaleL1, 1, AlignB(scaleL1SpaceSize, C0_SIZE)); | 545 | self->ctx.pipe.InitBuffer(self->ctx.queueScaleL1, 1, AlignB(scaleL1SpaceSize, C0_SIZE)); |
| @@ -550,9 +550,9 @@ __aicore__ inline void InitBuffer(Intf *self) | |||
| 550 | template <class Intf> | 550 | template <class Intf> |
| 551 | __aicore__ inline void InitHf32Mode(Intf *self) | 551 | __aicore__ inline void InitHf32Mode(Intf *self) |
| 552 | { | 552 | { |
| 553 | - if (self->ctx.convTilingData->convApiTiling.hf32Enable) { | 553 | + if (self->ctx.convTilingData->hf32Enable) { |
| 554 | - SetHF32Mode(self->ctx.convTilingData->convApiTiling.hf32Enable); | 554 | + SetHF32Mode(self->ctx.convTilingData->hf32Enable); |
| 555 | - SetHF32TransMode(self->ctx.convTilingData->convApiTiling.hf32TransMode); | 555 | + SetHF32TransMode(self->ctx.convTilingData->hf32TransMode); |
| 556 | } else { | 556 | } else { |
| 557 | SetHF32Mode(0); | 557 | SetHF32Mode(0); |
| 558 | SetHF32TransMode(0); | 558 | SetHF32TransMode(0); |
| @@ -70,23 +70,23 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 70 | CalcStartAddrFmapHW() | 70 | CalcStartAddrFmapHW() |
| 71 | { | 71 | { |
| 72 | if constexpr (!CONV::isMMode) { | 72 | if constexpr (!CONV::isMMode) { |
| 73 | - int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->convRunInfo.strideH) - | 73 | + int64_t hiStartPosTmp = static_cast<int64_t>(convOps->hoIdxStart * convTilingData->strideH) - |
| 74 | - static_cast<int64_t>(convTilingData->convRunInfo.padTop); | 74 | + static_cast<int64_t>(convTilingData->padTop); |
| 75 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; | 75 | convOps->singleCoreHiStartPos = hiStartPosTmp < 0 ? 0 : hiStartPosTmp; |
| 76 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC || CONV::A_FORMAT == ConvFormat::NHWC) { | 76 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC || CONV::A_FORMAT == ConvFormat::NHWC) { |
| 77 | - fmStartAddr += convOps->singleCoreHiStartPos * convTilingData->convRunInfo.win * convTilingData->convRunInfo.cin; | 77 | + fmStartAddr += convOps->singleCoreHiStartPos * convTilingData->win * convTilingData->cin; |
| 78 | } else { | 78 | } else { |
| 79 | - fmStartAddr += convOps->singleCoreHiStartPos * convTilingData->convRunInfo.win; | 79 | + fmStartAddr += convOps->singleCoreHiStartPos * convTilingData->win; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | // Conv2D Split W | 82 | // Conv2D Split W |
| 83 | convOps->singleCoreHiStartPos = hiStartPosTmp; | 83 | convOps->singleCoreHiStartPos = hiStartPosTmp; |
| 84 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW || CONV::A_FORMAT == ConvFormat::NHWC) { | 84 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW || CONV::A_FORMAT == ConvFormat::NHWC) { |
| 85 | - int64_t wiStartPosTmp = static_cast<int64_t>(convOps->woIdxStart * convTilingData->convRunInfo.strideW) - | 85 | + int64_t wiStartPosTmp = static_cast<int64_t>(convOps->woIdxStart * convTilingData->strideW) - |
| 86 | - static_cast<int64_t>(convTilingData->convRunInfo.padLeft); | 86 | + static_cast<int64_t>(convTilingData->padLeft); |
| 87 | convOps->singleCoreWiStartPos = wiStartPosTmp < 0 ? 0 : wiStartPosTmp; | 87 | convOps->singleCoreWiStartPos = wiStartPosTmp < 0 ? 0 : wiStartPosTmp; |
| 88 | if constexpr (CONV::A_FORMAT == ConvFormat::NHWC) { | 88 | if constexpr (CONV::A_FORMAT == ConvFormat::NHWC) { |
| 89 | - fmStartAddr += convOps->singleCoreWiStartPos * convTilingData->convRunInfo.cin; | 89 | + fmStartAddr += convOps->singleCoreWiStartPos * convTilingData->cin; |
| 90 | } else { | 90 | } else { |
| 91 | fmStartAddr += convOps->singleCoreWiStartPos; | 91 | fmStartAddr += convOps->singleCoreWiStartPos; |
| 92 | } | 92 | } |
| @@ -110,16 +110,16 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 110 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + | 110 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + |
| 111 | convOps->groupIdxStart * convOps->coPerGroup + convOps->nIdxStart; | 111 | convOps->groupIdxStart * convOps->coPerGroup + convOps->nIdxStart; |
| 112 | if constexpr (CONV::isMMode) { | 112 | if constexpr (CONV::isMMode) { |
| 113 | - outputStartAddr += convOps->mIdxStart * convTilingData->convRunInfo.cout; | 113 | + outputStartAddr += convOps->mIdxStart * convTilingData->cout; |
| 114 | } else { | 114 | } else { |
| 115 | - outputStartAddr += convOps->hoIdxStart * convTilingData->convRunInfo.wout * convTilingData->convRunInfo.cout; | 115 | + outputStartAddr += convOps->hoIdxStart * convTilingData->wout * convTilingData->cout; |
| 116 | if constexpr (CONV::A_FORMAT == ConvFormat::NHWC) { | 116 | if constexpr (CONV::A_FORMAT == ConvFormat::NHWC) { |
| 117 | - outputStartAddr += convOps->woIdxStart * convTilingData->convRunInfo.cout; | 117 | + outputStartAddr += convOps->woIdxStart * convTilingData->cout; |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| 120 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { | 120 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { |
| 121 | - fmStartAddr += diIdxStart * hwIn * convTilingData->convRunInfo.cin; | 121 | + fmStartAddr += diIdxStart * hwIn * convTilingData->cin; |
| 122 | - outputStartAddr += doIdxStart * hwOut * convTilingData->convRunInfo.cout; | 122 | + outputStartAddr += doIdxStart * hwOut * convTilingData->cout; |
| 123 | } | 123 | } |
| 124 | } | 124 | } |
| 125 | 125 | ||
| @@ -141,7 +141,7 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 141 | if constexpr (CONV::isMMode) { | 141 | if constexpr (CONV::isMMode) { |
| 142 | outputStartAddr += convOps->mIdxStart; | 142 | outputStartAddr += convOps->mIdxStart; |
| 143 | } else { | 143 | } else { |
| 144 | - outputStartAddr += convOps->hoIdxStart * convTilingData->convRunInfo.wout; | 144 | + outputStartAddr += convOps->hoIdxStart * convTilingData->wout; |
| 145 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW) { | 145 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW) { |
| 146 | outputStartAddr += convOps->woIdxStart; | 146 | outputStartAddr += convOps->woIdxStart; |
| 147 | } | 147 | } |
| @@ -158,12 +158,12 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 158 | CalcStartAddrOriGroup(const uint64_t din, const uint64_t dout, const uint32_t kd, const uint64_t doIdxStart, | 158 | CalcStartAddrOriGroup(const uint64_t din, const uint64_t dout, const uint32_t kd, const uint64_t doIdxStart, |
| 159 | const int64_t diIdxStart) | 159 | const int64_t diIdxStart) |
| 160 | { | 160 | { |
| 161 | - hwIn = convTilingData->convRunInfo.hin * convTilingData->convRunInfo.win; | 161 | + hwIn = convTilingData->hin * convTilingData->win; |
| 162 | - hwOut = convTilingData->convRunInfo.hout * convTilingData->convRunInfo.wout; | 162 | + hwOut = convTilingData->hout * convTilingData->wout; |
| 163 | dhwOut = dout * hwOut; | 163 | dhwOut = dout * hwOut; |
| 164 | dhwIn = din * hwIn; | 164 | dhwIn = din * hwIn; |
| 165 | - convOps->fmapOneBatchSize = dhwIn * convTilingData->convRunInfo.cin; | 165 | + convOps->fmapOneBatchSize = dhwIn * convTilingData->cin; |
| 166 | - convOps->outputOneBatchSize = dhwOut * convTilingData->convRunInfo.cout; | 166 | + convOps->outputOneBatchSize = dhwOut * convTilingData->cout; |
| 167 | 167 | ||
| 168 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC || CONV::A_FORMAT == ConvFormat::NHWC) { | 168 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC || CONV::A_FORMAT == ConvFormat::NHWC) { |
| 169 | fmapOneGroupSize = convOps->ciPerGroup; | 169 | fmapOneGroupSize = convOps->ciPerGroup; |
| @@ -172,13 +172,13 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 172 | CalcStartAddrOriGroupHWC(doIdxStart, diIdxStart); | 172 | CalcStartAddrOriGroupHWC(doIdxStart, diIdxStart); |
| 173 | } else { | 173 | } else { |
| 174 | fmapOneGroupSize = convOps->ciPerGroup * dhwIn; | 174 | fmapOneGroupSize = convOps->ciPerGroup * dhwIn; |
| 175 | - weightOneCoSize = convOps->ciPerGroup * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 175 | + weightOneCoSize = convOps->ciPerGroup * kd * convTilingData->kh * convTilingData->kw; |
| 176 | weightOneGroupSize = convOps->coPerGroup * weightOneCoSize; | 176 | weightOneGroupSize = convOps->coPerGroup * weightOneCoSize; |
| 177 | outputOneGroupSize = convOps->coPerGroup * dhwOut; | 177 | outputOneGroupSize = convOps->coPerGroup * dhwOut; |
| 178 | CalcStartAddrOriGroupCHW(doIdxStart, diIdxStart); | 178 | CalcStartAddrOriGroupCHW(doIdxStart, diIdxStart); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | - if (convTilingData->convRunInfo.hasBias) { | 181 | + if (convTilingData->hasBias) { |
| 182 | biasStartAddr = convOps->groupIdxStart * convOps->coPerGroup + convOps->nIdxStart; | 182 | biasStartAddr = convOps->groupIdxStart * convOps->coPerGroup + convOps->nIdxStart; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| @@ -197,30 +197,30 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 197 | if (hasScale) { | 197 | if (hasScale) { |
| 198 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW || CONV::A_FORMAT == ConvFormat::NHWC) { | 198 | if constexpr (CONV::A_FORMAT == ConvFormat::NCHW || CONV::A_FORMAT == ConvFormat::NHWC) { |
| 199 | Extendconv2dFixpipeParams fixpipeParamsCopy(convOps->fixpipeParams); | 199 | Extendconv2dFixpipeParams fixpipeParamsCopy(convOps->fixpipeParams); |
| 200 | - if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 200 | + if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 201 | fixpipeParamsCopy.scale0 = convOps->fixpipeParams.scale0[groupIter * coPerGroup]; | 201 | fixpipeParamsCopy.scale0 = convOps->fixpipeParams.scale0[groupIter * coPerGroup]; |
| 202 | } | 202 | } |
| 203 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 203 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 204 | - if (convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 204 | + if (convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 205 | fixpipeParamsCopy.reluWeight0 = convOps->fixpipeParams.reluWeight0[groupIter * coPerGroup]; | 205 | fixpipeParamsCopy.reluWeight0 = convOps->fixpipeParams.reluWeight0[groupIter * coPerGroup]; |
| 206 | } | 206 | } |
| 207 | - if (convTilingData->convApiTiling.dualOutput) { | 207 | + if (convTilingData->dualOutput) { |
| 208 | - if (convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 208 | + if (convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 209 | fixpipeParamsCopy.scale1 = convOps->fixpipeParams.scale1[groupIter * coPerGroup]; | 209 | fixpipeParamsCopy.scale1 = convOps->fixpipeParams.scale1[groupIter * coPerGroup]; |
| 210 | } | 210 | } |
| 211 | - if (convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 211 | + if (convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 212 | fixpipeParamsCopy.reluWeight1 = convOps->fixpipeParams.reluWeight1[groupIter * coPerGroup]; | 212 | fixpipeParamsCopy.reluWeight1 = convOps->fixpipeParams.reluWeight1[groupIter * coPerGroup]; |
| 213 | } | 213 | } |
| 214 | - if (convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || | 214 | + if (convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || |
| 215 | - convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || | 215 | + convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || |
| 216 | - convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || | 216 | + convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || |
| 217 | - convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 217 | + convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 218 | convOps->conv.SetFixpipeParams(fixpipeParamsCopy); | 218 | convOps->conv.SetFixpipeParams(fixpipeParamsCopy); |
| 219 | } | 219 | } |
| 220 | - } else if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 220 | + } else if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 221 | convOps->conv.SetFixpipeParams(fixpipeParamsCopy); | 221 | convOps->conv.SetFixpipeParams(fixpipeParamsCopy); |
| 222 | } | 222 | } |
| 223 | - } else if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 223 | + } else if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 224 | convOps->conv.SetFixpipeParams(fixpipeParamsCopy); | 224 | convOps->conv.SetFixpipeParams(fixpipeParamsCopy); |
| 225 | } | 225 | } |
| 226 | } else { | 226 | } else { |
| @@ -237,14 +237,14 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 237 | for (uint64_t groupIter = 0; groupIter < convOps->singleGroups; ++groupIter) { | 237 | for (uint64_t groupIter = 0; groupIter < convOps->singleGroups; ++groupIter) { |
| 238 | convOps->conv.SetWeight(convOps->filterGm[groupIter * weightOneGroupSize]); | 238 | convOps->conv.SetWeight(convOps->filterGm[groupIter * weightOneGroupSize]); |
| 239 | convOps->conv.SetFmap(convOps->fmapGm[groupIter * fmapOneGroupSize]); | 239 | convOps->conv.SetFmap(convOps->fmapGm[groupIter * fmapOneGroupSize]); |
| 240 | - if (convTilingData->convRunInfo.hasBias) { | 240 | + if (convTilingData->hasBias) { |
| 241 | convOps->conv.SetBias(convOps->biasGm[groupIter * convOps->coPerGroup]); | 241 | convOps->conv.SetBias(convOps->biasGm[groupIter * convOps->coPerGroup]); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | DealFixpiepParams(groupIter, convOps->coPerGroup); | 244 | DealFixpiepParams(groupIter, convOps->coPerGroup); |
| 245 | 245 | ||
| 246 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 246 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 247 | - if (this->convTilingData->convApiTiling.dualOutput) { | 247 | + if (this->convTilingData->dualOutput) { |
| 248 | convOps->conv.IterateAll(convOps->outputGm[groupIter * outputOneGroupSize], | 248 | convOps->conv.IterateAll(convOps->outputGm[groupIter * outputOneGroupSize], |
| 249 | convOps->output1Gm[groupIter * outputOneGroupSize]); | 249 | convOps->output1Gm[groupIter * outputOneGroupSize]); |
| 250 | } else { | 250 | } else { |
| @@ -264,7 +264,7 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 264 | convOps->singleCoreN = convOps->singleCoOpt; | 264 | convOps->singleCoreN = convOps->singleCoOpt; |
| 265 | 265 | ||
| 266 | // update singleGroups : real groups nums in singlecore | 266 | // update singleGroups : real groups nums in singlecore |
| 267 | - enlargeTail = convTilingData->convRunInfo.groups % convTilingData->convRunInfo.enlarge; | 267 | + enlargeTail = convTilingData->groups % convTilingData->enlarge; |
| 268 | 268 | ||
| 269 | if (unlikely(convOps->isGroupDimTail && enlargeTail != 0)) { | 269 | if (unlikely(convOps->isGroupDimTail && enlargeTail != 0)) { |
| 270 | uint64_t realCout = enlargeTail * convOps->coPerGroup; | 270 | uint64_t realCout = enlargeTail * convOps->coPerGroup; |
| @@ -278,7 +278,7 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | if (unlikely(convOps->isGroupDimTail)) { | 280 | if (unlikely(convOps->isGroupDimTail)) { |
| 281 | - convOps->singleGroups = enlargeTail == 0 ? convTilingData->convRunInfo.enlarge : enlargeTail; | 281 | + convOps->singleGroups = enlargeTail == 0 ? convTilingData->enlarge : enlargeTail; |
| 282 | } | 282 | } |
| 283 | } | 283 | } |
| 284 | 284 | ||
| @@ -287,25 +287,25 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 287 | CalcOutputStartAddrOptGroup(const uint64_t doIdxStart) | 287 | CalcOutputStartAddrOptGroup(const uint64_t doIdxStart) |
| 288 | { | 288 | { |
| 289 | if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC || CONV::C_FORMAT == ConvFormat::NHWC) { | 289 | if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC || CONV::C_FORMAT == ConvFormat::NHWC) { |
| 290 | - outputOneGroupSize = convTilingData->convRunInfo.coutOpt; | 290 | + outputOneGroupSize = convTilingData->coutOpt; |
| 291 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + | 291 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + |
| 292 | - convOps->groupIdxStart * convTilingData->convRunInfo.coutOpt + | 292 | + convOps->groupIdxStart * convTilingData->coutOpt + |
| 293 | convOps->nIdxStart; | 293 | convOps->nIdxStart; |
| 294 | 294 | ||
| 295 | if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC) { | 295 | if constexpr (CONV::C_FORMAT == ConvFormat::NDHWC) { |
| 296 | - outputStartAddr += doIdxStart * hwOut * convTilingData->convRunInfo.cout; | 296 | + outputStartAddr += doIdxStart * hwOut * convTilingData->cout; |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | if constexpr (CONV::isMMode) { | 299 | if constexpr (CONV::isMMode) { |
| 300 | - outputStartAddr += convOps->mIdxStart * convTilingData->convRunInfo.cout; | 300 | + outputStartAddr += convOps->mIdxStart * convTilingData->cout; |
| 301 | } else { | 301 | } else { |
| 302 | - outputStartAddr += convOps->hoIdxStart * convTilingData->convRunInfo.wout * convTilingData->convRunInfo.cout; | 302 | + outputStartAddr += convOps->hoIdxStart * convTilingData->wout * convTilingData->cout; |
| 303 | if constexpr (CONV::C_FORMAT == ConvFormat::NHWC) { | 303 | if constexpr (CONV::C_FORMAT == ConvFormat::NHWC) { |
| 304 | - outputStartAddr += convOps->woIdxStart * convTilingData->convRunInfo.cout; | 304 | + outputStartAddr += convOps->woIdxStart * convTilingData->cout; |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NCDHW || CONV::C_FORMAT == ConvFormat::NCHW) { | 307 | } else if constexpr (CONV::C_FORMAT == ConvFormat::NCDHW || CONV::C_FORMAT == ConvFormat::NCHW) { |
| 308 | - outputOneGroupSize = convTilingData->convRunInfo.coutOpt * dhwOut; | 308 | + outputOneGroupSize = convTilingData->coutOpt * dhwOut; |
| 309 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + | 309 | outputStartAddr = convOps->batchIdxStart * convOps->outputOneBatchSize + |
| 310 | convOps->groupIdxStart * outputOneGroupSize + | 310 | convOps->groupIdxStart * outputOneGroupSize + |
| 311 | convOps->nIdxStart * dhwOut; | 311 | convOps->nIdxStart * dhwOut; |
| @@ -317,7 +317,7 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 317 | if constexpr (CONV::isMMode) { | 317 | if constexpr (CONV::isMMode) { |
| 318 | outputStartAddr += convOps->mIdxStart; | 318 | outputStartAddr += convOps->mIdxStart; |
| 319 | } else { | 319 | } else { |
| 320 | - outputStartAddr += convOps->hoIdxStart * convTilingData->convRunInfo.wout; | 320 | + outputStartAddr += convOps->hoIdxStart * convTilingData->wout; |
| 321 | if constexpr (CONV::C_FORMAT == ConvFormat::NCHW) { | 321 | if constexpr (CONV::C_FORMAT == ConvFormat::NCHW) { |
| 322 | outputStartAddr += convOps->woIdxStart; | 322 | outputStartAddr += convOps->woIdxStart; |
| 323 | } | 323 | } |
| @@ -336,10 +336,10 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 336 | convOps->groupIdxStart * fmapOneGroupSize; | 336 | convOps->groupIdxStart * fmapOneGroupSize; |
| 337 | CalcStartAddrFmapHW(); | 337 | CalcStartAddrFmapHW(); |
| 338 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z) { | 338 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z) { |
| 339 | - weightOneGroupSize = convTilingData->convRunInfo.coutOpt * convTilingData->convRunInfo.cinOpt * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 339 | + weightOneGroupSize = convTilingData->coutOpt * convTilingData->cinOpt * kd * convTilingData->kh * convTilingData->kw; |
| 340 | weightStartAddr = convOps->groupIdxStart * weightOneGroupSize + convOps->nIdxStart * convOps->k0; | 340 | weightStartAddr = convOps->groupIdxStart * weightOneGroupSize + convOps->nIdxStart * convOps->k0; |
| 341 | } else { | 341 | } else { |
| 342 | - weightOneGroupSize = convTilingData->convRunInfo.coutOpt * convOps->ciPerGroup * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 342 | + weightOneGroupSize = convTilingData->coutOpt * convOps->ciPerGroup * kd * convTilingData->kh * convTilingData->kw; |
| 343 | weightStartAddr = convOps->groupIdxStart * weightOneGroupSize; | 343 | weightStartAddr = convOps->groupIdxStart * weightOneGroupSize; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| @@ -358,18 +358,18 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 358 | // weight: Kd -> KhKw -> Ci_opt -> Group(enlarge) -> Co_opt | 358 | // weight: Kd -> KhKw -> Ci_opt -> Group(enlarge) -> Co_opt |
| 359 | // output: Batch -> Do -> HoWo -> Group(enlarge) -> Co_opt | 359 | // output: Batch -> Do -> HoWo -> Group(enlarge) -> Co_opt |
| 360 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + | 360 | fmStartAddr = convOps->batchIdxStart * convOps->fmapOneBatchSize + |
| 361 | - convOps->groupIdxStart * convTilingData->convRunInfo.cinOpt; | 361 | + convOps->groupIdxStart * convTilingData->cinOpt; |
| 362 | CalcStartAddrFmapHW(); | 362 | CalcStartAddrFmapHW(); |
| 363 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z) { | 363 | if constexpr (CONV::B_FORMAT == ConvFormat::FRACTAL_Z) { |
| 364 | - weightOneGroupSize = convTilingData->convRunInfo.coutOpt * convTilingData->convRunInfo.cinOpt * kd * convTilingData->convRunInfo.kh * convTilingData->convRunInfo.kw; | 364 | + weightOneGroupSize = convTilingData->coutOpt * convTilingData->cinOpt * kd * convTilingData->kh * convTilingData->kw; |
| 365 | weightStartAddr = convOps->groupIdxStart * weightOneGroupSize + convOps->nIdxStart * convOps->k0; | 365 | weightStartAddr = convOps->groupIdxStart * weightOneGroupSize + convOps->nIdxStart * convOps->k0; |
| 366 | } else { | 366 | } else { |
| 367 | - weightOneGroupSize = convTilingData->convRunInfo.coutOpt; | 367 | + weightOneGroupSize = convTilingData->coutOpt; |
| 368 | - weightStartAddr = convOps->groupIdxStart * convTilingData->convRunInfo.coutOpt; | 368 | + weightStartAddr = convOps->groupIdxStart * convTilingData->coutOpt; |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { | 371 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC) { |
| 372 | - fmStartAddr += diIdxStart * hwIn * convTilingData->convRunInfo.cin; | 372 | + fmStartAddr += diIdxStart * hwIn * convTilingData->cin; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | CalcOutputStartAddrOptGroup(doIdxStart); | 375 | CalcOutputStartAddrOptGroup(doIdxStart); |
| @@ -380,38 +380,38 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 380 | CalcStartAddrOptGroup(const uint64_t din, const uint64_t dout, const uint32_t kd, const uint64_t doIdxStart, | 380 | CalcStartAddrOptGroup(const uint64_t din, const uint64_t dout, const uint32_t kd, const uint64_t doIdxStart, |
| 381 | const int64_t diIdxStart) | 381 | const int64_t diIdxStart) |
| 382 | { | 382 | { |
| 383 | - hwIn = convTilingData->convRunInfo.hin * convTilingData->convRunInfo.win; | 383 | + hwIn = convTilingData->hin * convTilingData->win; |
| 384 | - hwOut = convTilingData->convRunInfo.hout * convTilingData->convRunInfo.wout; | 384 | + hwOut = convTilingData->hout * convTilingData->wout; |
| 385 | dhwOut = dout * hwOut; | 385 | dhwOut = dout * hwOut; |
| 386 | dhwIn = din * hwIn; | 386 | dhwIn = din * hwIn; |
| 387 | - convOps->fmapOneBatchSize = convTilingData->convRunInfo.cin * dhwIn; | 387 | + convOps->fmapOneBatchSize = convTilingData->cin * dhwIn; |
| 388 | - convOps->outputOneBatchSize = convTilingData->convRunInfo.cout * dhwOut; | 388 | + convOps->outputOneBatchSize = convTilingData->cout * dhwOut; |
| 389 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC || CONV::A_FORMAT == ConvFormat::NHWC) { | 389 | if constexpr (CONV::A_FORMAT == ConvFormat::NDHWC || CONV::A_FORMAT == ConvFormat::NHWC) { |
| 390 | - fmapOneGroupSize = convTilingData->convRunInfo.cinOpt; | 390 | + fmapOneGroupSize = convTilingData->cinOpt; |
| 391 | CalcStartAddrOptGroupHWC(doIdxStart, diIdxStart, kd); | 391 | CalcStartAddrOptGroupHWC(doIdxStart, diIdxStart, kd); |
| 392 | } else { | 392 | } else { |
| 393 | - fmapOneGroupSize = convTilingData->convRunInfo.cinOpt * dhwIn; | 393 | + fmapOneGroupSize = convTilingData->cinOpt * dhwIn; |
| 394 | CalcStartAddrOptGroupCHW(doIdxStart, diIdxStart, kd); | 394 | CalcStartAddrOptGroupCHW(doIdxStart, diIdxStart, kd); |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | - if (convTilingData->convRunInfo.hasBias) { | 397 | + if (convTilingData->hasBias) { |
| 398 | - biasStartAddr = convOps->groupIdxStart * convTilingData->convRunInfo.coutOpt + convOps->nIdxStart; | 398 | + biasStartAddr = convOps->groupIdxStart * convTilingData->coutOpt + convOps->nIdxStart; |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | if constexpr (CONV::isQuant) { | 401 | if constexpr (CONV::isQuant) { |
| 402 | if (hasScale) { | 402 | if (hasScale) { |
| 403 | - scaleStartAddr = convOps->groupIdxStart * convTilingData->convRunInfo.coutOpt + convOps->nIdxStart; | 403 | + scaleStartAddr = convOps->groupIdxStart * convTilingData->coutOpt + convOps->nIdxStart; |
| 404 | } | 404 | } |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 407 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 408 | - if (convOps->convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || | 408 | + if (convOps->convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT) || |
| 409 | - convOps->convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 409 | + convOps->convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 410 | - scaleStartAddr = convOps->groupIdxStart * convTilingData->convRunInfo.coutOpt + convOps->nIdxStart; | 410 | + scaleStartAddr = convOps->groupIdxStart * convTilingData->coutOpt + convOps->nIdxStart; |
| 411 | } | 411 | } |
| 412 | - if (convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || | 412 | + if (convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU) || |
| 413 | - convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 413 | + convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 414 | - reluWeightStartAddr = convOps->groupIdxStart * convTilingData->convRunInfo.coutOpt + convOps->nIdxStart; | 414 | + reluWeightStartAddr = convOps->groupIdxStart * convTilingData->coutOpt + convOps->nIdxStart; |
| 415 | } | 415 | } |
| 416 | } | 416 | } |
| 417 | } | 417 | } |
| @@ -439,14 +439,14 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 439 | convOps->conv.SetFmap(convOps->fmapGm[groupOptIter * fmapOneGroupSize]); | 439 | convOps->conv.SetFmap(convOps->fmapGm[groupOptIter * fmapOneGroupSize]); |
| 440 | convOps->conv.SetWeight(convOps->filterGm[groupOptIter * weightOneGroupSize]); | 440 | convOps->conv.SetWeight(convOps->filterGm[groupOptIter * weightOneGroupSize]); |
| 441 | 441 | ||
| 442 | - if (convTilingData->convRunInfo.hasBias) { | 442 | + if (convTilingData->hasBias) { |
| 443 | - convOps->conv.SetBias(convOps->biasGm[groupOptIter * convTilingData->convRunInfo.coutOpt]); | 443 | + convOps->conv.SetBias(convOps->biasGm[groupOptIter * convTilingData->coutOpt]); |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | - DealFixpiepParams(groupOptIter, convTilingData->convRunInfo.coutOpt); | 446 | + DealFixpiepParams(groupOptIter, convTilingData->coutOpt); |
| 447 | 447 | ||
| 448 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 448 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 449 | - if (this->convTilingData->convApiTiling.dualOutput) { | 449 | + if (this->convTilingData->dualOutput) { |
| 450 | convOps->conv.IterateAll(convOps->outputGm[groupOptIter * outputOneGroupSize], | 450 | convOps->conv.IterateAll(convOps->outputGm[groupOptIter * outputOneGroupSize], |
| 451 | convOps->output1Gm[groupOptIter * outputOneGroupSize]); | 451 | convOps->output1Gm[groupOptIter * outputOneGroupSize]); |
| 452 | } else { | 452 | } else { |
| @@ -471,7 +471,7 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 471 | } | 471 | } |
| 472 | convOps->conv.SetOptGroupParams(enlargeTail, convOps->singleGroupOpt, convOps->singleCoOpt); | 472 | convOps->conv.SetOptGroupParams(enlargeTail, convOps->singleGroupOpt, convOps->singleCoOpt); |
| 473 | } else { | 473 | } else { |
| 474 | - convOps->conv.SetOptGroupParams(convTilingData->convRunInfo.enlarge, convOps->singleGroupOpt, convOps->singleCoOpt); | 474 | + convOps->conv.SetOptGroupParams(convTilingData->enlarge, convOps->singleGroupOpt, convOps->singleCoOpt); |
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | convOps->conv.SetIterIndex(groupOptIter); | 477 | convOps->conv.SetIterIndex(groupOptIter); |
| @@ -479,12 +479,12 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 479 | convOps->conv.SetFmap(convOps->fmapGm); | 479 | convOps->conv.SetFmap(convOps->fmapGm); |
| 480 | convOps->conv.SetWeight(convOps->filterGm); | 480 | convOps->conv.SetWeight(convOps->filterGm); |
| 481 | 481 | ||
| 482 | - if (convTilingData->convRunInfo.hasBias) { | 482 | + if (convTilingData->hasBias) { |
| 483 | convOps->conv.SetBias(convOps->biasGm); | 483 | convOps->conv.SetBias(convOps->biasGm); |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | // quant need, current not care | 486 | // quant need, current not care |
| 487 | - DealFixpiepParams(groupOptIter, convTilingData->convRunInfo.coutOpt); | 487 | + DealFixpiepParams(groupOptIter, convTilingData->coutOpt); |
| 488 | 488 | ||
| 489 | if constexpr (CONV::IS_EXTEND_CONV2D) { | 489 | if constexpr (CONV::IS_EXTEND_CONV2D) { |
| 490 | if (convOps->dualOutput) { | 490 | if (convOps->dualOutput) { |
| @@ -509,7 +509,7 @@ __aicore__ __forceinline__ void ConvGroupCommon<CONV, CONV_TILING>:: | |||
| 509 | convOps->singleCoreBatch); | 509 | convOps->singleCoreBatch); |
| 510 | } else { | 510 | } else { |
| 511 | convOps->conv.SetSingleOutputShape(convOps->singleCoOpt, convOps->singleCoreDout, convOps->singleCoreHo, | 511 | convOps->conv.SetSingleOutputShape(convOps->singleCoOpt, convOps->singleCoreDout, convOps->singleCoreHo, |
| 512 | - convTilingData->convRunInfo.wout, convOps->singleCoreBatch); | 512 | + convTilingData->wout, convOps->singleCoreBatch); |
| 513 | } | 513 | } |
| 514 | } else { | 514 | } else { |
| 515 | if constexpr (CONV::isMMode) { | 515 | if constexpr (CONV::isMMode) { |
| @@ -32,31 +32,31 @@ public: | |||
| 32 | self_ = self; | 32 | self_ = self; |
| 33 | if constexpr (Intf::isConv3D) { | 33 | if constexpr (Intf::isConv3D) { |
| 34 | if constexpr (Intf::kPreLoadFlag) { | 34 | if constexpr (Intf::kPreLoadFlag) { |
| 35 | - channelSize_ = self_->ctx.kAL1Iter - 1 != self_->ctx.maxKAL1Iter ? self_->ctx.convTilingData->convApiTiling.cinAInCore : | 35 | + channelSize_ = self_->ctx.kAL1Iter - 1 != self_->ctx.maxKAL1Iter ? self_->ctx.convTilingData->cinAInCore : |
| 36 | - self_->ctx.convTilingData->convApiTiling.cinATailInCore; | 36 | + self_->ctx.convTilingData->cinATailInCore; |
| 37 | } else { | 37 | } else { |
| 38 | - channelSize_ = self_->ctx.kAL1Iter != self_->ctx.maxKAL1Iter ? self_->ctx.convTilingData->convApiTiling.cinAInCore : | 38 | + channelSize_ = self_->ctx.kAL1Iter != self_->ctx.maxKAL1Iter ? self_->ctx.convTilingData->cinAInCore : |
| 39 | - self_->ctx.convTilingData->convApiTiling.cinATailInCore; | 39 | + self_->ctx.convTilingData->cinATailInCore; |
| 40 | } | 40 | } |
| 41 | } else { | 41 | } else { |
| 42 | if constexpr (Intf::c04Flag) { | 42 | if constexpr (Intf::c04Flag) { |
| 43 | channelSize_ = conv::C04_CIN_SIZE; | 43 | channelSize_ = conv::C04_CIN_SIZE; |
| 44 | - c04KStepTail = (channelSize_ * self_->ctx.convTilingData->convApiTiling.kernelHxkernelW) % self_->ctx.convTilingData->convApiTiling.kL0; | 44 | + c04KStepTail = (channelSize_ * self_->ctx.convTilingData->kernelHxkernelW) % self_->ctx.convTilingData->kL0; |
| 45 | - c04KStepTail = c04KStepTail == 0 ? self_->ctx.convTilingData->convApiTiling.kL0 : c04KStepTail; | 45 | + c04KStepTail = c04KStepTail == 0 ? self_->ctx.convTilingData->kL0 : c04KStepTail; |
| 46 | } else { | 46 | } else { |
| 47 | if constexpr (Intf::kPreLoadFlag) { | 47 | if constexpr (Intf::kPreLoadFlag) { |
| 48 | if constexpr (Intf::isKL1NL0FullLoad) { | 48 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 49 | - channelSize_ = AlignB(self_->ctx.convTilingData->convApiTiling.cinATailInCore, Intf::k0); | 49 | + channelSize_ = AlignB(self_->ctx.convTilingData->cinATailInCore, Intf::k0); |
| 50 | } else { | 50 | } else { |
| 51 | channelSize_ = self_->ctx.kAL1Iter - 1 != self_->ctx.maxKAL1Iter ? | 51 | channelSize_ = self_->ctx.kAL1Iter - 1 != self_->ctx.maxKAL1Iter ? |
| 52 | - self_->ctx.convTilingData->convApiTiling.cinAInCore : AlignB(self_->ctx.convTilingData->convApiTiling.cinATailInCore, Intf::k0); | 52 | + self_->ctx.convTilingData->cinAInCore : AlignB(self_->ctx.convTilingData->cinATailInCore, Intf::k0); |
| 53 | } | 53 | } |
| 54 | } else { | 54 | } else { |
| 55 | if constexpr (Intf::isKL1NL0FullLoad) { | 55 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 56 | - channelSize_ = AlignB(self_->ctx.convTilingData->convApiTiling.cinATailInCore, Intf::k0); | 56 | + channelSize_ = AlignB(self_->ctx.convTilingData->cinATailInCore, Intf::k0); |
| 57 | } else { | 57 | } else { |
| 58 | channelSize_ = self_->ctx.kAL1Iter != self_->ctx.maxKAL1Iter ? | 58 | channelSize_ = self_->ctx.kAL1Iter != self_->ctx.maxKAL1Iter ? |
| 59 | - self_->ctx.convTilingData->convApiTiling.cinAInCore : AlignB(self_->ctx.convTilingData->convApiTiling.cinATailInCore, Intf::k0); | 59 | + self_->ctx.convTilingData->cinAInCore : AlignB(self_->ctx.convTilingData->cinATailInCore, Intf::k0); |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| @@ -68,8 +68,8 @@ public: | |||
| 68 | currentML0_ = m; | 68 | currentML0_ = m; |
| 69 | if constexpr (!Intf::isDmaFlag) { | 69 | if constexpr (!Intf::isDmaFlag) { |
| 70 | currentML0Align_ = mNotAlign; | 70 | currentML0Align_ = mNotAlign; |
| 71 | - mStartPt_ = self_->ctx.hoL0Iter * self_->ctx.currentWoL1 * self_->ctx.convTilingData->convApiTiling.hoL0 + | 71 | + mStartPt_ = self_->ctx.hoL0Iter * self_->ctx.currentWoL1 * self_->ctx.convTilingData->hoL0 + |
| 72 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0; | 72 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0; |
| 73 | SetLoad3dRepeatParams(); | 73 | SetLoad3dRepeatParams(); |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| @@ -82,14 +82,14 @@ public: | |||
| 82 | uint8_t repeatMode = 0; | 82 | uint8_t repeatMode = 0; |
| 83 | mExtension_ = currentML0Align_; | 83 | mExtension_ = currentML0Align_; |
| 84 | 84 | ||
| 85 | - if (self_->ctx.currentWoL0 == self_->ctx.convTilingData->convApiTiling.woL0 && | 85 | + if (self_->ctx.currentWoL0 == self_->ctx.convTilingData->woL0 && |
| 86 | - self_->ctx.currentHoL0 == self_->ctx.convTilingData->convApiTiling.hoL0) { | 86 | + self_->ctx.currentHoL0 == self_->ctx.convTilingData->hoL0) { |
| 87 | - dstStride = self_->ctx.convTilingData->convApiTiling.fmapKStride; | 87 | + dstStride = self_->ctx.convTilingData->fmapKStride; |
| 88 | } else { | 88 | } else { |
| 89 | dstStride = currentML0_ / BLOCK_L0_M; | 89 | dstStride = currentML0_ / BLOCK_L0_M; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | - if (unlikely(CeilDiv(self_->ctx.currentWoL1, self_->ctx.convTilingData->convApiTiling.woL0) > 1)) { | 92 | + if (unlikely(CeilDiv(self_->ctx.currentWoL1, self_->ctx.convTilingData->woL0) > 1)) { |
| 93 | mExtension_ = self_->ctx.currentWoL0; | 93 | mExtension_ = self_->ctx.currentWoL0; |
| 94 | repeatStride = self_->ctx.currentWoL1 / BLOCK_L0_M; | 94 | repeatStride = self_->ctx.currentWoL1 / BLOCK_L0_M; |
| 95 | repeatTime = self_->ctx.currentHoL0; | 95 | repeatTime = self_->ctx.currentHoL0; |
| @@ -108,7 +108,7 @@ public: | |||
| 108 | xm_.bf.mExtension_ = mExtension_ & MASK_16; | 108 | xm_.bf.mExtension_ = mExtension_ & MASK_16; |
| 109 | xm_.bf.mStartPt_ = mStartPt_ & MASK_16; | 109 | xm_.bf.mStartPt_ = mStartPt_ & MASK_16; |
| 110 | 110 | ||
| 111 | - xt_.n = static_cast<uint64_t>(self_->ctx.convTilingData->convApiTiling.unionDataXt); | 111 | + xt_.n = static_cast<uint64_t>(self_->ctx.convTilingData->unionDataXt); |
| 112 | xt_.bf.channelSize = channelSize_; | 112 | xt_.bf.channelSize = channelSize_; |
| 113 | param_.SetConfig1(xt_.n); | 113 | param_.SetConfig1(xt_.n); |
| 114 | } | 114 | } |
| @@ -144,17 +144,17 @@ private: | |||
| 144 | __aicore__ inline void DmaLoad2DImpl(const uint64_t &kIter, const LocalTensor<typename Intf::FmapT> &al0) | 144 | __aicore__ inline void DmaLoad2DImpl(const uint64_t &kIter, const LocalTensor<typename Intf::FmapT> &al0) |
| 145 | { | 145 | { |
| 146 | uint64_t currentWoL1Align = AlignB(self_->ctx.currentWoL1, BLOCK_L0_M); | 146 | uint64_t currentWoL1Align = AlignB(self_->ctx.currentWoL1, BLOCK_L0_M); |
| 147 | - uint64_t currentKL0 = IsKL0Tail(kIter) ? self_->ctx.kL0Tail : self_->ctx.convTilingData->convApiTiling.kL0; | 147 | + uint64_t currentKL0 = IsKL0Tail(kIter) ? self_->ctx.kL0Tail : self_->ctx.convTilingData->kL0; |
| 148 | 148 | ||
| 149 | LoadData2DParamsV2 loadParams; | 149 | LoadData2DParamsV2 loadParams; |
| 150 | - loadParams.kStartPosition = (kIter % self_->ctx.multiKAL1) * self_->ctx.convTilingData->convApiTiling.kL0 / Intf::k0; | 150 | + loadParams.kStartPosition = (kIter % self_->ctx.multiKAL1) * self_->ctx.convTilingData->kL0 / Intf::k0; |
| 151 | loadParams.mStep = CeilDiv(self_->ctx.currentWoL0, BLOCK_L0_M); | 151 | loadParams.mStep = CeilDiv(self_->ctx.currentWoL0, BLOCK_L0_M); |
| 152 | loadParams.kStep = currentKL0 / Intf::k0; | 152 | loadParams.kStep = currentKL0 / Intf::k0; |
| 153 | loadParams.srcStride = self_->ctx.currentHoL1 * currentWoL1Align / BLOCK_L0_M; | 153 | loadParams.srcStride = self_->ctx.currentHoL1 * currentWoL1Align / BLOCK_L0_M; |
| 154 | loadParams.dstStride = currentML0_ / BLOCK_L0_M; | 154 | loadParams.dstStride = currentML0_ / BLOCK_L0_M; |
| 155 | 155 | ||
| 156 | - uint32_t mStartPosition = self_->ctx.hoL0Iter * self_->ctx.convTilingData->convApiTiling.hoL0 * currentWoL1Align + | 156 | + uint32_t mStartPosition = self_->ctx.hoL0Iter * self_->ctx.convTilingData->hoL0 * currentWoL1Align + |
| 157 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0; | 157 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0; |
| 158 | uint32_t dstOffset = 0; | 158 | uint32_t dstOffset = 0; |
| 159 | uint32_t dstOffsetStride = AlignB(self_->ctx.currentWoL0, BLOCK_L0_M) * Intf::k0; | 159 | uint32_t dstOffsetStride = AlignB(self_->ctx.currentWoL0, BLOCK_L0_M) * Intf::k0; |
| 160 | for (uint16_t hoL0Idx = 0; hoL0Idx < self_->ctx.currentHoL0; ++ hoL0Idx) { | 160 | for (uint16_t hoL0Idx = 0; hoL0Idx < self_->ctx.currentHoL0; ++ hoL0Idx) { |
| @@ -185,7 +185,7 @@ public: | |||
| 185 | __aicore__ inline void SetParams(Intf *self) | 185 | __aicore__ inline void SetParams(Intf *self) |
| 186 | { | 186 | { |
| 187 | self_ = self; | 187 | self_ = self; |
| 188 | - valueHoWo_ = self_->ctx.convTilingData->convApiTiling.orgHo * self_->ctx.convTilingData->convApiTiling.orgWo; | 188 | + valueHoWo_ = self_->ctx.convTilingData->orgHo * self_->ctx.convTilingData->orgWo; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | __aicore__ inline void SetMN(uint64_t m, uint64_t n) | 191 | __aicore__ inline void SetMN(uint64_t m, uint64_t n) |
| @@ -202,7 +202,7 @@ public: | |||
| 202 | intriParams.params.dnNum = self_->ctx.currentHoL0; | 202 | intriParams.params.dnNum = self_->ctx.currentHoL0; |
| 203 | intriParams.params.dstDnMatrixStride = self_->ctx.singleCoreWo; | 203 | intriParams.params.dstDnMatrixStride = self_->ctx.singleCoreWo; |
| 204 | } else { | 204 | } else { |
| 205 | - if (likely(self_->ctx.convTilingData->convApiTiling.woL0 >= self_->ctx.singleCoreWo)) { | 205 | + if (likely(self_->ctx.convTilingData->woL0 >= self_->ctx.singleCoreWo)) { |
| 206 | intriParams.mSize = currentML0_; | 206 | intriParams.mSize = currentML0_; |
| 207 | intriParams.params.srcNzMatrixStride = 0; | 207 | intriParams.params.srcNzMatrixStride = 0; |
| 208 | intriParams.params.dnNum = 1; | 208 | intriParams.params.dnNum = 1; |
| @@ -218,7 +218,7 @@ public: | |||
| 218 | intriParams.nSize = currentNL0_; | 218 | intriParams.nSize = currentNL0_; |
| 219 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); | 219 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); |
| 220 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { | 220 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { |
| 221 | - intriParams.dstStride = self_->ctx.convTilingData->convApiTiling.orgDo * valueHoWo_; | 221 | + intriParams.dstStride = self_->ctx.convTilingData->orgDo * valueHoWo_; |
| 222 | } else { | 222 | } else { |
| 223 | intriParams.dstStride = valueHoWo_; | 223 | intriParams.dstStride = valueHoWo_; |
| 224 | } | 224 | } |
| @@ -232,8 +232,8 @@ public: | |||
| 232 | intriParams.mSize = self_->ctx.currentWoL0; | 232 | intriParams.mSize = self_->ctx.currentWoL0; |
| 233 | intriParams.params.srcNdStride = AlignB(self_->ctx.currentWoL0, BLOCK_L0_M); | 233 | intriParams.params.srcNdStride = AlignB(self_->ctx.currentWoL0, BLOCK_L0_M); |
| 234 | intriParams.params.ndNum = self_->ctx.currentHoL0; | 234 | intriParams.params.ndNum = self_->ctx.currentHoL0; |
| 235 | - intriParams.params.dstNdStride = self_->ctx.singleCoreWo * self_->ctx.convTilingData->convApiTiling.orgCo; | 235 | + intriParams.params.dstNdStride = self_->ctx.singleCoreWo * self_->ctx.convTilingData->orgCo; |
| 236 | - } else if (likely(self_->ctx.convTilingData->convApiTiling.woL0 >= self_->ctx.singleCoreWo)) { | 236 | + } else if (likely(self_->ctx.convTilingData->woL0 >= self_->ctx.singleCoreWo)) { |
| 237 | intriParams.mSize = currentML0_; | 237 | intriParams.mSize = currentML0_; |
| 238 | intriParams.params.srcNdStride = 0; | 238 | intriParams.params.srcNdStride = 0; |
| 239 | intriParams.params.ndNum = 1; | 239 | intriParams.params.ndNum = 1; |
| @@ -242,10 +242,10 @@ public: | |||
| 242 | intriParams.mSize = self_->ctx.currentWoL0; | 242 | intriParams.mSize = self_->ctx.currentWoL0; |
| 243 | intriParams.params.srcNdStride = self_->ctx.currentWoL0; | 243 | intriParams.params.srcNdStride = self_->ctx.currentWoL0; |
| 244 | intriParams.params.ndNum = self_->ctx.currentHoL0; | 244 | intriParams.params.ndNum = self_->ctx.currentHoL0; |
| 245 | - intriParams.params.dstNdStride = self_->ctx.singleCoreWo * self_->ctx.convTilingData->convApiTiling.orgCo; | 245 | + intriParams.params.dstNdStride = self_->ctx.singleCoreWo * self_->ctx.convTilingData->orgCo; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | - intriParams.dstStride = self_->ctx.convTilingData->convApiTiling.orgCo; | 248 | + intriParams.dstStride = self_->ctx.convTilingData->orgCo; |
| 249 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); | 249 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); |
| 250 | intriParams.nSize = currentNL0_; | 250 | intriParams.nSize = currentNL0_; |
| 251 | SetBaseParams<CO2Layout::ROW_MAJOR>(intriParams); | 251 | SetBaseParams<CO2Layout::ROW_MAJOR>(intriParams); |
| @@ -267,21 +267,21 @@ public: | |||
| 267 | if constexpr (Intf::isKL1NL0FullLoad) { | 267 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 268 | ubInfo->outCIdx = ubInfo->nLoopIdx * ubInfo->nUb; | 268 | ubInfo->outCIdx = ubInfo->nLoopIdx * ubInfo->nUb; |
| 269 | } else { | 269 | } else { |
| 270 | - ubInfo->outCIdx = self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 270 | + ubInfo->outCIdx = self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 271 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0 + ubInfo->nLoopIdx * ubInfo->nUb; | 271 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0 + ubInfo->nLoopIdx * ubInfo->nUb; |
| 272 | } | 272 | } |
| 273 | - ubInfo->outHIdx = self_->ctx.hoAL1Iter * self_->ctx.convTilingData->convApiTiling.hoL1 + | 273 | + ubInfo->outHIdx = self_->ctx.hoAL1Iter * self_->ctx.convTilingData->hoL1 + |
| 274 | - self_->ctx.hoL0Iter * self_->ctx.convTilingData->convApiTiling.hoL0 + ubInfo->mLoopIdx * ubInfo->mUb / self_->ctx.convTilingData->convApiTiling.woL0; | 274 | + self_->ctx.hoL0Iter * self_->ctx.convTilingData->hoL0 + ubInfo->mLoopIdx * ubInfo->mUb / self_->ctx.convTilingData->woL0; |
| 275 | if (self_->ctx.woL1SmallTail == 0) { | 275 | if (self_->ctx.woL1SmallTail == 0) { |
| 276 | - ubInfo->outWIdx = self_->ctx.woAL1Iter * self_->ctx.convTilingData->convApiTiling.woL1 + | 276 | + ubInfo->outWIdx = self_->ctx.woAL1Iter * self_->ctx.convTilingData->woL1 + |
| 277 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0 + ubInfo->mLoopIdx * ubInfo->mUb % self_->ctx.convTilingData->convApiTiling.woL0; | 277 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0 + ubInfo->mLoopIdx * ubInfo->mUb % self_->ctx.convTilingData->woL0; |
| 278 | } else { | 278 | } else { |
| 279 | if (self_->ctx.woAL1Iter == self_->ctx.maxWoL1Iter) { | 279 | if (self_->ctx.woAL1Iter == self_->ctx.maxWoL1Iter) { |
| 280 | - ubInfo->outWIdx = ((self_->ctx.woAL1Iter - 1) * self_->ctx.convTilingData->convApiTiling.woL1 + self_->ctx.woAL1Tail) + | 280 | + ubInfo->outWIdx = ((self_->ctx.woAL1Iter - 1) * self_->ctx.convTilingData->woL1 + self_->ctx.woAL1Tail) + |
| 281 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0 + ubInfo->mLoopIdx * ubInfo->mUb % self_->ctx.convTilingData->convApiTiling.woL0; | 281 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0 + ubInfo->mLoopIdx * ubInfo->mUb % self_->ctx.convTilingData->woL0; |
| 282 | } else { | 282 | } else { |
| 283 | - ubInfo->outWIdx = self_->ctx.woAL1Iter * self_->ctx.convTilingData->convApiTiling.woL1 + | 283 | + ubInfo->outWIdx = self_->ctx.woAL1Iter * self_->ctx.convTilingData->woL1 + |
| 284 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0 + ubInfo->mLoopIdx * ubInfo->mUb % self_->ctx.convTilingData->convApiTiling.woL0; | 284 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0 + ubInfo->mLoopIdx * ubInfo->mUb % self_->ctx.convTilingData->woL0; |
| 285 | } | 285 | } |
| 286 | } | 286 | } |
| 287 | 287 | ||
| @@ -307,29 +307,29 @@ public: | |||
| 307 | __aicore__ inline void SetBaseParams(FixpipeParamsC310<format> &intriParams) | 307 | __aicore__ inline void SetBaseParams(FixpipeParamsC310<format> &intriParams) |
| 308 | { | 308 | { |
| 309 | intriParams.quantPre = GetQuantPre<Intf, OutputT, FixpipeIdx>(self_); | 309 | intriParams.quantPre = GetQuantPre<Intf, OutputT, FixpipeIdx>(self_); |
| 310 | - if (self_->ctx.convTilingData->convApiTiling.hasScale == 0) { | 310 | + if (self_->ctx.convTilingData->hasScale == 0) { |
| 311 | intriParams.deqScalar = DEQ_SCALAR_ONE; | 311 | intriParams.deqScalar = DEQ_SCALAR_ONE; |
| 312 | } | 312 | } |
| 313 | if constexpr (Intf::isExtendConv2d) { | 313 | if constexpr (Intf::isExtendConv2d) { |
| 314 | if constexpr (FixpipeIdx == 0) { | 314 | if constexpr (FixpipeIdx == 0) { |
| 315 | - intriParams.reluEn = self_->ctx.convTilingData->convApiTiling.reluMode0 != 0; | 315 | + intriParams.reluEn = self_->ctx.convTilingData->reluMode0 != 0; |
| 316 | 316 | ||
| 317 | - intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->convApiTiling.reluMode0); | 317 | + intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->reluMode0); |
| 318 | - if (self_->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 318 | + if (self_->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 319 | intriParams.reluScalar = self_->ctx.preReluScalar0; | 319 | intriParams.reluScalar = self_->ctx.preReluScalar0; |
| 320 | - } else if (self_->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 320 | + } else if (self_->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 321 | intriParams.vectorRelu = | 321 | intriParams.vectorRelu = |
| 322 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr()].GetPhyAddr(); | 322 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr()].GetPhyAddr(); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | intriParams.deqScalar = self_->ctx.deqScalar0; | 325 | intriParams.deqScalar = self_->ctx.deqScalar0; |
| 326 | } else { | 326 | } else { |
| 327 | - intriParams.reluEn = self_->ctx.convTilingData->convApiTiling.reluMode1 != 0; | 327 | + intriParams.reluEn = self_->ctx.convTilingData->reluMode1 != 0; |
| 328 | 328 | ||
| 329 | - intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->convApiTiling.reluMode1); | 329 | + intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->reluMode1); |
| 330 | - if (self_->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 330 | + if (self_->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 331 | intriParams.reluScalar = self_->ctx.preReluScalar1; | 331 | intriParams.reluScalar = self_->ctx.preReluScalar1; |
| 332 | - } else if(self_->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 332 | + } else if(self_->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 333 | intriParams.vectorRelu = | 333 | intriParams.vectorRelu = |
| 334 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr() + self_->ctx.reluWeight1L1offset].GetPhyAddr(); | 334 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr() + self_->ctx.reluWeight1L1offset].GetPhyAddr(); |
| 335 | } | 335 | } |
| @@ -341,7 +341,7 @@ public: | |||
| 341 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; | 341 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; |
| 342 | } else { | 342 | } else { |
| 343 | if constexpr (Intf::isExtendConv2d) { | 343 | if constexpr (Intf::isExtendConv2d) { |
| 344 | - if (self_->ctx.convTilingData->convApiTiling.dualOutput) { | 344 | + if (self_->ctx.convTilingData->dualOutput) { |
| 345 | intriParams.unitFlag = UNIT_FLAG_ENABLE_ONLY; | 345 | intriParams.unitFlag = UNIT_FLAG_ENABLE_ONLY; |
| 346 | } else { | 346 | } else { |
| 347 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; | 347 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; |
| @@ -355,42 +355,42 @@ public: | |||
| 355 | __aicore__ inline uint64_t CalcFixpipeOffset() | 355 | __aicore__ inline uint64_t CalcFixpipeOffset() |
| 356 | { | 356 | { |
| 357 | uint64_t offset = self_->ctx.batchIter * self_->ctx.outputOneBatchSize; | 357 | uint64_t offset = self_->ctx.batchIter * self_->ctx.outputOneBatchSize; |
| 358 | - uint64_t offsetH = self_->ctx.hoAL1Iter * self_->ctx.convTilingData->convApiTiling.hoL1 + | 358 | + uint64_t offsetH = self_->ctx.hoAL1Iter * self_->ctx.convTilingData->hoL1 + |
| 359 | - self_->ctx.hoL0Iter * self_->ctx.convTilingData->convApiTiling.hoL0; | 359 | + self_->ctx.hoL0Iter * self_->ctx.convTilingData->hoL0; |
| 360 | uint64_t offsetW; | 360 | uint64_t offsetW; |
| 361 | if (self_->ctx.woL1SmallTail == 0) { | 361 | if (self_->ctx.woL1SmallTail == 0) { |
| 362 | - offsetW = self_->ctx.woAL1Iter * self_->ctx.convTilingData->convApiTiling.woL1 + | 362 | + offsetW = self_->ctx.woAL1Iter * self_->ctx.convTilingData->woL1 + |
| 363 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0; | 363 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0; |
| 364 | } else { | 364 | } else { |
| 365 | if (self_->ctx.woAL1Iter == self_->ctx.maxWoL1Iter) { | 365 | if (self_->ctx.woAL1Iter == self_->ctx.maxWoL1Iter) { |
| 366 | - offsetW = ((self_->ctx.woAL1Iter - 1) * self_->ctx.convTilingData->convApiTiling.woL1 + self_->ctx.woAL1Tail) + | 366 | + offsetW = ((self_->ctx.woAL1Iter - 1) * self_->ctx.convTilingData->woL1 + self_->ctx.woAL1Tail) + |
| 367 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0; | 367 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0; |
| 368 | } else { | 368 | } else { |
| 369 | - offsetW = self_->ctx.woAL1Iter * self_->ctx.convTilingData->convApiTiling.woL1 + | 369 | + offsetW = self_->ctx.woAL1Iter * self_->ctx.convTilingData->woL1 + |
| 370 | - self_->ctx.woL0Iter * self_->ctx.convTilingData->convApiTiling.woL0; | 370 | + self_->ctx.woL0Iter * self_->ctx.convTilingData->woL0; |
| 371 | } | 371 | } |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | uint64_t offsetCout = 0U; | 374 | uint64_t offsetCout = 0U; |
| 375 | if constexpr (!Intf::isKL1NL0FullLoad) { | 375 | if constexpr (!Intf::isKL1NL0FullLoad) { |
| 376 | - offsetCout = self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 376 | + offsetCout = self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 377 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 377 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 378 | } | 378 | } |
| 379 | if constexpr (Intf::groupOptPreloadFlag) { | 379 | if constexpr (Intf::groupOptPreloadFlag) { |
| 380 | - offsetCout += self_->ctx.groupOptIter * self_->ctx.convTilingData->convApiTiling.orgCo / | 380 | + offsetCout += self_->ctx.groupOptIter * self_->ctx.convTilingData->orgCo / |
| 381 | - self_->ctx.convTilingData->convApiTiling.groups * | 381 | + self_->ctx.convTilingData->groups * |
| 382 | - self_->ctx.convTilingData->convApiTiling.enlarge; | 382 | + self_->ctx.convTilingData->enlarge; |
| 383 | } | 383 | } |
| 384 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { | 384 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { |
| 385 | - offset += offsetCout * self_->ctx.convTilingData->convApiTiling.orgDo * valueHoWo_ + self_->ctx.dOutIter * valueHoWo_ + | 385 | + offset += offsetCout * self_->ctx.convTilingData->orgDo * valueHoWo_ + self_->ctx.dOutIter * valueHoWo_ + |
| 386 | - offsetH * self_->ctx.convTilingData->convApiTiling.orgWo + offsetW; | 386 | + offsetH * self_->ctx.convTilingData->orgWo + offsetW; |
| 387 | } else if constexpr (Intf::formatOutput == ConvFormat::NDHWC) { | 387 | } else if constexpr (Intf::formatOutput == ConvFormat::NDHWC) { |
| 388 | - offset += self_->ctx.dOutIter * valueHoWo_ * self_->ctx.convTilingData->convApiTiling.orgCo + offsetH * self_->ctx.convTilingData->convApiTiling.orgWo * | 388 | + offset += self_->ctx.dOutIter * valueHoWo_ * self_->ctx.convTilingData->orgCo + offsetH * self_->ctx.convTilingData->orgWo * |
| 389 | - self_->ctx.convTilingData->convApiTiling.orgCo + offsetW * self_->ctx.convTilingData->convApiTiling.orgCo + offsetCout; | 389 | + self_->ctx.convTilingData->orgCo + offsetW * self_->ctx.convTilingData->orgCo + offsetCout; |
| 390 | } else if constexpr (Intf::formatOutput == ConvFormat::NCHW) { | 390 | } else if constexpr (Intf::formatOutput == ConvFormat::NCHW) { |
| 391 | - offset += offsetCout * valueHoWo_ + offsetH * self_->ctx.convTilingData->convApiTiling.orgWo + offsetW; | 391 | + offset += offsetCout * valueHoWo_ + offsetH * self_->ctx.convTilingData->orgWo + offsetW; |
| 392 | } else { | 392 | } else { |
| 393 | - offset += offsetH * self_->ctx.convTilingData->convApiTiling.orgWo * self_->ctx.convTilingData->convApiTiling.orgCo + offsetW * self_->ctx.convTilingData->convApiTiling.orgCo + offsetCout; | 393 | + offset += offsetH * self_->ctx.convTilingData->orgWo * self_->ctx.convTilingData->orgCo + offsetW * self_->ctx.convTilingData->orgCo + offsetCout; |
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | return offset; | 396 | return offset; |
| @@ -419,9 +419,9 @@ public: | |||
| 419 | if constexpr (Intf::isKL1NL0FullLoad) { | 419 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 420 | return 0; | 420 | return 0; |
| 421 | } | 421 | } |
| 422 | - if (self_->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 422 | + if (self_->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 423 | - return self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 423 | + return self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 424 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 424 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 425 | } | 425 | } |
| 426 | return 0; | 426 | return 0; |
| 427 | } | 427 | } |
| @@ -449,7 +449,7 @@ public: | |||
| 449 | if constexpr (Intf::isExtendConv2d) { | 449 | if constexpr (Intf::isExtendConv2d) { |
| 450 | ExtendConv2DFixpipe<TensorTypeT, config>(output, intriParams, offset); | 450 | ExtendConv2DFixpipe<TensorTypeT, config>(output, intriParams, offset); |
| 451 | } else if constexpr (Intf::isQuantScene) { | 451 | } else if constexpr (Intf::isQuantScene) { |
| 452 | - if (self_->ctx.convTilingData->convApiTiling.hasScale != 0) { | 452 | + if (self_->ctx.convTilingData->hasScale != 0) { |
| 453 | Fixpipe<OutputT, typename Intf::L0cT, config>( | 453 | Fixpipe<OutputT, typename Intf::L0cT, config>( |
| 454 | output[offset], self_->ctx.cl0, self_->ctx.scaleL1[GetScaleL1Addr()], intriParams); | 454 | output[offset], self_->ctx.cl0, self_->ctx.scaleL1[GetScaleL1Addr()], intriParams); |
| 455 | } else { | 455 | } else { |
| @@ -472,9 +472,9 @@ private: | |||
| 472 | return 0; | 472 | return 0; |
| 473 | } | 473 | } |
| 474 | if constexpr (Intf::isQuantScene) { | 474 | if constexpr (Intf::isQuantScene) { |
| 475 | - if (self_->ctx.convTilingData->convApiTiling.hasScale != 0 && self_->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 475 | + if (self_->ctx.convTilingData->hasScale != 0 && self_->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 476 | - return self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 476 | + return self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 477 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 477 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 478 | } | 478 | } |
| 479 | } | 479 | } |
| 480 | return 0; | 480 | return 0; |
| @@ -58,8 +58,8 @@ public: | |||
| 58 | if constexpr (Intf::isKL1NL0FullLoad) { | 58 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 59 | LoadChannelWiseL1FullLoad(tensorL1, tensorGm, currentNL0_, 0); | 59 | LoadChannelWiseL1FullLoad(tensorL1, tensorGm, currentNL0_, 0); |
| 60 | } else { | 60 | } else { |
| 61 | - uint64_t tensorGmOffset = self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 61 | + uint64_t tensorGmOffset = self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 62 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 62 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 63 | LoadChannelWiseL1FullLoad(tensorL1, tensorGm, currentNL0_, tensorGmOffset); | 63 | LoadChannelWiseL1FullLoad(tensorL1, tensorGm, currentNL0_, tensorGmOffset); |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| @@ -93,15 +93,15 @@ public: | |||
| 93 | } | 93 | } |
| 94 | uint32_t offset = 0; | 94 | uint32_t offset = 0; |
| 95 | 95 | ||
| 96 | - if (self_->ctx.convTilingData->convApiTiling.biasFullLoadFlag) { | 96 | + if (self_->ctx.convTilingData->biasFullLoadFlag) { |
| 97 | if constexpr (!Intf::isKL1NL0FullLoad) { | 97 | if constexpr (!Intf::isKL1NL0FullLoad) { |
| 98 | - offset += self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 98 | + offset += self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 99 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 99 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 100 | } | 100 | } |
| 101 | if constexpr (Intf::groupOptPreloadFlag) { | 101 | if constexpr (Intf::groupOptPreloadFlag) { |
| 102 | - offset += self_->ctx.groupOptIter * self_->ctx.convTilingData->convApiTiling.orgCo / | 102 | + offset += self_->ctx.groupOptIter * self_->ctx.convTilingData->orgCo / |
| 103 | - self_->ctx.convTilingData->convApiTiling.groups * | 103 | + self_->ctx.convTilingData->groups * |
| 104 | - self_->ctx.convTilingData->convApiTiling.enlarge; | 104 | + self_->ctx.convTilingData->enlarge; |
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| @@ -124,7 +124,7 @@ public: | |||
| 124 | __aicore__ inline void SetParams(Intf *self) | 124 | __aicore__ inline void SetParams(Intf *self) |
| 125 | { | 125 | { |
| 126 | self_ = self; | 126 | self_ = self; |
| 127 | - nStep_ = self_->ctx.convTilingData->convApiTiling.nL0 / BLOCK_L0_N; | 127 | + nStep_ = self_->ctx.convTilingData->nL0 / BLOCK_L0_N; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | __aicore__ inline void SetN(uint64_t n) | 130 | __aicore__ inline void SetN(uint64_t n) |
| @@ -133,7 +133,7 @@ public: | |||
| 133 | ratioOfNToN0 = n / BLOCK_L0_N; | 133 | ratioOfNToN0 = n / BLOCK_L0_N; |
| 134 | } else { | 134 | } else { |
| 135 | ratioOfNToN0 = (self_->ctx.nBL1Iter == self_->ctx.maxNBL1Iter && self_->ctx.nL0Iter == self_->ctx.maxNL0Iter) ? | 135 | ratioOfNToN0 = (self_->ctx.nBL1Iter == self_->ctx.maxNBL1Iter && self_->ctx.nL0Iter == self_->ctx.maxNL0Iter) ? |
| 136 | - n / BLOCK_L0_N : self_->ctx.convTilingData->convApiTiling.nStep; | 136 | + n / BLOCK_L0_N : self_->ctx.convTilingData->nStep; |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| @@ -145,7 +145,7 @@ public: | |||
| 145 | param_.SetMStartPosition(static_cast<uint32_t>(self_->ctx.nL0Iter * nStep_)); | 145 | param_.SetMStartPosition(static_cast<uint32_t>(self_->ctx.nL0Iter * nStep_)); |
| 146 | } | 146 | } |
| 147 | param_.SetMStep(static_cast<uint16_t>(ratioOfNToN0)); | 147 | param_.SetMStep(static_cast<uint16_t>(ratioOfNToN0)); |
| 148 | - param_.SetSrcStride(static_cast<int32_t>(self_->ctx.convTilingData->convApiTiling.nL1DivBlockSize)); | 148 | + param_.SetSrcStride(static_cast<int32_t>(self_->ctx.convTilingData->nL1DivBlockSize)); |
| 149 | param_.SetDstStride(static_cast<uint16_t>(ratioOfNToN0)); | 149 | param_.SetDstStride(static_cast<uint16_t>(ratioOfNToN0)); |
| 150 | param_.SetIfTranspose(false); | 150 | param_.SetIfTranspose(false); |
| 151 | } | 151 | } |
| @@ -166,9 +166,9 @@ public: | |||
| 166 | isLoaded = true; | 166 | isLoaded = true; |
| 167 | param_.SetMStartPosition(0); | 167 | param_.SetMStartPosition(0); |
| 168 | param_.SetKStartPosition(0); | 168 | param_.SetKStartPosition(0); |
| 169 | - param_.SetMStep(static_cast<uint16_t>(self_->ctx.convTilingData->convApiTiling.nL0 / BLOCK_L0_N)); | 169 | + param_.SetMStep(static_cast<uint16_t>(self_->ctx.convTilingData->nL0 / BLOCK_L0_N)); |
| 170 | - param_.SetKStep(static_cast<uint16_t>(AlignB(self_->ctx.convTilingData->convApiTiling.kBL1, Intf::k0)/Intf::k0)); | 170 | + param_.SetKStep(static_cast<uint16_t>(AlignB(self_->ctx.convTilingData->kBL1, Intf::k0)/Intf::k0)); |
| 171 | - uint16_t stride = static_cast<uint16_t>(self_->ctx.convTilingData->convApiTiling.nBL1 / BLOCK_L0_N); | 171 | + uint16_t stride = static_cast<uint16_t>(self_->ctx.convTilingData->nBL1 / BLOCK_L0_N); |
| 172 | param_.SetSrcStride(stride); | 172 | param_.SetSrcStride(stride); |
| 173 | param_.SetDstStride(stride); | 173 | param_.SetDstStride(stride); |
| 174 | param_.SetIfTranspose(false); | 174 | param_.SetIfTranspose(false); |
| @@ -197,7 +197,7 @@ public: | |||
| 197 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::MULTI_BATCH)) { | 197 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::MULTI_BATCH)) { |
| 198 | uint32_t srcOffset = 0; | 198 | uint32_t srcOffset = 0; |
| 199 | uint32_t dstOffset = 0; | 199 | uint32_t dstOffset = 0; |
| 200 | - uint32_t srcBatchStride = self_->ctx.currentML0Align * self_->ctx.convTilingData->convApiTiling.kL0; | 200 | + uint32_t srcBatchStride = self_->ctx.currentML0Align * self_->ctx.convTilingData->kL0; |
| 201 | uint32_t dstBatchStride = self_->ctx.currentML0Align * self_->ctx.currentNL0Align; | 201 | uint32_t dstBatchStride = self_->ctx.currentML0Align * self_->ctx.currentNL0Align; |
| 202 | for (uint32_t batchIdx = 0; batchIdx < self_->ctx.innerBatch; batchIdx++) { | 202 | for (uint32_t batchIdx = 0; batchIdx < self_->ctx.innerBatch; batchIdx++) { |
| 203 | Mmad<typename Intf::L0cT, typename Intf::FmapT, typename Intf::WeightT>( | 203 | Mmad<typename Intf::L0cT, typename Intf::FmapT, typename Intf::WeightT>( |
| @@ -228,7 +228,7 @@ __aicore__ inline QuantMode_t GetQuantPreHif8Fp8(Intf *self) | |||
| 228 | // extend conv2d: may be scalar or vector quant | 228 | // extend conv2d: may be scalar or vector quant |
| 229 | if constexpr (AscendC::IsSameType<OutputT, float>::value) { | 229 | if constexpr (AscendC::IsSameType<OutputT, float>::value) { |
| 230 | if constexpr (Intf::isExtendConv2d) { | 230 | if constexpr (Intf::isExtendConv2d) { |
| 231 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 231 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 232 | return QuantMode_t::VQF322F32_PRE; | 232 | return QuantMode_t::VQF322F32_PRE; |
| 233 | } else { | 233 | } else { |
| 234 | return QuantMode_t::QF322F32_PRE; | 234 | return QuantMode_t::QF322F32_PRE; |
| @@ -240,7 +240,7 @@ __aicore__ inline QuantMode_t GetQuantPreHif8Fp8(Intf *self) | |||
| 240 | 240 | ||
| 241 | if constexpr (AscendC::IsSameType<OutputT, half>::value) { | 241 | if constexpr (AscendC::IsSameType<OutputT, half>::value) { |
| 242 | if constexpr (Intf::isExtendConv2d) { | 242 | if constexpr (Intf::isExtendConv2d) { |
| 243 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 243 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 244 | return QuantMode_t::VQF322F16_PRE; | 244 | return QuantMode_t::VQF322F16_PRE; |
| 245 | } else { | 245 | } else { |
| 246 | return QuantMode_t::QF322F16_PRE; | 246 | return QuantMode_t::QF322F16_PRE; |
| @@ -252,7 +252,7 @@ __aicore__ inline QuantMode_t GetQuantPreHif8Fp8(Intf *self) | |||
| 252 | 252 | ||
| 253 | if constexpr (AscendC::IsSameType<OutputT, bfloat16_t>::value) { | 253 | if constexpr (AscendC::IsSameType<OutputT, bfloat16_t>::value) { |
| 254 | if constexpr (Intf::isExtendConv2d) { | 254 | if constexpr (Intf::isExtendConv2d) { |
| 255 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 255 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 256 | return QuantMode_t::VQF322BF16_PRE; | 256 | return QuantMode_t::VQF322BF16_PRE; |
| 257 | } else { | 257 | } else { |
| 258 | return QuantMode_t::QF322BF16_PRE; | 258 | return QuantMode_t::QF322BF16_PRE; |
| @@ -264,16 +264,16 @@ __aicore__ inline QuantMode_t GetQuantPreHif8Fp8(Intf *self) | |||
| 264 | 264 | ||
| 265 | if constexpr (AscendC::IsSameType<OutputT, hifloat8_t>::value) { | 265 | if constexpr (AscendC::IsSameType<OutputT, hifloat8_t>::value) { |
| 266 | if constexpr (Intf::isExtendConv2d) { | 266 | if constexpr (Intf::isExtendConv2d) { |
| 267 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 267 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 268 | return QuantMode_t::VQF322HIF8_PRE; | 268 | return QuantMode_t::VQF322HIF8_PRE; |
| 269 | } else { | 269 | } else { |
| 270 | return QuantMode_t::QF322HIF8_PRE; | 270 | return QuantMode_t::QF322HIF8_PRE; |
| 271 | } | 271 | } |
| 272 | } else { | 272 | } else { |
| 273 | - if (self->ctx.convTilingData->convApiTiling.hasScale == 0) { | 273 | + if (self->ctx.convTilingData->hasScale == 0) { |
| 274 | // conv2d support hif8 in hif8 out | 274 | // conv2d support hif8 in hif8 out |
| 275 | return QuantMode_t::QF322HIF8_PRE; | 275 | return QuantMode_t::QF322HIF8_PRE; |
| 276 | - } else if (self->ctx.convTilingData->convApiTiling.roundMode == ROUND_MODE_ROUND) { | 276 | + } else if (self->ctx.convTilingData->roundMode == ROUND_MODE_ROUND) { |
| 277 | // quantconv2d/quantconv3d | 277 | // quantconv2d/quantconv3d |
| 278 | return QuantMode_t::VQF322HIF8_PRE; | 278 | return QuantMode_t::VQF322HIF8_PRE; |
| 279 | } | 279 | } |
| @@ -282,7 +282,7 @@ __aicore__ inline QuantMode_t GetQuantPreHif8Fp8(Intf *self) | |||
| 282 | 282 | ||
| 283 | if constexpr (AscendC::IsSameType<OutputT, fp8_e4m3fn_t>::value) { | 283 | if constexpr (AscendC::IsSameType<OutputT, fp8_e4m3fn_t>::value) { |
| 284 | if constexpr (Intf::isExtendConv2d) { | 284 | if constexpr (Intf::isExtendConv2d) { |
| 285 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 285 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 286 | return QuantMode_t::VQF322FP8_PRE; | 286 | return QuantMode_t::VQF322FP8_PRE; |
| 287 | } else { | 287 | } else { |
| 288 | return QuantMode_t::QF322FP8_PRE; | 288 | return QuantMode_t::QF322FP8_PRE; |
| @@ -302,13 +302,13 @@ __aicore__ inline QuantMode_t GetQuantPreInt32(Intf *self) | |||
| 302 | if constexpr (AscendC::IsSameType<OutputT, half>::value) { | 302 | if constexpr (AscendC::IsSameType<OutputT, half>::value) { |
| 303 | if constexpr (Intf::isExtendConv2d) { | 303 | if constexpr (Intf::isExtendConv2d) { |
| 304 | if constexpr (FixpipeIdx == 0) { | 304 | if constexpr (FixpipeIdx == 0) { |
| 305 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 305 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 306 | return QuantMode_t::VDEQF16; | 306 | return QuantMode_t::VDEQF16; |
| 307 | } else { | 307 | } else { |
| 308 | return QuantMode_t::DEQF16; | 308 | return QuantMode_t::DEQF16; |
| 309 | } | 309 | } |
| 310 | } else { | 310 | } else { |
| 311 | - if (self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 311 | + if (self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 312 | return QuantMode_t::VDEQF16; | 312 | return QuantMode_t::VDEQF16; |
| 313 | } else { | 313 | } else { |
| 314 | return QuantMode_t::DEQF16; | 314 | return QuantMode_t::DEQF16; |
| @@ -323,13 +323,13 @@ __aicore__ inline QuantMode_t GetQuantPreInt32(Intf *self) | |||
| 323 | } else if constexpr (AscendC::IsSameType<OutputT, int8_t>::value) { | 323 | } else if constexpr (AscendC::IsSameType<OutputT, int8_t>::value) { |
| 324 | if constexpr (Intf::isExtendConv2d) { | 324 | if constexpr (Intf::isExtendConv2d) { |
| 325 | if constexpr (FixpipeIdx == 0) { | 325 | if constexpr (FixpipeIdx == 0) { |
| 326 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 326 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 327 | return QuantMode_t::VREQ8; | 327 | return QuantMode_t::VREQ8; |
| 328 | } else { | 328 | } else { |
| 329 | return QuantMode_t::REQ8; | 329 | return QuantMode_t::REQ8; |
| 330 | } | 330 | } |
| 331 | } else { | 331 | } else { |
| 332 | - if (self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 332 | + if (self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 333 | return QuantMode_t::VREQ8; | 333 | return QuantMode_t::VREQ8; |
| 334 | } else { | 334 | } else { |
| 335 | return QuantMode_t::REQ8; | 335 | return QuantMode_t::REQ8; |
| @@ -359,13 +359,13 @@ __aicore__ inline QuantMode_t GetQuantPreFp32(Intf *self) | |||
| 359 | } else if constexpr (AscendC::IsSameType<OutputT, int8_t>::value) { | 359 | } else if constexpr (AscendC::IsSameType<OutputT, int8_t>::value) { |
| 360 | if constexpr (Intf::isExtendConv2d) { | 360 | if constexpr (Intf::isExtendConv2d) { |
| 361 | if constexpr (FixpipeIdx == 0) { | 361 | if constexpr (FixpipeIdx == 0) { |
| 362 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 362 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 363 | return QuantMode_t::VQF322B8_PRE; | 363 | return QuantMode_t::VQF322B8_PRE; |
| 364 | } else { | 364 | } else { |
| 365 | return QuantMode_t::QF322B8_PRE; | 365 | return QuantMode_t::QF322B8_PRE; |
| 366 | } | 366 | } |
| 367 | } else { | 367 | } else { |
| 368 | - if (self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 368 | + if (self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 369 | return QuantMode_t::VQF322B8_PRE; | 369 | return QuantMode_t::VQF322B8_PRE; |
| 370 | } else { | 370 | } else { |
| 371 | return QuantMode_t::QF322B8_PRE; | 371 | return QuantMode_t::QF322B8_PRE; |
| @@ -32,35 +32,35 @@ public: | |||
| 32 | __aicore__ inline void SetParams(Intf *self) | 32 | __aicore__ inline void SetParams(Intf *self) |
| 33 | { | 33 | { |
| 34 | self_ = self; | 34 | self_ = self; |
| 35 | - alignCinATailInCore_ = AlignB(self_->ctx.convTilingData->convApiTiling.cinATailInCore, Intf::k0FmapTail); | 35 | + alignCinATailInCore_ = AlignB(self_->ctx.convTilingData->cinATailInCore, Intf::k0FmapTail); |
| 36 | 36 | ||
| 37 | if constexpr (Intf::c04Flag) { | 37 | if constexpr (Intf::c04Flag) { |
| 38 | channelSize_ = conv::C04_CIN_SIZE; | 38 | channelSize_ = conv::C04_CIN_SIZE; |
| 39 | - c04KStepTail = (conv::C04_CIN_SIZE * self_->ctx.convTilingData->convApiTiling.kernelHxkernelW) % self_->ctx.convTilingData->convApiTiling.kL0; | 39 | + c04KStepTail = (conv::C04_CIN_SIZE * self_->ctx.convTilingData->kernelHxkernelW) % self_->ctx.convTilingData->kL0; |
| 40 | - c04KStepTail = c04KStepTail == 0 ? self_->ctx.convTilingData->convApiTiling.kL0 : c04KStepTail; | 40 | + c04KStepTail = c04KStepTail == 0 ? self_->ctx.convTilingData->kL0 : c04KStepTail; |
| 41 | } else { | 41 | } else { |
| 42 | if constexpr (Intf::kPreLoadFlag) { | 42 | if constexpr (Intf::kPreLoadFlag) { |
| 43 | if constexpr (Intf::isKL1NL0FullLoad) { | 43 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 44 | channelSize_ = alignCinATailInCore_; | 44 | channelSize_ = alignCinATailInCore_; |
| 45 | } else { | 45 | } else { |
| 46 | channelSize_ = (self_->ctx.kAL1Iter - 1 != self_->ctx.maxKAL1Iter ? | 46 | channelSize_ = (self_->ctx.kAL1Iter - 1 != self_->ctx.maxKAL1Iter ? |
| 47 | - self_->ctx.convTilingData->convApiTiling.cinAInCore : alignCinATailInCore_); | 47 | + self_->ctx.convTilingData->cinAInCore : alignCinATailInCore_); |
| 48 | } | 48 | } |
| 49 | } else { | 49 | } else { |
| 50 | if constexpr (Intf::isKL1NL0FullLoad) { | 50 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 51 | channelSize_ = alignCinATailInCore_; | 51 | channelSize_ = alignCinATailInCore_; |
| 52 | } else { | 52 | } else { |
| 53 | channelSize_ = (self_->ctx.kAL1Iter != self_->ctx.maxKAL1Iter ? | 53 | channelSize_ = (self_->ctx.kAL1Iter != self_->ctx.maxKAL1Iter ? |
| 54 | - self_->ctx.convTilingData->convApiTiling.cinAInCore : alignCinATailInCore_); | 54 | + self_->ctx.convTilingData->cinAInCore : alignCinATailInCore_); |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::MULTI_BATCH)) { | 59 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::MULTI_BATCH)) { |
| 60 | - uint64_t hiLoadL1 = (self_->ctx.convTilingData->convApiTiling.orgHo - 1) * self_->ctx.convTilingData->convApiTiling.strideH + | 60 | + uint64_t hiLoadL1 = (self_->ctx.convTilingData->orgHo - 1) * self_->ctx.convTilingData->strideH + |
| 61 | self_->ctx.dilatedKernelH; | 61 | self_->ctx.dilatedKernelH; |
| 62 | - hiLoadL1 = hiLoadL1 > self_->ctx.convTilingData->convApiTiling.orgHi ? self_->ctx.convTilingData->convApiTiling.orgHi : hiLoadL1; | 62 | + hiLoadL1 = hiLoadL1 > self_->ctx.convTilingData->orgHi ? self_->ctx.convTilingData->orgHi : hiLoadL1; |
| 63 | - realHixWi = hiLoadL1 * self_->ctx.convTilingData->convApiTiling.orgWi; | 63 | + realHixWi = hiLoadL1 * self_->ctx.convTilingData->orgWi; |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| 66 | 66 | ||
| @@ -90,11 +90,11 @@ public: | |||
| 90 | __aicore__ inline void SetFirst() | 90 | __aicore__ inline void SetFirst() |
| 91 | { | 91 | { |
| 92 | uint64_t posM = self_->ctx.mL0Iter * self_->ctx.mL0 + | 92 | uint64_t posM = self_->ctx.mL0Iter * self_->ctx.mL0 + |
| 93 | - (self_->ctx.mStartPos + self_->ctx.mAL1Iter * self_->ctx.mAL1) % self_->ctx.convTilingData->convApiTiling.orgWo; | 93 | + (self_->ctx.mStartPos + self_->ctx.mAL1Iter * self_->ctx.mAL1) % self_->ctx.convTilingData->orgWo; |
| 94 | xm_.bf.mExtension_ = currentML0_ & MASK_16; | 94 | xm_.bf.mExtension_ = currentML0_ & MASK_16; |
| 95 | xm_.bf.mStartPt_ = posM & MASK_16; | 95 | xm_.bf.mStartPt_ = posM & MASK_16; |
| 96 | 96 | ||
| 97 | - xt_.n = static_cast<uint64_t>(self_->ctx.convTilingData->convApiTiling.unionDataXt); | 97 | + xt_.n = static_cast<uint64_t>(self_->ctx.convTilingData->unionDataXt); |
| 98 | xt_.bf.channelSize = channelSize_; | 98 | xt_.bf.channelSize = channelSize_; |
| 99 | param_.SetConfig1(xt_.n); | 99 | param_.SetConfig1(xt_.n); |
| 100 | } | 100 | } |
| @@ -115,8 +115,8 @@ public: | |||
| 115 | 115 | ||
| 116 | if constexpr (Intf::preFusionFlag) { | 116 | if constexpr (Intf::preFusionFlag) { |
| 117 | uint64_t aL1Offset = 0; | 117 | uint64_t aL1Offset = 0; |
| 118 | - if ((self_->ctx.convTilingData->convApiTiling.pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { | 118 | + if ((self_->ctx.convTilingData->pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { |
| 119 | - aL1Offset = (self_->ctx.al1PingPongFlag^1) * self_->ctx.convTilingData->convApiTiling.aL1SpaceSize / Intf::sizeOfFmap; | 119 | + aL1Offset = (self_->ctx.al1PingPongFlag^1) * self_->ctx.convTilingData->aL1SpaceSize / Intf::sizeOfFmap; |
| 120 | } | 120 | } |
| 121 | LoadData<TPosition::A2, TPosition::A1, typename Intf::FmapT>(al0, | 121 | LoadData<TPosition::A2, TPosition::A1, typename Intf::FmapT>(al0, |
| 122 | self_->ctx.al1[aL1Offset], param_); | 122 | self_->ctx.al1[aL1Offset], param_); |
| @@ -125,12 +125,12 @@ public: | |||
| 125 | uint32_t dstOffset = 0; | 125 | uint32_t dstOffset = 0; |
| 126 | uint32_t srcBatchStride = 0; | 126 | uint32_t srcBatchStride = 0; |
| 127 | if constexpr (Intf::c04Flag) { | 127 | if constexpr (Intf::c04Flag) { |
| 128 | - srcBatchStride = AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->convApiTiling.orgHixWi, Intf::k0); | 128 | + srcBatchStride = AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->orgHixWi, Intf::k0); |
| 129 | } else { | 129 | } else { |
| 130 | srcBatchStride = ((kIter / self_->ctx.multiKAL1) != self_->ctx.maxKAL1Iter ? | 130 | srcBatchStride = ((kIter / self_->ctx.multiKAL1) != self_->ctx.maxKAL1Iter ? |
| 131 | - self_->ctx.convTilingData->convApiTiling.cinAInCore : alignCinATailInCore_) * realHixWi; | 131 | + self_->ctx.convTilingData->cinAInCore : alignCinATailInCore_) * realHixWi; |
| 132 | } | 132 | } |
| 133 | - uint32_t dstBatchStride = currentML0Align_ * self_->ctx.convTilingData->convApiTiling.kL0; | 133 | + uint32_t dstBatchStride = currentML0Align_ * self_->ctx.convTilingData->kL0; |
| 134 | for (uint16_t batchIter = 0; batchIter < self_->ctx.innerBatch; batchIter++) { | 134 | for (uint16_t batchIter = 0; batchIter < self_->ctx.innerBatch; batchIter++) { |
| 135 | LoadData<TPosition::A2, TPosition::A1, typename Intf::FmapT>(al0[dstOffset], | 135 | LoadData<TPosition::A2, TPosition::A1, typename Intf::FmapT>(al0[dstOffset], |
| 136 | self_->ctx.al1[srcOffset], param_); | 136 | self_->ctx.al1[srcOffset], param_); |
| @@ -164,7 +164,7 @@ public: | |||
| 164 | __aicore__ inline void SetParams(Intf *self) | 164 | __aicore__ inline void SetParams(Intf *self) |
| 165 | { | 165 | { |
| 166 | self_ = self; | 166 | self_ = self; |
| 167 | - valueHoWo_ = self_->ctx.convTilingData->convApiTiling.orgHo * self_->ctx.convTilingData->convApiTiling.orgWo; | 167 | + valueHoWo_ = self_->ctx.convTilingData->orgHo * self_->ctx.convTilingData->orgWo; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | __aicore__ inline void SetMN(uint64_t m, uint64_t n) | 170 | __aicore__ inline void SetMN(uint64_t m, uint64_t n) |
| @@ -199,7 +199,7 @@ public: | |||
| 199 | if constexpr (Intf::isExtendConv2d) { | 199 | if constexpr (Intf::isExtendConv2d) { |
| 200 | ExtendConv2DFixpipe<TensorTypeT, config>(output, intriParams, offset); | 200 | ExtendConv2DFixpipe<TensorTypeT, config>(output, intriParams, offset); |
| 201 | } else if constexpr (Intf::isQuantScene) { | 201 | } else if constexpr (Intf::isQuantScene) { |
| 202 | - if (self_->ctx.convTilingData->convApiTiling.hasScale == 0) { | 202 | + if (self_->ctx.convTilingData->hasScale == 0) { |
| 203 | Fixpipe<OutputT, typename Intf::L0cT, config>(output[offset], self_->ctx.cl0, intriParams); | 203 | Fixpipe<OutputT, typename Intf::L0cT, config>(output[offset], self_->ctx.cl0, intriParams); |
| 204 | } else { | 204 | } else { |
| 205 | Fixpipe<OutputT, typename Intf::L0cT, config>( | 205 | Fixpipe<OutputT, typename Intf::L0cT, config>( |
| @@ -231,7 +231,7 @@ private: | |||
| 231 | if constexpr (Intf::isExtendConv2d) { | 231 | if constexpr (Intf::isExtendConv2d) { |
| 232 | ExtendConv2DFixpipe<TensorTypeT, config>(output, intriParams, offset); | 232 | ExtendConv2DFixpipe<TensorTypeT, config>(output, intriParams, offset); |
| 233 | } else if constexpr (Intf::isQuantScene) { | 233 | } else if constexpr (Intf::isQuantScene) { |
| 234 | - if (self_->ctx.convTilingData->convApiTiling.hasScale != 0) { | 234 | + if (self_->ctx.convTilingData->hasScale != 0) { |
| 235 | Fixpipe<OutputT, typename Intf::L0cT, config>( | 235 | Fixpipe<OutputT, typename Intf::L0cT, config>( |
| 236 | output[offset], self_->ctx.cl0, self_->ctx.scaleL1[GetScaleL1Addr()], intriParams); | 236 | output[offset], self_->ctx.cl0, self_->ctx.scaleL1[GetScaleL1Addr()], intriParams); |
| 237 | } else { | 237 | } else { |
| @@ -261,7 +261,7 @@ private: | |||
| 261 | intriParams.params.srcNzMatrixStride = self_->ctx.currentML0Align * CeilDiv(currentNL0_ , BLOCK_L0_N); | 261 | intriParams.params.srcNzMatrixStride = self_->ctx.currentML0Align * CeilDiv(currentNL0_ , BLOCK_L0_N); |
| 262 | } | 262 | } |
| 263 | intriParams.params.srcNzC0Stride = 1; | 263 | intriParams.params.srcNzC0Stride = 1; |
| 264 | - intriParams.params.dstDnMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCo * valueHoWo_; | 264 | + intriParams.params.dstDnMatrixStride = self_->ctx.convTilingData->orgCo * valueHoWo_; |
| 265 | intriParams.dstStride = valueHoWo_; | 265 | intriParams.dstStride = valueHoWo_; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| @@ -277,8 +277,8 @@ private: | |||
| 277 | intriParams.srcStride = self_->ctx.currentML0Align; | 277 | intriParams.srcStride = self_->ctx.currentML0Align; |
| 278 | intriParams.params.srcNdStride = self_->ctx.currentML0Align * CeilDiv(currentNL0_ , BLOCK_L0_N); | 278 | intriParams.params.srcNdStride = self_->ctx.currentML0Align * CeilDiv(currentNL0_ , BLOCK_L0_N); |
| 279 | } | 279 | } |
| 280 | - intriParams.params.dstNdStride = self_->ctx.convTilingData->convApiTiling.orgCo * valueHoWo_; | 280 | + intriParams.params.dstNdStride = self_->ctx.convTilingData->orgCo * valueHoWo_; |
| 281 | - intriParams.dstStride = self_->ctx.convTilingData->convApiTiling.orgCo; | 281 | + intriParams.dstStride = self_->ctx.convTilingData->orgCo; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | __aicore__ inline void SetFixpipeIntriParamsHWC(FixpipeParamsC310<CO2Layout::ROW_MAJOR> &intriParams) | 284 | __aicore__ inline void SetFixpipeIntriParamsHWC(FixpipeParamsC310<CO2Layout::ROW_MAJOR> &intriParams) |
| @@ -286,7 +286,7 @@ private: | |||
| 286 | intriParams.nSize = currentNL0_; | 286 | intriParams.nSize = currentNL0_; |
| 287 | intriParams.mSize = currentML0_; | 287 | intriParams.mSize = currentML0_; |
| 288 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); | 288 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); |
| 289 | - intriParams.dstStride = self_->ctx.convTilingData->convApiTiling.orgCo; | 289 | + intriParams.dstStride = self_->ctx.convTilingData->orgCo; |
| 290 | intriParams.params.ndNum = 1; | 290 | intriParams.params.ndNum = 1; |
| 291 | intriParams.params.dstNdStride = 0; | 291 | intriParams.params.dstNdStride = 0; |
| 292 | intriParams.params.srcNdStride = 0; | 292 | intriParams.params.srcNdStride = 0; |
| @@ -299,7 +299,7 @@ private: | |||
| 299 | intriParams.mSize = currentML0_; | 299 | intriParams.mSize = currentML0_; |
| 300 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); | 300 | intriParams.srcStride = AlignB(currentML0_, BLOCK_L0_M); |
| 301 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { | 301 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { |
| 302 | - intriParams.dstStride = self_->ctx.convTilingData->convApiTiling.orgDo * valueHoWo_; | 302 | + intriParams.dstStride = self_->ctx.convTilingData->orgDo * valueHoWo_; |
| 303 | } else { | 303 | } else { |
| 304 | intriParams.dstStride = valueHoWo_; | 304 | intriParams.dstStride = valueHoWo_; |
| 305 | } | 305 | } |
| @@ -327,8 +327,8 @@ private: | |||
| 327 | if constexpr (Intf::isKL1NL0FullLoad) { | 327 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 328 | ubInfo->outCIdx = ubInfo->nLoopIdx * ubInfo->nUb; | 328 | ubInfo->outCIdx = ubInfo->nLoopIdx * ubInfo->nUb; |
| 329 | } else { | 329 | } else { |
| 330 | - ubInfo->outCIdx = self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 330 | + ubInfo->outCIdx = self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 331 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0 + ubInfo->nLoopIdx * ubInfo->nUb; | 331 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0 + ubInfo->nLoopIdx * ubInfo->nUb; |
| 332 | } | 332 | } |
| 333 | ubInfo->outHIdx = 0; | 333 | ubInfo->outHIdx = 0; |
| 334 | ubInfo->outWIdx = self_->ctx.mAL1Iter * self_->ctx.mAL1 + | 334 | ubInfo->outWIdx = self_->ctx.mAL1Iter * self_->ctx.mAL1 + |
| @@ -339,29 +339,29 @@ private: | |||
| 339 | __aicore__ inline void SetBaseParams(FixpipeParamsC310<format> &intriParams) | 339 | __aicore__ inline void SetBaseParams(FixpipeParamsC310<format> &intriParams) |
| 340 | { | 340 | { |
| 341 | intriParams.quantPre = GetQuantPre<Intf, OutputT, FixpipeIdx>(self_); | 341 | intriParams.quantPre = GetQuantPre<Intf, OutputT, FixpipeIdx>(self_); |
| 342 | - if (self_->ctx.convTilingData->convApiTiling.hasScale == 0) { | 342 | + if (self_->ctx.convTilingData->hasScale == 0) { |
| 343 | intriParams.deqScalar = DEQ_SCALAR_ONE; | 343 | intriParams.deqScalar = DEQ_SCALAR_ONE; |
| 344 | } | 344 | } |
| 345 | if constexpr (Intf::isExtendConv2d) { | 345 | if constexpr (Intf::isExtendConv2d) { |
| 346 | if constexpr (FixpipeIdx == 0) { | 346 | if constexpr (FixpipeIdx == 0) { |
| 347 | - intriParams.reluEn = self_->ctx.convTilingData->convApiTiling.reluMode0 != 0; | 347 | + intriParams.reluEn = self_->ctx.convTilingData->reluMode0 != 0; |
| 348 | 348 | ||
| 349 | - intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->convApiTiling.reluMode0); | 349 | + intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->reluMode0); |
| 350 | - if (self_->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 350 | + if (self_->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 351 | intriParams.reluScalar = self_->ctx.preReluScalar0; | 351 | intriParams.reluScalar = self_->ctx.preReluScalar0; |
| 352 | - } else if (self_->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 352 | + } else if (self_->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 353 | intriParams.vectorRelu = | 353 | intriParams.vectorRelu = |
| 354 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr()].GetPhyAddr(); | 354 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr()].GetPhyAddr(); |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | intriParams.deqScalar = self_->ctx.deqScalar0; | 357 | intriParams.deqScalar = self_->ctx.deqScalar0; |
| 358 | } else { | 358 | } else { |
| 359 | - intriParams.reluEn = self_->ctx.convTilingData->convApiTiling.reluMode1 != 0; | 359 | + intriParams.reluEn = self_->ctx.convTilingData->reluMode1 != 0; |
| 360 | 360 | ||
| 361 | - intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->convApiTiling.reluMode1); | 361 | + intriParams.preReluMode = static_cast<ReluMode>(self_->ctx.convTilingData->reluMode1); |
| 362 | - if (self_->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { | 362 | + if (self_->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::SCALAR_RELU)) { |
| 363 | intriParams.reluScalar = self_->ctx.preReluScalar1; | 363 | intriParams.reluScalar = self_->ctx.preReluScalar1; |
| 364 | - } else if(self_->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 364 | + } else if(self_->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 365 | intriParams.vectorRelu = | 365 | intriParams.vectorRelu = |
| 366 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr() + self_->ctx.reluWeight1L1offset].GetPhyAddr(); | 366 | self_->ctx.reluWeightL1[GetExtendConv2dScaleL1Addr() + self_->ctx.reluWeight1L1offset].GetPhyAddr(); |
| 367 | } | 367 | } |
| @@ -375,7 +375,7 @@ private: | |||
| 375 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; | 375 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; |
| 376 | } else { | 376 | } else { |
| 377 | if constexpr (Intf::isExtendConv2d) { | 377 | if constexpr (Intf::isExtendConv2d) { |
| 378 | - if (self_->ctx.convTilingData->convApiTiling.dualOutput) { | 378 | + if (self_->ctx.convTilingData->dualOutput) { |
| 379 | intriParams.unitFlag = UNIT_FLAG_ENABLE_ONLY; | 379 | intriParams.unitFlag = UNIT_FLAG_ENABLE_ONLY; |
| 380 | } else { | 380 | } else { |
| 381 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; | 381 | intriParams.unitFlag = UNIT_FLAG_ENABLE_WITH_FLIP; |
| @@ -445,29 +445,29 @@ private: | |||
| 445 | offset = self_->ctx.batchIter * self_->ctx.outputOneBatchSize; | 445 | offset = self_->ctx.batchIter * self_->ctx.outputOneBatchSize; |
| 446 | } | 446 | } |
| 447 | if constexpr (Intf::isInnerBatchFlag) { | 447 | if constexpr (Intf::isInnerBatchFlag) { |
| 448 | - offset *= self_->ctx.convTilingData->convApiTiling.innerBatch; | 448 | + offset *= self_->ctx.convTilingData->innerBatch; |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | uint64_t offsetCout = 0; | 451 | uint64_t offsetCout = 0; |
| 452 | if constexpr (Intf::groupOptPreloadFlag) { | 452 | if constexpr (Intf::groupOptPreloadFlag) { |
| 453 | - offsetCout += self_->ctx.groupOptIter * self_->ctx.convTilingData->convApiTiling.orgCo / self_->ctx.convTilingData->convApiTiling.groups * | 453 | + offsetCout += self_->ctx.groupOptIter * self_->ctx.convTilingData->orgCo / self_->ctx.convTilingData->groups * |
| 454 | - self_->ctx.convTilingData->convApiTiling.enlarge; | 454 | + self_->ctx.convTilingData->enlarge; |
| 455 | } | 455 | } |
| 456 | if constexpr (!Intf::isKL1NL0FullLoad) { | 456 | if constexpr (!Intf::isKL1NL0FullLoad) { |
| 457 | - offsetCout += self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 457 | + offsetCout += self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 458 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 458 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 459 | } | 459 | } |
| 460 | uint64_t offsetMAL1 = self_->ctx.mAL1Iter * self_->ctx.mAL1 + | 460 | uint64_t offsetMAL1 = self_->ctx.mAL1Iter * self_->ctx.mAL1 + |
| 461 | self_->ctx.mL0Iter * self_->ctx.mL0; | 461 | self_->ctx.mL0Iter * self_->ctx.mL0; |
| 462 | 462 | ||
| 463 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { | 463 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW) { |
| 464 | - offset += offsetCout * self_->ctx.convTilingData->convApiTiling.orgDo * valueHoWo_ + self_->ctx.dOutIter * valueHoWo_ + offsetMAL1; | 464 | + offset += offsetCout * self_->ctx.convTilingData->orgDo * valueHoWo_ + self_->ctx.dOutIter * valueHoWo_ + offsetMAL1; |
| 465 | } else if constexpr (Intf::formatOutput == ConvFormat::NDHWC) { | 465 | } else if constexpr (Intf::formatOutput == ConvFormat::NDHWC) { |
| 466 | - offset += self_->ctx.dOutIter * valueHoWo_ * self_->ctx.convTilingData->convApiTiling.orgCo + offsetMAL1 * self_->ctx.convTilingData->convApiTiling.orgCo + offsetCout; | 466 | + offset += self_->ctx.dOutIter * valueHoWo_ * self_->ctx.convTilingData->orgCo + offsetMAL1 * self_->ctx.convTilingData->orgCo + offsetCout; |
| 467 | } else if constexpr (Intf::formatOutput == ConvFormat::NCHW) { | 467 | } else if constexpr (Intf::formatOutput == ConvFormat::NCHW) { |
| 468 | offset += offsetCout * valueHoWo_ + offsetMAL1; | 468 | offset += offsetCout * valueHoWo_ + offsetMAL1; |
| 469 | } else { | 469 | } else { |
| 470 | - offset += offsetMAL1 * self_->ctx.convTilingData->convApiTiling.orgCo + offsetCout; | 470 | + offset += offsetMAL1 * self_->ctx.convTilingData->orgCo + offsetCout; |
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | return offset; | 473 | return offset; |
| @@ -497,9 +497,9 @@ private: | |||
| 497 | return 0; | 497 | return 0; |
| 498 | } | 498 | } |
| 499 | if constexpr (Intf::isQuantScene) { | 499 | if constexpr (Intf::isQuantScene) { |
| 500 | - if (self_->ctx.convTilingData->convApiTiling.hasScale != 0 && self_->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 500 | + if (self_->ctx.convTilingData->hasScale != 0 && self_->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 501 | - return self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 501 | + return self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 502 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 502 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 503 | } | 503 | } |
| 504 | } | 504 | } |
| 505 | 505 | ||
| @@ -511,9 +511,9 @@ private: | |||
| 511 | if constexpr (Intf::isKL1NL0FullLoad) { | 511 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 512 | return 0; | 512 | return 0; |
| 513 | } | 513 | } |
| 514 | - if (self_->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 514 | + if (self_->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 515 | - return self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 515 | + return self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 516 | - self_->ctx.nL0Iter * self_->ctx.convTilingData->convApiTiling.nL0; | 516 | + self_->ctx.nL0Iter * self_->ctx.convTilingData->nL0; |
| 517 | } | 517 | } |
| 518 | return 0; | 518 | return 0; |
| 519 | } | 519 | } |
| @@ -63,14 +63,14 @@ public: | |||
| 63 | uint64_t weightOneGroupSize = 0; | 63 | uint64_t weightOneGroupSize = 0; |
| 64 | if constexpr (Intf::formatWeight == ConvFormat::NCHW) { | 64 | if constexpr (Intf::formatWeight == ConvFormat::NCHW) { |
| 65 | weightOneGroupSize = self_->ctx.coPerGroup * self_->ctx.ciPerGroup * self_->ctx.enlarge * | 65 | weightOneGroupSize = self_->ctx.coPerGroup * self_->ctx.ciPerGroup * self_->ctx.enlarge * |
| 66 | - self_->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD; | 66 | + self_->ctx.convTilingData->kernelHxkernelWxkernelD; |
| 67 | } else if constexpr (Intf::formatWeight == ConvFormat::HWCN) { | 67 | } else if constexpr (Intf::formatWeight == ConvFormat::HWCN) { |
| 68 | weightOneGroupSize = self_->ctx.coPerGroup * self_->ctx.enlarge; | 68 | weightOneGroupSize = self_->ctx.coPerGroup * self_->ctx.enlarge; |
| 69 | } | 69 | } |
| 70 | gmOffset = weightOneGroupSize * self_->ctx.groupOptIter; | 70 | gmOffset = weightOneGroupSize * self_->ctx.groupOptIter; |
| 71 | } | 71 | } |
| 72 | if constexpr (Intf::formatOutput == ConvFormat::NDHWC || Intf::formatOutput == ConvFormat::NHWC) { | 72 | if constexpr (Intf::formatOutput == ConvFormat::NDHWC || Intf::formatOutput == ConvFormat::NHWC) { |
| 73 | - uint64_t curSrcCoOpt = self_->ctx.convTilingData->convApiTiling.orgCo; | 73 | + uint64_t curSrcCoOpt = self_->ctx.convTilingData->orgCo; |
| 74 | copyParamsHWC.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = curSrcCoOpt; | 74 | copyParamsHWC.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = curSrcCoOpt; |
| 75 | copyParamsHWC.loopInfo.loopSrcStride[NDDMA_LOOP3_INDEX] = curSrcCoOpt * self_->ctx.ciPerGroup; | 75 | copyParamsHWC.loopInfo.loopSrcStride[NDDMA_LOOP3_INDEX] = curSrcCoOpt * self_->ctx.ciPerGroup; |
| 76 | copyParamsHWC.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = self_->ctx.singleGroups; | 76 | copyParamsHWC.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = self_->ctx.singleGroups; |
| @@ -86,7 +86,7 @@ public: | |||
| 86 | private: | 86 | private: |
| 87 | __aicore__ inline void NDDMAFirstSetCopyParamsCHW() | 87 | __aicore__ inline void NDDMAFirstSetCopyParamsCHW() |
| 88 | { | 88 | { |
| 89 | - uint64_t srcKSize = self_->ctx.ciPerGroup * self_->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD; | 89 | + uint64_t srcKSize = self_->ctx.ciPerGroup * self_->ctx.convTilingData->kernelHxkernelWxkernelD; |
| 90 | // NDDMA Loop0 params | 90 | // NDDMA Loop0 params |
| 91 | copyParams.loopInfo.loopSize[NDDMA_LOOP0_INDEX] = srcKSize; | 91 | copyParams.loopInfo.loopSize[NDDMA_LOOP0_INDEX] = srcKSize; |
| 92 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = 1; | 92 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = 1; |
| @@ -115,7 +115,7 @@ __aicore__ inline void NDDMAFirstSetCopyParamsCHW() | |||
| 115 | copyParamsHWC.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = self_->ctx.coOptAlign * self_->ctx.ciPerGroup + | 115 | copyParamsHWC.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = self_->ctx.coOptAlign * self_->ctx.ciPerGroup + |
| 116 | self_->ctx.coPerGroup; | 116 | self_->ctx.coPerGroup; |
| 117 | // NDDMA Loop3 params | 117 | // NDDMA Loop3 params |
| 118 | - copyParamsHWC.loopInfo.loopSize[NDDMA_LOOP3_INDEX] = self_->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD; | 118 | + copyParamsHWC.loopInfo.loopSize[NDDMA_LOOP3_INDEX] = self_->ctx.convTilingData->kernelHxkernelWxkernelD; |
| 119 | copyParamsHWC.loopInfo.loopDstStride[NDDMA_LOOP3_INDEX] = self_->ctx.coOptAlign * self_->ctx.ciOptAlign; | 119 | copyParamsHWC.loopInfo.loopDstStride[NDDMA_LOOP3_INDEX] = self_->ctx.coOptAlign * self_->ctx.ciOptAlign; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| @@ -173,7 +173,7 @@ private: | |||
| 173 | for (uint8_t idx = 0; idx < Intf::k0; ++idx) { | 173 | for (uint8_t idx = 0; idx < Intf::k0; ++idx) { |
| 174 | indexTensor.SetValue(idx, curValue); | 174 | indexTensor.SetValue(idx, curValue); |
| 175 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW || Intf::formatOutput == ConvFormat::NCHW) { | 175 | if constexpr (Intf::formatOutput == ConvFormat::NCDHW || Intf::formatOutput == ConvFormat::NCHW) { |
| 176 | - curValue += self_->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD; | 176 | + curValue += self_->ctx.convTilingData->kernelHxkernelWxkernelD; |
| 177 | } else { | 177 | } else { |
| 178 | curValue += self_->ctx.coOptAlign; | 178 | curValue += self_->ctx.coOptAlign; |
| 179 | } | 179 | } |
| @@ -212,10 +212,10 @@ private: | |||
| 212 | { | 212 | { |
| 213 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; | 213 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; |
| 214 | uint16_t coLoopTimes = coOptLoopTimes; | 214 | uint16_t coLoopTimes = coOptLoopTimes; |
| 215 | - uint16_t khkwLoopTimes = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 215 | + uint16_t khkwLoopTimes = self_->ctx.convTilingData->kernelHxkernelW; |
| 216 | - uint32_t srcCiStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * Intf::k0; | 216 | + uint32_t srcCiStride = self_->ctx.convTilingData->kernelHxkernelW * Intf::k0; |
| 217 | uint32_t srcCoStride = coPerReg * self_->ctx.kUbSize; | 217 | uint32_t srcCoStride = coPerReg * self_->ctx.kUbSize; |
| 218 | - uint32_t dstCiStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; | 218 | + uint32_t dstCiStride = self_->ctx.convTilingData->kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; |
| 219 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; | 219 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; |
| 220 | uint32_t dstCoStride = coPerReg * Intf::k0; | 220 | uint32_t dstCoStride = coPerReg * Intf::k0; |
| 221 | 221 | ||
| @@ -265,16 +265,16 @@ private: | |||
| 265 | 265 | ||
| 266 | __aicore__ inline void TransNCDHW2NZ() | 266 | __aicore__ inline void TransNCDHW2NZ() |
| 267 | { | 267 | { |
| 268 | - uint16_t kdLoopTimes = self_->ctx.convTilingData->convApiTiling.kernelD; | 268 | + uint16_t kdLoopTimes = self_->ctx.convTilingData->kernelD; |
| 269 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; | 269 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; |
| 270 | uint16_t coLoopTimes = coOptLoopTimes; | 270 | uint16_t coLoopTimes = coOptLoopTimes; |
| 271 | - uint16_t khkwLoopTimes = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 271 | + uint16_t khkwLoopTimes = self_->ctx.convTilingData->kernelHxkernelW; |
| 272 | - uint32_t srcCiStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD * Intf::k0; | 272 | + uint32_t srcCiStride = self_->ctx.convTilingData->kernelHxkernelWxkernelD * Intf::k0; |
| 273 | uint32_t srcCoStride = coPerReg * self_->ctx.kUbSize; | 273 | uint32_t srcCoStride = coPerReg * self_->ctx.kUbSize; |
| 274 | - uint32_t dstCiStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; | 274 | + uint32_t dstCiStride = self_->ctx.convTilingData->kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; |
| 275 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; | 275 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; |
| 276 | uint32_t dstCoStride = coPerReg * Intf::k0; | 276 | uint32_t dstCoStride = coPerReg * Intf::k0; |
| 277 | - uint32_t srcKdStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 277 | + uint32_t srcKdStride = self_->ctx.convTilingData->kernelHxkernelW; |
| 278 | uint32_t dstKdStride = self_->ctx.ci1Opt * dstCiStride; | 278 | uint32_t dstKdStride = self_->ctx.ci1Opt * dstCiStride; |
| 279 | 279 | ||
| 280 | __VEC_SCOPE__ | 280 | __VEC_SCOPE__ |
| @@ -324,19 +324,19 @@ private: | |||
| 324 | 324 | ||
| 325 | __aicore__ inline void TransNDHWC2NZ() | 325 | __aicore__ inline void TransNDHWC2NZ() |
| 326 | { | 326 | { |
| 327 | - uint16_t kdLoopTimes = self_->ctx.convTilingData->convApiTiling.kernelD; | 327 | + uint16_t kdLoopTimes = self_->ctx.convTilingData->kernelD; |
| 328 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; | 328 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; |
| 329 | uint16_t coLoopTimes = coOptLoopTimes; | 329 | uint16_t coLoopTimes = coOptLoopTimes; |
| 330 | - uint16_t khkwLoopTimes = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 330 | + uint16_t khkwLoopTimes = self_->ctx.convTilingData->kernelHxkernelW; |
| 331 | uint32_t srcGroupOptSize = self_->ctx.coOptAlign * self_->ctx.ciOptAlign; | 331 | uint32_t srcGroupOptSize = self_->ctx.coOptAlign * self_->ctx.ciOptAlign; |
| 332 | uint32_t srcCiStride = self_->ctx.coOptAlign * Intf::k0; | 332 | uint32_t srcCiStride = self_->ctx.coOptAlign * Intf::k0; |
| 333 | uint32_t srcCoStride = coPerReg; | 333 | uint32_t srcCoStride = coPerReg; |
| 334 | - uint32_t dstCiStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; | 334 | + uint32_t dstCiStride = self_->ctx.convTilingData->kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; |
| 335 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; | 335 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; |
| 336 | uint32_t srcKhKwStride = srcGroupOptSize; | 336 | uint32_t srcKhKwStride = srcGroupOptSize; |
| 337 | uint32_t dstCoStride = coPerReg * Intf::k0; | 337 | uint32_t dstCoStride = coPerReg * Intf::k0; |
| 338 | - uint32_t srcKdStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * srcGroupOptSize; | 338 | + uint32_t srcKdStride = self_->ctx.convTilingData->kernelHxkernelW * srcGroupOptSize; |
| 339 | - uint32_t dstKdStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * self_->ctx.coOptAlign * | 339 | + uint32_t dstKdStride = self_->ctx.convTilingData->kernelHxkernelW * self_->ctx.coOptAlign * |
| 340 | self_->ctx.ci1Opt * Intf::k0; // ci1Opt has updated in groupOptTail | 340 | self_->ctx.ci1Opt * Intf::k0; // ci1Opt has updated in groupOptTail |
| 341 | __VEC_SCOPE__ | 341 | __VEC_SCOPE__ |
| 342 | { | 342 | { |
| @@ -386,12 +386,12 @@ private: | |||
| 386 | __aicore__ inline void TransNHWC2NZ() | 386 | __aicore__ inline void TransNHWC2NZ() |
| 387 | { | 387 | { |
| 388 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; | 388 | uint16_t ciLoopTimes = self_->ctx.ci1Opt; |
| 389 | - uint16_t khkwLoopTimes = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 389 | + uint16_t khkwLoopTimes = self_->ctx.convTilingData->kernelHxkernelW; |
| 390 | uint16_t coLoopTimes = coOptLoopTimes; | 390 | uint16_t coLoopTimes = coOptLoopTimes; |
| 391 | uint32_t srcCiStride = self_->ctx.coOptAlign * Intf::k0; | 391 | uint32_t srcCiStride = self_->ctx.coOptAlign * Intf::k0; |
| 392 | uint32_t srcKhKwStride = self_->ctx.coOptAlign * self_->ctx.ciOptAlign; | 392 | uint32_t srcKhKwStride = self_->ctx.coOptAlign * self_->ctx.ciOptAlign; |
| 393 | uint32_t srcCoStride = coPerReg; | 393 | uint32_t srcCoStride = coPerReg; |
| 394 | - uint32_t dstCiStride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; | 394 | + uint32_t dstCiStride = self_->ctx.convTilingData->kernelHxkernelW * Intf::k0 * self_->ctx.coOptAlign; |
| 395 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; | 395 | uint32_t dstKhKwStride = Intf::k0 * self_->ctx.coOptAlign; |
| 396 | uint32_t dstCoStride = coPerReg * Intf::k0; | 396 | uint32_t dstCoStride = coPerReg * Intf::k0; |
| 397 | 397 | ||
| @@ -485,37 +485,37 @@ private: | |||
| 485 | __aicore__ inline void SetCopyParams2D() | 485 | __aicore__ inline void SetCopyParams2D() |
| 486 | { | 486 | { |
| 487 | if (unlikely(self_->ctx.groupOptIter == self_->ctx.vecId)) { | 487 | if (unlikely(self_->ctx.groupOptIter == self_->ctx.vecId)) { |
| 488 | - copyParams.blockCount = self_->ctx.convTilingData->convApiTiling.kBL1 / Intf::k0; | 488 | + copyParams.blockCount = self_->ctx.convTilingData->kBL1 / Intf::k0; |
| 489 | - copyParams.blockLen = self_->ctx.convTilingData->convApiTiling.nBL1; | 489 | + copyParams.blockLen = self_->ctx.convTilingData->nBL1; |
| 490 | - copyParams.srcStride = self_->ctx.co1Opt * BLOCK_L0_N - self_->ctx.convTilingData->convApiTiling.nBL1; | 490 | + copyParams.srcStride = self_->ctx.co1Opt * BLOCK_L0_N - self_->ctx.convTilingData->nBL1; |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | if constexpr (Intf::isKL1NL0FullLoad) { | 493 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 494 | srcOffset = self_->ctx.coStartPos * Intf::k0 + | 494 | srcOffset = self_->ctx.coStartPos * Intf::k0 + |
| 495 | - self_->ctx.kBL1Iter * self_->ctx.convTilingData->convApiTiling.kBL1 * self_->ctx.coOptAlign; | 495 | + self_->ctx.kBL1Iter * self_->ctx.convTilingData->kBL1 * self_->ctx.coOptAlign; |
| 496 | } else { | 496 | } else { |
| 497 | - srcOffset = (self_->ctx.coStartPos + self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1) * Intf::k0 + | 497 | + srcOffset = (self_->ctx.coStartPos + self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1) * Intf::k0 + |
| 498 | - self_->ctx.kBL1Iter * self_->ctx.convTilingData->convApiTiling.kBL1 * self_->ctx.coOptAlign; | 498 | + self_->ctx.kBL1Iter * self_->ctx.convTilingData->kBL1 * self_->ctx.coOptAlign; |
| 499 | } | 499 | } |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | __aicore__ inline void SetCopyParams3D() | 502 | __aicore__ inline void SetCopyParams3D() |
| 503 | { | 503 | { |
| 504 | if (unlikely(self_->ctx.loadUB2L1Iter == 0)) { | 504 | if (unlikely(self_->ctx.loadUB2L1Iter == 0)) { |
| 505 | - copyParams.blockLen = self_->ctx.convTilingData->convApiTiling.nBL1; | 505 | + copyParams.blockLen = self_->ctx.convTilingData->nBL1; |
| 506 | - copyParams.srcStride = self_->ctx.co1Opt * BLOCK_L0_N - self_->ctx.convTilingData->convApiTiling.nBL1; | 506 | + copyParams.srcStride = self_->ctx.co1Opt * BLOCK_L0_N - self_->ctx.convTilingData->nBL1; |
| 507 | - kOffset = self_->ctx.bL1Dk * self_->ctx.bL1Cin * self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 507 | + kOffset = self_->ctx.bL1Dk * self_->ctx.bL1Cin * self_->ctx.convTilingData->kernelHxkernelW; |
| 508 | } | 508 | } |
| 509 | 509 | ||
| 510 | uint64_t currentBL1Dk = IsKBL1Tail() ? self_->ctx.bL1DkTail : self_->ctx.bL1Dk; | 510 | uint64_t currentBL1Dk = IsKBL1Tail() ? self_->ctx.bL1DkTail : self_->ctx.bL1Dk; |
| 511 | uint64_t currentBL1Cin1 = IsKBL1Tail() ? self_->ctx.bL1CinTail : self_->ctx.bL1Cin; | 511 | uint64_t currentBL1Cin1 = IsKBL1Tail() ? self_->ctx.bL1CinTail : self_->ctx.bL1Cin; |
| 512 | copyParams.blockCount = currentBL1Dk * CeilDiv(currentBL1Cin1, Intf::k0) * | 512 | copyParams.blockCount = currentBL1Dk * CeilDiv(currentBL1Cin1, Intf::k0) * |
| 513 | - self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 513 | + self_->ctx.convTilingData->kernelHxkernelW; |
| 514 | 514 | ||
| 515 | if constexpr (Intf::isKL1NL0FullLoad) { | 515 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 516 | srcOffset = self_->ctx.coStartPos * Intf::k0 + self_->ctx.kBL1Iter * kOffset * self_->ctx.coOptAlign; | 516 | srcOffset = self_->ctx.coStartPos * Intf::k0 + self_->ctx.kBL1Iter * kOffset * self_->ctx.coOptAlign; |
| 517 | } else { | 517 | } else { |
| 518 | - srcOffset = (self_->ctx.coStartPos + self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1) * Intf::k0 + | 518 | + srcOffset = (self_->ctx.coStartPos + self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1) * Intf::k0 + |
| 519 | self_->ctx.kBL1Iter * kOffset * self_->ctx.coOptAlign; | 519 | self_->ctx.kBL1Iter * kOffset * self_->ctx.coOptAlign; |
| 520 | } | 520 | } |
| 521 | } | 521 | } |
| @@ -61,10 +61,10 @@ template <class Intf> | |||
| 61 | static __aicore__ inline void InitBatchDirectionValue(Intf *self) | 61 | static __aicore__ inline void InitBatchDirectionValue(Intf *self) |
| 62 | { | 62 | { |
| 63 | if constexpr (Intf::isInnerBatchFlag) { | 63 | if constexpr (Intf::isInnerBatchFlag) { |
| 64 | - self->ctx.ddr2l1LoopBatch = CeilDiv(self->ctx.singleCoreBatch, self->ctx.convTilingData->convApiTiling.innerBatch); | 64 | + self->ctx.ddr2l1LoopBatch = CeilDiv(self->ctx.singleCoreBatch, self->ctx.convTilingData->innerBatch); |
| 65 | - self->ctx.innerBatchTail = self->ctx.singleCoreBatch % self->ctx.convTilingData->convApiTiling.innerBatch; | 65 | + self->ctx.innerBatchTail = self->ctx.singleCoreBatch % self->ctx.convTilingData->innerBatch; |
| 66 | self->ctx.innerBatchTail = self->ctx.innerBatchTail == 0 ? | 66 | self->ctx.innerBatchTail = self->ctx.innerBatchTail == 0 ? |
| 67 | - self->ctx.convTilingData->convApiTiling.innerBatch : self->ctx.innerBatchTail; | 67 | + self->ctx.convTilingData->innerBatch : self->ctx.innerBatchTail; |
| 68 | } else { | 68 | } else { |
| 69 | self->ctx.ddr2l1LoopBatch = self->ctx.singleCoreBatch; | 69 | self->ctx.ddr2l1LoopBatch = self->ctx.singleCoreBatch; |
| 70 | } | 70 | } |
| @@ -73,16 +73,16 @@ static __aicore__ inline void InitBatchDirectionValue(Intf *self) | |||
| 73 | template <class Intf> | 73 | template <class Intf> |
| 74 | static __aicore__ inline void InitCoDirectionValue(Intf *self) | 74 | static __aicore__ inline void InitCoDirectionValue(Intf *self) |
| 75 | { | 75 | { |
| 76 | - self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->convApiTiling.nBL1; | 76 | + self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->nBL1; |
| 77 | - self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.nBL1 : self->ctx.nBL1Tail; | 77 | + self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->nBL1 : self->ctx.nBL1Tail; |
| 78 | - self->ctx.nL0Tail = self->ctx.nBL1Tail % self->ctx.convTilingData->convApiTiling.nL0; | 78 | + self->ctx.nL0Tail = self->ctx.nBL1Tail % self->ctx.convTilingData->nL0; |
| 79 | - self->ctx.nL0Tail = self->ctx.nL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.nL0 : self->ctx.nL0Tail; | 79 | + self->ctx.nL0Tail = self->ctx.nL0Tail == 0 ? self->ctx.convTilingData->nL0 : self->ctx.nL0Tail; |
| 80 | 80 | ||
| 81 | if constexpr (!Intf::hasNL1IterFlag) { | 81 | if constexpr (!Intf::hasNL1IterFlag) { |
| 82 | self->ctx.maxNBL1Iter = 0; | 82 | self->ctx.maxNBL1Iter = 0; |
| 83 | self->ctx.ddr2l1LoopN = 1; | 83 | self->ctx.ddr2l1LoopN = 1; |
| 84 | } else { | 84 | } else { |
| 85 | - self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->convApiTiling.nBL1); | 85 | + self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->nBL1); |
| 86 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; | 86 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| @@ -91,7 +91,7 @@ static __aicore__ inline void InitCoDirectionValue(Intf *self) | |||
| 91 | self->ctx.maxNL0Iter = 0; | 91 | self->ctx.maxNL0Iter = 0; |
| 92 | } else if constexpr (Intf::groupOptFlag || Intf::weightUbTrans) { | 92 | } else if constexpr (Intf::groupOptFlag || Intf::weightUbTrans) { |
| 93 | self->ctx.l12l0LoopN = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? | 93 | self->ctx.l12l0LoopN = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? |
| 94 | - CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->convApiTiling.nL0) : self->ctx.convTilingData->convApiTiling.multiNBL1; | 94 | + CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->nL0) : self->ctx.convTilingData->multiNBL1; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | if constexpr (Intf::WEIGHT_NZ_FLAG) { | 97 | if constexpr (Intf::WEIGHT_NZ_FLAG) { |
| @@ -105,7 +105,7 @@ __aicore__ inline void CalcCoDirectionVar(Intf *self) | |||
| 105 | { | 105 | { |
| 106 | if constexpr (Intf::hasNL0IterFlag) { | 106 | if constexpr (Intf::hasNL0IterFlag) { |
| 107 | self->ctx.l12l0LoopN = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? | 107 | self->ctx.l12l0LoopN = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? |
| 108 | - CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->convApiTiling.nL0) : self->ctx.convTilingData->convApiTiling.multiNBL1; | 108 | + CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->nL0) : self->ctx.convTilingData->multiNBL1; |
| 109 | self->ctx.maxNL0Iter = self->ctx.l12l0LoopN - 1; | 109 | self->ctx.maxNL0Iter = self->ctx.l12l0LoopN - 1; |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| @@ -118,7 +118,7 @@ __aicore__ inline uint64_t CalcCurrentNL0(Intf *self) | |||
| 118 | return self->ctx.nL0Tail; | 118 | return self->ctx.nL0Tail; |
| 119 | } else { | 119 | } else { |
| 120 | bool isNL0Tail = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter && self->ctx.nL0Iter == self->ctx.maxNL0Iter; | 120 | bool isNL0Tail = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter && self->ctx.nL0Iter == self->ctx.maxNL0Iter; |
| 121 | - uint64_t currentNL0 = isNL0Tail ? self->ctx.nL0Tail : self->ctx.convTilingData->convApiTiling.nL0; | 121 | + uint64_t currentNL0 = isNL0Tail ? self->ctx.nL0Tail : self->ctx.convTilingData->nL0; |
| 122 | self->ctx.currentNL0Align = isNL0Tail ? AlignB(currentNL0, BLOCK_L0_N) : currentNL0; | 122 | self->ctx.currentNL0Align = isNL0Tail ? AlignB(currentNL0, BLOCK_L0_N) : currentNL0; |
| 123 | return currentNL0; | 123 | return currentNL0; |
| 124 | } | 124 | } |
| @@ -144,9 +144,9 @@ __aicore__ inline uint64_t CalcCurrentML0HWMode(Intf *self) | |||
| 144 | return currentML0; | 144 | return currentML0; |
| 145 | } else { | 145 | } else { |
| 146 | uint64_t currentML0 = self->ctx.currentHoL0 * self->ctx.currentWoL0; | 146 | uint64_t currentML0 = self->ctx.currentHoL0 * self->ctx.currentWoL0; |
| 147 | - if (self->ctx.currentWoL0 == self->ctx.convTilingData->convApiTiling.woL0 && | 147 | + if (self->ctx.currentWoL0 == self->ctx.convTilingData->woL0 && |
| 148 | - self->ctx.currentHoL0 == self->ctx.convTilingData->convApiTiling.hoL0) { | 148 | + self->ctx.currentHoL0 == self->ctx.convTilingData->hoL0) { |
| 149 | - self->ctx.currentML0Align = self->ctx.convTilingData->convApiTiling.mStep; | 149 | + self->ctx.currentML0Align = self->ctx.convTilingData->mStep; |
| 150 | } else { | 150 | } else { |
| 151 | self->ctx.currentML0Align = AlignB(currentML0, BLOCK_L0_N); | 151 | self->ctx.currentML0Align = AlignB(currentML0, BLOCK_L0_N); |
| 152 | } | 152 | } |
| @@ -159,7 +159,7 @@ template <class Intf> | |||
| 159 | __aicore__ inline void LoadAL1BaseModule(Intf *self) | 159 | __aicore__ inline void LoadAL1BaseModule(Intf *self) |
| 160 | { | 160 | { |
| 161 | if constexpr (Intf::preFusionFlag) { | 161 | if constexpr (Intf::preFusionFlag) { |
| 162 | - if ((self->ctx.convTilingData->convApiTiling.pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { | 162 | + if ((self->ctx.convTilingData->pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { |
| 163 | self->ctx.al1PingPongFlag ^= 1; | 163 | self->ctx.al1PingPongFlag ^= 1; |
| 164 | } | 164 | } |
| 165 | self->ctx.al1 = LocalTensor<typename Intf::FmapT>(TPosition::A1, 0, 0); | 165 | self->ctx.al1 = LocalTensor<typename Intf::FmapT>(TPosition::A1, 0, 0); |
| @@ -216,7 +216,7 @@ __aicore__ inline void LoadBL1BaseModule(Intf *self) | |||
| 216 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(self->ctx.pingPongFlag * VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); | 216 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(self->ctx.pingPongFlag * VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); |
| 217 | } else { | 217 | } else { |
| 218 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE3_MTE1); | 218 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE3_MTE1); |
| 219 | - if (self->ctx.convTilingData->convApiTiling.nBL1 > BLOCK_L0_N) { | 219 | + if (self->ctx.convTilingData->nBL1 > BLOCK_L0_N) { |
| 220 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); | 220 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); |
| 221 | } | 221 | } |
| 222 | } | 222 | } |
| @@ -241,7 +241,7 @@ __aicore__ inline void LoadBL1BaseModule(Intf *self, TempIters& tempIters) | |||
| 241 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(self->ctx.pingPongFlag * VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); | 241 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(self->ctx.pingPongFlag * VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); |
| 242 | } else { | 242 | } else { |
| 243 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE3_MTE1); | 243 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE3_MTE1); |
| 244 | - if (self->ctx.convTilingData->convApiTiling.nBL1 > BLOCK_L0_N) { | 244 | + if (self->ctx.convTilingData->nBL1 > BLOCK_L0_N) { |
| 245 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); | 245 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); |
| 246 | } | 246 | } |
| 247 | } | 247 | } |
| @@ -278,7 +278,7 @@ const uint64_t &KStartPosition, const uint64_t &kStep, const MmadParams &mmadPar | |||
| 278 | event_t eventID = static_cast<event_t>(L0_SYBC_DB_CLOSE); | 278 | event_t eventID = static_cast<event_t>(L0_SYBC_DB_CLOSE); |
| 279 | AscendC::WaitFlag<AscendC::HardEvent::M_MTE1>(eventID); | 279 | AscendC::WaitFlag<AscendC::HardEvent::M_MTE1>(eventID); |
| 280 | const LocalTensor<typename Intf::FmapT> &al0 = self->ctx.wholeAl0Tensor; | 280 | const LocalTensor<typename Intf::FmapT> &al0 = self->ctx.wholeAl0Tensor; |
| 281 | - if (self->ctx.convTilingData->convApiTiling.kAL1 != self->ctx.convTilingData->convApiTiling.kL0 || self->ctx.loadAL0Flag) { | 281 | + if (self->ctx.convTilingData->kAL1 != self->ctx.convTilingData->kL0 || self->ctx.loadAL0Flag) { |
| 282 | self->ctx.loadAL0Ins.LoadAL0(currentKL0, posK, kIter, al0); | 282 | self->ctx.loadAL0Ins.LoadAL0(currentKL0, posK, kIter, al0); |
| 283 | } | 283 | } |
| 284 | 284 | ||
| @@ -289,11 +289,11 @@ const uint64_t &KStartPosition, const uint64_t &kStep, const MmadParams &mmadPar | |||
| 289 | LocalTensor<typename Intf::WeightT> bl0; | 289 | LocalTensor<typename Intf::WeightT> bl0; |
| 290 | if constexpr (Intf::isL0BFullLoadable) { | 290 | if constexpr (Intf::isL0BFullLoadable) { |
| 291 | bl0 = | 291 | bl0 = |
| 292 | - self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->convApiTiling.nL0 * self->ctx.convTilingData->convApiTiling.kL0]; | 292 | + self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->nL0 * self->ctx.convTilingData->kL0]; |
| 293 | } else { | 293 | } else { |
| 294 | bl0 = self->ctx.wholeBl0Tensor; | 294 | bl0 = self->ctx.wholeBl0Tensor; |
| 295 | } | 295 | } |
| 296 | - if (self->ctx.convTilingData->convApiTiling.kBL1 != self->ctx.convTilingData->convApiTiling.kL0 || self->ctx.loadBL0Flag) { | 296 | + if (self->ctx.convTilingData->kBL1 != self->ctx.convTilingData->kL0 || self->ctx.loadBL0Flag) { |
| 297 | if constexpr (!Intf::isL0BFullLoadable) { | 297 | if constexpr (!Intf::isL0BFullLoadable) { |
| 298 | self->ctx.loadBL0Ins.LoadBL0(KStartPosition, kStep, bl0); | 298 | self->ctx.loadBL0Ins.LoadBL0(KStartPosition, kStep, bl0); |
| 299 | } | 299 | } |
| @@ -331,11 +331,11 @@ const uint64_t &posK, const uint64_t &KStartPosition, const uint64_t &kStep, con | |||
| 331 | LocalTensor<typename Intf::WeightT> bl0; | 331 | LocalTensor<typename Intf::WeightT> bl0; |
| 332 | if constexpr (Intf::isL0BFullLoadable) { | 332 | if constexpr (Intf::isL0BFullLoadable) { |
| 333 | bl0 = | 333 | bl0 = |
| 334 | - self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->convApiTiling.nL0 * self->ctx.convTilingData->convApiTiling.kL0]; | 334 | + self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->nL0 * self->ctx.convTilingData->kL0]; |
| 335 | } else { | 335 | } else { |
| 336 | bl0 = self->ctx.wholeBl0Tensor; | 336 | bl0 = self->ctx.wholeBl0Tensor; |
| 337 | } | 337 | } |
| 338 | - if (self->ctx.convTilingData->convApiTiling.kBL1 != self->ctx.convTilingData->convApiTiling.kL0 || self->ctx.loadBL0Flag) { | 338 | + if (self->ctx.convTilingData->kBL1 != self->ctx.convTilingData->kL0 || self->ctx.loadBL0Flag) { |
| 339 | // BL0 wait MMAD | 339 | // BL0 wait MMAD |
| 340 | event_t e = static_cast<event_t>(al0PingPongFlag ^ 1); | 340 | event_t e = static_cast<event_t>(al0PingPongFlag ^ 1); |
| 341 | AscendC::WaitFlag<AscendC::HardEvent::M_MTE1>(e); | 341 | AscendC::WaitFlag<AscendC::HardEvent::M_MTE1>(e); |
| @@ -374,7 +374,7 @@ const uint64_t ¤tKL0, const uint64_t &posK, const uint64_t &KStartPosition | |||
| 374 | 374 | ||
| 375 | if constexpr (Intf::isL0BFullLoadable) { | 375 | if constexpr (Intf::isL0BFullLoadable) { |
| 376 | bl0 = | 376 | bl0 = |
| 377 | - self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->convApiTiling.nL0 * self->ctx.convTilingData->convApiTiling.kL0]; | 377 | + self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->nL0 * self->ctx.convTilingData->kL0]; |
| 378 | } else { | 378 | } else { |
| 379 | bl0 = self->ctx.wholeBl0Tensor[(bl0PingPongFlag) * L0B_HALF_SIZE / Intf::sizeOfWeight]; | 379 | bl0 = self->ctx.wholeBl0Tensor[(bl0PingPongFlag) * L0B_HALF_SIZE / Intf::sizeOfWeight]; |
| 380 | self->ctx.loadBL0Ins.LoadBL0(KStartPosition, kStep, bl0); | 380 | self->ctx.loadBL0Ins.LoadBL0(KStartPosition, kStep, bl0); |
| @@ -390,7 +390,7 @@ const uint64_t ¤tKL0, const uint64_t &posK, const uint64_t &KStartPosition | |||
| 390 | self->ctx.weightUbProcessTools.WeightUbTransSyncSet(self, kIter); | 390 | self->ctx.weightUbProcessTools.WeightUbTransSyncSet(self, kIter); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | - if (self->ctx.convTilingData->convApiTiling.kAL1 != self->ctx.convTilingData->convApiTiling.kL0 || self->ctx.loadAL0Flag) { | 393 | + if (self->ctx.convTilingData->kAL1 != self->ctx.convTilingData->kL0 || self->ctx.loadAL0Flag) { |
| 394 | // AL0 wait MMAD | 394 | // AL0 wait MMAD |
| 395 | event_t e = static_cast<event_t>((bl0PingPongFlag ^ 1)); | 395 | event_t e = static_cast<event_t>((bl0PingPongFlag ^ 1)); |
| 396 | AscendC::WaitFlag<AscendC::HardEvent::M_MTE1>(e); | 396 | AscendC::WaitFlag<AscendC::HardEvent::M_MTE1>(e); |
| @@ -423,7 +423,7 @@ const uint64_t ¤tKL0, const uint64_t &posK, const uint64_t &KStartPosition | |||
| 423 | 423 | ||
| 424 | LocalTensor<typename Intf::WeightT> bl0; | 424 | LocalTensor<typename Intf::WeightT> bl0; |
| 425 | if constexpr (Intf::isL0BFullLoadable) { | 425 | if constexpr (Intf::isL0BFullLoadable) { |
| 426 | - bl0 = self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->convApiTiling.nL0 * self->ctx.convTilingData->convApiTiling.kL0]; | 426 | + bl0 = self->ctx.wholeBl0Tensor[kIter * self->ctx.convTilingData->nL0 * self->ctx.convTilingData->kL0]; |
| 427 | } else { | 427 | } else { |
| 428 | bl0 = self->ctx.wholeBl0Tensor[(al0PingPongFlag) * L0B_HALF_SIZE / Intf::sizeOfWeight]; | 428 | bl0 = self->ctx.wholeBl0Tensor[(al0PingPongFlag) * L0B_HALF_SIZE / Intf::sizeOfWeight]; |
| 429 | self->ctx.loadBL0Ins.LoadBL0(KStartPosition, kStep, bl0); | 429 | self->ctx.loadBL0Ins.LoadBL0(KStartPosition, kStep, bl0); |
| @@ -463,9 +463,9 @@ template <class Intf> | |||
| 463 | __aicore__ inline void SetMNBeforeIterateK(Intf *self, MmadParams &mmadParams) | 463 | __aicore__ inline void SetMNBeforeIterateK(Intf *self, MmadParams &mmadParams) |
| 464 | { | 464 | { |
| 465 | if constexpr (Intf::isInnerBatchFlag) { | 465 | if constexpr (Intf::isInnerBatchFlag) { |
| 466 | - uint16_t maxBatchIter = CeilDiv(self->ctx.singleCoreBatch, self->ctx.convTilingData->convApiTiling.innerBatch) - 1; | 466 | + uint16_t maxBatchIter = CeilDiv(self->ctx.singleCoreBatch, self->ctx.convTilingData->innerBatch) - 1; |
| 467 | self->ctx.innerBatch = self->ctx.batchIter == maxBatchIter ? | 467 | self->ctx.innerBatch = self->ctx.batchIter == maxBatchIter ? |
| 468 | - self->ctx.innerBatchTail : self->ctx.convTilingData->convApiTiling.innerBatch; | 468 | + self->ctx.innerBatchTail : self->ctx.convTilingData->innerBatch; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | uint64_t currentML0 = 0; | 471 | uint64_t currentML0 = 0; |
| @@ -515,8 +515,8 @@ __aicore__ inline void FreeL1Tensor(Intf *self) | |||
| 515 | if constexpr (Intf::groupOptPreloadFlag) { | 515 | if constexpr (Intf::groupOptPreloadFlag) { |
| 516 | self->ctx.queueAL1.FreeTensor(self->ctx.al1); | 516 | self->ctx.queueAL1.FreeTensor(self->ctx.al1); |
| 517 | } else if constexpr (Intf::isMPreLoad) { | 517 | } else if constexpr (Intf::isMPreLoad) { |
| 518 | - if ((self->ctx.mL0Iter + 1) % CeilDiv(self->ctx.convTilingData->convApiTiling.hoL1, | 518 | + if ((self->ctx.mL0Iter + 1) % CeilDiv(self->ctx.convTilingData->hoL1, |
| 519 | - self->ctx.convTilingData->convApiTiling.hoL0) == 0) { | 519 | + self->ctx.convTilingData->hoL0) == 0) { |
| 520 | self->ctx.queueAL1.FreeTensor(self->ctx.al1); | 520 | self->ctx.queueAL1.FreeTensor(self->ctx.al1); |
| 521 | } | 521 | } |
| 522 | } else { | 522 | } else { |
| @@ -533,7 +533,7 @@ __aicore__ inline void FreeL1Tensor(Intf *self) | |||
| 533 | } | 533 | } |
| 534 | 534 | ||
| 535 | if (self->ctx.enableBias) { | 535 | if (self->ctx.enableBias) { |
| 536 | - if (!self->ctx.convTilingData->convApiTiling.biasFullLoadFlag) { | 536 | + if (!self->ctx.convTilingData->biasFullLoadFlag) { |
| 537 | self->ctx.queueBiasL1.FreeTensor(self->ctx.biasL1); | 537 | self->ctx.queueBiasL1.FreeTensor(self->ctx.biasL1); |
| 538 | } | 538 | } |
| 539 | 539 | ||
| @@ -546,14 +546,14 @@ __aicore__ inline bool CheckReduceOneKNotSupportDBCase(Intf *self) | |||
| 546 | { | 546 | { |
| 547 | // when only L0A pingpong and L0B not pingpong, L0B tensor need full load for template ReduceKOpenL0APingPong | 547 | // when only L0A pingpong and L0B not pingpong, L0B tensor need full load for template ReduceKOpenL0APingPong |
| 548 | if constexpr (Intf::l0PingPong == 1) { | 548 | if constexpr (Intf::l0PingPong == 1) { |
| 549 | - if (self->ctx.convTilingData->convApiTiling.nL0 < self->ctx.singleCoreCo) { | 549 | + if (self->ctx.convTilingData->nL0 < self->ctx.singleCoreCo) { |
| 550 | return true; | 550 | return true; |
| 551 | } | 551 | } |
| 552 | } | 552 | } |
| 553 | // when only L0B pingpong and L0A not pingpong, L0A tensor need full load for template ReduceKOpenL0BPingPong | 553 | // when only L0B pingpong and L0A not pingpong, L0A tensor need full load for template ReduceKOpenL0BPingPong |
| 554 | if constexpr (Intf::l0PingPong == 2) { | 554 | if constexpr (Intf::l0PingPong == 2) { |
| 555 | - if (self->ctx.convTilingData->convApiTiling.hoL0 < self->ctx.convTilingData->convApiTiling.singleCoreHo || | 555 | + if (self->ctx.convTilingData->hoL0 < self->ctx.convTilingData->singleCoreHo || |
| 556 | - self->ctx.convTilingData->convApiTiling.woL0 < self->ctx.convTilingData->convApiTiling.singleCoreWo) { | 556 | + self->ctx.convTilingData->woL0 < self->ctx.convTilingData->singleCoreWo) { |
| 557 | return true; | 557 | return true; |
| 558 | } | 558 | } |
| 559 | } | 559 | } |
| @@ -28,11 +28,11 @@ template <class Intf> | |||
| 28 | static __aicore__ inline void InitHoDirectionValue(Intf *self) | 28 | static __aicore__ inline void InitHoDirectionValue(Intf *self) |
| 29 | { | 29 | { |
| 30 | // Ho方向L1及L0均全载时相关变量赋值 | 30 | // Ho方向L1及L0均全载时相关变量赋值 |
| 31 | - self->ctx.hoAL1Tail = self->ctx.singleCoreHo % self->ctx.convTilingData->convApiTiling.hoL1; | 31 | + self->ctx.hoAL1Tail = self->ctx.singleCoreHo % self->ctx.convTilingData->hoL1; |
| 32 | - self->ctx.hoAL1Tail = self->ctx.hoAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.hoL1 : self->ctx.hoAL1Tail; | 32 | + self->ctx.hoAL1Tail = self->ctx.hoAL1Tail == 0 ? self->ctx.convTilingData->hoL1 : self->ctx.hoAL1Tail; |
| 33 | self->ctx.currentHoL1 = self->ctx.hoAL1Tail; | 33 | self->ctx.currentHoL1 = self->ctx.hoAL1Tail; |
| 34 | - self->ctx.hoL0Tail = self->ctx.currentHoL1 % self->ctx.convTilingData->convApiTiling.hoL0; | 34 | + self->ctx.hoL0Tail = self->ctx.currentHoL1 % self->ctx.convTilingData->hoL0; |
| 35 | - self->ctx.hoL0Tail = self->ctx.hoL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.hoL0 : self->ctx.hoL0Tail; | 35 | + self->ctx.hoL0Tail = self->ctx.hoL0Tail == 0 ? self->ctx.convTilingData->hoL0 : self->ctx.hoL0Tail; |
| 36 | self->ctx.currentHoL0 = self->ctx.hoL0Tail; | 36 | self->ctx.currentHoL0 = self->ctx.hoL0Tail; |
| 37 | 37 | ||
| 38 | // Ho方向变量计算 | 38 | // Ho方向变量计算 |
| @@ -40,7 +40,7 @@ static __aicore__ inline void InitHoDirectionValue(Intf *self) | |||
| 40 | self->ctx.ddr2l1LoopH = 1; | 40 | self->ctx.ddr2l1LoopH = 1; |
| 41 | self->ctx.maxHoL1Iter = 0; | 41 | self->ctx.maxHoL1Iter = 0; |
| 42 | } else { | 42 | } else { |
| 43 | - self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL1); | 43 | + self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL1); |
| 44 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; | 44 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; |
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| @@ -49,26 +49,26 @@ template <class Intf> | |||
| 49 | static __aicore__ inline void InitWoDirectionValue(Intf *self) | 49 | static __aicore__ inline void InitWoDirectionValue(Intf *self) |
| 50 | { | 50 | { |
| 51 | // Wo方向L1及L0均全载时相关变量赋值 | 51 | // Wo方向L1及L0均全载时相关变量赋值 |
| 52 | - self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->convApiTiling.woL1; | 52 | + self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->woL1; |
| 53 | - self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.woL1 : self->ctx.woAL1Tail; | 53 | + self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->woL1 : self->ctx.woAL1Tail; |
| 54 | self->ctx.currentWoL1 = self->ctx.woAL1Tail; | 54 | self->ctx.currentWoL1 = self->ctx.woAL1Tail; |
| 55 | self->ctx.maxWoL1Iter = 0; | 55 | self->ctx.maxWoL1Iter = 0; |
| 56 | - self->ctx.woL0Tail = self->ctx.currentWoL1 % self->ctx.convTilingData->convApiTiling.woL0; | 56 | + self->ctx.woL0Tail = self->ctx.currentWoL1 % self->ctx.convTilingData->woL0; |
| 57 | - self->ctx.woL0Tail = self->ctx.woL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.woL0 : self->ctx.woL0Tail; | 57 | + self->ctx.woL0Tail = self->ctx.woL0Tail == 0 ? self->ctx.convTilingData->woL0 : self->ctx.woL0Tail; |
| 58 | self->ctx.currentWoL0 = self->ctx.woL0Tail; | 58 | self->ctx.currentWoL0 = self->ctx.woL0Tail; |
| 59 | self->ctx.maxWoL0Iter = 0; | 59 | self->ctx.maxWoL0Iter = 0; |
| 60 | self->ctx.l12l0LoopW = 1; | 60 | self->ctx.l12l0LoopW = 1; |
| 61 | 61 | ||
| 62 | // Wo方向变量计算 | 62 | // Wo方向变量计算 |
| 63 | if constexpr (Intf::hasWL1IterFlag) { | 63 | if constexpr (Intf::hasWL1IterFlag) { |
| 64 | - self->ctx.maxWoL1Iter = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL1) - 1; | 64 | + self->ctx.maxWoL1Iter = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL1) - 1; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | if constexpr (!Intf::isDmaFlag) { | 67 | if constexpr (!Intf::isDmaFlag) { |
| 68 | - if (Intf::hasWL0IterFlag && self->ctx.convTilingData->convApiTiling.hoL0 > 1 && self->ctx.woAL1Tail % BLOCK_L0_N > 0 && | 68 | + if (Intf::hasWL0IterFlag && self->ctx.convTilingData->hoL0 > 1 && self->ctx.woAL1Tail % BLOCK_L0_N > 0 && |
| 69 | - CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->convApiTiling.woL0) > 1) { | 69 | + CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->woL0) > 1) { |
| 70 | - self->ctx.woL1SmallTail = self->ctx.woAL1Tail % self->ctx.convTilingData->convApiTiling.woL0; | 70 | + self->ctx.woL1SmallTail = self->ctx.woAL1Tail % self->ctx.convTilingData->woL0; |
| 71 | - self->ctx.woAL1Tail = (self->ctx.woAL1Tail / self->ctx.convTilingData->convApiTiling.woL0) * self->ctx.convTilingData->convApiTiling.woL0; | 71 | + self->ctx.woAL1Tail = (self->ctx.woAL1Tail / self->ctx.convTilingData->woL0) * self->ctx.convTilingData->woL0; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | if (self->ctx.woL1SmallTail > 0) { | 74 | if (self->ctx.woL1SmallTail > 0) { |
| @@ -89,17 +89,17 @@ __aicore__ inline void CalcWoDirectionVar(Intf *self) | |||
| 89 | } else if (self->ctx.woAL1Iter == self->ctx.maxWoL1Iter - 1) { | 89 | } else if (self->ctx.woAL1Iter == self->ctx.maxWoL1Iter - 1) { |
| 90 | self->ctx.currentWoL1 = self->ctx.woAL1Tail; | 90 | self->ctx.currentWoL1 = self->ctx.woAL1Tail; |
| 91 | } else { | 91 | } else { |
| 92 | - self->ctx.currentWoL1 = self->ctx.convTilingData->convApiTiling.woL1; | 92 | + self->ctx.currentWoL1 = self->ctx.convTilingData->woL1; |
| 93 | } | 93 | } |
| 94 | } else { | 94 | } else { |
| 95 | self->ctx.currentWoL1 = self->ctx.woAL1Iter == self->ctx.maxWoL1Iter ? | 95 | self->ctx.currentWoL1 = self->ctx.woAL1Iter == self->ctx.maxWoL1Iter ? |
| 96 | - self->ctx.woAL1Tail : self->ctx.convTilingData->convApiTiling.woL1; | 96 | + self->ctx.woAL1Tail : self->ctx.convTilingData->woL1; |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | if constexpr (Intf::hasWL0IterFlag) { | 99 | if constexpr (Intf::hasWL0IterFlag) { |
| 100 | - self->ctx.woL0Tail = self->ctx.currentWoL1 % self->ctx.convTilingData->convApiTiling.woL0; | 100 | + self->ctx.woL0Tail = self->ctx.currentWoL1 % self->ctx.convTilingData->woL0; |
| 101 | - self->ctx.woL0Tail = self->ctx.woL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.woL0 : self->ctx.woL0Tail; | 101 | + self->ctx.woL0Tail = self->ctx.woL0Tail == 0 ? self->ctx.convTilingData->woL0 : self->ctx.woL0Tail; |
| 102 | - self->ctx.maxWoL0Iter = CeilDiv(self->ctx.currentWoL1, self->ctx.convTilingData->convApiTiling.woL0) - 1; | 102 | + self->ctx.maxWoL0Iter = CeilDiv(self->ctx.currentWoL1, self->ctx.convTilingData->woL0) - 1; |
| 103 | self->ctx.l12l0LoopW = self->ctx.maxWoL0Iter + 1; | 103 | self->ctx.l12l0LoopW = self->ctx.maxWoL0Iter + 1; |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| @@ -109,13 +109,13 @@ __aicore__ inline void CalcHoDirectionVar(Intf *self) | |||
| 109 | { | 109 | { |
| 110 | if constexpr (Intf::hasHL1IterFlag) { | 110 | if constexpr (Intf::hasHL1IterFlag) { |
| 111 | self->ctx.currentHoL1 = self->ctx.hoAL1Iter == self->ctx.maxHoL1Iter ? | 111 | self->ctx.currentHoL1 = self->ctx.hoAL1Iter == self->ctx.maxHoL1Iter ? |
| 112 | - self->ctx.hoAL1Tail : self->ctx.convTilingData->convApiTiling.hoL1; | 112 | + self->ctx.hoAL1Tail : self->ctx.convTilingData->hoL1; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | if constexpr (Intf::hasHL0IterFlag) { | 115 | if constexpr (Intf::hasHL0IterFlag) { |
| 116 | - self->ctx.hoL0Tail = self->ctx.currentHoL1 % self->ctx.convTilingData->convApiTiling.hoL0; | 116 | + self->ctx.hoL0Tail = self->ctx.currentHoL1 % self->ctx.convTilingData->hoL0; |
| 117 | - self->ctx.hoL0Tail = self->ctx.hoL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.hoL0 : self->ctx.hoL0Tail; | 117 | + self->ctx.hoL0Tail = self->ctx.hoL0Tail == 0 ? self->ctx.convTilingData->hoL0 : self->ctx.hoL0Tail; |
| 118 | - self->ctx.maxHoL0Iter = CeilDiv(self->ctx.currentHoL1, self->ctx.convTilingData->convApiTiling.hoL0) - 1; | 118 | + self->ctx.maxHoL0Iter = CeilDiv(self->ctx.currentHoL1, self->ctx.convTilingData->hoL0) - 1; |
| 119 | self->ctx.l12l0LoopH = self->ctx.maxHoL0Iter + 1; | 119 | self->ctx.l12l0LoopH = self->ctx.maxHoL0Iter + 1; |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| @@ -124,36 +124,36 @@ template <class Intf> | |||
| 124 | __aicore__ inline void UpdateHoL0WoL0(Intf *self) | 124 | __aicore__ inline void UpdateHoL0WoL0(Intf *self) |
| 125 | { | 125 | { |
| 126 | self->ctx.currentHoL0 = self->ctx.hoL0Iter == self->ctx.maxHoL0Iter ? | 126 | self->ctx.currentHoL0 = self->ctx.hoL0Iter == self->ctx.maxHoL0Iter ? |
| 127 | - self->ctx.hoL0Tail : self->ctx.convTilingData->convApiTiling.hoL0; | 127 | + self->ctx.hoL0Tail : self->ctx.convTilingData->hoL0; |
| 128 | self->ctx.currentWoL0 = self->ctx.woL0Iter == self->ctx.maxWoL0Iter ? | 128 | self->ctx.currentWoL0 = self->ctx.woL0Iter == self->ctx.maxWoL0Iter ? |
| 129 | - self->ctx.woL0Tail : self->ctx.convTilingData->convApiTiling.woL0; | 129 | + self->ctx.woL0Tail : self->ctx.convTilingData->woL0; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | template <class Intf> | 132 | template <class Intf> |
| 133 | __aicore__ inline void CalcGroupOptParamForHWMode(Intf *self) | 133 | __aicore__ inline void CalcGroupOptParamForHWMode(Intf *self) |
| 134 | { | 134 | { |
| 135 | if (((self->ctx.groupOptIter + 1 == self->ctx.singleGroupOpt - 1 && self->ctx.groupOptIter != 0) || | 135 | if (((self->ctx.groupOptIter + 1 == self->ctx.singleGroupOpt - 1 && self->ctx.groupOptIter != 0) || |
| 136 | - self->ctx.singleGroupOpt == 1) && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 136 | + self->ctx.singleGroupOpt == 1) && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 137 | self->ctx.singleGroups = self->ctx.updateEnlarge; | 137 | self->ctx.singleGroups = self->ctx.updateEnlarge; |
| 138 | - self->ctx.singleGroups = self->ctx.singleGroups == 0 ? self->ctx.convTilingData->convApiTiling.enlarge : self->ctx.singleGroups; | 138 | + self->ctx.singleGroups = self->ctx.singleGroups == 0 ? self->ctx.convTilingData->enlarge : self->ctx.singleGroups; |
| 139 | } | 139 | } |
| 140 | - uint64_t enlargeTail = self->ctx.singleGroups % self->ctx.convTilingData->convApiTiling.enlarge; | 140 | + uint64_t enlargeTail = self->ctx.singleGroups % self->ctx.convTilingData->enlarge; |
| 141 | - enlargeTail = enlargeTail == 0 ? self->ctx.convTilingData->convApiTiling.enlarge : enlargeTail; | 141 | + enlargeTail = enlargeTail == 0 ? self->ctx.convTilingData->enlarge : enlargeTail; |
| 142 | - if (enlargeTail != self->ctx.convTilingData->convApiTiling.enlarge) { | 142 | + if (enlargeTail != self->ctx.convTilingData->enlarge) { |
| 143 | - self->ctx.singleCoreCi = enlargeTail * (self->ctx.convTilingData->convApiTiling.orgCi / self->ctx.convTilingData->convApiTiling.groups); | 143 | + self->ctx.singleCoreCi = enlargeTail * (self->ctx.convTilingData->orgCi / self->ctx.convTilingData->groups); |
| 144 | if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { | 144 | if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { |
| 145 | self->ctx.singleCoreCo = self->ctx.updateSingleCoOpt; | 145 | self->ctx.singleCoreCo = self->ctx.updateSingleCoOpt; |
| 146 | 146 | ||
| 147 | - uint64_t totalKAlignK0 = AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 147 | + uint64_t totalKAlignK0 = AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelW; |
| 148 | - self->ctx.ddr2l0LoopK = CeilDiv(totalKAlignK0, self->ctx.convTilingData->convApiTiling.kL0); | 148 | + self->ctx.ddr2l0LoopK = CeilDiv(totalKAlignK0, self->ctx.convTilingData->kL0); |
| 149 | self->ctx.maxKL0Iter = self->ctx.ddr2l0LoopK - 1; | 149 | self->ctx.maxKL0Iter = self->ctx.ddr2l0LoopK - 1; |
| 150 | - self->ctx.kL0Tail = totalKAlignK0 % self->ctx.convTilingData->convApiTiling.kL0; | 150 | + self->ctx.kL0Tail = totalKAlignK0 % self->ctx.convTilingData->kL0; |
| 151 | if constexpr (Intf::k0 != Intf::k0FmapTail) { | 151 | if constexpr (Intf::k0 != Intf::k0FmapTail) { |
| 152 | self->ctx.kAL0Tail = AlignB(self->ctx.singleCoreCi, Intf::k0FmapTail) * | 152 | self->ctx.kAL0Tail = AlignB(self->ctx.singleCoreCi, Intf::k0FmapTail) * |
| 153 | - self->ctx.convTilingData->convApiTiling.kernelHxkernelW % self->ctx.convTilingData->convApiTiling.kL0; | 153 | + self->ctx.convTilingData->kernelHxkernelW % self->ctx.convTilingData->kL0; |
| 154 | - self->ctx.kAL0Tail = self->ctx.kAL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.kL0 : self->ctx.kAL0Tail; | 154 | + self->ctx.kAL0Tail = self->ctx.kAL0Tail == 0 ? self->ctx.convTilingData->kL0 : self->ctx.kAL0Tail; |
| 155 | } | 155 | } |
| 156 | - self->ctx.kL0Tail = self->ctx.kL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.kL0 : self->ctx.kL0Tail; | 156 | + self->ctx.kL0Tail = self->ctx.kL0Tail == 0 ? self->ctx.convTilingData->kL0 : self->ctx.kL0Tail; |
| 157 | 157 | ||
| 158 | InitCoDirectionValue<Intf>(self); | 158 | InitCoDirectionValue<Intf>(self); |
| 159 | } | 159 | } |
| @@ -199,18 +199,18 @@ __aicore__ inline void FirstIterateImplHWMode(Intf *self) | |||
| 199 | CalcCoDirectionVar<Intf>(self); | 199 | CalcCoDirectionVar<Intf>(self); |
| 200 | 200 | ||
| 201 | if constexpr (Intf::groupOptPreloadFlag) { | 201 | if constexpr (Intf::groupOptPreloadFlag) { |
| 202 | - if (self->ctx.singleGroupOpt == 1 && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 202 | + if (self->ctx.singleGroupOpt == 1 && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 203 | self->ctx.singleGroups = self->ctx.updateEnlarge; | 203 | self->ctx.singleGroups = self->ctx.updateEnlarge; |
| 204 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? | 204 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? |
| 205 | - self->ctx.convTilingData->convApiTiling.enlarge : self->ctx.singleGroups; | 205 | + self->ctx.convTilingData->enlarge : self->ctx.singleGroups; |
| 206 | CalcGroupOptParamForHWMode<Intf>(self); | 206 | CalcGroupOptParamForHWMode<Intf>(self); |
| 207 | } | 207 | } |
| 208 | LoadAL1BaseModule<Intf>(self); | 208 | LoadAL1BaseModule<Intf>(self); |
| 209 | self->ctx.loadAL1Flag = true; | 209 | self->ctx.loadAL1Flag = true; |
| 210 | - if (self->ctx.singleGroupOpt == 2 && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 210 | + if (self->ctx.singleGroupOpt == 2 && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 211 | self->ctx.singleGroups = self->ctx.updateEnlarge; | 211 | self->ctx.singleGroups = self->ctx.updateEnlarge; |
| 212 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? | 212 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? |
| 213 | - self->ctx.convTilingData->convApiTiling.enlarge : self->ctx.singleGroups; | 213 | + self->ctx.convTilingData->enlarge : self->ctx.singleGroups; |
| 214 | CalcGroupOptParamForHWMode<Intf>(self); | 214 | CalcGroupOptParamForHWMode<Intf>(self); |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| @@ -367,7 +367,7 @@ __aicore__ inline bool IterateMFirstHWMode(Intf *self) | |||
| 367 | if (self->ctx.groupOptIter != self->ctx.singleGroupOpt) { | 367 | if (self->ctx.groupOptIter != self->ctx.singleGroupOpt) { |
| 368 | return true; | 368 | return true; |
| 369 | } else if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { | 369 | } else if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { |
| 370 | - if (self->ctx.updateSingleCoOpt == 0 && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 370 | + if (self->ctx.updateSingleCoOpt == 0 && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 371 | return false; | 371 | return false; |
| 372 | } | 372 | } |
| 373 | return true; | 373 | return true; |
| @@ -114,7 +114,7 @@ struct PreFusionProcess { | |||
| 114 | if constexpr (!Intf::preFusionFlag) { | 114 | if constexpr (!Intf::preFusionFlag) { |
| 115 | return; | 115 | return; |
| 116 | } | 116 | } |
| 117 | - if ((self->ctx.convTilingData->convApiTiling.pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { | 117 | + if ((self->ctx.convTilingData->pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { |
| 118 | if (!self->ctx.al1PingPongFlag) { | 118 | if (!self->ctx.al1PingPongFlag) { |
| 119 | eventIdMte3ToMte1 = self->ctx.eventIdMte3ToMte1Ping; | 119 | eventIdMte3ToMte1 = self->ctx.eventIdMte3ToMte1Ping; |
| 120 | eventIdMte1ToMte3 = self->ctx.eventIdMte1ToMte3Ping; | 120 | eventIdMte1ToMte3 = self->ctx.eventIdMte1ToMte3Ping; |
| @@ -122,7 +122,7 @@ struct PreFusionProcess { | |||
| 122 | eventIdMte3ToMte1 = self->ctx.eventIdMte3ToMte1Pong; | 122 | eventIdMte3ToMte1 = self->ctx.eventIdMte3ToMte1Pong; |
| 123 | eventIdMte1ToMte3 = self->ctx.eventIdMte1ToMte3Pong; | 123 | eventIdMte1ToMte3 = self->ctx.eventIdMte1ToMte3Pong; |
| 124 | } | 124 | } |
| 125 | - aL1Offset = self->ctx.al1PingPongFlag * self->ctx.convTilingData->convApiTiling.aL1SpaceSize; | 125 | + aL1Offset = self->ctx.al1PingPongFlag * self->ctx.convTilingData->aL1SpaceSize; |
| 126 | } else { | 126 | } else { |
| 127 | eventIdMte3ToMte1 = self->ctx.eventIdMte3ToMte1Ping; | 127 | eventIdMte3ToMte1 = self->ctx.eventIdMte3ToMte1Ping; |
| 128 | eventIdMte1ToMte3 = self->ctx.eventIdMte1ToMte3Ping; | 128 | eventIdMte1ToMte3 = self->ctx.eventIdMte1ToMte3Ping; |
| @@ -379,7 +379,7 @@ template <class Intf, uint32_t ImplType> | |||
| 379 | __aicore__ void Iterate<Intf, ImplType>::ReduceKPreload(Intf *self, MmadParams &mmadParams) | 379 | __aicore__ void Iterate<Intf, ImplType>::ReduceKPreload(Intf *self, MmadParams &mmadParams) |
| 380 | { | 380 | { |
| 381 | // updateIterByFmapTag is true means fm update; false means weight update | 381 | // updateIterByFmapTag is true means fm update; false means weight update |
| 382 | - bool updateIterByFmapTag = self->ctx.convTilingData->convApiTiling.kAL1 > self->ctx.convTilingData->convApiTiling.kBL1; | 382 | + bool updateIterByFmapTag = self->ctx.convTilingData->kAL1 > self->ctx.convTilingData->kBL1; |
| 383 | if (self->ctx.kAL1fullload && !self->ctx.kBL1fullload) { | 383 | if (self->ctx.kAL1fullload && !self->ctx.kBL1fullload) { |
| 384 | updateIterByFmapTag = false; | 384 | updateIterByFmapTag = false; |
| 385 | } else if (!self->ctx.kAL1fullload && self->ctx.kBL1fullload) { | 385 | } else if (!self->ctx.kAL1fullload && self->ctx.kBL1fullload) { |
| @@ -408,10 +408,10 @@ __aicore__ void Iterate<Intf, ImplType>::ReduceKPreload(Intf *self, MmadParams & | |||
| 408 | // state | 408 | // state |
| 409 | TempIters tempIters; | 409 | TempIters tempIters; |
| 410 | 410 | ||
| 411 | - uint64_t currentKL0 = self->ctx.convTilingData->convApiTiling.kL0; | 411 | + uint64_t currentKL0 = self->ctx.convTilingData->kL0; |
| 412 | uint64_t posK = 0; | 412 | uint64_t posK = 0; |
| 413 | uint64_t KStartPosition = 0; | 413 | uint64_t KStartPosition = 0; |
| 414 | - uint64_t kStep = self->ctx.convTilingData->convApiTiling.kStep; | 414 | + uint64_t kStep = self->ctx.convTilingData->kStep; |
| 415 | uint64_t multiKAL1 = self->ctx.multiKAL1; | 415 | uint64_t multiKAL1 = self->ctx.multiKAL1; |
| 416 | uint64_t multiKBL1 = self->ctx.multiKBL1; | 416 | uint64_t multiKBL1 = self->ctx.multiKBL1; |
| 417 | 417 | ||
| @@ -470,7 +470,7 @@ template <class Intf, uint32_t ImplType> | |||
| 470 | __aicore__ void Iterate<Intf, ImplType>::ReduceKFmapPreload(Intf *self, MmadParams &mmadParams) | 470 | __aicore__ void Iterate<Intf, ImplType>::ReduceKFmapPreload(Intf *self, MmadParams &mmadParams) |
| 471 | { | 471 | { |
| 472 | // updateIterByFmapTag is true means fm update; false means weight update | 472 | // updateIterByFmapTag is true means fm update; false means weight update |
| 473 | - bool updateIterByFmapTag = self->ctx.convTilingData->convApiTiling.kAL1 > self->ctx.convTilingData->convApiTiling.kBL1; | 473 | + bool updateIterByFmapTag = self->ctx.convTilingData->kAL1 > self->ctx.convTilingData->kBL1; |
| 474 | if (self->ctx.kAL1fullload && !self->ctx.kBL1fullload) { | 474 | if (self->ctx.kAL1fullload && !self->ctx.kBL1fullload) { |
| 475 | updateIterByFmapTag = false; | 475 | updateIterByFmapTag = false; |
| 476 | } else if (!self->ctx.kAL1fullload && self->ctx.kBL1fullload) { | 476 | } else if (!self->ctx.kAL1fullload && self->ctx.kBL1fullload) { |
| @@ -488,10 +488,10 @@ __aicore__ void Iterate<Intf, ImplType>::ReduceKFmapPreload(Intf *self, MmadPara | |||
| 488 | // state | 488 | // state |
| 489 | TempIters tempIters; | 489 | TempIters tempIters; |
| 490 | 490 | ||
| 491 | - uint64_t currentKL0 = self->ctx.convTilingData->convApiTiling.kL0; | 491 | + uint64_t currentKL0 = self->ctx.convTilingData->kL0; |
| 492 | uint64_t posK = 0; | 492 | uint64_t posK = 0; |
| 493 | uint64_t KStartPosition = 0; | 493 | uint64_t KStartPosition = 0; |
| 494 | - uint64_t kStep = self->ctx.convTilingData->convApiTiling.kStep; | 494 | + uint64_t kStep = self->ctx.convTilingData->kStep; |
| 495 | uint64_t multiKAL1 = self->ctx.multiKAL1; | 495 | uint64_t multiKAL1 = self->ctx.multiKAL1; |
| 496 | uint64_t multiKBL1 = self->ctx.multiKBL1; | 496 | uint64_t multiKBL1 = self->ctx.multiKBL1; |
| 497 | 497 | ||
| @@ -559,11 +559,11 @@ __aicore__ void Iterate<Intf, ImplType>::ReduceKPreloadWithWeightFullloadL0(Intf | |||
| 559 | if (self->ctx.loadAL1Flag) { | 559 | if (self->ctx.loadAL1Flag) { |
| 560 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { | 560 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { |
| 561 | if constexpr (Intf::isNoPad) { | 561 | if constexpr (Intf::isNoPad) { |
| 562 | - self->ctx.loadAl1Ins.SetLoad3dFMatrixNoPad(self->ctx.convTilingData->convApiTiling.orgWi); | 562 | + self->ctx.loadAl1Ins.SetLoad3dFMatrixNoPad(self->ctx.convTilingData->orgWi); |
| 563 | } else { | 563 | } else { |
| 564 | - self->ctx.loadAl1Ins.SetLoad3dFMatrix(self->ctx.convTilingData->convApiTiling.padLeft, | 564 | + self->ctx.loadAl1Ins.SetLoad3dFMatrix(self->ctx.convTilingData->padLeft, |
| 565 | - self->ctx.convTilingData->convApiTiling.padRight, | 565 | + self->ctx.convTilingData->padRight, |
| 566 | - self->ctx.convTilingData->convApiTiling.orgWi); | 566 | + self->ctx.convTilingData->orgWi); |
| 567 | } | 567 | } |
| 568 | } | 568 | } |
| 569 | // If the current m direction iterator is not the last one, load the next fmap block to be processed. | 569 | // If the current m direction iterator is not the last one, load the next fmap block to be processed. |
| @@ -585,10 +585,10 @@ __aicore__ void Iterate<Intf, ImplType>::ReduceKPreloadWithWeightFullloadL0(Intf | |||
| 585 | } | 585 | } |
| 586 | self->ctx.loadAL0Flag = true; | 586 | self->ctx.loadAL0Flag = true; |
| 587 | 587 | ||
| 588 | - uint64_t currentKL0 = self->ctx.convTilingData->convApiTiling.kL0; | 588 | + uint64_t currentKL0 = self->ctx.convTilingData->kL0; |
| 589 | uint64_t posK = 0; | 589 | uint64_t posK = 0; |
| 590 | uint64_t KStartPosition = 0; | 590 | uint64_t KStartPosition = 0; |
| 591 | - uint64_t kStep = self->ctx.convTilingData->convApiTiling.kStep; | 591 | + uint64_t kStep = self->ctx.convTilingData->kStep; |
| 592 | uint64_t multiKAL1 = self->ctx.multiKAL1; | 592 | uint64_t multiKAL1 = self->ctx.multiKAL1; |
| 593 | uint64_t multiKBL1 = self->ctx.multiKBL1; | 593 | uint64_t multiKBL1 = self->ctx.multiKBL1; |
| 594 | 594 | ||
| @@ -636,10 +636,10 @@ template <class Intf, uint32_t ImplType> | |||
| 636 | __aicore__ void Iterate<Intf, ImplType>::ReduceK(Intf *self, MmadParams &mmadParams) | 636 | __aicore__ void Iterate<Intf, ImplType>::ReduceK(Intf *self, MmadParams &mmadParams) |
| 637 | { | 637 | { |
| 638 | // state | 638 | // state |
| 639 | - uint64_t currentKL0 = self->ctx.convTilingData->convApiTiling.kL0; | 639 | + uint64_t currentKL0 = self->ctx.convTilingData->kL0; |
| 640 | uint64_t posK = 0; | 640 | uint64_t posK = 0; |
| 641 | uint64_t KStartPosition = 0; | 641 | uint64_t KStartPosition = 0; |
| 642 | - uint64_t kStep = self->ctx.convTilingData->convApiTiling.kStep; | 642 | + uint64_t kStep = self->ctx.convTilingData->kStep; |
| 643 | uint64_t multiKAL1 = self->ctx.multiKAL1; | 643 | uint64_t multiKAL1 = self->ctx.multiKAL1; |
| 644 | uint64_t multiKBL1 = self->ctx.multiKBL1; | 644 | uint64_t multiKBL1 = self->ctx.multiKBL1; |
| 645 | 645 | ||
| @@ -832,10 +832,10 @@ __aicore__ void Iterate<Intf, ImplType>::ReduceGroupOptFmapPreload(Intf *self, M | |||
| 832 | } | 832 | } |
| 833 | 833 | ||
| 834 | // state | 834 | // state |
| 835 | - uint64_t currentKL0 = self->ctx.convTilingData->convApiTiling.kL0; | 835 | + uint64_t currentKL0 = self->ctx.convTilingData->kL0; |
| 836 | uint64_t posK = 0; | 836 | uint64_t posK = 0; |
| 837 | uint64_t KStartPosition = 0; | 837 | uint64_t KStartPosition = 0; |
| 838 | - uint64_t kStep = self->ctx.convTilingData->convApiTiling.kStep; | 838 | + uint64_t kStep = self->ctx.convTilingData->kStep; |
| 839 | uint64_t multiKAL1 = self->ctx.multiKAL1; | 839 | uint64_t multiKAL1 = self->ctx.multiKAL1; |
| 840 | uint64_t multiKBL1 = self->ctx.multiKBL1; | 840 | uint64_t multiKBL1 = self->ctx.multiKBL1; |
| 841 | 841 | ||
| @@ -898,7 +898,7 @@ __aicore__ void Iterate<Intf, ImplType>::IterateK(Intf *self) | |||
| 898 | if constexpr (Intf::isInnerBatchFlag || Intf::isDeQuantFlag) { | 898 | if constexpr (Intf::isInnerBatchFlag || Intf::isDeQuantFlag) { |
| 899 | self->ctx.cl0 = self->ctx.queueCL0.template AllocTensor<typename Intf::L0cT>(); | 899 | self->ctx.cl0 = self->ctx.queueCL0.template AllocTensor<typename Intf::L0cT>(); |
| 900 | } else { | 900 | } else { |
| 901 | - if ((self->ctx.convTilingData->convApiTiling.pBufferFlag & 0x04) >> 2) { // cl0 db | 901 | + if ((self->ctx.convTilingData->pBufferFlag & 0x04) >> 2) { // cl0 db |
| 902 | self->ctx.cl0 = | 902 | self->ctx.cl0 = |
| 903 | self->ctx.wholeCl0Tensor[(self->ctx.cl0PingPongFlag & 0x1) * L0C_HALF_SIZE / Intf::sizeOfL0c]; | 903 | self->ctx.wholeCl0Tensor[(self->ctx.cl0PingPongFlag & 0x1) * L0C_HALF_SIZE / Intf::sizeOfL0c]; |
| 904 | } else { | 904 | } else { |
| @@ -937,7 +937,7 @@ template <class Intf, uint32_t ImplType> | |||
| 937 | __aicore__ void Iterate<Intf, ImplType>::IterateBiasScale(Intf *self) | 937 | __aicore__ void Iterate<Intf, ImplType>::IterateBiasScale(Intf *self) |
| 938 | { | 938 | { |
| 939 | if (self->ctx.enableBias) { | 939 | if (self->ctx.enableBias) { |
| 940 | - if (!self->ctx.convTilingData->convApiTiling.biasFullLoadFlag) { | 940 | + if (!self->ctx.convTilingData->biasFullLoadFlag) { |
| 941 | self->ctx.biasL1 = self->ctx.queueBiasL1.template AllocTensor<typename Intf::BiasT>(); | 941 | self->ctx.biasL1 = self->ctx.queueBiasL1.template AllocTensor<typename Intf::BiasT>(); |
| 942 | self->ctx.loadBiasL1Ins.LoadChannelWiseL1(self->ctx.biasL1, self->ctx.biasgm); | 942 | self->ctx.loadBiasL1Ins.LoadChannelWiseL1(self->ctx.biasL1, self->ctx.biasgm); |
| 943 | self->ctx.queueBiasL1.EnQue(self->ctx.biasL1); | 943 | self->ctx.queueBiasL1.EnQue(self->ctx.biasL1); |
| @@ -949,7 +949,7 @@ __aicore__ void Iterate<Intf, ImplType>::IterateBiasScale(Intf *self) | |||
| 949 | self->ctx.biasBT = self->ctx.queueBiasBT.template DeQue<typename Intf::L0cT>(); | 949 | self->ctx.biasBT = self->ctx.queueBiasBT.template DeQue<typename Intf::L0cT>(); |
| 950 | } | 950 | } |
| 951 | 951 | ||
| 952 | - if (!self->ctx.convTilingData->convApiTiling.fixpParamsFullLoadFlag) { | 952 | + if (!self->ctx.convTilingData->fixpParamsFullLoadFlag) { |
| 953 | if (self->ctx.enableVectorQuant || self->ctx.enableVectorRelu) { | 953 | if (self->ctx.enableVectorQuant || self->ctx.enableVectorRelu) { |
| 954 | event_t eventId = static_cast<event_t>(self->ctx.pipe.FetchEventID(HardEvent::FIX_MTE2)); | 954 | event_t eventId = static_cast<event_t>(self->ctx.pipe.FetchEventID(HardEvent::FIX_MTE2)); |
| 955 | SetFlag<HardEvent::FIX_MTE2>(eventId); | 955 | SetFlag<HardEvent::FIX_MTE2>(eventId); |
| @@ -958,11 +958,11 @@ __aicore__ void Iterate<Intf, ImplType>::IterateBiasScale(Intf *self) | |||
| 958 | if (self->ctx.enableVectorQuant) { | 958 | if (self->ctx.enableVectorQuant) { |
| 959 | self->ctx.scaleL1 = self->ctx.queueScaleL1.template AllocTensor<typename Intf::ScaleT>(); | 959 | self->ctx.scaleL1 = self->ctx.queueScaleL1.template AllocTensor<typename Intf::ScaleT>(); |
| 960 | if constexpr (Intf::isExtendConv2d) { | 960 | if constexpr (Intf::isExtendConv2d) { |
| 961 | - if (self->ctx.convTilingData->convApiTiling.quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 961 | + if (self->ctx.convTilingData->quantMode0 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 962 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1(self->ctx.scaleL1, self->ctx.scalegm); | 962 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1(self->ctx.scaleL1, self->ctx.scalegm); |
| 963 | } | 963 | } |
| 964 | - if (self->ctx.convTilingData->convApiTiling.dualOutput && | 964 | + if (self->ctx.convTilingData->dualOutput && |
| 965 | - self->ctx.convTilingData->convApiTiling.quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { | 965 | + self->ctx.convTilingData->quantMode1 == static_cast<uint8_t>(QuantModeType::VECTOR_QUANT)) { |
| 966 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1(self->ctx.scaleL1[self->ctx.scale1L1offset], | 966 | self->ctx.loadScaleL1Ins.LoadChannelWiseL1(self->ctx.scaleL1[self->ctx.scale1L1offset], |
| 967 | self->ctx.scale1gm); | 967 | self->ctx.scale1gm); |
| 968 | } | 968 | } |
| @@ -975,11 +975,11 @@ __aicore__ void Iterate<Intf, ImplType>::IterateBiasScale(Intf *self) | |||
| 975 | if constexpr (Intf::isExtendConv2d) { | 975 | if constexpr (Intf::isExtendConv2d) { |
| 976 | if (self->ctx.enableVectorRelu) { | 976 | if (self->ctx.enableVectorRelu) { |
| 977 | self->ctx.reluWeightL1 = self->ctx.queueReluWeightL1.template AllocTensor<typename Intf::ReluWeightT>(); | 977 | self->ctx.reluWeightL1 = self->ctx.queueReluWeightL1.template AllocTensor<typename Intf::ReluWeightT>(); |
| 978 | - if (self->ctx.convTilingData->convApiTiling.reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 978 | + if (self->ctx.convTilingData->reluMode0 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 979 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1(self->ctx.reluWeightL1, self->ctx.reluWeightGM); | 979 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1(self->ctx.reluWeightL1, self->ctx.reluWeightGM); |
| 980 | } | 980 | } |
| 981 | - if (self->ctx.convTilingData->convApiTiling.dualOutput && | 981 | + if (self->ctx.convTilingData->dualOutput && |
| 982 | - self->ctx.convTilingData->convApiTiling.reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { | 982 | + self->ctx.convTilingData->reluMode1 == static_cast<uint8_t>(ReluMode::VECTOR_RELU)) { |
| 983 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1(self->ctx.reluWeightL1[self->ctx.reluWeight1L1offset], | 983 | self->ctx.loadReluWeightL1Ins.LoadChannelWiseL1(self->ctx.reluWeightL1[self->ctx.reluWeight1L1offset], |
| 984 | self->ctx.reluWeight1GM); | 984 | self->ctx.reluWeight1GM); |
| 985 | } | 985 | } |
| @@ -51,28 +51,28 @@ template <class Intf> | |||
| 51 | __aicore__ inline void CalcGroupOptParamForMMode(Intf *self) | 51 | __aicore__ inline void CalcGroupOptParamForMMode(Intf *self) |
| 52 | { | 52 | { |
| 53 | if (((self->ctx.groupOptIter + 1 == self->ctx.singleGroupOpt - 1 && self->ctx.groupOptIter != 0) || | 53 | if (((self->ctx.groupOptIter + 1 == self->ctx.singleGroupOpt - 1 && self->ctx.groupOptIter != 0) || |
| 54 | - self->ctx.singleGroupOpt == 1) && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 54 | + self->ctx.singleGroupOpt == 1) && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 55 | self->ctx.singleGroups = self->ctx.updateEnlarge; | 55 | self->ctx.singleGroups = self->ctx.updateEnlarge; |
| 56 | - self->ctx.singleGroups = self->ctx.singleGroups == 0 ? self->ctx.convTilingData->convApiTiling.enlarge : self->ctx.singleGroups; | 56 | + self->ctx.singleGroups = self->ctx.singleGroups == 0 ? self->ctx.convTilingData->enlarge : self->ctx.singleGroups; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | - uint64_t enlargeTail = self->ctx.singleGroups % self->ctx.convTilingData->convApiTiling.enlarge; | 59 | + uint64_t enlargeTail = self->ctx.singleGroups % self->ctx.convTilingData->enlarge; |
| 60 | - enlargeTail = enlargeTail == 0 ? self->ctx.convTilingData->convApiTiling.enlarge : enlargeTail; | 60 | + enlargeTail = enlargeTail == 0 ? self->ctx.convTilingData->enlarge : enlargeTail; |
| 61 | - if (enlargeTail != self->ctx.convTilingData->convApiTiling.enlarge) { | 61 | + if (enlargeTail != self->ctx.convTilingData->enlarge) { |
| 62 | - self->ctx.singleCoreCi = enlargeTail * (self->ctx.convTilingData->convApiTiling.orgCi / self->ctx.convTilingData->convApiTiling.groups); | 62 | + self->ctx.singleCoreCi = enlargeTail * (self->ctx.convTilingData->orgCi / self->ctx.convTilingData->groups); |
| 63 | if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { | 63 | if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { |
| 64 | self->ctx.singleCoreCo = self->ctx.updateSingleCoOpt; | 64 | self->ctx.singleCoreCo = self->ctx.updateSingleCoOpt; |
| 65 | 65 | ||
| 66 | - uint64_t totalKAlignK0 = AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 66 | + uint64_t totalKAlignK0 = AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelW; |
| 67 | - self->ctx.ddr2l0LoopK = CeilDiv(totalKAlignK0, self->ctx.convTilingData->convApiTiling.kL0); | 67 | + self->ctx.ddr2l0LoopK = CeilDiv(totalKAlignK0, self->ctx.convTilingData->kL0); |
| 68 | self->ctx.maxKL0Iter = self->ctx.ddr2l0LoopK - 1; | 68 | self->ctx.maxKL0Iter = self->ctx.ddr2l0LoopK - 1; |
| 69 | - self->ctx.kL0Tail = totalKAlignK0 % self->ctx.convTilingData->convApiTiling.kL0; | 69 | + self->ctx.kL0Tail = totalKAlignK0 % self->ctx.convTilingData->kL0; |
| 70 | if constexpr (Intf::k0 != Intf::k0FmapTail) { | 70 | if constexpr (Intf::k0 != Intf::k0FmapTail) { |
| 71 | self->ctx.kAL0Tail = AlignB(self->ctx.singleCoreCi, Intf::k0FmapTail) * | 71 | self->ctx.kAL0Tail = AlignB(self->ctx.singleCoreCi, Intf::k0FmapTail) * |
| 72 | - self->ctx.convTilingData->convApiTiling.kernelHxkernelW % self->ctx.convTilingData->convApiTiling.kL0; | 72 | + self->ctx.convTilingData->kernelHxkernelW % self->ctx.convTilingData->kL0; |
| 73 | - self->ctx.kAL0Tail = self->ctx.kAL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.kL0 : self->ctx.kAL0Tail; | 73 | + self->ctx.kAL0Tail = self->ctx.kAL0Tail == 0 ? self->ctx.convTilingData->kL0 : self->ctx.kAL0Tail; |
| 74 | } | 74 | } |
| 75 | - self->ctx.kL0Tail = self->ctx.kL0Tail == 0 ? self->ctx.convTilingData->convApiTiling.kL0 : self->ctx.kL0Tail; | 75 | + self->ctx.kL0Tail = self->ctx.kL0Tail == 0 ? self->ctx.convTilingData->kL0 : self->ctx.kL0Tail; |
| 76 | 76 | ||
| 77 | InitCoDirectionValue<Intf>(self); | 77 | InitCoDirectionValue<Intf>(self); |
| 78 | } | 78 | } |
| @@ -114,18 +114,18 @@ __aicore__ inline void FirstIterateImplMMode(Intf *self) | |||
| 114 | CalcCoDirectionVar<Intf>(self); | 114 | CalcCoDirectionVar<Intf>(self); |
| 115 | 115 | ||
| 116 | if constexpr (Intf::groupOptPreloadFlag) { | 116 | if constexpr (Intf::groupOptPreloadFlag) { |
| 117 | - if (self->ctx.singleGroupOpt == 1 && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 117 | + if (self->ctx.singleGroupOpt == 1 && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 118 | self->ctx.singleGroups = self->ctx.updateEnlarge; | 118 | self->ctx.singleGroups = self->ctx.updateEnlarge; |
| 119 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? | 119 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? |
| 120 | - self->ctx.convTilingData->convApiTiling.enlarge : self->ctx.singleGroups; | 120 | + self->ctx.convTilingData->enlarge : self->ctx.singleGroups; |
| 121 | CalcGroupOptParamForMMode<Intf>(self); | 121 | CalcGroupOptParamForMMode<Intf>(self); |
| 122 | } | 122 | } |
| 123 | LoadAL1BaseModule<Intf>(self); | 123 | LoadAL1BaseModule<Intf>(self); |
| 124 | self->ctx.loadAL1Flag = true; | 124 | self->ctx.loadAL1Flag = true; |
| 125 | - if (self->ctx.singleGroupOpt == 2 && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 125 | + if (self->ctx.singleGroupOpt == 2 && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 126 | self->ctx.singleGroups = self->ctx.updateEnlarge; | 126 | self->ctx.singleGroups = self->ctx.updateEnlarge; |
| 127 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? | 127 | self->ctx.singleGroups = self->ctx.singleGroups == 0 ? |
| 128 | - self->ctx.convTilingData->convApiTiling.enlarge : self->ctx.singleGroups; | 128 | + self->ctx.convTilingData->enlarge : self->ctx.singleGroups; |
| 129 | CalcGroupOptParamForMMode<Intf>(self); | 129 | CalcGroupOptParamForMMode<Intf>(self); |
| 130 | } | 130 | } |
| 131 | } else if constexpr (Intf::isMPreLoad) { | 131 | } else if constexpr (Intf::isMPreLoad) { |
| @@ -246,7 +246,7 @@ __aicore__ inline bool IterateMFirstMMode(Intf *self) | |||
| 246 | if (self->ctx.groupOptIter < self->ctx.singleGroupOpt - 1) { | 246 | if (self->ctx.groupOptIter < self->ctx.singleGroupOpt - 1) { |
| 247 | return true; | 247 | return true; |
| 248 | } else if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { | 248 | } else if (self->ctx.groupOptIter == self->ctx.singleGroupOpt - 1) { |
| 249 | - if (self->ctx.updateSingleCoOpt == 0 && self->ctx.updateEnlarge != self->ctx.convTilingData->convApiTiling.enlarge) { | 249 | + if (self->ctx.updateSingleCoOpt == 0 && self->ctx.updateEnlarge != self->ctx.convTilingData->enlarge) { |
| 250 | return false; | 250 | return false; |
| 251 | } | 251 | } |
| 252 | return true; | 252 | return true; |
| @@ -139,7 +139,7 @@ template <class Intf> | |||
| 139 | __aicore__ inline void OptGroupUpdateLoopN(Intf *self) { | 139 | __aicore__ inline void OptGroupUpdateLoopN(Intf *self) { |
| 140 | if constexpr (Intf::hasNL0IterFlag) { | 140 | if constexpr (Intf::hasNL0IterFlag) { |
| 141 | self->ctx.l12l0LoopN = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? | 141 | self->ctx.l12l0LoopN = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? |
| 142 | - CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->convApiTiling.nL0) : self->ctx.convTilingData->convApiTiling.multiNBL1; | 142 | + CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->nL0) : self->ctx.convTilingData->multiNBL1; |
| 143 | self->ctx.ddr2l1LoopInner = self->ctx.ddr2l1LoopTmp * self->ctx.l12l0LoopN; | 143 | self->ctx.ddr2l1LoopInner = self->ctx.ddr2l1LoopTmp * self->ctx.l12l0LoopN; |
| 144 | } | 144 | } |
| 145 | } | 145 | } |
| @@ -159,24 +159,24 @@ __aicore__ inline void OptGroupUpdateLoopInner(Intf *self) { | |||
| 159 | } else if (self->ctx.woAL1Iter == self->ctx.maxWoL1Iter) { | 159 | } else if (self->ctx.woAL1Iter == self->ctx.maxWoL1Iter) { |
| 160 | self->ctx.currentWoL1 = self->ctx.woL1SmallTail; | 160 | self->ctx.currentWoL1 = self->ctx.woL1SmallTail; |
| 161 | } else { | 161 | } else { |
| 162 | - self->ctx.currentWoL1 = self->ctx.convTilingData->convApiTiling.woL1; | 162 | + self->ctx.currentWoL1 = self->ctx.convTilingData->woL1; |
| 163 | } | 163 | } |
| 164 | } else { | 164 | } else { |
| 165 | self->ctx.currentWoL1 = self->ctx.woAL1Iter == self->ctx.maxWoL1Iter ? | 165 | self->ctx.currentWoL1 = self->ctx.woAL1Iter == self->ctx.maxWoL1Iter ? |
| 166 | - self->ctx.woAL1Tail : self->ctx.convTilingData->convApiTiling.woL1; | 166 | + self->ctx.woAL1Tail : self->ctx.convTilingData->woL1; |
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| 169 | if constexpr (Intf::hasWL0IterFlag) { | 169 | if constexpr (Intf::hasWL0IterFlag) { |
| 170 | - self->ctx.l12l0LoopW = CeilDiv(self->ctx.currentWoL1, self->ctx.convTilingData->convApiTiling.woL0); | 170 | + self->ctx.l12l0LoopW = CeilDiv(self->ctx.currentWoL1, self->ctx.convTilingData->woL0); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | if constexpr (Intf::hasHL1IterFlag) { | 173 | if constexpr (Intf::hasHL1IterFlag) { |
| 174 | self->ctx.hoAL1Iter = (self->ctx.outerIter / self->ctx.ddr2l1LoopW) % self->ctx.ddr2l1LoopH; | 174 | self->ctx.hoAL1Iter = (self->ctx.outerIter / self->ctx.ddr2l1LoopW) % self->ctx.ddr2l1LoopH; |
| 175 | self->ctx.currentHoL1 = self->ctx.hoAL1Iter == self->ctx.maxHoL1Iter ? | 175 | self->ctx.currentHoL1 = self->ctx.hoAL1Iter == self->ctx.maxHoL1Iter ? |
| 176 | - self->ctx.hoAL1Tail : self->ctx.convTilingData->convApiTiling.hoL1; | 176 | + self->ctx.hoAL1Tail : self->ctx.convTilingData->hoL1; |
| 177 | } | 177 | } |
| 178 | if constexpr (Intf::hasHL0IterFlag) { | 178 | if constexpr (Intf::hasHL0IterFlag) { |
| 179 | - self->ctx.l12l0LoopH = CeilDiv(self->ctx.currentHoL1, self->ctx.convTilingData->convApiTiling.hoL0); | 179 | + self->ctx.l12l0LoopH = CeilDiv(self->ctx.currentHoL1, self->ctx.convTilingData->hoL0); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | self->ctx.ddr2l1LoopTmp = self->ctx.l12l0LoopW * self->ctx.l12l0LoopH; | 182 | self->ctx.ddr2l1LoopTmp = self->ctx.l12l0LoopW * self->ctx.l12l0LoopH; |
| @@ -29,19 +29,19 @@ __aicore__ inline void OptGroupCalcBL1LoadTimesHWMode(Intf *self) | |||
| 29 | { | 29 | { |
| 30 | if (!self->ctx.kBL1fullload) { | 30 | if (!self->ctx.kBL1fullload) { |
| 31 | self->ctx.ddr2l1LoopKB = self->ctx.maxKBL1Iter + 1; | 31 | self->ctx.ddr2l1LoopKB = self->ctx.maxKBL1Iter + 1; |
| 32 | - uint64_t ddr2l0LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL0); | 32 | + uint64_t ddr2l0LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL0); |
| 33 | uint64_t ddr2l0LoopW = 0; | 33 | uint64_t ddr2l0LoopW = 0; |
| 34 | if constexpr (Intf::hasWL0IterFlag) { | 34 | if constexpr (Intf::hasWL0IterFlag) { |
| 35 | if (self->ctx.woL1SmallTail > 0) { | 35 | if (self->ctx.woL1SmallTail > 0) { |
| 36 | ddr2l0LoopW = (self->ctx.ddr2l1LoopW - W_TAIL_NUM) * | 36 | ddr2l0LoopW = (self->ctx.ddr2l1LoopW - W_TAIL_NUM) * |
| 37 | - CeilDiv(self->ctx.convTilingData->convApiTiling.woL1, self->ctx.convTilingData->convApiTiling.woL0) + | 37 | + CeilDiv(self->ctx.convTilingData->woL1, self->ctx.convTilingData->woL0) + |
| 38 | - CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->convApiTiling.woL0) + | 38 | + CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->woL0) + |
| 39 | - CeilDiv(self->ctx.woL1SmallTail, self->ctx.convTilingData->convApiTiling.woL0); | 39 | + CeilDiv(self->ctx.woL1SmallTail, self->ctx.convTilingData->woL0); |
| 40 | } else { | 40 | } else { |
| 41 | - ddr2l0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL0); | 41 | + ddr2l0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL0); |
| 42 | } | 42 | } |
| 43 | } else { | 43 | } else { |
| 44 | - ddr2l0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL0); | 44 | + ddr2l0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL0); |
| 45 | } | 45 | } |
| 46 | self->ctx.bL1LoadTimes = ddr2l0LoopH * ddr2l0LoopW * self->ctx.ddr2l1LoopN * self->ctx.l12l0LoopN * | 46 | self->ctx.bL1LoadTimes = ddr2l0LoopH * ddr2l0LoopW * self->ctx.ddr2l1LoopN * self->ctx.l12l0LoopN * |
| 47 | self->ctx.ddr2l1LoopBatch * self->ctx.ddr2l1LoopKB; | 47 | self->ctx.ddr2l1LoopBatch * self->ctx.ddr2l1LoopKB; |
| @@ -98,27 +98,27 @@ template <class Intf> | |||
| 98 | __aicore__ inline void OptGroupInitIterValueMfirstHWMode(Intf *self) | 98 | __aicore__ inline void OptGroupInitIterValueMfirstHWMode(Intf *self) |
| 99 | { | 99 | { |
| 100 | if (!self->ctx.kBL1fullload) { | 100 | if (!self->ctx.kBL1fullload) { |
| 101 | - uint64_t ddr2l0LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL0); | 101 | + uint64_t ddr2l0LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL0); |
| 102 | uint64_t ddr2l0LoopW = 0; | 102 | uint64_t ddr2l0LoopW = 0; |
| 103 | if constexpr (Intf::hasWL0IterFlag) { | 103 | if constexpr (Intf::hasWL0IterFlag) { |
| 104 | - self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->convApiTiling.woL1; | 104 | + self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->woL1; |
| 105 | - self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.woL1 : self->ctx.woAL1Tail; | 105 | + self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->woL1 : self->ctx.woAL1Tail; |
| 106 | - if (self->ctx.convTilingData->convApiTiling.hoL0 > 1 && self->ctx.woAL1Tail % BLOCK_L0_N > 0 && | 106 | + if (self->ctx.convTilingData->hoL0 > 1 && self->ctx.woAL1Tail % BLOCK_L0_N > 0 && |
| 107 | - CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->convApiTiling.woL0) > 1) { | 107 | + CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->woL0) > 1) { |
| 108 | - self->ctx.woL1SmallTail = self->ctx.woAL1Tail % self->ctx.convTilingData->convApiTiling.woL0; | 108 | + self->ctx.woL1SmallTail = self->ctx.woAL1Tail % self->ctx.convTilingData->woL0; |
| 109 | - self->ctx.woAL1Tail = (self->ctx.woAL1Tail / self->ctx.convTilingData->convApiTiling.woL0) * self->ctx.convTilingData->convApiTiling.woL0; | 109 | + self->ctx.woAL1Tail = (self->ctx.woAL1Tail / self->ctx.convTilingData->woL0) * self->ctx.convTilingData->woL0; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | - self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL1); | 112 | + self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL1); |
| 113 | ddr2l0LoopW = | 113 | ddr2l0LoopW = |
| 114 | - (self->ctx.ddr2l1LoopW - 1) * CeilDiv(self->ctx.convTilingData->convApiTiling.woL1, self->ctx.convTilingData->convApiTiling.woL0) + | 114 | + (self->ctx.ddr2l1LoopW - 1) * CeilDiv(self->ctx.convTilingData->woL1, self->ctx.convTilingData->woL0) + |
| 115 | - CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->convApiTiling.woL0); | 115 | + CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->woL0); |
| 116 | 116 | ||
| 117 | if (self->ctx.woL1SmallTail > 0) { | 117 | if (self->ctx.woL1SmallTail > 0) { |
| 118 | - ddr2l0LoopW += CeilDiv(self->ctx.woL1SmallTail, self->ctx.convTilingData->convApiTiling.woL0); | 118 | + ddr2l0LoopW += CeilDiv(self->ctx.woL1SmallTail, self->ctx.convTilingData->woL0); |
| 119 | } | 119 | } |
| 120 | } else { | 120 | } else { |
| 121 | - ddr2l0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL0); | 121 | + ddr2l0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL0); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | self->ctx.ddr2l1LoopTmp = self->ctx.ddr2l1LoopBatch * ddr2l0LoopH * ddr2l0LoopW; | 124 | self->ctx.ddr2l1LoopTmp = self->ctx.ddr2l1LoopBatch * ddr2l0LoopH * ddr2l0LoopW; |
| @@ -135,23 +135,23 @@ __aicore__ inline void OptGroupInitIterValueNfirstHWMode(Intf *self) | |||
| 135 | self->ctx.ddr2l1LoopH = 1; | 135 | self->ctx.ddr2l1LoopH = 1; |
| 136 | self->ctx.maxHoL1Iter = 0; | 136 | self->ctx.maxHoL1Iter = 0; |
| 137 | } else { | 137 | } else { |
| 138 | - self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL1); | 138 | + self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL1); |
| 139 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; | 139 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | if constexpr (Intf::hasWL1IterFlag) { | 142 | if constexpr (Intf::hasWL1IterFlag) { |
| 143 | - self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL1); | 143 | + self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL1); |
| 144 | } else { | 144 | } else { |
| 145 | self->ctx.ddr2l1LoopW = 1; | 145 | self->ctx.ddr2l1LoopW = 1; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | - self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->convApiTiling.woL1; | 148 | + self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->woL1; |
| 149 | - self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.woL1 : self->ctx.woAL1Tail; | 149 | + self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->woL1 : self->ctx.woAL1Tail; |
| 150 | if constexpr (Intf::hasWL0IterFlag) { | 150 | if constexpr (Intf::hasWL0IterFlag) { |
| 151 | - if (self->ctx.convTilingData->convApiTiling.hoL0 > 1 && self->ctx.woAL1Tail % BLOCK_L0_N > 0 && | 151 | + if (self->ctx.convTilingData->hoL0 > 1 && self->ctx.woAL1Tail % BLOCK_L0_N > 0 && |
| 152 | - CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->convApiTiling.woL0) > 1) { | 152 | + CeilDiv(self->ctx.woAL1Tail, self->ctx.convTilingData->woL0) > 1) { |
| 153 | - self->ctx.woL1SmallTail = self->ctx.woAL1Tail % self->ctx.convTilingData->convApiTiling.woL0; | 153 | + self->ctx.woL1SmallTail = self->ctx.woAL1Tail % self->ctx.convTilingData->woL0; |
| 154 | - self->ctx.woAL1Tail = (self->ctx.woAL1Tail / self->ctx.convTilingData->convApiTiling.woL0) * self->ctx.convTilingData->convApiTiling.woL0; | 154 | + self->ctx.woAL1Tail = (self->ctx.woAL1Tail / self->ctx.convTilingData->woL0) * self->ctx.convTilingData->woL0; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | if (self->ctx.woL1SmallTail > 0) { | 157 | if (self->ctx.woL1SmallTail > 0) { |
| @@ -160,8 +160,8 @@ __aicore__ inline void OptGroupInitIterValueNfirstHWMode(Intf *self) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | if (!self->ctx.kBL1fullload) { | 162 | if (!self->ctx.kBL1fullload) { |
| 163 | - self->ctx.hoAL1Tail = self->ctx.singleCoreHo % self->ctx.convTilingData->convApiTiling.hoL1; | 163 | + self->ctx.hoAL1Tail = self->ctx.singleCoreHo % self->ctx.convTilingData->hoL1; |
| 164 | - self->ctx.hoAL1Tail = self->ctx.hoAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.hoL1 : self->ctx.hoAL1Tail; | 164 | + self->ctx.hoAL1Tail = self->ctx.hoAL1Tail == 0 ? self->ctx.convTilingData->hoL1 : self->ctx.hoAL1Tail; |
| 165 | self->ctx.currentHoL1 = self->ctx.hoAL1Tail; | 165 | self->ctx.currentHoL1 = self->ctx.hoAL1Tail; |
| 166 | self->ctx.currentWoL1 = self->ctx.woAL1Tail; | 166 | self->ctx.currentWoL1 = self->ctx.woAL1Tail; |
| 167 | self->ctx.maxWoL1Iter = self->ctx.ddr2l1LoopW - 1; | 167 | self->ctx.maxWoL1Iter = self->ctx.ddr2l1LoopW - 1; |
| @@ -225,15 +225,15 @@ template <class Intf> | |||
| 225 | __aicore__ inline void OptGroupInitKValue(Intf *self) | 225 | __aicore__ inline void OptGroupInitKValue(Intf *self) |
| 226 | { | 226 | { |
| 227 | self->ctx.ddr2l1LoopKB = | 227 | self->ctx.ddr2l1LoopKB = |
| 228 | - CeilDiv(AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD, | 228 | + CeilDiv(AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelWxkernelD, |
| 229 | - self->ctx.convTilingData->convApiTiling.kBL1); | 229 | + self->ctx.convTilingData->kBL1); |
| 230 | self->ctx.maxKBL1Iter = self->ctx.ddr2l1LoopKB - 1; | 230 | self->ctx.maxKBL1Iter = self->ctx.ddr2l1LoopKB - 1; |
| 231 | self->ctx.kBL1fullload = self->ctx.ddr2l1LoopKB == 1; | 231 | self->ctx.kBL1fullload = self->ctx.ddr2l1LoopKB == 1; |
| 232 | 232 | ||
| 233 | self->ctx.ci1Opt = CeilDiv(self->ctx.singleCoreCi, Intf::k0); | 233 | self->ctx.ci1Opt = CeilDiv(self->ctx.singleCoreCi, Intf::k0); |
| 234 | 234 | ||
| 235 | if constexpr (Intf::isConv3D) { | 235 | if constexpr (Intf::isConv3D) { |
| 236 | - self->ctx.bL1Cin = self->ctx.convTilingData->convApiTiling.cinBInCore / self->ctx.bL1Dk; | 236 | + self->ctx.bL1Cin = self->ctx.convTilingData->cinBInCore / self->ctx.bL1Dk; |
| 237 | self->ctx.bL1CinTail = self->ctx.bL1Dk > 1 ? self->ctx.bL1Cin : self->ctx.singleCoreCi % self->ctx.bL1Cin; | 237 | self->ctx.bL1CinTail = self->ctx.bL1Dk > 1 ? self->ctx.bL1Cin : self->ctx.singleCoreCi % self->ctx.bL1Cin; |
| 238 | self->ctx.bL1CinTail = self->ctx.bL1CinTail == 0 ? self->ctx.bL1Cin : self->ctx.bL1CinTail; | 238 | self->ctx.bL1CinTail = self->ctx.bL1CinTail == 0 ? self->ctx.bL1Cin : self->ctx.bL1CinTail; |
| 239 | self->ctx.bL1CinLoadNum = CeilDiv(self->ctx.singleCoreCi, self->ctx.bL1Cin); | 239 | self->ctx.bL1CinLoadNum = CeilDiv(self->ctx.singleCoreCi, self->ctx.bL1Cin); |
| @@ -243,28 +243,28 @@ __aicore__ inline void OptGroupInitKValue(Intf *self) | |||
| 243 | template <class Intf> | 243 | template <class Intf> |
| 244 | __aicore__ inline void OptGroupInitNValue(Intf *self) | 244 | __aicore__ inline void OptGroupInitNValue(Intf *self) |
| 245 | { | 245 | { |
| 246 | - self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->convApiTiling.nBL1; | 246 | + self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->nBL1; |
| 247 | - self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.nBL1 : self->ctx.nBL1Tail; | 247 | + self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->nBL1 : self->ctx.nBL1Tail; |
| 248 | 248 | ||
| 249 | if constexpr (!Intf::hasNL1IterFlag) { | 249 | if constexpr (!Intf::hasNL1IterFlag) { |
| 250 | self->ctx.ddr2l1LoopN = 1; | 250 | self->ctx.ddr2l1LoopN = 1; |
| 251 | self->ctx.maxNBL1Iter = 0; | 251 | self->ctx.maxNBL1Iter = 0; |
| 252 | } else { | 252 | } else { |
| 253 | - self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->convApiTiling.nBL1); | 253 | + self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->nBL1); |
| 254 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; | 254 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | if constexpr (!Intf::hasNL0IterFlag) { | 257 | if constexpr (!Intf::hasNL0IterFlag) { |
| 258 | self->ctx.l12l0LoopN = 1; | 258 | self->ctx.l12l0LoopN = 1; |
| 259 | } else { | 259 | } else { |
| 260 | - self->ctx.l12l0LoopN = self->ctx.convTilingData->convApiTiling.multiNBL1; | 260 | + self->ctx.l12l0LoopN = self->ctx.convTilingData->multiNBL1; |
| 261 | } | 261 | } |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | template <class Intf> | 264 | template <class Intf> |
| 265 | __aicore__ inline void OptGroupInitBuf(Intf *self) | 265 | __aicore__ inline void OptGroupInitBuf(Intf *self) |
| 266 | { | 266 | { |
| 267 | - self->ctx.ubBufSize = self->ctx.ci1Opt * self->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD * self->ctx.co1Opt * | 267 | + self->ctx.ubBufSize = self->ctx.ci1Opt * self->ctx.convTilingData->kernelHxkernelWxkernelD * self->ctx.co1Opt * |
| 268 | Intf::k0 * BLOCK_L0_N; | 268 | Intf::k0 * BLOCK_L0_N; |
| 269 | self->ctx.pipe.InitBuffer(self->ctx.ndUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); | 269 | self->ctx.pipe.InitBuffer(self->ctx.ndUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); |
| 270 | self->ctx.pipe.InitBuffer(self->ctx.nzUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); | 270 | self->ctx.pipe.InitBuffer(self->ctx.nzUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); |
| @@ -272,11 +272,11 @@ __aicore__ inline void OptGroupInitBuf(Intf *self) | |||
| 272 | 272 | ||
| 273 | self->ctx.nzTensor = self->ctx.nzUbBuf.template Get<typename Intf::WeightT>(); | 273 | self->ctx.nzTensor = self->ctx.nzUbBuf.template Get<typename Intf::WeightT>(); |
| 274 | 274 | ||
| 275 | - uint32_t aL1SpaceSize = self->ctx.convTilingData->convApiTiling.aL1SpaceSize; | 275 | + uint32_t aL1SpaceSize = self->ctx.convTilingData->aL1SpaceSize; |
| 276 | - if ((self->ctx.convTilingData->convApiTiling.pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { | 276 | + if ((self->ctx.convTilingData->pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { |
| 277 | aL1SpaceSize *= DOUBLE_BUF; | 277 | aL1SpaceSize *= DOUBLE_BUF; |
| 278 | } | 278 | } |
| 279 | - self->ctx.bL1SpaceSize = self->ctx.convTilingData->convApiTiling.nBL1 * self->ctx.convTilingData->convApiTiling.kBL1; | 279 | + self->ctx.bL1SpaceSize = self->ctx.convTilingData->nBL1 * self->ctx.convTilingData->kBL1; |
| 280 | 280 | ||
| 281 | if constexpr (Intf::bL1DBFlag) { | 281 | if constexpr (Intf::bL1DBFlag) { |
| 282 | self->ctx.pipe.InitBuffer(self->ctx.bL1TBuf, | 282 | self->ctx.pipe.InitBuffer(self->ctx.bL1TBuf, |
| @@ -294,37 +294,37 @@ __aicore__ inline void OptGroupVecInit(Intf *self) | |||
| 294 | { | 294 | { |
| 295 | self->ctx.vecId = GetSubBlockIdx(); | 295 | self->ctx.vecId = GetSubBlockIdx(); |
| 296 | 296 | ||
| 297 | - self->ctx.singleCoreCi = self->ctx.convTilingData->convApiTiling.singleCoreCi; | 297 | + self->ctx.singleCoreCi = self->ctx.convTilingData->singleCoreCi; |
| 298 | - self->ctx.singleCoreCo = self->ctx.convTilingData->convApiTiling.singleCoreCo; | 298 | + self->ctx.singleCoreCo = self->ctx.convTilingData->singleCoreCo; |
| 299 | - self->ctx.singleGroups = self->ctx.convTilingData->convApiTiling.singleCoreGroups; | 299 | + self->ctx.singleGroups = self->ctx.convTilingData->singleCoreGroups; |
| 300 | - self->ctx.singleGroupOpt = self->ctx.convTilingData->convApiTiling.singleCoreGroupOpt; | 300 | + self->ctx.singleGroupOpt = self->ctx.convTilingData->singleCoreGroupOpt; |
| 301 | 301 | ||
| 302 | - self->ctx.enlarge = self->ctx.convTilingData->convApiTiling.enlarge; | 302 | + self->ctx.enlarge = self->ctx.convTilingData->enlarge; |
| 303 | - self->ctx.ciPerGroup = self->ctx.convTilingData->convApiTiling.orgCi / self->ctx.convTilingData->convApiTiling.groups; | 303 | + self->ctx.ciPerGroup = self->ctx.convTilingData->orgCi / self->ctx.convTilingData->groups; |
| 304 | - self->ctx.coPerGroup = self->ctx.convTilingData->convApiTiling.orgCo / self->ctx.convTilingData->convApiTiling.groups; | 304 | + self->ctx.coPerGroup = self->ctx.convTilingData->orgCo / self->ctx.convTilingData->groups; |
| 305 | - self->ctx.ciOpt = self->ctx.ciPerGroup * self->ctx.convTilingData->convApiTiling.enlarge; | 305 | + self->ctx.ciOpt = self->ctx.ciPerGroup * self->ctx.convTilingData->enlarge; |
| 306 | self->ctx.ci1Opt = CeilDiv(self->ctx.ciOpt, Intf::k0); | 306 | self->ctx.ci1Opt = CeilDiv(self->ctx.ciOpt, Intf::k0); |
| 307 | self->ctx.ciOptAlign = self->ctx.ci1Opt * Intf::k0; | 307 | self->ctx.ciOptAlign = self->ctx.ci1Opt * Intf::k0; |
| 308 | - self->ctx.kUbSize = self->ctx.ciOptAlign * self->ctx.convTilingData->convApiTiling.kernelHxkernelWxkernelD; | 308 | + self->ctx.kUbSize = self->ctx.ciOptAlign * self->ctx.convTilingData->kernelHxkernelWxkernelD; |
| 309 | - self->ctx.coOpt = self->ctx.coPerGroup * self->ctx.convTilingData->convApiTiling.enlarge; | 309 | + self->ctx.coOpt = self->ctx.coPerGroup * self->ctx.convTilingData->enlarge; |
| 310 | self->ctx.co1Opt = CeilDiv(self->ctx.coOpt, BLOCK_L0_N); | 310 | self->ctx.co1Opt = CeilDiv(self->ctx.coOpt, BLOCK_L0_N); |
| 311 | self->ctx.coOptAlign = self->ctx.co1Opt * BLOCK_L0_N; | 311 | self->ctx.coOptAlign = self->ctx.co1Opt * BLOCK_L0_N; |
| 312 | 312 | ||
| 313 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { | 313 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { |
| 314 | - self->ctx.singleCoreM = self->ctx.convTilingData->convApiTiling.singleCoreHo; | 314 | + self->ctx.singleCoreM = self->ctx.convTilingData->singleCoreHo; |
| 315 | - self->ctx.mAL1 = self->ctx.convTilingData->convApiTiling.hoL1; | 315 | + self->ctx.mAL1 = self->ctx.convTilingData->hoL1; |
| 316 | - self->ctx.mL0 = self->ctx.convTilingData->convApiTiling.hoL0; | 316 | + self->ctx.mL0 = self->ctx.convTilingData->hoL0; |
| 317 | } else { | 317 | } else { |
| 318 | - self->ctx.singleCoreHo = self->ctx.convTilingData->convApiTiling.singleCoreHo; | 318 | + self->ctx.singleCoreHo = self->ctx.convTilingData->singleCoreHo; |
| 319 | - self->ctx.singleCoreWo = self->ctx.convTilingData->convApiTiling.singleCoreWo; | 319 | + self->ctx.singleCoreWo = self->ctx.convTilingData->singleCoreWo; |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | if constexpr (Intf::isConv3D) { | 322 | if constexpr (Intf::isConv3D) { |
| 323 | - self->ctx.singleCoreDo = self->ctx.convTilingData->convApiTiling.singleCoreDo; | 323 | + self->ctx.singleCoreDo = self->ctx.convTilingData->singleCoreDo; |
| 324 | self->ctx.cin1xcin0 = AlignB(self->ctx.singleCoreCi, Intf::k0); | 324 | self->ctx.cin1xcin0 = AlignB(self->ctx.singleCoreCi, Intf::k0); |
| 325 | - self->ctx.bL1Dk = self->ctx.convTilingData->convApiTiling.cinBInCore <= self->ctx.cin1xcin0 ? | 325 | + self->ctx.bL1Dk = self->ctx.convTilingData->cinBInCore <= self->ctx.cin1xcin0 ? |
| 326 | - 1 : self->ctx.convTilingData->convApiTiling.cinBInCore / self->ctx.cin1xcin0; | 326 | + 1 : self->ctx.convTilingData->cinBInCore / self->ctx.cin1xcin0; |
| 327 | - self->ctx.bL1DkTail = self->ctx.convTilingData->convApiTiling.kernelD % self->ctx.bL1Dk; | 327 | + self->ctx.bL1DkTail = self->ctx.convTilingData->kernelD % self->ctx.bL1Dk; |
| 328 | self->ctx.bL1DkTail = self->ctx.bL1DkTail == 0 ? self->ctx.bL1Dk : self->ctx.bL1DkTail; | 328 | self->ctx.bL1DkTail = self->ctx.bL1DkTail == 0 ? self->ctx.bL1Dk : self->ctx.bL1DkTail; |
| 329 | } | 329 | } |
| 330 | 330 | ||
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -31,7 +32,7 @@ using namespace std; | |||
| 31 | 32 | ||
| 32 | 33 | ||
| 33 | namespace conv_tiling { | 34 | namespace conv_tiling { |
| 34 | -int64_t Conv2dTiling::GetTiling(optiling::TConv2DTiling &tiling) | 35 | +int64_t Conv2dTiling::GetTiling(optiling::Conv2DTilingData &tiling) |
| 35 | { | 36 | { |
| 36 | if (!CheckParams()) { | 37 | if (!CheckParams()) { |
| 37 | OP_LOGE(nodeType, "conv2d api tiling check params failed."); | 38 | OP_LOGE(nodeType, "conv2d api tiling check params failed."); |
| @@ -57,7 +58,7 @@ int64_t Conv2dTiling::GetTiling(optiling::TConv2DTiling &tiling) | |||
| 57 | return 0; | 58 | return 0; |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | -bool Conv2dTiling::GetTiling(Conv2DBasicBlockInfo& conv2DBasicBlockInfo, optiling::TConv2DTiling &tiling) | 61 | +bool Conv2dTiling::GetTiling(Conv2DBasicBlockInfo& conv2DBasicBlockInfo, optiling::Conv2DTilingData &tiling) |
| 61 | { | 62 | { |
| 62 | if (!CheckTilingAlgorithmType(conv2DBasicBlockInfo, BB_PHASE_2)) { | 63 | if (!CheckTilingAlgorithmType(conv2DBasicBlockInfo, BB_PHASE_2)) { |
| 63 | return false; | 64 | return false; |
| @@ -260,7 +261,7 @@ void Conv2dTiling::GetDmaUbTiling(ConvDmaParams& params) | |||
| 260 | params.khUb = static_cast<uint32_t>(khUbRange[khUbIdx]); | 261 | params.khUb = static_cast<uint32_t>(khUbRange[khUbIdx]); |
| 261 | } | 262 | } |
| 262 | 263 | ||
| 263 | -void Conv2dTiling::SetScalarParams(optiling::TConv2DTiling& tiling) | 264 | +void Conv2dTiling::SetScalarParams(optiling::Conv2DTilingData& tiling) |
| 264 | { | 265 | { |
| 265 | // calculate the follow params in tiling process, for scalar optimization in kernel | 266 | // calculate the follow params in tiling process, for scalar optimization in kernel |
| 266 | uint32_t kernelHxkernelW = tiling.get_kernelH() * tiling.get_kernelW(); | 267 | uint32_t kernelHxkernelW = tiling.get_kernelH() * tiling.get_kernelW(); |
| @@ -309,7 +310,7 @@ void Conv2dTiling::SetScalarParams(optiling::TConv2DTiling& tiling) | |||
| 309 | tiling.set_aL1SpaceSize(CalcAL1SpaceSize(tiling)); | 310 | tiling.set_aL1SpaceSize(CalcAL1SpaceSize(tiling)); |
| 310 | } | 311 | } |
| 311 | 312 | ||
| 312 | -void Conv2dTiling::SetUbTiling(optiling::TConv2DTiling& tiling) | 313 | +void Conv2dTiling::SetUbTiling(optiling::Conv2DTilingData& tiling) |
| 313 | { | 314 | { |
| 314 | if (isDmaFlag) { | 315 | if (isDmaFlag) { |
| 315 | ConvDmaParams params = {l1TilingInfo.hoAL1, l1TilingInfo.woAL1, l1TilingInfo.khL1, | 316 | ConvDmaParams params = {l1TilingInfo.hoAL1, l1TilingInfo.woAL1, l1TilingInfo.khL1, |
| @@ -350,7 +351,7 @@ void Conv2dTiling::SetUbTiling(optiling::TConv2DTiling& tiling) | |||
| 350 | tiling.set_bUbKStep(0); | 351 | tiling.set_bUbKStep(0); |
| 351 | } | 352 | } |
| 352 | 353 | ||
| 353 | -void Conv2dTiling::SetExtendConv2DParams(optiling::TConv2DTiling& tiling) | 354 | +void Conv2dTiling::SetExtendConv2DParams(optiling::Conv2DTilingData& tiling) |
| 354 | { | 355 | { |
| 355 | // set extendConv2d fixpipe mode to tilingdata | 356 | // set extendConv2d fixpipe mode to tilingdata |
| 356 | tiling.set_quantMode0(shapeInfo.quantMode0); | 357 | tiling.set_quantMode0(shapeInfo.quantMode0); |
| @@ -362,7 +363,7 @@ void Conv2dTiling::SetExtendConv2DParams(optiling::TConv2DTiling& tiling) | |||
| 362 | tiling.set_dualOutput(shapeInfo.dualOutput); | 363 | tiling.set_dualOutput(shapeInfo.dualOutput); |
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | -void Conv2dTiling::SetTilingData(optiling::TConv2DTiling& tiling) | 366 | +void Conv2dTiling::SetTilingData(optiling::Conv2DTilingData& tiling) |
| 366 | { | 367 | { |
| 367 | if (outputOrder == static_cast<int8_t>(OutputOrder::M)) { | 368 | if (outputOrder == static_cast<int8_t>(OutputOrder::M)) { |
| 368 | tiling.set_singleCoreHo(static_cast<uint64_t>(shapeInfo.singleM)); | 369 | tiling.set_singleCoreHo(static_cast<uint64_t>(shapeInfo.singleM)); |
| @@ -417,7 +418,7 @@ void Conv2dTiling::SetTilingData(optiling::TConv2DTiling& tiling) | |||
| 417 | SetExtendConv2DParams(tiling); | 418 | SetExtendConv2DParams(tiling); |
| 418 | } | 419 | } |
| 419 | 420 | ||
| 420 | -void Conv2dTiling::SetAttrsTilingData(optiling::TConv2DTiling& tiling) | 421 | +void Conv2dTiling::SetAttrsTilingData(optiling::Conv2DTilingData& tiling) |
| 421 | { | 422 | { |
| 422 | tiling.set_strideH(static_cast<uint32_t>(attrInfo.strideH)); | 423 | tiling.set_strideH(static_cast<uint32_t>(attrInfo.strideH)); |
| 423 | tiling.set_strideW(static_cast<uint32_t>(attrInfo.strideW)); | 424 | tiling.set_strideW(static_cast<uint32_t>(attrInfo.strideW)); |
| @@ -440,7 +441,7 @@ void Conv2dTiling::SetAttrsTilingData(optiling::TConv2DTiling& tiling) | |||
| 440 | tiling.set_roundMode(attrInfo.roundMode); | 441 | tiling.set_roundMode(attrInfo.roundMode); |
| 441 | } | 442 | } |
| 442 | 443 | ||
| 443 | -uint32_t Conv2dTiling::CalcAL1SpaceSize(optiling::TConv2DTiling& tiling) | 444 | +uint32_t Conv2dTiling::CalcAL1SpaceSize(optiling::Conv2DTilingData& tiling) |
| 444 | { | 445 | { |
| 445 | uint64_t aL1SpaceSize = 0; | 446 | uint64_t aL1SpaceSize = 0; |
| 446 | uint64_t fmapSize = DTYPE_SIZE_TAB.at(descInfo.fMapType.dtype); | 447 | uint64_t fmapSize = DTYPE_SIZE_TAB.at(descInfo.fMapType.dtype); |
| @@ -22,6 +22,10 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | +namespace optiling { | ||
| 26 | + class Conv2DTilingData; | ||
| 27 | +} | ||
| 28 | + | ||
| 25 | namespace conv_tiling { | 29 | namespace conv_tiling { |
| 26 | using optiling::conv_ops_tiling::FixpipeInfo; | 30 | using optiling::conv_ops_tiling::FixpipeInfo; |
| 27 | using optiling::conv_ops_tiling::ConvOriGroupInfo; | 31 | using optiling::conv_ops_tiling::ConvOriGroupInfo; |
| @@ -76,8 +80,8 @@ public: | |||
| 76 | Conv2dTiling() {}; | 80 | Conv2dTiling() {}; |
| 77 | explicit Conv2dTiling(const PlatformInfo& platform) : ConvTilingBase(platform) {}; | 81 | explicit Conv2dTiling(const PlatformInfo& platform) : ConvTilingBase(platform) {}; |
| 78 | ~Conv2dTiling() override {}; | 82 | ~Conv2dTiling() override {}; |
| 79 | - int64_t GetTiling(optiling::TConv2DTiling &tiling); | 83 | + int64_t GetTiling(optiling::Conv2DTilingData &tiling); |
| 80 | - bool GetTiling(Conv2DBasicBlockInfo& conv2DBasicBlockInfo, optiling::TConv2DTiling &tiling); | 84 | + bool GetTiling(Conv2DBasicBlockInfo& conv2DBasicBlockInfo, optiling::Conv2DTilingData &tiling); |
| 81 | int64_t Compute() override; | 85 | int64_t Compute() override; |
| 82 | 86 | ||
| 83 | void SetOrgWeightShape(int64_t orgCo, int64_t orgkH, int64_t orgkW); | 87 | void SetOrgWeightShape(int64_t orgCo, int64_t orgkH, int64_t orgkW); |
| @@ -113,14 +117,14 @@ public: | |||
| 113 | void GetDmaUbTiling(ConvDmaParams& params); | 117 | void GetDmaUbTiling(ConvDmaParams& params); |
| 114 | private: | 118 | private: |
| 115 | std::shared_ptr<ConvTilingAlgorithmBase> algoPtr; | 119 | std::shared_ptr<ConvTilingAlgorithmBase> algoPtr; |
| 116 | - void SetTilingData(optiling::TConv2DTiling& tiling); | 120 | + void SetTilingData(optiling::Conv2DTilingData& tiling); |
| 117 | - void SetAttrsTilingData(optiling::TConv2DTiling& tiling); | 121 | + void SetAttrsTilingData(optiling::Conv2DTilingData& tiling); |
| 118 | - void SetScalarParams(optiling::TConv2DTiling& tiling); | 122 | + void SetScalarParams(optiling::Conv2DTilingData& tiling); |
| 119 | - void SetUbTiling(optiling::TConv2DTiling& tiling); | 123 | + void SetUbTiling(optiling::Conv2DTilingData& tiling); |
| 120 | - void SetExtendConv2DParams(optiling::TConv2DTiling& tiling); | 124 | + void SetExtendConv2DParams(optiling::Conv2DTilingData& tiling); |
| 121 | uint64_t CalcWeightUBSize(ConvWeightUbTransParams& params, uint64_t ci1Ub, uint64_t co1Ub) const; | 125 | uint64_t CalcWeightUBSize(ConvWeightUbTransParams& params, uint64_t ci1Ub, uint64_t co1Ub) const; |
| 122 | uint64_t CalcDmaUBSize(ConvDmaParams& params, uint64_t khUb, uint64_t kwUb) const; | 126 | uint64_t CalcDmaUBSize(ConvDmaParams& params, uint64_t khUb, uint64_t kwUb) const; |
| 123 | - uint32_t CalcAL1SpaceSize(optiling::TConv2DTiling& tiling); | 127 | + uint32_t CalcAL1SpaceSize(optiling::Conv2DTilingData& tiling); |
| 124 | void SetDefaultDdim(); | 128 | void SetDefaultDdim(); |
| 125 | void Infer5hdShape(); | 129 | void Infer5hdShape(); |
| 126 | bool CheckParams(); | 130 | bool CheckParams(); |
| @@ -440,12 +440,12 @@ ge::graphStatus Conv2dBaseTiling::GetFeatureFlag() | |||
| 440 | 440 | ||
| 441 | void Conv2dBaseTiling::SetNumBlocksRes() | 441 | void Conv2dBaseTiling::SetNumBlocksRes() |
| 442 | { | 442 | { |
| 443 | - numBlocksRes.batchDim = tilingData_.convRunInfo.get_batchDim(); | 443 | + numBlocksRes.batchDim = tilingData_.get_batchDim(); |
| 444 | - numBlocksRes.nDim = tilingData_.convRunInfo.get_nDim(); | 444 | + numBlocksRes.nDim = tilingData_.get_nDim(); |
| 445 | - numBlocksRes.hoDim = tilingData_.convRunInfo.get_hoDim(); | 445 | + numBlocksRes.hoDim = tilingData_.get_hoDim(); |
| 446 | - numBlocksRes.woDim = tilingData_.convRunInfo.get_woDim(); | 446 | + numBlocksRes.woDim = tilingData_.get_woDim(); |
| 447 | numBlocksRes.mDim = numBlocksRes.hoDim; | 447 | numBlocksRes.mDim = numBlocksRes.hoDim; |
| 448 | - numBlocksRes.groupDim = tilingData_.convRunInfo.get_groupDim(); | 448 | + numBlocksRes.groupDim = tilingData_.get_groupDim(); |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | // reset conv2d API's tilingdata | 451 | // reset conv2d API's tilingdata |
| @@ -63,68 +63,68 @@ bool Conv2dBaseTiling::AddTilingToCache() | |||
| 63 | 63 | ||
| 64 | void Conv2dBaseTiling::GetCachedTilingDataAux() | 64 | void Conv2dBaseTiling::GetCachedTilingDataAux() |
| 65 | { | 65 | { |
| 66 | - cachedTilingData_.fmapKStride = tilingData_.convApiTiling.get_fmapKStride(); | 66 | + cachedTilingData_.fmapKStride = tilingData_.get_fmapKStride(); |
| 67 | - cachedTilingData_.weightKStride = tilingData_.convApiTiling.get_weightKStride(); | 67 | + cachedTilingData_.weightKStride = tilingData_.get_weightKStride(); |
| 68 | - cachedTilingData_.cinOffsetBlockInGM = tilingData_.convApiTiling.get_cinOffsetBlockInGM(); | 68 | + cachedTilingData_.cinOffsetBlockInGM = tilingData_.get_cinOffsetBlockInGM(); |
| 69 | - cachedTilingData_.coutOffsetBlock = tilingData_.convApiTiling.get_coutOffsetBlock(); | 69 | + cachedTilingData_.coutOffsetBlock = tilingData_.get_coutOffsetBlock(); |
| 70 | - cachedTilingData_.nL1DivBlockSize = tilingData_.convApiTiling.get_nL1DivBlockSize(); | 70 | + cachedTilingData_.nL1DivBlockSize = tilingData_.get_nL1DivBlockSize(); |
| 71 | - cachedTilingData_.iterateMNOrder = tilingData_.convApiTiling.get_iterateMNOrder(); | 71 | + cachedTilingData_.iterateMNOrder = tilingData_.get_iterateMNOrder(); |
| 72 | - cachedTilingData_.biasFullLoadFlag = tilingData_.convApiTiling.get_biasFullLoadFlag(); | 72 | + cachedTilingData_.biasFullLoadFlag = tilingData_.get_biasFullLoadFlag(); |
| 73 | - cachedTilingData_.fixpParamsFullLoadFlag = tilingData_.convApiTiling.get_fixpParamsFullLoadFlag(); | 73 | + cachedTilingData_.fixpParamsFullLoadFlag = tilingData_.get_fixpParamsFullLoadFlag(); |
| 74 | - cachedTilingData_.hf32Enable = tilingData_.convApiTiling.get_hf32Enable(); | 74 | + cachedTilingData_.hf32Enable = tilingData_.get_hf32Enable(); |
| 75 | - cachedTilingData_.hf32TransMode = tilingData_.convApiTiling.get_hf32TransMode(); | 75 | + cachedTilingData_.hf32TransMode = tilingData_.get_hf32TransMode(); |
| 76 | - cachedTilingData_.batchDim = tilingData_.convRunInfo.get_batchDim(); | 76 | + cachedTilingData_.batchDim = tilingData_.get_batchDim(); |
| 77 | - cachedTilingData_.groupDim = tilingData_.convRunInfo.get_groupDim(); | 77 | + cachedTilingData_.groupDim = tilingData_.get_groupDim(); |
| 78 | - cachedTilingData_.nDim = tilingData_.convRunInfo.get_nDim(); | 78 | + cachedTilingData_.nDim = tilingData_.get_nDim(); |
| 79 | - cachedTilingData_.hoDim = tilingData_.convRunInfo.get_hoDim(); | 79 | + cachedTilingData_.hoDim = tilingData_.get_hoDim(); |
| 80 | - cachedTilingData_.woDim = tilingData_.convRunInfo.get_woDim(); | 80 | + cachedTilingData_.woDim = tilingData_.get_woDim(); |
| 81 | - cachedTilingData_.cinOpt = tilingData_.convRunInfo.get_cinOpt(); | 81 | + cachedTilingData_.cinOpt = tilingData_.get_cinOpt(); |
| 82 | - cachedTilingData_.coutOpt = tilingData_.convRunInfo.get_coutOpt(); | 82 | + cachedTilingData_.coutOpt = tilingData_.get_coutOpt(); |
| 83 | - cachedTilingData_.groupOpt = tilingData_.convRunInfo.get_groupOpt(); | 83 | + cachedTilingData_.groupOpt = tilingData_.get_groupOpt(); |
| 84 | cachedTilingData_.enableC04Flag = flagInfo_.enableC04Flag; | 84 | cachedTilingData_.enableC04Flag = flagInfo_.enableC04Flag; |
| 85 | cachedTilingData_.mSplitModeFlag = flagInfo_.mSplitModeFlag; | 85 | cachedTilingData_.mSplitModeFlag = flagInfo_.mSplitModeFlag; |
| 86 | - cachedTilingData_.unionDataXt = tilingData_.convApiTiling.get_unionDataXt(); | 86 | + cachedTilingData_.unionDataXt = tilingData_.get_unionDataXt(); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | void Conv2dBaseTiling::GetCachedTilingData() | 89 | void Conv2dBaseTiling::GetCachedTilingData() |
| 90 | { | 90 | { |
| 91 | - cachedTilingData_.singleCoreBatch = tilingData_.convApiTiling.get_singleCoreBatch(); | 91 | + cachedTilingData_.singleCoreBatch = tilingData_.get_singleCoreBatch(); |
| 92 | - cachedTilingData_.singleCoreHo = tilingData_.convApiTiling.get_singleCoreHo(); | 92 | + cachedTilingData_.singleCoreHo = tilingData_.get_singleCoreHo(); |
| 93 | - cachedTilingData_.singleCoreWo = tilingData_.convApiTiling.get_singleCoreWo(); | 93 | + cachedTilingData_.singleCoreWo = tilingData_.get_singleCoreWo(); |
| 94 | - cachedTilingData_.singleCoreCi = tilingData_.convApiTiling.get_singleCoreCi(); | 94 | + cachedTilingData_.singleCoreCi = tilingData_.get_singleCoreCi(); |
| 95 | - cachedTilingData_.singleCoreCo = tilingData_.convApiTiling.get_singleCoreCo(); | 95 | + cachedTilingData_.singleCoreCo = tilingData_.get_singleCoreCo(); |
| 96 | - cachedTilingData_.hoL1 = tilingData_.convApiTiling.get_hoL1(); | 96 | + cachedTilingData_.hoL1 = tilingData_.get_hoL1(); |
| 97 | - cachedTilingData_.woL1 = tilingData_.convApiTiling.get_woL1(); | 97 | + cachedTilingData_.woL1 = tilingData_.get_woL1(); |
| 98 | - cachedTilingData_.kAL1 = tilingData_.convApiTiling.get_kAL1(); | 98 | + cachedTilingData_.kAL1 = tilingData_.get_kAL1(); |
| 99 | - cachedTilingData_.kBL1 = tilingData_.convApiTiling.get_kBL1(); | 99 | + cachedTilingData_.kBL1 = tilingData_.get_kBL1(); |
| 100 | - cachedTilingData_.khL1 = tilingData_.convApiTiling.get_khL1(); | 100 | + cachedTilingData_.khL1 = tilingData_.get_khL1(); |
| 101 | - cachedTilingData_.kwL1 = tilingData_.convApiTiling.get_kwL1(); | 101 | + cachedTilingData_.kwL1 = tilingData_.get_kwL1(); |
| 102 | - cachedTilingData_.nBL1 = tilingData_.convApiTiling.get_nBL1(); | 102 | + cachedTilingData_.nBL1 = tilingData_.get_nBL1(); |
| 103 | - cachedTilingData_.hoL0 = tilingData_.convApiTiling.get_hoL0(); | 103 | + cachedTilingData_.hoL0 = tilingData_.get_hoL0(); |
| 104 | - cachedTilingData_.woL0 = tilingData_.convApiTiling.get_woL0(); | 104 | + cachedTilingData_.woL0 = tilingData_.get_woL0(); |
| 105 | - cachedTilingData_.kL0 = tilingData_.convApiTiling.get_kL0(); | 105 | + cachedTilingData_.kL0 = tilingData_.get_kL0(); |
| 106 | - cachedTilingData_.nL0 = tilingData_.convApiTiling.get_nL0(); | 106 | + cachedTilingData_.nL0 = tilingData_.get_nL0(); |
| 107 | - cachedTilingData_.pBufferFlag = tilingData_.convApiTiling.get_pBufferFlag(); | 107 | + cachedTilingData_.pBufferFlag = tilingData_.get_pBufferFlag(); |
| 108 | - cachedTilingData_.enlarge = tilingData_.convApiTiling.get_enlarge(); | 108 | + cachedTilingData_.enlarge = tilingData_.get_enlarge(); |
| 109 | - cachedTilingData_.singleCoreGroups = tilingData_.convApiTiling.get_singleCoreGroups(); | 109 | + cachedTilingData_.singleCoreGroups = tilingData_.get_singleCoreGroups(); |
| 110 | - cachedTilingData_.singleCoreGroupOpt = tilingData_.convApiTiling.get_singleCoreGroupOpt(); | 110 | + cachedTilingData_.singleCoreGroupOpt = tilingData_.get_singleCoreGroupOpt(); |
| 111 | - cachedTilingData_.bUbNStep = tilingData_.convApiTiling.get_bUbNStep(); | 111 | + cachedTilingData_.bUbNStep = tilingData_.get_bUbNStep(); |
| 112 | - cachedTilingData_.bUbKStep = tilingData_.convApiTiling.get_bUbKStep(); | 112 | + cachedTilingData_.bUbKStep = tilingData_.get_bUbKStep(); |
| 113 | - cachedTilingData_.khUb = tilingData_.convApiTiling.get_khUb(); | 113 | + cachedTilingData_.khUb = tilingData_.get_khUb(); |
| 114 | - cachedTilingData_.kwUb = tilingData_.convApiTiling.get_kwUb(); | 114 | + cachedTilingData_.kwUb = tilingData_.get_kwUb(); |
| 115 | - cachedTilingData_.orgHixWi = tilingData_.convApiTiling.get_orgHixWi(); | 115 | + cachedTilingData_.orgHixWi = tilingData_.get_orgHixWi(); |
| 116 | - cachedTilingData_.kernelHxkernelW = tilingData_.convApiTiling.get_kernelHxkernelW(); | 116 | + cachedTilingData_.kernelHxkernelW = tilingData_.get_kernelHxkernelW(); |
| 117 | - cachedTilingData_.kernelHxkernelWxkernelD = tilingData_.convApiTiling.get_kernelHxkernelWxkernelD(); | 117 | + cachedTilingData_.kernelHxkernelWxkernelD = tilingData_.get_kernelHxkernelWxkernelD(); |
| 118 | - cachedTilingData_.aL1SpaceSize = tilingData_.convApiTiling.get_aL1SpaceSize(); | 118 | + cachedTilingData_.aL1SpaceSize = tilingData_.get_aL1SpaceSize(); |
| 119 | - cachedTilingData_.multiNBL1 = tilingData_.convApiTiling.get_multiNBL1(); | 119 | + cachedTilingData_.multiNBL1 = tilingData_.get_multiNBL1(); |
| 120 | - cachedTilingData_.cinAInCore = tilingData_.convApiTiling.get_cinAInCore(); | 120 | + cachedTilingData_.cinAInCore = tilingData_.get_cinAInCore(); |
| 121 | - cachedTilingData_.cinATailInCore = tilingData_.convApiTiling.get_cinATailInCore(); | 121 | + cachedTilingData_.cinATailInCore = tilingData_.get_cinATailInCore(); |
| 122 | - cachedTilingData_.cinBInCore = tilingData_.convApiTiling.get_cinBInCore(); | 122 | + cachedTilingData_.cinBInCore = tilingData_.get_cinBInCore(); |
| 123 | - cachedTilingData_.cinBTailInCore = tilingData_.convApiTiling.get_cinBTailInCore(); | 123 | + cachedTilingData_.cinBTailInCore = tilingData_.get_cinBTailInCore(); |
| 124 | - cachedTilingData_.mStep = tilingData_.convApiTiling.get_mStep(); | 124 | + cachedTilingData_.mStep = tilingData_.get_mStep(); |
| 125 | - cachedTilingData_.kStep = tilingData_.convApiTiling.get_kStep(); | 125 | + cachedTilingData_.kStep = tilingData_.get_kStep(); |
| 126 | - cachedTilingData_.nStep = tilingData_.convApiTiling.get_nStep(); | 126 | + cachedTilingData_.nStep = tilingData_.get_nStep(); |
| 127 | - cachedTilingData_.innerBatch = tilingData_.convApiTiling.get_innerBatch(); | 127 | + cachedTilingData_.innerBatch = tilingData_.get_innerBatch(); |
| 128 | GetCachedTilingDataAux(); | 128 | GetCachedTilingDataAux(); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| @@ -188,116 +188,108 @@ void Conv2dBaseTiling::GetCacheTilingInputArgs() | |||
| 188 | 188 | ||
| 189 | void Conv2dBaseTiling::TranslateCachedRunInfo() | 189 | void Conv2dBaseTiling::TranslateCachedRunInfo() |
| 190 | { | 190 | { |
| 191 | - tilingData_.convRunInfo.set_batch(cacheInputArgs_.inputShapeN); | 191 | + tilingData_.set_batch(cacheInputArgs_.inputShapeN); |
| 192 | - tilingData_.convRunInfo.set_hin(cacheInputArgs_.inputShapeH); | 192 | + tilingData_.set_hin(cacheInputArgs_.inputShapeH); |
| 193 | - tilingData_.convRunInfo.set_win(cacheInputArgs_.inputShapeW); | 193 | + tilingData_.set_win(cacheInputArgs_.inputShapeW); |
| 194 | - tilingData_.convRunInfo.set_batchDim(cachedTilingData_.batchDim); | 194 | + tilingData_.set_batchDim(cachedTilingData_.batchDim); |
| 195 | - tilingData_.convRunInfo.set_hoDim(cachedTilingData_.hoDim); | 195 | + tilingData_.set_hoDim(cachedTilingData_.hoDim); |
| 196 | - tilingData_.convRunInfo.set_woDim(cachedTilingData_.woDim); | 196 | + tilingData_.set_woDim(cachedTilingData_.woDim); |
| 197 | - tilingData_.convRunInfo.set_nDim(cachedTilingData_.nDim); | 197 | + tilingData_.set_nDim(cachedTilingData_.nDim); |
| 198 | - tilingData_.convRunInfo.set_cin(shapeInfo_.ci); | 198 | + tilingData_.set_cin(shapeInfo_.ci); |
| 199 | - tilingData_.convRunInfo.set_cout(cacheInputArgs_.weightShapeN); | 199 | + tilingData_.set_cout(cacheInputArgs_.weightShapeN); |
| 200 | - tilingData_.convRunInfo.set_kh(cacheInputArgs_.weightShapeH); | 200 | + tilingData_.set_kh(cacheInputArgs_.weightShapeH); |
| 201 | - tilingData_.convRunInfo.set_kw(cacheInputArgs_.weightShapeW); | 201 | + tilingData_.set_kw(cacheInputArgs_.weightShapeW); |
| 202 | - tilingData_.convRunInfo.set_hout(cacheInputArgs_.outputShapeH); | 202 | + tilingData_.set_hout(cacheInputArgs_.outputShapeH); |
| 203 | - tilingData_.convRunInfo.set_wout(cacheInputArgs_.outputShapeW); | 203 | + tilingData_.set_wout(cacheInputArgs_.outputShapeW); |
| 204 | - tilingData_.convRunInfo.set_strideH(cacheInputArgs_.strideH); | 204 | + tilingData_.set_cinOpt(cachedTilingData_.cinOpt); |
| 205 | - tilingData_.convRunInfo.set_strideW(cacheInputArgs_.strideW); | 205 | + tilingData_.set_coutOpt(cachedTilingData_.coutOpt); |
| 206 | - tilingData_.convRunInfo.set_dilationH(cacheInputArgs_.dilationH); | 206 | + tilingData_.set_groupOpt(cachedTilingData_.groupOpt); |
| 207 | - tilingData_.convRunInfo.set_dilationW(cacheInputArgs_.dilationW); | 207 | + tilingData_.set_enlarge(cachedTilingData_.enlarge); |
| 208 | - tilingData_.convRunInfo.set_padTop(cacheInputArgs_.padTop); | 208 | + tilingData_.set_groupDim(cachedTilingData_.groupDim); |
| 209 | - tilingData_.convRunInfo.set_padLeft(cacheInputArgs_.padLeft); | ||
| 210 | - tilingData_.convRunInfo.set_hasBias(cacheInputArgs_.biasFlag); | ||
| 211 | - tilingData_.convRunInfo.set_groups(cacheInputArgs_.groups); | ||
| 212 | - tilingData_.convRunInfo.set_cinOpt(cachedTilingData_.cinOpt); | ||
| 213 | - tilingData_.convRunInfo.set_coutOpt(cachedTilingData_.coutOpt); | ||
| 214 | - tilingData_.convRunInfo.set_groupOpt(cachedTilingData_.groupOpt); | ||
| 215 | - tilingData_.convRunInfo.set_enlarge(cachedTilingData_.enlarge); | ||
| 216 | - tilingData_.convRunInfo.set_groupDim(cachedTilingData_.groupDim); | ||
| 217 | } | 209 | } |
| 218 | 210 | ||
| 219 | void Conv2dBaseTiling::TranslateCachedApiTilingPartTwo() | 211 | void Conv2dBaseTiling::TranslateCachedApiTilingPartTwo() |
| 220 | { | 212 | { |
| 221 | - tilingData_.convApiTiling.set_strideH(cacheInputArgs_.strideH); | 213 | + tilingData_.set_strideH(cacheInputArgs_.strideH); |
| 222 | - tilingData_.convApiTiling.set_strideW(cacheInputArgs_.strideW); | 214 | + tilingData_.set_strideW(cacheInputArgs_.strideW); |
| 223 | - tilingData_.convApiTiling.set_dilationH(cacheInputArgs_.dilationH); | 215 | + tilingData_.set_dilationH(cacheInputArgs_.dilationH); |
| 224 | - tilingData_.convApiTiling.set_dilationW(cacheInputArgs_.dilationW); | 216 | + tilingData_.set_dilationW(cacheInputArgs_.dilationW); |
| 225 | - tilingData_.convApiTiling.set_padTop(cacheInputArgs_.padTop); | 217 | + tilingData_.set_padTop(cacheInputArgs_.padTop); |
| 226 | - tilingData_.convApiTiling.set_padBottom(cacheInputArgs_.padBottom); | 218 | + tilingData_.set_padBottom(cacheInputArgs_.padBottom); |
| 227 | - tilingData_.convApiTiling.set_padLeft(cacheInputArgs_.padLeft); | 219 | + tilingData_.set_padLeft(cacheInputArgs_.padLeft); |
| 228 | - tilingData_.convApiTiling.set_padRight(cacheInputArgs_.padRight); | 220 | + tilingData_.set_padRight(cacheInputArgs_.padRight); |
| 229 | - tilingData_.convApiTiling.set_iterateMNOrder(cachedTilingData_.iterateMNOrder); | 221 | + tilingData_.set_iterateMNOrder(cachedTilingData_.iterateMNOrder); |
| 230 | - tilingData_.convApiTiling.set_biasFullLoadFlag(cachedTilingData_.biasFullLoadFlag); | 222 | + tilingData_.set_biasFullLoadFlag(cachedTilingData_.biasFullLoadFlag); |
| 231 | - tilingData_.convApiTiling.set_fixpParamsFullLoadFlag(cachedTilingData_.fixpParamsFullLoadFlag); | 223 | + tilingData_.set_fixpParamsFullLoadFlag(cachedTilingData_.fixpParamsFullLoadFlag); |
| 232 | - tilingData_.convApiTiling.set_hf32Enable(cachedTilingData_.hf32Enable); | 224 | + tilingData_.set_hf32Enable(cachedTilingData_.hf32Enable); |
| 233 | - tilingData_.convApiTiling.set_hf32TransMode(cachedTilingData_.hf32TransMode); | 225 | + tilingData_.set_hf32TransMode(cachedTilingData_.hf32TransMode); |
| 234 | - tilingData_.convApiTiling.set_hasBias(cacheInputArgs_.biasFlag); | 226 | + tilingData_.set_hasBias(cacheInputArgs_.biasFlag); |
| 235 | - tilingData_.convApiTiling.set_hasScale(static_cast<uint8_t>(flagInfo_.quantFlag || flagInfo_.extendConvFlag)); | 227 | + tilingData_.set_hasScale(static_cast<uint8_t>(flagInfo_.quantFlag || flagInfo_.extendConvFlag)); |
| 236 | - tilingData_.convApiTiling.set_offsetx(attrInfo_.offsetx); | 228 | + tilingData_.set_offsetx(attrInfo_.offsetx); |
| 237 | - tilingData_.convApiTiling.set_roundMode(attrInfo_.roundMode); | 229 | + tilingData_.set_roundMode(attrInfo_.roundMode); |
| 238 | - tilingData_.convApiTiling.set_dualOutput(fixpipeInfo_.dualOutput); | 230 | + tilingData_.set_dualOutput(fixpipeInfo_.dualOutput); |
| 239 | - tilingData_.convApiTiling.set_quantMode0(fixpipeInfo_.quantMode0); | 231 | + tilingData_.set_quantMode0(fixpipeInfo_.quantMode0); |
| 240 | - tilingData_.convApiTiling.set_reluMode0(fixpipeInfo_.reluMode0); | 232 | + tilingData_.set_reluMode0(fixpipeInfo_.reluMode0); |
| 241 | - tilingData_.convApiTiling.set_clipMode0(fixpipeInfo_.clipMode0); | 233 | + tilingData_.set_clipMode0(fixpipeInfo_.clipMode0); |
| 242 | - tilingData_.convApiTiling.set_quantMode1(fixpipeInfo_.quantMode1); | 234 | + tilingData_.set_quantMode1(fixpipeInfo_.quantMode1); |
| 243 | - tilingData_.convApiTiling.set_reluMode1(fixpipeInfo_.reluMode1); | 235 | + tilingData_.set_reluMode1(fixpipeInfo_.reluMode1); |
| 244 | - tilingData_.convApiTiling.set_clipMode1(fixpipeInfo_.clipMode1); | 236 | + tilingData_.set_clipMode1(fixpipeInfo_.clipMode1); |
| 245 | - tilingData_.convApiTiling.set_innerBatch(cachedTilingData_.innerBatch); | 237 | + tilingData_.set_innerBatch(cachedTilingData_.innerBatch); |
| 246 | - tilingData_.convApiTiling.set_unionDataXt(cachedTilingData_.unionDataXt); | 238 | + tilingData_.set_unionDataXt(cachedTilingData_.unionDataXt); |
| 247 | } | 239 | } |
| 248 | 240 | ||
| 249 | void Conv2dBaseTiling::TranslateCachedApiTilingPartOne() | 241 | void Conv2dBaseTiling::TranslateCachedApiTilingPartOne() |
| 250 | { | 242 | { |
| 251 | - tilingData_.convApiTiling.set_orgHi(cacheInputArgs_.inputShapeH); | 243 | + tilingData_.set_orgHi(cacheInputArgs_.inputShapeH); |
| 252 | - tilingData_.convApiTiling.set_orgWi(cacheInputArgs_.inputShapeW); | 244 | + tilingData_.set_orgWi(cacheInputArgs_.inputShapeW); |
| 253 | - tilingData_.convApiTiling.set_orgHo(cacheInputArgs_.outputShapeH); | 245 | + tilingData_.set_orgHo(cacheInputArgs_.outputShapeH); |
| 254 | - tilingData_.convApiTiling.set_orgWo(cacheInputArgs_.outputShapeW); | 246 | + tilingData_.set_orgWo(cacheInputArgs_.outputShapeW); |
| 255 | - tilingData_.convApiTiling.set_singleCoreBatch(cachedTilingData_.singleCoreBatch); | 247 | + tilingData_.set_singleCoreBatch(cachedTilingData_.singleCoreBatch); |
| 256 | - tilingData_.convApiTiling.set_singleCoreHo(cachedTilingData_.singleCoreHo); | 248 | + tilingData_.set_singleCoreHo(cachedTilingData_.singleCoreHo); |
| 257 | - tilingData_.convApiTiling.set_singleCoreWo(cachedTilingData_.singleCoreWo); | 249 | + tilingData_.set_singleCoreWo(cachedTilingData_.singleCoreWo); |
| 258 | - tilingData_.convApiTiling.set_orgCi(shapeInfo_.ci); | 250 | + tilingData_.set_orgCi(shapeInfo_.ci); |
| 259 | - tilingData_.convApiTiling.set_orgCo(cacheInputArgs_.weightShapeN); | 251 | + tilingData_.set_orgCo(cacheInputArgs_.weightShapeN); |
| 260 | - tilingData_.convApiTiling.set_singleCoreCi(cachedTilingData_.singleCoreCi); | 252 | + tilingData_.set_singleCoreCi(cachedTilingData_.singleCoreCi); |
| 261 | - tilingData_.convApiTiling.set_singleCoreCo(cachedTilingData_.singleCoreCo); | 253 | + tilingData_.set_singleCoreCo(cachedTilingData_.singleCoreCo); |
| 262 | - tilingData_.convApiTiling.set_hoL1(cachedTilingData_.hoL1); | 254 | + tilingData_.set_hoL1(cachedTilingData_.hoL1); |
| 263 | - tilingData_.convApiTiling.set_woL1(cachedTilingData_.woL1); | 255 | + tilingData_.set_woL1(cachedTilingData_.woL1); |
| 264 | - tilingData_.convApiTiling.set_kAL1(cachedTilingData_.kAL1); | 256 | + tilingData_.set_kAL1(cachedTilingData_.kAL1); |
| 265 | - tilingData_.convApiTiling.set_kBL1(cachedTilingData_.kBL1); | 257 | + tilingData_.set_kBL1(cachedTilingData_.kBL1); |
| 266 | - tilingData_.convApiTiling.set_khL1(cachedTilingData_.khL1); | 258 | + tilingData_.set_khL1(cachedTilingData_.khL1); |
| 267 | - tilingData_.convApiTiling.set_kwL1(cachedTilingData_.kwL1); | 259 | + tilingData_.set_kwL1(cachedTilingData_.kwL1); |
| 268 | - tilingData_.convApiTiling.set_nBL1(cachedTilingData_.nBL1); | 260 | + tilingData_.set_nBL1(cachedTilingData_.nBL1); |
| 269 | - tilingData_.convApiTiling.set_hoL0(cachedTilingData_.hoL0); | 261 | + tilingData_.set_hoL0(cachedTilingData_.hoL0); |
| 270 | - tilingData_.convApiTiling.set_woL0(cachedTilingData_.woL0); | 262 | + tilingData_.set_woL0(cachedTilingData_.woL0); |
| 271 | - tilingData_.convApiTiling.set_kL0(cachedTilingData_.kL0); | 263 | + tilingData_.set_kL0(cachedTilingData_.kL0); |
| 272 | - tilingData_.convApiTiling.set_nL0(cachedTilingData_.nL0); | 264 | + tilingData_.set_nL0(cachedTilingData_.nL0); |
| 273 | - tilingData_.convApiTiling.set_pBufferFlag(cachedTilingData_.pBufferFlag); | 265 | + tilingData_.set_pBufferFlag(cachedTilingData_.pBufferFlag); |
| 274 | - tilingData_.convApiTiling.set_groups(cacheInputArgs_.groups); | 266 | + tilingData_.set_groups(cacheInputArgs_.groups); |
| 275 | - tilingData_.convApiTiling.set_enlarge(cachedTilingData_.enlarge); | 267 | + tilingData_.set_enlarge(cachedTilingData_.enlarge); |
| 276 | - tilingData_.convApiTiling.set_singleCoreGroups(cachedTilingData_.singleCoreGroups); | 268 | + tilingData_.set_singleCoreGroups(cachedTilingData_.singleCoreGroups); |
| 277 | - tilingData_.convApiTiling.set_singleCoreGroupOpt(cachedTilingData_.singleCoreGroupOpt); | 269 | + tilingData_.set_singleCoreGroupOpt(cachedTilingData_.singleCoreGroupOpt); |
| 278 | - tilingData_.convApiTiling.set_bUbNStep(cachedTilingData_.bUbNStep); | 270 | + tilingData_.set_bUbNStep(cachedTilingData_.bUbNStep); |
| 279 | - tilingData_.convApiTiling.set_bUbKStep(cachedTilingData_.bUbKStep); | 271 | + tilingData_.set_bUbKStep(cachedTilingData_.bUbKStep); |
| 280 | - tilingData_.convApiTiling.set_khUb(cachedTilingData_.khUb); | 272 | + tilingData_.set_khUb(cachedTilingData_.khUb); |
| 281 | - tilingData_.convApiTiling.set_kwUb(cachedTilingData_.kwUb); | 273 | + tilingData_.set_kwUb(cachedTilingData_.kwUb); |
| 282 | - tilingData_.convApiTiling.set_orgHixWi(cachedTilingData_.orgHixWi); | 274 | + tilingData_.set_orgHixWi(cachedTilingData_.orgHixWi); |
| 283 | - tilingData_.convApiTiling.set_kernelHxkernelW(cachedTilingData_.kernelHxkernelW); | 275 | + tilingData_.set_kernelHxkernelW(cachedTilingData_.kernelHxkernelW); |
| 284 | - tilingData_.convApiTiling.set_kernelHxkernelWxkernelD(cachedTilingData_.kernelHxkernelWxkernelD); | 276 | + tilingData_.set_kernelHxkernelWxkernelD(cachedTilingData_.kernelHxkernelWxkernelD); |
| 285 | - tilingData_.convApiTiling.set_aL1SpaceSize(cachedTilingData_.aL1SpaceSize); | 277 | + tilingData_.set_aL1SpaceSize(cachedTilingData_.aL1SpaceSize); |
| 286 | - tilingData_.convApiTiling.set_multiNBL1(cachedTilingData_.multiNBL1); | 278 | + tilingData_.set_multiNBL1(cachedTilingData_.multiNBL1); |
| 287 | - tilingData_.convApiTiling.set_cinAInCore(cachedTilingData_.cinAInCore); | 279 | + tilingData_.set_cinAInCore(cachedTilingData_.cinAInCore); |
| 288 | - tilingData_.convApiTiling.set_cinATailInCore(cachedTilingData_.cinATailInCore); | 280 | + tilingData_.set_cinATailInCore(cachedTilingData_.cinATailInCore); |
| 289 | - tilingData_.convApiTiling.set_cinBInCore(cachedTilingData_.cinBInCore); | 281 | + tilingData_.set_cinBInCore(cachedTilingData_.cinBInCore); |
| 290 | - tilingData_.convApiTiling.set_cinBTailInCore(cachedTilingData_.cinBTailInCore); | 282 | + tilingData_.set_cinBTailInCore(cachedTilingData_.cinBTailInCore); |
| 291 | - tilingData_.convApiTiling.set_mStep(cachedTilingData_.mStep); | 283 | + tilingData_.set_mStep(cachedTilingData_.mStep); |
| 292 | - tilingData_.convApiTiling.set_kStep(cachedTilingData_.kStep); | 284 | + tilingData_.set_kStep(cachedTilingData_.kStep); |
| 293 | - tilingData_.convApiTiling.set_nStep(cachedTilingData_.nStep); | 285 | + tilingData_.set_nStep(cachedTilingData_.nStep); |
| 294 | - tilingData_.convApiTiling.set_fmapKStride(cachedTilingData_.fmapKStride); | 286 | + tilingData_.set_fmapKStride(cachedTilingData_.fmapKStride); |
| 295 | - tilingData_.convApiTiling.set_weightKStride(cachedTilingData_.weightKStride); | 287 | + tilingData_.set_weightKStride(cachedTilingData_.weightKStride); |
| 296 | - tilingData_.convApiTiling.set_cinOffsetBlockInGM(cachedTilingData_.cinOffsetBlockInGM); | 288 | + tilingData_.set_cinOffsetBlockInGM(cachedTilingData_.cinOffsetBlockInGM); |
| 297 | - tilingData_.convApiTiling.set_coutOffsetBlock(cachedTilingData_.coutOffsetBlock); | 289 | + tilingData_.set_coutOffsetBlock(cachedTilingData_.coutOffsetBlock); |
| 298 | - tilingData_.convApiTiling.set_nL1DivBlockSize(cachedTilingData_.nL1DivBlockSize); | 290 | + tilingData_.set_nL1DivBlockSize(cachedTilingData_.nL1DivBlockSize); |
| 299 | - tilingData_.convApiTiling.set_kernelH(cacheInputArgs_.weightShapeH); | 291 | + tilingData_.set_kernelH(cacheInputArgs_.weightShapeH); |
| 300 | - tilingData_.convApiTiling.set_kernelW(cacheInputArgs_.weightShapeW); | 292 | + tilingData_.set_kernelW(cacheInputArgs_.weightShapeW); |
| 301 | } | 293 | } |
| 302 | 294 | ||
| 303 | void Conv2dBaseTiling::TranslateCachedTilingData() | 295 | void Conv2dBaseTiling::TranslateCachedTilingData() |
| @@ -251,12 +251,12 @@ ge::graphStatus Conv2dBaseTiling::GetConv2dApiTiling() | |||
| 251 | Conv2dApiTilingSetShape(); | 251 | Conv2dApiTilingSetShape(); |
| 252 | 252 | ||
| 253 | if (flagInfo_.mBasicBlockFlag) { | 253 | if (flagInfo_.mBasicBlockFlag) { |
| 254 | - if (!conv2dApiTiling_.GetTiling(conv2dBasicBlockInfo_, tilingData_.convApiTiling)) { | 254 | + if (!conv2dApiTiling_.GetTiling(conv2dBasicBlockInfo_, tilingData_)) { |
| 255 | OP_LOGE(context_->GetNodeName(), "%s AscendC: get api tiling wrong", paramInfo_.nodeType.c_str()); | 255 | OP_LOGE(context_->GetNodeName(), "%s AscendC: get api tiling wrong", paramInfo_.nodeType.c_str()); |
| 256 | return ge::GRAPH_FAILED; | 256 | return ge::GRAPH_FAILED; |
| 257 | } | 257 | } |
| 258 | } else { | 258 | } else { |
| 259 | - if (conv2dApiTiling_.GetTiling(tilingData_.convApiTiling) == -1) { | 259 | + if (conv2dApiTiling_.GetTiling(tilingData_) == -1) { |
| 260 | OP_LOGE(context_->GetNodeName(), "%s AscendC: get api tiling wrong", paramInfo_.nodeType.c_str()); | 260 | OP_LOGE(context_->GetNodeName(), "%s AscendC: get api tiling wrong", paramInfo_.nodeType.c_str()); |
| 261 | return ge::GRAPH_FAILED; | 261 | return ge::GRAPH_FAILED; |
| 262 | } | 262 | } |
| @@ -334,39 +334,39 @@ void Conv2dBaseTiling::Conv2dOpTilingSetAttr() | |||
| 334 | 334 | ||
| 335 | ge::graphStatus Conv2dBaseTiling::GetConv2dOpsTiling() | 335 | ge::graphStatus Conv2dBaseTiling::GetConv2dOpsTiling() |
| 336 | { | 336 | { |
| 337 | - tilingData_.convRunInfo.set_hin(static_cast<uint64_t>(shapeInfo_.hi)); | 337 | + tilingData_.set_hin(static_cast<uint64_t>(shapeInfo_.hi)); |
| 338 | - tilingData_.convRunInfo.set_win(static_cast<uint64_t>(shapeInfo_.wi)); | 338 | + tilingData_.set_win(static_cast<uint64_t>(shapeInfo_.wi)); |
| 339 | - tilingData_.convRunInfo.set_hout(static_cast<uint64_t>(shapeInfo_.ho)); | 339 | + tilingData_.set_hout(static_cast<uint64_t>(shapeInfo_.ho)); |
| 340 | - tilingData_.convRunInfo.set_wout(static_cast<uint64_t>(shapeInfo_.wo)); | 340 | + tilingData_.set_wout(static_cast<uint64_t>(shapeInfo_.wo)); |
| 341 | - tilingData_.convRunInfo.set_batch(static_cast<uint32_t>(shapeInfo_.batch)); | 341 | + tilingData_.set_batch(static_cast<uint32_t>(shapeInfo_.batch)); |
| 342 | - tilingData_.convRunInfo.set_cin(static_cast<uint32_t>(shapeInfo_.ci)); | 342 | + tilingData_.set_cin(static_cast<uint32_t>(shapeInfo_.ci)); |
| 343 | - tilingData_.convRunInfo.set_cout(static_cast<uint32_t>(shapeInfo_.co)); | 343 | + tilingData_.set_cout(static_cast<uint32_t>(shapeInfo_.co)); |
| 344 | - tilingData_.convRunInfo.set_kh(static_cast<uint32_t>(shapeInfo_.kh)); | 344 | + tilingData_.set_kh(static_cast<uint32_t>(shapeInfo_.kh)); |
| 345 | - tilingData_.convRunInfo.set_kw(static_cast<uint32_t>(shapeInfo_.kw)); | 345 | + tilingData_.set_kw(static_cast<uint32_t>(shapeInfo_.kw)); |
| 346 | - tilingData_.convRunInfo.set_strideH(static_cast<uint32_t>(attrInfo_.strideH)); | 346 | + tilingData_.set_strideH(static_cast<uint32_t>(attrInfo_.strideH)); |
| 347 | - tilingData_.convRunInfo.set_strideW(static_cast<uint32_t>(attrInfo_.strideW)); | 347 | + tilingData_.set_strideW(static_cast<uint32_t>(attrInfo_.strideW)); |
| 348 | - tilingData_.convRunInfo.set_dilationH(static_cast<uint32_t>(attrInfo_.dilationH)); | 348 | + tilingData_.set_dilationH(static_cast<uint32_t>(attrInfo_.dilationH)); |
| 349 | - tilingData_.convRunInfo.set_dilationW(static_cast<uint32_t>(attrInfo_.dilationW)); | 349 | + tilingData_.set_dilationW(static_cast<uint32_t>(attrInfo_.dilationW)); |
| 350 | - tilingData_.convRunInfo.set_padTop(static_cast<uint32_t>(attrInfo_.padTop)); | 350 | + tilingData_.set_padTop(static_cast<uint32_t>(attrInfo_.padTop)); |
| 351 | - tilingData_.convRunInfo.set_padLeft(static_cast<uint32_t>(attrInfo_.padLeft)); | 351 | + tilingData_.set_padLeft(static_cast<uint32_t>(attrInfo_.padLeft)); |
| 352 | - tilingData_.convRunInfo.set_hasBias(static_cast<uint8_t>(flagInfo_.hasBias)); | 352 | + tilingData_.set_hasBias(static_cast<uint8_t>(flagInfo_.hasBias)); |
| 353 | - tilingData_.convRunInfo.set_batchDim(static_cast<uint32_t>(numBlocksRes.batchDim)); | 353 | + tilingData_.set_batchDim(static_cast<uint32_t>(numBlocksRes.batchDim)); |
| 354 | - tilingData_.convRunInfo.set_nDim(static_cast<uint32_t>(numBlocksRes.nDim)); | 354 | + tilingData_.set_nDim(static_cast<uint32_t>(numBlocksRes.nDim)); |
| 355 | - tilingData_.convRunInfo.set_groupDim(static_cast<uint32_t>(numBlocksRes.groupDim)); | 355 | + tilingData_.set_groupDim(static_cast<uint32_t>(numBlocksRes.groupDim)); |
| 356 | - tilingData_.convRunInfo.set_groups(static_cast<uint32_t>(attrInfo_.groups)); | 356 | + tilingData_.set_groups(static_cast<uint32_t>(attrInfo_.groups)); |
| 357 | if (flagInfo_.convGroupType == ConvGroupType::OPT_GROUP_CONV) { | 357 | if (flagInfo_.convGroupType == ConvGroupType::OPT_GROUP_CONV) { |
| 358 | - tilingData_.convRunInfo.set_cinOpt(static_cast<uint32_t>(optGroupInfo_.cinOpt)); | 358 | + tilingData_.set_cinOpt(static_cast<uint32_t>(optGroupInfo_.cinOpt)); |
| 359 | - tilingData_.convRunInfo.set_coutOpt(static_cast<uint32_t>(optGroupInfo_.coutOpt)); | 359 | + tilingData_.set_coutOpt(static_cast<uint32_t>(optGroupInfo_.coutOpt)); |
| 360 | - tilingData_.convRunInfo.set_groupOpt(static_cast<uint32_t>(optGroupInfo_.groupOpt)); | 360 | + tilingData_.set_groupOpt(static_cast<uint32_t>(optGroupInfo_.groupOpt)); |
| 361 | - tilingData_.convRunInfo.set_enlarge(static_cast<uint32_t>(optGroupInfo_.enlarge)); | 361 | + tilingData_.set_enlarge(static_cast<uint32_t>(optGroupInfo_.enlarge)); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | if (flagInfo_.mSplitModeFlag) { | 364 | if (flagInfo_.mSplitModeFlag) { |
| 365 | - tilingData_.convRunInfo.set_hoDim(static_cast<uint32_t>(numBlocksRes.mDim)); | 365 | + tilingData_.set_hoDim(static_cast<uint32_t>(numBlocksRes.mDim)); |
| 366 | - tilingData_.convRunInfo.set_woDim(static_cast<uint32_t>(1)); | 366 | + tilingData_.set_woDim(static_cast<uint32_t>(1)); |
| 367 | } else { | 367 | } else { |
| 368 | - tilingData_.convRunInfo.set_hoDim(static_cast<uint32_t>(numBlocksRes.hoDim)); | 368 | + tilingData_.set_hoDim(static_cast<uint32_t>(numBlocksRes.hoDim)); |
| 369 | - tilingData_.convRunInfo.set_woDim(static_cast<uint32_t>(numBlocksRes.woDim)); | 369 | + tilingData_.set_woDim(static_cast<uint32_t>(numBlocksRes.woDim)); |
| 370 | } | 370 | } |
| 371 | return ge::GRAPH_SUCCESS; | 371 | return ge::GRAPH_SUCCESS; |
| 372 | } | 372 | } |
| @@ -23,26 +23,26 @@ void Conv2dBaseTiling::PrintOpTilingData() | |||
| 23 | do not modify the param name if not necessarily | 23 | do not modify the param name if not necessarily |
| 24 | */ | 24 | */ |
| 25 | std::stringstream ss; | 25 | std::stringstream ss; |
| 26 | - ss << "hin: " << tilingData_.convRunInfo.get_hin() << ", win: " << tilingData_.convRunInfo.get_win() | 26 | + ss << "hin: " << tilingData_.get_hin() << ", win: " << tilingData_.get_win() |
| 27 | - << ", hout: " << tilingData_.convRunInfo.get_hout() << ", wout: " << tilingData_.convRunInfo.get_wout() | 27 | + << ", hout: " << tilingData_.get_hout() << ", wout: " << tilingData_.get_wout() |
| 28 | - << ", batch: " << tilingData_.convRunInfo.get_batch() << ", cin: " << tilingData_.convRunInfo.get_cin() | 28 | + << ", batch: " << tilingData_.get_batch() << ", cin: " << tilingData_.get_cin() |
| 29 | - << ", cout: " << tilingData_.convRunInfo.get_cout() << ", kh: " << tilingData_.convRunInfo.get_kh() | 29 | + << ", cout: " << tilingData_.get_cout() << ", kh: " << tilingData_.get_kh() |
| 30 | - << ", kw: " << tilingData_.convRunInfo.get_kw() << ", batchDim: " << tilingData_.convRunInfo.get_batchDim() | 30 | + << ", kw: " << tilingData_.get_kw() << ", batchDim: " << tilingData_.get_batchDim() |
| 31 | - << ", hoDim: " << tilingData_.convRunInfo.get_hoDim() << ", woDim: " << tilingData_.convRunInfo.get_woDim() | 31 | + << ", hoDim: " << tilingData_.get_hoDim() << ", woDim: " << tilingData_.get_woDim() |
| 32 | - << ", nDim: " << tilingData_.convRunInfo.get_nDim() | 32 | + << ", nDim: " << tilingData_.get_nDim() |
| 33 | - << ", strideH: " << tilingData_.convRunInfo.get_strideH() | 33 | + << ", strideH: " << tilingData_.get_strideH() |
| 34 | - << ", strideW: " << tilingData_.convRunInfo.get_strideW() | 34 | + << ", strideW: " << tilingData_.get_strideW() |
| 35 | - << ", dilationH: " << tilingData_.convRunInfo.get_dilationH() | 35 | + << ", dilationH: " << tilingData_.get_dilationH() |
| 36 | - << ", dilationW: " << tilingData_.convRunInfo.get_dilationW() | 36 | + << ", dilationW: " << tilingData_.get_dilationW() |
| 37 | - << ", padTop: " << tilingData_.convRunInfo.get_padTop() | 37 | + << ", padTop: " << tilingData_.get_padTop() |
| 38 | - << ", padLeft: " << tilingData_.convRunInfo.get_padLeft() | 38 | + << ", padLeft: " << tilingData_.get_padLeft() |
| 39 | - << ", groups: " << tilingData_.convRunInfo.get_groups() | 39 | + << ", groups: " << tilingData_.get_groups() |
| 40 | - << ", cinOpt: " << tilingData_.convRunInfo.get_cinOpt() | 40 | + << ", cinOpt: " << tilingData_.get_cinOpt() |
| 41 | - << ", coutOpt: " << tilingData_.convRunInfo.get_coutOpt() | 41 | + << ", coutOpt: " << tilingData_.get_coutOpt() |
| 42 | - << ", groupOpt: " << tilingData_.convRunInfo.get_groupOpt() | 42 | + << ", groupOpt: " << tilingData_.get_groupOpt() |
| 43 | - << ", enlarge: " << tilingData_.convRunInfo.get_enlarge() | 43 | + << ", enlarge: " << tilingData_.get_enlarge() |
| 44 | - << ", groupDim: " << tilingData_.convRunInfo.get_groupDim() | 44 | + << ", groupDim: " << tilingData_.get_groupDim() |
| 45 | - << ", hasBias: " << static_cast<uint32_t>(tilingData_.convRunInfo.get_hasBias()); | 45 | + << ", hasBias: " << static_cast<uint32_t>(tilingData_.get_hasBias()); |
| 46 | OP_LOGD(context_->GetNodeName(), "%s AscendC: ops tilingdata: %s", paramInfo_.nodeType.c_str(), ss.str().c_str()); | 46 | OP_LOGD(context_->GetNodeName(), "%s AscendC: ops tilingdata: %s", paramInfo_.nodeType.c_str(), ss.str().c_str()); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -73,54 +73,54 @@ void Conv2dBaseTiling::PrintTilingInfo() const | |||
| 73 | 73 | ||
| 74 | void Conv2dBaseTiling::PrintLibApiTilingDataPartOne(std::stringstream &ss) | 74 | void Conv2dBaseTiling::PrintLibApiTilingDataPartOne(std::stringstream &ss) |
| 75 | { | 75 | { |
| 76 | - ss << "singleCoreHo: " << tilingData_.convApiTiling.get_singleCoreHo() | 76 | + ss << "singleCoreHo: " << tilingData_.get_singleCoreHo() |
| 77 | - << ", singleCoreWo: " << tilingData_.convApiTiling.get_singleCoreWo() | 77 | + << ", singleCoreWo: " << tilingData_.get_singleCoreWo() |
| 78 | - << ", singleCoreBatch: " << tilingData_.convApiTiling.get_singleCoreBatch() | 78 | + << ", singleCoreBatch: " << tilingData_.get_singleCoreBatch() |
| 79 | - << ", orgHi: " << tilingData_.convApiTiling.get_orgHi() | 79 | + << ", orgHi: " << tilingData_.get_orgHi() |
| 80 | - << ", orgWi: " << tilingData_.convApiTiling.get_orgWi() | 80 | + << ", orgWi: " << tilingData_.get_orgWi() |
| 81 | - << ", orgHo: " << tilingData_.convApiTiling.get_orgHo() | 81 | + << ", orgHo: " << tilingData_.get_orgHo() |
| 82 | - << ", orgWo: " << tilingData_.convApiTiling.get_orgWo() | 82 | + << ", orgWo: " << tilingData_.get_orgWo() |
| 83 | - << ", groups: " << tilingData_.convApiTiling.get_groups() | 83 | + << ", groups: " << tilingData_.get_groups() |
| 84 | - << ", orgCi: " << tilingData_.convApiTiling.get_orgCi() | 84 | + << ", orgCi: " << tilingData_.get_orgCi() |
| 85 | - << ", orgCo: " << tilingData_.convApiTiling.get_orgCo() | 85 | + << ", orgCo: " << tilingData_.get_orgCo() |
| 86 | - << ", kernelH: " << tilingData_.convApiTiling.get_kernelH() | 86 | + << ", kernelH: " << tilingData_.get_kernelH() |
| 87 | - << ", kernelW: " << tilingData_.convApiTiling.get_kernelW() | 87 | + << ", kernelW: " << tilingData_.get_kernelW() |
| 88 | - << ", singleCoreCi: " << tilingData_.convApiTiling.get_singleCoreCi() | 88 | + << ", singleCoreCi: " << tilingData_.get_singleCoreCi() |
| 89 | - << ", singleCoreCo: " << tilingData_.convApiTiling.get_singleCoreCo() | 89 | + << ", singleCoreCo: " << tilingData_.get_singleCoreCo() |
| 90 | - << ", hoL1: " << tilingData_.convApiTiling.get_hoL1() | 90 | + << ", hoL1: " << tilingData_.get_hoL1() |
| 91 | - << ", woL1: " << tilingData_.convApiTiling.get_woL1() | 91 | + << ", woL1: " << tilingData_.get_woL1() |
| 92 | - << ", kAL1: " << tilingData_.convApiTiling.get_kAL1() | 92 | + << ", kAL1: " << tilingData_.get_kAL1() |
| 93 | - << ", kBL1: " << tilingData_.convApiTiling.get_kBL1() | 93 | + << ", kBL1: " << tilingData_.get_kBL1() |
| 94 | - << ", nBL1: " << tilingData_.convApiTiling.get_nBL1() | 94 | + << ", nBL1: " << tilingData_.get_nBL1() |
| 95 | - << ", hoL0: " << tilingData_.convApiTiling.get_hoL0() | 95 | + << ", hoL0: " << tilingData_.get_hoL0() |
| 96 | - << ", woL0: " << tilingData_.convApiTiling.get_woL0() | 96 | + << ", woL0: " << tilingData_.get_woL0() |
| 97 | - << ", kL0: " << tilingData_.convApiTiling.get_kL0() | 97 | + << ", kL0: " << tilingData_.get_kL0() |
| 98 | - << ", nL0: " << tilingData_.convApiTiling.get_nL0() | 98 | + << ", nL0: " << tilingData_.get_nL0() |
| 99 | - << ", pBufferFlag: " << tilingData_.convApiTiling.get_pBufferFlag() | 99 | + << ", pBufferFlag: " << tilingData_.get_pBufferFlag() |
| 100 | - << ", multiNBL1: " << tilingData_.convApiTiling.get_multiNBL1() | 100 | + << ", multiNBL1: " << tilingData_.get_multiNBL1() |
| 101 | - << ", strideH: " << tilingData_.convApiTiling.get_strideH() | 101 | + << ", strideH: " << tilingData_.get_strideH() |
| 102 | - << ", strideW: " << tilingData_.convApiTiling.get_strideW() | 102 | + << ", strideW: " << tilingData_.get_strideW() |
| 103 | - << ", dilationH: " << tilingData_.convApiTiling.get_dilationH() | 103 | + << ", dilationH: " << tilingData_.get_dilationH() |
| 104 | - << ", dilationW: " << tilingData_.convApiTiling.get_dilationW() | 104 | + << ", dilationW: " << tilingData_.get_dilationW() |
| 105 | - << ", padTop: " << tilingData_.convApiTiling.get_padTop() | 105 | + << ", padTop: " << tilingData_.get_padTop() |
| 106 | - << ", padBottom: " << tilingData_.convApiTiling.get_padBottom() | 106 | + << ", padBottom: " << tilingData_.get_padBottom() |
| 107 | - << ", padLeft: " << tilingData_.convApiTiling.get_padLeft() | 107 | + << ", padLeft: " << tilingData_.get_padLeft() |
| 108 | - << ", padRight: " << tilingData_.convApiTiling.get_padRight() | 108 | + << ", padRight: " << tilingData_.get_padRight() |
| 109 | - << ", aL1SpaceSize: " << tilingData_.convApiTiling.get_aL1SpaceSize() | 109 | + << ", aL1SpaceSize: " << tilingData_.get_aL1SpaceSize() |
| 110 | - << ", singleCoreGroups: " << tilingData_.convApiTiling.get_singleCoreGroups() | 110 | + << ", singleCoreGroups: " << tilingData_.get_singleCoreGroups() |
| 111 | - << ", singleCoreGroupOpt: " << tilingData_.convApiTiling.get_singleCoreGroupOpt() | 111 | + << ", singleCoreGroupOpt: " << tilingData_.get_singleCoreGroupOpt() |
| 112 | - << ", enlarge: " << tilingData_.convApiTiling.get_enlarge() | 112 | + << ", enlarge: " << tilingData_.get_enlarge() |
| 113 | - << ", bUbNStep: " << tilingData_.convApiTiling.get_bUbNStep() | 113 | + << ", bUbNStep: " << tilingData_.get_bUbNStep() |
| 114 | - << ", iterateMNOrder: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_iterateMNOrder()) | 114 | + << ", iterateMNOrder: " << static_cast<uint32_t>(tilingData_.get_iterateMNOrder()) |
| 115 | - << ", biasFullLoadFlag: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_biasFullLoadFlag()) | 115 | + << ", biasFullLoadFlag: " << static_cast<uint32_t>(tilingData_.get_biasFullLoadFlag()) |
| 116 | - << ", fixpParamsFullLoadFlag: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_fixpParamsFullLoadFlag()) | 116 | + << ", fixpParamsFullLoadFlag: " << static_cast<uint32_t>(tilingData_.get_fixpParamsFullLoadFlag()) |
| 117 | - << ", hf32Enable: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_hf32Enable()) | 117 | + << ", hf32Enable: " << static_cast<uint32_t>(tilingData_.get_hf32Enable()) |
| 118 | - << ", hf32TransMode: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_hf32TransMode()) | 118 | + << ", hf32TransMode: " << static_cast<uint32_t>(tilingData_.get_hf32TransMode()) |
| 119 | - << ", hasBias: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_hasBias()) | 119 | + << ", hasBias: " << static_cast<uint32_t>(tilingData_.get_hasBias()) |
| 120 | - << ", hasScale: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_hasScale()) | 120 | + << ", hasScale: " << static_cast<uint32_t>(tilingData_.get_hasScale()) |
| 121 | - << ", offsetx: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_offsetx()) | 121 | + << ", offsetx: " << static_cast<uint32_t>(tilingData_.get_offsetx()) |
| 122 | - << ", roundMode: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_roundMode()) | 122 | + << ", roundMode: " << static_cast<uint32_t>(tilingData_.get_roundMode()) |
| 123 | - << ", innerBatch: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_innerBatch()); | 123 | + << ", innerBatch: " << static_cast<uint32_t>(tilingData_.get_innerBatch()); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | 126 | ||
| @@ -133,34 +133,34 @@ void Conv2dBaseTiling::PrintLibApiTilingData() | |||
| 133 | std::stringstream ss; | 133 | std::stringstream ss; |
| 134 | PrintLibApiTilingDataPartOne(ss); | 134 | PrintLibApiTilingDataPartOne(ss); |
| 135 | std::stringstream ssPartTwo; | 135 | std::stringstream ssPartTwo; |
| 136 | - ssPartTwo << "bUbKStep: " << tilingData_.convApiTiling.get_bUbKStep() | 136 | + ssPartTwo << "bUbKStep: " << tilingData_.get_bUbKStep() |
| 137 | - << ", orgHixWi: " << tilingData_.convApiTiling.get_orgHixWi() | 137 | + << ", orgHixWi: " << tilingData_.get_orgHixWi() |
| 138 | - << ", kernelHxkernelW: " << tilingData_.convApiTiling.get_kernelHxkernelW() | 138 | + << ", kernelHxkernelW: " << tilingData_.get_kernelHxkernelW() |
| 139 | - << ", kernelHxkernelWxkernelD: " << tilingData_.convApiTiling.get_kernelHxkernelWxkernelD() | 139 | + << ", kernelHxkernelWxkernelD: " << tilingData_.get_kernelHxkernelWxkernelD() |
| 140 | - << ", cinAInCore: " << tilingData_.convApiTiling.get_cinAInCore() | 140 | + << ", cinAInCore: " << tilingData_.get_cinAInCore() |
| 141 | - << ", cinATailInCore: " << tilingData_.convApiTiling.get_cinATailInCore() | 141 | + << ", cinATailInCore: " << tilingData_.get_cinATailInCore() |
| 142 | - << ", cinBInCore: " << tilingData_.convApiTiling.get_cinBInCore() | 142 | + << ", cinBInCore: " << tilingData_.get_cinBInCore() |
| 143 | - << ", cinBTailInCore: " << tilingData_.convApiTiling.get_cinBTailInCore() | 143 | + << ", cinBTailInCore: " << tilingData_.get_cinBTailInCore() |
| 144 | - << ", mStep: " << tilingData_.convApiTiling.get_mStep() | 144 | + << ", mStep: " << tilingData_.get_mStep() |
| 145 | - << ", kStep: " << tilingData_.convApiTiling.get_kStep() | 145 | + << ", kStep: " << tilingData_.get_kStep() |
| 146 | - << ", nStep: " << tilingData_.convApiTiling.get_nStep() | 146 | + << ", nStep: " << tilingData_.get_nStep() |
| 147 | - << ", fmapKStride: " << tilingData_.convApiTiling.get_fmapKStride() | 147 | + << ", fmapKStride: " << tilingData_.get_fmapKStride() |
| 148 | - << ", weightKStride: " << tilingData_.convApiTiling.get_weightKStride() | 148 | + << ", weightKStride: " << tilingData_.get_weightKStride() |
| 149 | - << ", cinOffsetBlockInGM: " << tilingData_.convApiTiling.get_cinOffsetBlockInGM() | 149 | + << ", cinOffsetBlockInGM: " << tilingData_.get_cinOffsetBlockInGM() |
| 150 | - << ", coutOffsetBlock: " << tilingData_.convApiTiling.get_coutOffsetBlock() | 150 | + << ", coutOffsetBlock: " << tilingData_.get_coutOffsetBlock() |
| 151 | - << ", nL1DivBlockSize: " << tilingData_.convApiTiling.get_nL1DivBlockSize() | 151 | + << ", nL1DivBlockSize: " << tilingData_.get_nL1DivBlockSize() |
| 152 | - << ", dualOutput: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_dualOutput()) | 152 | + << ", dualOutput: " << static_cast<uint32_t>(tilingData_.get_dualOutput()) |
| 153 | - << ", quantMode0: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_quantMode0()) | 153 | + << ", quantMode0: " << static_cast<uint32_t>(tilingData_.get_quantMode0()) |
| 154 | - << ", reluMode0: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_reluMode0()) | 154 | + << ", reluMode0: " << static_cast<uint32_t>(tilingData_.get_reluMode0()) |
| 155 | - << ", clipMode0: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_clipMode0()) | 155 | + << ", clipMode0: " << static_cast<uint32_t>(tilingData_.get_clipMode0()) |
| 156 | - << ", quantMode1: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_quantMode1()) | 156 | + << ", quantMode1: " << static_cast<uint32_t>(tilingData_.get_quantMode1()) |
| 157 | - << ", reluMode1: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_reluMode1()) | 157 | + << ", reluMode1: " << static_cast<uint32_t>(tilingData_.get_reluMode1()) |
| 158 | - << ", clipMode1: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_clipMode1()) | 158 | + << ", clipMode1: " << static_cast<uint32_t>(tilingData_.get_clipMode1()) |
| 159 | - << ", khL1: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_khL1()) | 159 | + << ", khL1: " << static_cast<uint32_t>(tilingData_.get_khL1()) |
| 160 | - << ", kwL1: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_kwL1()) | 160 | + << ", kwL1: " << static_cast<uint32_t>(tilingData_.get_kwL1()) |
| 161 | - << ", khUb: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_khUb()) | 161 | + << ", khUb: " << static_cast<uint32_t>(tilingData_.get_khUb()) |
| 162 | - << ", kwUb: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_kwUb()) | 162 | + << ", kwUb: " << static_cast<uint32_t>(tilingData_.get_kwUb()) |
| 163 | - << ", unionDataXt: " << static_cast<uint32_t>(tilingData_.convApiTiling.get_unionDataXt()); | 163 | + << ", unionDataXt: " << static_cast<uint32_t>(tilingData_.get_unionDataXt()); |
| 164 | OP_LOGD(context_->GetNodeName(), "%s AscendC: api tilingdata: %s", paramInfo_.nodeType.c_str(), ss.str().c_str()); | 164 | OP_LOGD(context_->GetNodeName(), "%s AscendC: api tilingdata: %s", paramInfo_.nodeType.c_str(), ss.str().c_str()); |
| 165 | OP_LOGD(context_->GetNodeName(), "%s", ssPartTwo.str().c_str()); | 165 | OP_LOGD(context_->GetNodeName(), "%s", ssPartTwo.str().c_str()); |
| 166 | } | 166 | } |
| @@ -118,51 +118,51 @@ bool Conv2dBaseTiling::TranslateRepoTiling(tuningtiling::TuningTilingDefPtr &tun | |||
| 118 | 118 | ||
| 119 | void Conv2dBaseTiling::TranslateApiTiling(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) | 119 | void Conv2dBaseTiling::TranslateApiTiling(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) |
| 120 | { | 120 | { |
| 121 | - tilingData_.convApiTiling.set_groups(convRepoTiling->groups); | 121 | + tilingData_.set_groups(convRepoTiling->groups); |
| 122 | - tilingData_.convApiTiling.set_orgCi(convRepoTiling->orgCi); | 122 | + tilingData_.set_orgCi(convRepoTiling->orgCi); |
| 123 | - tilingData_.convApiTiling.set_orgHi(convRepoTiling->orgHi); | 123 | + tilingData_.set_orgHi(convRepoTiling->orgHi); |
| 124 | - tilingData_.convApiTiling.set_orgWi(convRepoTiling->orgWi); | 124 | + tilingData_.set_orgWi(convRepoTiling->orgWi); |
| 125 | - tilingData_.convApiTiling.set_orgCo(convRepoTiling->orgCo); | 125 | + tilingData_.set_orgCo(convRepoTiling->orgCo); |
| 126 | - tilingData_.convApiTiling.set_orgHo(convRepoTiling->orgHo); | 126 | + tilingData_.set_orgHo(convRepoTiling->orgHo); |
| 127 | - tilingData_.convApiTiling.set_orgWo(convRepoTiling->orgWo); | 127 | + tilingData_.set_orgWo(convRepoTiling->orgWo); |
| 128 | - tilingData_.convApiTiling.set_kernelH(convRepoTiling->kernelH); | 128 | + tilingData_.set_kernelH(convRepoTiling->kernelH); |
| 129 | - tilingData_.convApiTiling.set_kernelW(convRepoTiling->kernelW); | 129 | + tilingData_.set_kernelW(convRepoTiling->kernelW); |
| 130 | - tilingData_.convApiTiling.set_singleCoreCi(convRepoTiling->singleCoreCi); | 130 | + tilingData_.set_singleCoreCi(convRepoTiling->singleCoreCi); |
| 131 | - tilingData_.convApiTiling.set_singleCoreCo(convRepoTiling->singleCoreCo); | 131 | + tilingData_.set_singleCoreCo(convRepoTiling->singleCoreCo); |
| 132 | - tilingData_.convApiTiling.set_singleCoreHo(convRepoTiling->singleCoreHo); | 132 | + tilingData_.set_singleCoreHo(convRepoTiling->singleCoreHo); |
| 133 | - tilingData_.convApiTiling.set_singleCoreWo(convRepoTiling->singleCoreWo); | 133 | + tilingData_.set_singleCoreWo(convRepoTiling->singleCoreWo); |
| 134 | - tilingData_.convApiTiling.set_singleCoreBatch(ConvCeilDiv(shapeInfo_.batch, convRepoTiling->batchDim)); | 134 | + tilingData_.set_singleCoreBatch(ConvCeilDiv(shapeInfo_.batch, convRepoTiling->batchDim)); |
| 135 | - tilingData_.convApiTiling.set_hoL1(convRepoTiling->hoL1); | 135 | + tilingData_.set_hoL1(convRepoTiling->hoL1); |
| 136 | - tilingData_.convApiTiling.set_woL1(convRepoTiling->woL1); | 136 | + tilingData_.set_woL1(convRepoTiling->woL1); |
| 137 | - tilingData_.convApiTiling.set_kAL1(convRepoTiling->kAL1); | 137 | + tilingData_.set_kAL1(convRepoTiling->kAL1); |
| 138 | - tilingData_.convApiTiling.set_kBL1(convRepoTiling->kBL1); | 138 | + tilingData_.set_kBL1(convRepoTiling->kBL1); |
| 139 | - tilingData_.convApiTiling.set_nBL1(convRepoTiling->nBL1); | 139 | + tilingData_.set_nBL1(convRepoTiling->nBL1); |
| 140 | - tilingData_.convApiTiling.set_hoL0(convRepoTiling->hoL0); | 140 | + tilingData_.set_hoL0(convRepoTiling->hoL0); |
| 141 | - tilingData_.convApiTiling.set_woL0(convRepoTiling->woL0); | 141 | + tilingData_.set_woL0(convRepoTiling->woL0); |
| 142 | - tilingData_.convApiTiling.set_kL0(convRepoTiling->kL0); | 142 | + tilingData_.set_kL0(convRepoTiling->kL0); |
| 143 | - tilingData_.convApiTiling.set_nL0(convRepoTiling->nL0); | 143 | + tilingData_.set_nL0(convRepoTiling->nL0); |
| 144 | - tilingData_.convApiTiling.set_pBufferFlag(convRepoTiling->pBufferFlag); | 144 | + tilingData_.set_pBufferFlag(convRepoTiling->pBufferFlag); |
| 145 | - tilingData_.convApiTiling.set_strideH(convRepoTiling->strideH); | 145 | + tilingData_.set_strideH(convRepoTiling->strideH); |
| 146 | - tilingData_.convApiTiling.set_strideW(convRepoTiling->strideW); | 146 | + tilingData_.set_strideW(convRepoTiling->strideW); |
| 147 | - tilingData_.convApiTiling.set_dilationH(convRepoTiling->dilationH); | 147 | + tilingData_.set_dilationH(convRepoTiling->dilationH); |
| 148 | - tilingData_.convApiTiling.set_dilationW(convRepoTiling->dilationW); | 148 | + tilingData_.set_dilationW(convRepoTiling->dilationW); |
| 149 | - tilingData_.convApiTiling.set_padTop(convRepoTiling->padTop); | 149 | + tilingData_.set_padTop(convRepoTiling->padTop); |
| 150 | - tilingData_.convApiTiling.set_padBottom(convRepoTiling->padBottom); | 150 | + tilingData_.set_padBottom(convRepoTiling->padBottom); |
| 151 | - tilingData_.convApiTiling.set_padLeft(convRepoTiling->padLeft); | 151 | + tilingData_.set_padLeft(convRepoTiling->padLeft); |
| 152 | - tilingData_.convApiTiling.set_padRight(convRepoTiling->padRight); | 152 | + tilingData_.set_padRight(convRepoTiling->padRight); |
| 153 | - tilingData_.convApiTiling.set_iterateMNOrder(convRepoTiling->iterateMNOrder); | 153 | + tilingData_.set_iterateMNOrder(convRepoTiling->iterateMNOrder); |
| 154 | - tilingData_.convApiTiling.set_biasFullLoadFlag(convRepoTiling->biasFullLoadFlag); | 154 | + tilingData_.set_biasFullLoadFlag(convRepoTiling->biasFullLoadFlag); |
| 155 | - tilingData_.convApiTiling.set_fixpParamsFullLoadFlag(convRepoTiling->fixpParamsFullLoadFlag); | 155 | + tilingData_.set_fixpParamsFullLoadFlag(convRepoTiling->fixpParamsFullLoadFlag); |
| 156 | - tilingData_.convApiTiling.set_offsetx(attrInfo_.offsetx); | 156 | + tilingData_.set_offsetx(attrInfo_.offsetx); |
| 157 | - tilingData_.convApiTiling.set_hf32Enable(convRepoTiling->hf32Enable); | 157 | + tilingData_.set_hf32Enable(convRepoTiling->hf32Enable); |
| 158 | - tilingData_.convApiTiling.set_hf32TransMode(convRepoTiling->hf32TransMode); | 158 | + tilingData_.set_hf32TransMode(convRepoTiling->hf32TransMode); |
| 159 | - tilingData_.convApiTiling.set_roundMode(attrInfo_.roundMode); | 159 | + tilingData_.set_roundMode(attrInfo_.roundMode); |
| 160 | if (convRepoTiling->enlarge > 0) { | 160 | if (convRepoTiling->enlarge > 0) { |
| 161 | - tilingData_.convApiTiling.set_enlarge(convRepoTiling->enlarge); | 161 | + tilingData_.set_enlarge(convRepoTiling->enlarge); |
| 162 | } else { | 162 | } else { |
| 163 | - tilingData_.convApiTiling.set_enlarge(optGroupInfo_.enlarge); | 163 | + tilingData_.set_enlarge(optGroupInfo_.enlarge); |
| 164 | } | 164 | } |
| 165 | - tilingData_.convApiTiling.set_innerBatch(convRepoTiling->innerBatch); | 165 | + tilingData_.set_innerBatch(convRepoTiling->innerBatch); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | void Conv2dBaseTiling::TranslateApiTilingAux(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) | 168 | void Conv2dBaseTiling::TranslateApiTilingAux(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) |
| @@ -188,31 +188,31 @@ void Conv2dBaseTiling::TranslateApiTilingAux(shared_ptr<tuningtiling::Conv2DV2Tu | |||
| 188 | kBTail = kBTail == 0 ? convRepoTiling->kBL1 : kBTail; | 188 | kBTail = kBTail == 0 ? convRepoTiling->kBL1 : kBTail; |
| 189 | 189 | ||
| 190 | if (featureFlagInfo_ == ConvAscendcFeatureFlag::IS_DMA_FLAG) { | 190 | if (featureFlagInfo_ == ConvAscendcFeatureFlag::IS_DMA_FLAG) { |
| 191 | - tilingData_.convApiTiling.set_khL1(convRepoTiling->khL1); | 191 | + tilingData_.set_khL1(convRepoTiling->khL1); |
| 192 | - tilingData_.convApiTiling.set_kwL1(convRepoTiling->kwL1); | 192 | + tilingData_.set_kwL1(convRepoTiling->kwL1); |
| 193 | } else { | 193 | } else { |
| 194 | - tilingData_.convApiTiling.set_khL1(0); | 194 | + tilingData_.set_khL1(0); |
| 195 | - tilingData_.convApiTiling.set_kwL1(0); | 195 | + tilingData_.set_kwL1(0); |
| 196 | } | 196 | } |
| 197 | - tilingData_.convApiTiling.set_kernelHxkernelW(kernelHW); | 197 | + tilingData_.set_kernelHxkernelW(kernelHW); |
| 198 | - tilingData_.convApiTiling.set_kernelHxkernelWxkernelD(kernelHW); | 198 | + tilingData_.set_kernelHxkernelWxkernelD(kernelHW); |
| 199 | - tilingData_.convApiTiling.set_multiNBL1(ConvCeilDiv(convRepoTiling->nBL1, convRepoTiling->nL0)); | 199 | + tilingData_.set_multiNBL1(ConvCeilDiv(convRepoTiling->nBL1, convRepoTiling->nL0)); |
| 200 | - tilingData_.convApiTiling.set_cinAInCore(cinAInCore); | 200 | + tilingData_.set_cinAInCore(cinAInCore); |
| 201 | - tilingData_.convApiTiling.set_cinATailInCore(kATail / kernelValueInKSize); | 201 | + tilingData_.set_cinATailInCore(kATail / kernelValueInKSize); |
| 202 | - tilingData_.convApiTiling.set_orgHixWi(orgHiWi); | 202 | + tilingData_.set_orgHixWi(orgHiWi); |
| 203 | - tilingData_.convApiTiling.set_cinOffsetBlockInGM(orgHiWi * cinAInCore); | 203 | + tilingData_.set_cinOffsetBlockInGM(orgHiWi * cinAInCore); |
| 204 | - tilingData_.convApiTiling.set_mStep(mStep); | 204 | + tilingData_.set_mStep(mStep); |
| 205 | - tilingData_.convApiTiling.set_fmapKStride(fmapKStride); | 205 | + tilingData_.set_fmapKStride(fmapKStride); |
| 206 | - tilingData_.convApiTiling.set_nStep(ConvCeilDiv(convRepoTiling->nL0, convOpsConstParams_.n0)); | 206 | + tilingData_.set_nStep(ConvCeilDiv(convRepoTiling->nL0, convOpsConstParams_.n0)); |
| 207 | - tilingData_.convApiTiling.set_kStep(convRepoTiling->kL0 / convOpsConstParams_.k0); | 207 | + tilingData_.set_kStep(convRepoTiling->kL0 / convOpsConstParams_.k0); |
| 208 | - tilingData_.convApiTiling.set_weightKStride(weightKStride); | 208 | + tilingData_.set_weightKStride(weightKStride); |
| 209 | - tilingData_.convApiTiling.set_coutOffsetBlock((convRepoTiling->orgCi / convRepoTiling->groups) * kernelHW); | 209 | + tilingData_.set_coutOffsetBlock((convRepoTiling->orgCi / convRepoTiling->groups) * kernelHW); |
| 210 | - tilingData_.convApiTiling.set_cinBInCore(cinBInCore); | 210 | + tilingData_.set_cinBInCore(cinBInCore); |
| 211 | - tilingData_.convApiTiling.set_cinBTailInCore(kBTail / kernelValueInKSize); | 211 | + tilingData_.set_cinBTailInCore(kBTail / kernelValueInKSize); |
| 212 | - tilingData_.convApiTiling.set_nL1DivBlockSize(convRepoTiling->nBL1 / convOpsConstParams_.n0); | 212 | + tilingData_.set_nL1DivBlockSize(convRepoTiling->nBL1 / convOpsConstParams_.n0); |
| 213 | - tilingData_.convApiTiling.set_aL1SpaceSize(CalcAL1SpaceSize(convRepoTiling)); | 213 | + tilingData_.set_aL1SpaceSize(CalcAL1SpaceSize(convRepoTiling)); |
| 214 | - tilingData_.convApiTiling.set_hasBias(static_cast<uint8_t>(flagInfo_.hasBias)); | 214 | + tilingData_.set_hasBias(static_cast<uint8_t>(flagInfo_.hasBias)); |
| 215 | - tilingData_.convApiTiling.set_hasScale(static_cast<uint8_t>(flagInfo_.quantFlag || flagInfo_.extendConvFlag)); | 215 | + tilingData_.set_hasScale(static_cast<uint8_t>(flagInfo_.quantFlag || flagInfo_.extendConvFlag)); |
| 216 | uint64_t singleGroups = 0; | 216 | uint64_t singleGroups = 0; |
| 217 | uint64_t singleGroupOpt = 0; | 217 | uint64_t singleGroupOpt = 0; |
| 218 | if (flagInfo_.convGroupType == ConvGroupType::OPT_GROUP_CONV) { | 218 | if (flagInfo_.convGroupType == ConvGroupType::OPT_GROUP_CONV) { |
| @@ -222,8 +222,8 @@ void Conv2dBaseTiling::TranslateApiTilingAux(shared_ptr<tuningtiling::Conv2DV2Tu | |||
| 222 | ConvCeilDiv(optGroupInfo_.groupOpt, convRepoTiling->groupDim); | 222 | ConvCeilDiv(optGroupInfo_.groupOpt, convRepoTiling->groupDim); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | - tilingData_.convApiTiling.set_singleCoreGroups(singleGroups); | 225 | + tilingData_.set_singleCoreGroups(singleGroups); |
| 226 | - tilingData_.convApiTiling.set_singleCoreGroupOpt(singleGroupOpt); | 226 | + tilingData_.set_singleCoreGroupOpt(singleGroupOpt); |
| 227 | 227 | ||
| 228 | SetUbTiling(convRepoTiling); | 228 | SetUbTiling(convRepoTiling); |
| 229 | SetFixpipeTiling(); | 229 | SetFixpipeTiling(); |
| @@ -240,18 +240,18 @@ void Conv2dBaseTiling::SetUbTiling(shared_ptr<tuningtiling::Conv2DV2TunnerTiling | |||
| 240 | c04Info_.n0 = convOpsConstParams_.n0; | 240 | c04Info_.n0 = convOpsConstParams_.n0; |
| 241 | c04Info_.k0 = convOpsConstParams_.k0; | 241 | c04Info_.k0 = convOpsConstParams_.k0; |
| 242 | c04Info_.weightDtype = dtypeMap.at(descInfo_.weightDtype); | 242 | c04Info_.weightDtype = dtypeMap.at(descInfo_.weightDtype); |
| 243 | - tilingData_.convApiTiling.set_bUbNStep(static_cast<uint32_t>(conv2dApiTiling_.CalcC04UbLoadNsize(c04Info_))); | 243 | + tilingData_.set_bUbNStep(static_cast<uint32_t>(conv2dApiTiling_.CalcC04UbLoadNsize(c04Info_))); |
| 244 | - tilingData_.convApiTiling.set_bUbKStep(0); | 244 | + tilingData_.set_bUbKStep(0); |
| 245 | } else if (convRepoTiling->isWeightUbTransFlag != 0) { | 245 | } else if (convRepoTiling->isWeightUbTransFlag != 0) { |
| 246 | conv_tiling::ConvWeightUbTransParams params = {convRepoTiling->nBL1, convRepoTiling->kBL1, | 246 | conv_tiling::ConvWeightUbTransParams params = {convRepoTiling->nBL1, convRepoTiling->kBL1, |
| 247 | static_cast<uint64_t>(convRepoTiling->kernelH), static_cast<uint64_t>(convRepoTiling->kernelW), | 247 | static_cast<uint64_t>(convRepoTiling->kernelH), static_cast<uint64_t>(convRepoTiling->kernelW), |
| 248 | convOpsConstParams_.k0, convOpsConstParams_.n0, dtypeMap.at(descInfo_.weightDtype)}; | 248 | convOpsConstParams_.k0, convOpsConstParams_.n0, dtypeMap.at(descInfo_.weightDtype)}; |
| 249 | conv2dApiTiling_.GetWeightUBTiling(params); | 249 | conv2dApiTiling_.GetWeightUBTiling(params); |
| 250 | - tilingData_.convApiTiling.set_bUbNStep(params.bUbNStep); | 250 | + tilingData_.set_bUbNStep(params.bUbNStep); |
| 251 | - tilingData_.convApiTiling.set_bUbKStep(params.bUbKStep); | 251 | + tilingData_.set_bUbKStep(params.bUbKStep); |
| 252 | } else { | 252 | } else { |
| 253 | - tilingData_.convApiTiling.set_bUbNStep(0); | 253 | + tilingData_.set_bUbNStep(0); |
| 254 | - tilingData_.convApiTiling.set_bUbKStep(0); | 254 | + tilingData_.set_bUbKStep(0); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | if (featureFlagInfo_ == ConvAscendcFeatureFlag::IS_DMA_FLAG) { | 257 | if (featureFlagInfo_ == ConvAscendcFeatureFlag::IS_DMA_FLAG) { |
| @@ -259,61 +259,51 @@ void Conv2dBaseTiling::SetUbTiling(shared_ptr<tuningtiling::Conv2DV2TunnerTiling | |||
| 259 | static_cast<uint64_t>(convRepoTiling->khL1), static_cast<uint64_t>(convRepoTiling->kwL1), | 259 | static_cast<uint64_t>(convRepoTiling->khL1), static_cast<uint64_t>(convRepoTiling->kwL1), |
| 260 | convOpsConstParams_.k0, dtypeMap.at(descInfo_.fMapDtype)}; | 260 | convOpsConstParams_.k0, dtypeMap.at(descInfo_.fMapDtype)}; |
| 261 | conv2dApiTiling_.GetDmaUbTiling(params); | 261 | conv2dApiTiling_.GetDmaUbTiling(params); |
| 262 | - tilingData_.convApiTiling.set_khUb(params.khUb); | 262 | + tilingData_.set_khUb(params.khUb); |
| 263 | - tilingData_.convApiTiling.set_kwUb(params.kwUb); | 263 | + tilingData_.set_kwUb(params.kwUb); |
| 264 | } else { | 264 | } else { |
| 265 | - tilingData_.convApiTiling.set_khUb(0); | 265 | + tilingData_.set_khUb(0); |
| 266 | - tilingData_.convApiTiling.set_kwUb(0); | 266 | + tilingData_.set_kwUb(0); |
| 267 | } | 267 | } |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | void Conv2dBaseTiling::SetFixpipeTiling() | 270 | void Conv2dBaseTiling::SetFixpipeTiling() |
| 271 | { | 271 | { |
| 272 | - tilingData_.convApiTiling.set_dualOutput(fixpipeInfo_.dualOutput); | 272 | + tilingData_.set_dualOutput(fixpipeInfo_.dualOutput); |
| 273 | - tilingData_.convApiTiling.set_quantMode0(fixpipeInfo_.quantMode0); | 273 | + tilingData_.set_quantMode0(fixpipeInfo_.quantMode0); |
| 274 | - tilingData_.convApiTiling.set_reluMode0(fixpipeInfo_.reluMode0); | 274 | + tilingData_.set_reluMode0(fixpipeInfo_.reluMode0); |
| 275 | - tilingData_.convApiTiling.set_clipMode0(fixpipeInfo_.clipMode0); | 275 | + tilingData_.set_clipMode0(fixpipeInfo_.clipMode0); |
| 276 | - tilingData_.convApiTiling.set_quantMode1(fixpipeInfo_.quantMode1); | 276 | + tilingData_.set_quantMode1(fixpipeInfo_.quantMode1); |
| 277 | - tilingData_.convApiTiling.set_reluMode1(fixpipeInfo_.reluMode1); | 277 | + tilingData_.set_reluMode1(fixpipeInfo_.reluMode1); |
| 278 | - tilingData_.convApiTiling.set_clipMode1(fixpipeInfo_.clipMode1); | 278 | + tilingData_.set_clipMode1(fixpipeInfo_.clipMode1); |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | void Conv2dBaseTiling::TranslateRunInfo(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) | 281 | void Conv2dBaseTiling::TranslateRunInfo(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) |
| 282 | { | 282 | { |
| 283 | - tilingData_.convRunInfo.set_batch(shapeInfo_.batch); | 283 | + tilingData_.set_batch(shapeInfo_.batch); |
| 284 | - tilingData_.convRunInfo.set_hin(convRepoTiling->orgHi); | 284 | + tilingData_.set_hin(convRepoTiling->orgHi); |
| 285 | - tilingData_.convRunInfo.set_win(convRepoTiling->orgWi); | 285 | + tilingData_.set_win(convRepoTiling->orgWi); |
| 286 | - tilingData_.convRunInfo.set_batchDim(convRepoTiling->batchDim); | 286 | + tilingData_.set_batchDim(convRepoTiling->batchDim); |
| 287 | - tilingData_.convRunInfo.set_hoDim(convRepoTiling->hoDim); | 287 | + tilingData_.set_hoDim(convRepoTiling->hoDim); |
| 288 | - tilingData_.convRunInfo.set_woDim(featureFlagInfo_ == ConvAscendcFeatureFlag::IS_CONV1D_FLAG ? | 288 | + tilingData_.set_woDim(featureFlagInfo_ == ConvAscendcFeatureFlag::IS_CONV1D_FLAG ? |
| 289 | convRepoTiling->woDim : 1); | 289 | convRepoTiling->woDim : 1); |
| 290 | - tilingData_.convRunInfo.set_nDim(convRepoTiling->nDim); | 290 | + tilingData_.set_nDim(convRepoTiling->nDim); |
| 291 | - tilingData_.convRunInfo.set_cin(convRepoTiling->orgCi); | 291 | + tilingData_.set_cin(convRepoTiling->orgCi); |
| 292 | - tilingData_.convRunInfo.set_cout(convRepoTiling->orgCo); | 292 | + tilingData_.set_cout(convRepoTiling->orgCo); |
| 293 | - tilingData_.convRunInfo.set_kh(convRepoTiling->kernelH); | 293 | + tilingData_.set_kh(convRepoTiling->kernelH); |
| 294 | - tilingData_.convRunInfo.set_kw(convRepoTiling->kernelW); | 294 | + tilingData_.set_kw(convRepoTiling->kernelW); |
| 295 | - tilingData_.convRunInfo.set_hout(convRepoTiling->orgHo); | 295 | + tilingData_.set_hout(convRepoTiling->orgHo); |
| 296 | - tilingData_.convRunInfo.set_wout(convRepoTiling->orgWo); | 296 | + tilingData_.set_wout(convRepoTiling->orgWo); |
| 297 | - tilingData_.convRunInfo.set_strideH(convRepoTiling->strideH); | ||
| 298 | - tilingData_.convRunInfo.set_strideW(convRepoTiling->strideW); | ||
| 299 | - tilingData_.convRunInfo.set_dilationH(convRepoTiling->dilationH); | ||
| 300 | - tilingData_.convRunInfo.set_dilationW(convRepoTiling->dilationW); | ||
| 301 | - tilingData_.convRunInfo.set_padTop(convRepoTiling->padTop); | ||
| 302 | - tilingData_.convRunInfo.set_padLeft(convRepoTiling->padLeft); | ||
| 303 | - tilingData_.convRunInfo.set_hasBias(flagInfo_.hasBias); | ||
| 304 | - tilingData_.convRunInfo.set_groups(convRepoTiling->groups); | ||
| 305 | if (convRepoTiling->enlarge > 0) { | 297 | if (convRepoTiling->enlarge > 0) { |
| 306 | - tilingData_.convRunInfo.set_cinOpt(oriGroupInfo_.ciPerGroup * convRepoTiling->enlarge); | 298 | + tilingData_.set_cinOpt(oriGroupInfo_.ciPerGroup * convRepoTiling->enlarge); |
| 307 | - tilingData_.convRunInfo.set_coutOpt(oriGroupInfo_.coPerGroup * convRepoTiling->enlarge); | 299 | + tilingData_.set_coutOpt(oriGroupInfo_.coPerGroup * convRepoTiling->enlarge); |
| 308 | - tilingData_.convRunInfo.set_groupOpt(ConvCeilDiv(convRepoTiling->groups, convRepoTiling->enlarge)); | 300 | + tilingData_.set_groupOpt(ConvCeilDiv(convRepoTiling->groups, convRepoTiling->enlarge)); |
| 309 | - tilingData_.convRunInfo.set_enlarge(convRepoTiling->enlarge); | ||
| 310 | } else { | 301 | } else { |
| 311 | - tilingData_.convRunInfo.set_cinOpt(optGroupInfo_.cinOpt); | 302 | + tilingData_.set_cinOpt(optGroupInfo_.cinOpt); |
| 312 | - tilingData_.convRunInfo.set_coutOpt(optGroupInfo_.coutOpt); | 303 | + tilingData_.set_coutOpt(optGroupInfo_.coutOpt); |
| 313 | - tilingData_.convRunInfo.set_groupOpt(optGroupInfo_.groupOpt); | 304 | + tilingData_.set_groupOpt(optGroupInfo_.groupOpt); |
| 314 | - tilingData_.convRunInfo.set_enlarge(optGroupInfo_.enlarge); | ||
| 315 | } | 305 | } |
| 316 | - tilingData_.convRunInfo.set_groupDim(convRepoTiling->groupDim); | 306 | + tilingData_.set_groupDim(convRepoTiling->groupDim); |
| 317 | } | 307 | } |
| 318 | 308 | ||
| 319 | uint32_t Conv2dBaseTiling::CalcAL1SpaceSize(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) | 309 | uint32_t Conv2dBaseTiling::CalcAL1SpaceSize(shared_ptr<tuningtiling::Conv2DV2TunnerTiling> convRepoTiling) |
| @@ -335,7 +325,7 @@ uint32_t Conv2dBaseTiling::CalcAL1SpaceSize(shared_ptr<tuningtiling::Conv2DV2Tun | |||
| 335 | uint64_t hoL1Max = std::min(mL1Max / convRepoTiling->orgWo + 2, convRepoTiling->orgHo); | 325 | uint64_t hoL1Max = std::min(mL1Max / convRepoTiling->orgWo + 2, convRepoTiling->orgHo); |
| 336 | uint64_t hiAL1Max = ConvInferHiL1(hoL1Max, convRepoTiling->orgHi, convRepoTiling->kernelH, convRepoTiling->dilationH, | 326 | uint64_t hiAL1Max = ConvInferHiL1(hoL1Max, convRepoTiling->orgHi, convRepoTiling->kernelH, convRepoTiling->dilationH, |
| 337 | convRepoTiling->strideH); | 327 | convRepoTiling->strideH); |
| 338 | - aL1SpaceSize = tilingData_.convApiTiling.get_cinAInCore() * hiAL1Max * convRepoTiling->orgWi; | 328 | + aL1SpaceSize = tilingData_.get_cinAInCore() * hiAL1Max * convRepoTiling->orgWi; |
| 339 | } | 329 | } |
| 340 | } else { | 330 | } else { |
| 341 | uint64_t hiAL1Max = ConvInferHiL1(convRepoTiling->hoL1, convRepoTiling->orgHi, convRepoTiling->kernelH, convRepoTiling->dilationH, | 331 | uint64_t hiAL1Max = ConvInferHiL1(convRepoTiling->hoL1, convRepoTiling->orgHi, convRepoTiling->kernelH, convRepoTiling->dilationH, |
| @@ -347,7 +337,7 @@ uint32_t Conv2dBaseTiling::CalcAL1SpaceSize(shared_ptr<tuningtiling::Conv2DV2Tun | |||
| 347 | } else { | 337 | } else { |
| 348 | wiAL1Max = ConvInferWiL1(convRepoTiling->woL1, convRepoTiling->orgWi, convRepoTiling->kernelW, convRepoTiling->dilationW, | 338 | wiAL1Max = ConvInferWiL1(convRepoTiling->woL1, convRepoTiling->orgWi, convRepoTiling->kernelW, convRepoTiling->dilationW, |
| 349 | convRepoTiling->strideW); | 339 | convRepoTiling->strideW); |
| 350 | - aL1SpaceSize = tilingData_.convApiTiling.get_cinAInCore() * hiAL1Max * wiAL1Max; | 340 | + aL1SpaceSize = tilingData_.get_cinAInCore() * hiAL1Max * wiAL1Max; |
| 351 | } | 341 | } |
| 352 | } | 342 | } |
| 353 | aL1SpaceSize = ConvAlignB(aL1SpaceSize * fmapSize, C0_SIZE) * convRepoTiling->innerBatch; | 343 | aL1SpaceSize = ConvAlignB(aL1SpaceSize * fmapSize, C0_SIZE) * convRepoTiling->innerBatch; |
| @@ -366,7 +356,7 @@ void Conv2dBaseTiling::SetUnionDataXt(shared_ptr<tuningtiling::Conv2DV2TunnerTil | |||
| 366 | unionDataXt.bf.dilationW = static_cast<uint64_t>(convRepoTiling->dilationW); | 356 | unionDataXt.bf.dilationW = static_cast<uint64_t>(convRepoTiling->dilationW); |
| 367 | unionDataXt.bf.strideH = static_cast<uint64_t>(convRepoTiling->strideH) & 0x3f; | 357 | unionDataXt.bf.strideH = static_cast<uint64_t>(convRepoTiling->strideH) & 0x3f; |
| 368 | unionDataXt.bf.strideW = static_cast<uint64_t>(convRepoTiling->strideW) & 0x3f; | 358 | unionDataXt.bf.strideW = static_cast<uint64_t>(convRepoTiling->strideW) & 0x3f; |
| 369 | - tilingData_.convApiTiling.set_unionDataXt(unionDataXt.n); | 359 | + tilingData_.set_unionDataXt(unionDataXt.n); |
| 370 | } | 360 | } |
| 371 | 361 | ||
| 372 | void Conv2dBaseTiling::PrintInputArgs(shared_ptr<tuningtiling::Conv2DV2InputArgs> conv2DInput) | 362 | void Conv2dBaseTiling::PrintInputArgs(shared_ptr<tuningtiling::Conv2DV2InputArgs> conv2DInput) |
| @@ -27,7 +27,7 @@ uint64_t Conv2dBaseTiling::GetSmallWeightVal() | |||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | // Not useful to weight ub | 29 | // Not useful to weight ub |
| 30 | - if (tilingData_.convApiTiling.get_bUbNStep() > 0 && tilingData_.convApiTiling.get_bUbKStep() > 0) { | 30 | + if (tilingData_.get_bUbNStep() > 0 && tilingData_.get_bUbKStep() > 0) { |
| 31 | return CONV_NOT_SMALL_WEIGHT; | 31 | return CONV_NOT_SMALL_WEIGHT; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| @@ -37,9 +37,9 @@ uint64_t Conv2dBaseTiling::GetSmallWeightVal() | |||
| 37 | ci1 * shapeInfo_.kh * shapeInfo_.kw * convOpsConstParams_.k0; | 37 | ci1 * shapeInfo_.kh * shapeInfo_.kw * convOpsConstParams_.k0; |
| 38 | uint64_t singleCoreNSize = ConvAlignB(ConvCeilDiv(shapeInfo_.co, numBlocksRes.nDim), convOpsConstParams_.n0); | 38 | uint64_t singleCoreNSize = ConvAlignB(ConvCeilDiv(shapeInfo_.co, numBlocksRes.nDim), convOpsConstParams_.n0); |
| 39 | int64_t weightDtypeSize = dtypeSizeTab.at(descInfo_.weightDtype); | 39 | int64_t weightDtypeSize = dtypeSizeTab.at(descInfo_.weightDtype); |
| 40 | - if (weightKSize == tilingData_.convApiTiling.get_kBL1() && | 40 | + if (weightKSize == tilingData_.get_kBL1() && |
| 41 | - weightKSize == tilingData_.convApiTiling.get_kAL1() && | 41 | + weightKSize == tilingData_.get_kAL1() && |
| 42 | - tilingData_.convApiTiling.get_nL0() == singleCoreNSize) { | 42 | + tilingData_.get_nL0() == singleCoreNSize) { |
| 43 | if (weightKSize * singleCoreNSize * weightDtypeSize <= apiInputPlatformInfo.l0BSize) { | 43 | if (weightKSize * singleCoreNSize * weightDtypeSize <= apiInputPlatformInfo.l0BSize) { |
| 44 | return CONV_WEIGHT_SMALLER_THAN_BL0; | 44 | return CONV_WEIGHT_SMALLER_THAN_BL0; |
| 45 | } | 45 | } |
| @@ -58,7 +58,7 @@ uint64_t Conv2dBaseTiling::GetFmpTilingVal() | |||
| 58 | uint64_t fmpKSize = flagInfo_.enableC04Flag ? ConvAlignB(C04_CIN_SIZE * | 58 | uint64_t fmpKSize = flagInfo_.enableC04Flag ? ConvAlignB(C04_CIN_SIZE * |
| 59 | shapeInfo_.kh * shapeInfo_.kw, convOpsConstParams_.k0) : | 59 | shapeInfo_.kh * shapeInfo_.kw, convOpsConstParams_.k0) : |
| 60 | ci1 * shapeInfo_.kh * shapeInfo_.kw * convOpsConstParams_.k0; | 60 | ci1 * shapeInfo_.kh * shapeInfo_.kw * convOpsConstParams_.k0; |
| 61 | - bool kAL1FullloadFlag = tilingData_.convApiTiling.get_kAL1() == fmpKSize; | 61 | + bool kAL1FullloadFlag = tilingData_.get_kAL1() == fmpKSize; |
| 62 | if (flagInfo_.mSplitModeFlag) { | 62 | if (flagInfo_.mSplitModeFlag) { |
| 63 | return GetFmpTilingValForMSplit(kAL1FullloadFlag); | 63 | return GetFmpTilingValForMSplit(kAL1FullloadFlag); |
| 64 | } | 64 | } |
| @@ -67,10 +67,10 @@ uint64_t Conv2dBaseTiling::GetFmpTilingVal() | |||
| 67 | 67 | ||
| 68 | uint64_t Conv2dBaseTiling::GetFmpTilingValForMSplit(bool kAL1FullloadFlag) | 68 | uint64_t Conv2dBaseTiling::GetFmpTilingValForMSplit(bool kAL1FullloadFlag) |
| 69 | { | 69 | { |
| 70 | - bool mL1FullloadFlag = tilingData_.convApiTiling.get_innerBatch() == 1 ? | 70 | + bool mL1FullloadFlag = tilingData_.get_innerBatch() == 1 ? |
| 71 | - tilingData_.convApiTiling.get_singleCoreHo() <= tilingData_.convApiTiling.get_hoL1() : | 71 | + tilingData_.get_singleCoreHo() <= tilingData_.get_hoL1() : |
| 72 | - tilingData_.convApiTiling.get_innerBatch() == tilingData_.convApiTiling.get_singleCoreBatch(); | 72 | + tilingData_.get_innerBatch() == tilingData_.get_singleCoreBatch(); |
| 73 | - bool mL0FullloadFlag = tilingData_.convApiTiling.get_hoL1() == tilingData_.convApiTiling.get_hoL0(); | 73 | + bool mL0FullloadFlag = tilingData_.get_hoL1() == tilingData_.get_hoL0(); |
| 74 | if (kAL1FullloadFlag && mL1FullloadFlag) { | 74 | if (kAL1FullloadFlag && mL1FullloadFlag) { |
| 75 | return FULLLOAD_AL1; | 75 | return FULLLOAD_AL1; |
| 76 | } else if (!kAL1FullloadFlag && mL1FullloadFlag && mL0FullloadFlag) { | 76 | } else if (!kAL1FullloadFlag && mL1FullloadFlag && mL0FullloadFlag) { |
| @@ -81,7 +81,7 @@ uint64_t Conv2dBaseTiling::GetFmpTilingValForMSplit(bool kAL1FullloadFlag) | |||
| 81 | 81 | ||
| 82 | uint64_t Conv2dBaseTiling::GetL0PingPongVal() | 82 | uint64_t Conv2dBaseTiling::GetL0PingPongVal() |
| 83 | { | 83 | { |
| 84 | - return static_cast<uint64_t>(tilingData_.convApiTiling.get_pBufferFlag() & L0A_L0B_PB_FLAG_MASK); | 84 | + return static_cast<uint64_t>(tilingData_.get_pBufferFlag() & L0A_L0B_PB_FLAG_MASK); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | uint64_t Conv2dBaseTiling::GetWeightTilingVal() | 87 | uint64_t Conv2dBaseTiling::GetWeightTilingVal() |
| @@ -96,11 +96,11 @@ uint64_t Conv2dBaseTiling::GetWeightTilingVal() | |||
| 96 | shapeInfo_.kh * shapeInfo_.kw, convOpsConstParams_.k0) : | 96 | shapeInfo_.kh * shapeInfo_.kw, convOpsConstParams_.k0) : |
| 97 | ci1 * shapeInfo_.kh * shapeInfo_.kw * convOpsConstParams_.k0; | 97 | ci1 * shapeInfo_.kh * shapeInfo_.kw * convOpsConstParams_.k0; |
| 98 | uint64_t singleCoreNSize = ConvAlignB(ConvCeilDiv(shapeInfo_.co, numBlocksRes.nDim), convOpsConstParams_.n0); | 98 | uint64_t singleCoreNSize = ConvAlignB(ConvCeilDiv(shapeInfo_.co, numBlocksRes.nDim), convOpsConstParams_.n0); |
| 99 | - if (tilingData_.convApiTiling.get_kBL1() == weightKSize) { | 99 | + if (tilingData_.get_kBL1() == weightKSize) { |
| 100 | kBL1FullloadFlag = true; | 100 | kBL1FullloadFlag = true; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | - if (tilingData_.convApiTiling.get_nBL1() == singleCoreNSize) { | 103 | + if (tilingData_.get_nBL1() == singleCoreNSize) { |
| 104 | nBL1FullloadFlag = true; | 104 | nBL1FullloadFlag = true; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| @@ -108,7 +108,7 @@ uint64_t Conv2dBaseTiling::GetWeightTilingVal() | |||
| 108 | return FULLLOAD_BL1; | 108 | return FULLLOAD_BL1; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | - if (!kBL1FullloadFlag && tilingData_.convApiTiling.get_nL0() == singleCoreNSize) { | 111 | + if (!kBL1FullloadFlag && tilingData_.get_nL0() == singleCoreNSize) { |
| 112 | return ONLY_N_FULLLOAD_BL1_BL0; | 112 | return ONLY_N_FULLLOAD_BL1_BL0; |
| 113 | } | 113 | } |
| 114 | return WEIGHT_OTHER; | 114 | return WEIGHT_OTHER; |
| @@ -124,16 +124,16 @@ uint64_t Conv2dBaseTiling::GetOutputOrderVal() | |||
| 124 | 124 | ||
| 125 | uint64_t Conv2dBaseTiling::GetFmpTilingValForHWSplit(bool kAL1FullloadFlag) | 125 | uint64_t Conv2dBaseTiling::GetFmpTilingValForHWSplit(bool kAL1FullloadFlag) |
| 126 | { | 126 | { |
| 127 | - bool hoL1FullloadFlag = tilingData_.convApiTiling.get_singleCoreHo() <= tilingData_.convApiTiling.get_hoL1(); | 127 | + bool hoL1FullloadFlag = tilingData_.get_singleCoreHo() <= tilingData_.get_hoL1(); |
| 128 | bool woL1FullloadFlag = false; | 128 | bool woL1FullloadFlag = false; |
| 129 | - if (tilingData_.convApiTiling.get_singleCoreWo() <= tilingData_.convApiTiling.get_woL1() && | 129 | + if (tilingData_.get_singleCoreWo() <= tilingData_.get_woL1() && |
| 130 | - !(ConvCeilDiv(tilingData_.convApiTiling.get_singleCoreWo(), tilingData_.convApiTiling.get_woL0()) > 1 && | 130 | + !(ConvCeilDiv(tilingData_.get_singleCoreWo(), tilingData_.get_woL0()) > 1 && |
| 131 | - tilingData_.convApiTiling.get_singleCoreWo() % convOpsConstParams_.m0 > 0 && | 131 | + tilingData_.get_singleCoreWo() % convOpsConstParams_.m0 > 0 && |
| 132 | - tilingData_.convApiTiling.get_hoL0() > 1)) { | 132 | + tilingData_.get_hoL0() > 1)) { |
| 133 | woL1FullloadFlag = true; | 133 | woL1FullloadFlag = true; |
| 134 | } | 134 | } |
| 135 | - bool hoL0FullloadFlag = tilingData_.convApiTiling.get_hoL1() == tilingData_.convApiTiling.get_hoL0(); | 135 | + bool hoL0FullloadFlag = tilingData_.get_hoL1() == tilingData_.get_hoL0(); |
| 136 | - bool woL0FullloadFlag = tilingData_.convApiTiling.get_woL1() == tilingData_.convApiTiling.get_woL0(); | 136 | + bool woL0FullloadFlag = tilingData_.get_woL1() == tilingData_.get_woL0(); |
| 137 | if (kAL1FullloadFlag && hoL1FullloadFlag && woL1FullloadFlag) { | 137 | if (kAL1FullloadFlag && hoL1FullloadFlag && woL1FullloadFlag) { |
| 138 | return FULLLOAD_AL1; | 138 | return FULLLOAD_AL1; |
| 139 | } else if (!kAL1FullloadFlag && hoL1FullloadFlag && hoL0FullloadFlag && woL1FullloadFlag && woL0FullloadFlag) { | 139 | } else if (!kAL1FullloadFlag && hoL1FullloadFlag && hoL0FullloadFlag && woL1FullloadFlag && woL0FullloadFlag) { |
| @@ -144,7 +144,7 @@ uint64_t Conv2dBaseTiling::GetFmpTilingValForHWSplit(bool kAL1FullloadFlag) | |||
| 144 | 144 | ||
| 145 | uint64_t Conv2dBaseTiling::GetL1PingPongVal() | 145 | uint64_t Conv2dBaseTiling::GetL1PingPongVal() |
| 146 | { | 146 | { |
| 147 | - uint64_t l1PingPong = static_cast<uint64_t>(tilingData_.convApiTiling.get_pBufferFlag() & | 147 | + uint64_t l1PingPong = static_cast<uint64_t>(tilingData_.get_pBufferFlag() & |
| 148 | L1A_L1B_PB_FLAG_MASK) >> L1_PB_OFFSET; | 148 | L1A_L1B_PB_FLAG_MASK) >> L1_PB_OFFSET; |
| 149 | // in group conv: only care about bl1 pingpong | 149 | // in group conv: only care about bl1 pingpong |
| 150 | if (flagInfo_.convGroupType != ConvGroupType::NORMAL_CONV) { | 150 | if (flagInfo_.convGroupType != ConvGroupType::NORMAL_CONV) { |
| @@ -160,7 +160,7 @@ uint64_t Conv2dBaseTiling::GetL1PingPongVal() | |||
| 160 | uint64_t Conv2dBaseTiling::GetWeightUbTrans() | 160 | uint64_t Conv2dBaseTiling::GetWeightUbTrans() |
| 161 | { | 161 | { |
| 162 | // bUbKStep is always 0 except weight ub trans mode. | 162 | // bUbKStep is always 0 except weight ub trans mode. |
| 163 | - if (tilingData_.convApiTiling.get_bUbNStep() > 0 && tilingData_.convApiTiling.get_bUbKStep() > 0) { | 163 | + if (tilingData_.get_bUbNStep() > 0 && tilingData_.get_bUbKStep() > 0) { |
| 164 | return WEIGHT_UB_TRANS_OPEN; | 164 | return WEIGHT_UB_TRANS_OPEN; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| @@ -169,7 +169,7 @@ uint64_t Conv2dBaseTiling::GetWeightUbTrans() | |||
| 169 | 169 | ||
| 170 | uint64_t Conv2dBaseTiling::GetEnableInnerBatch() | 170 | uint64_t Conv2dBaseTiling::GetEnableInnerBatch() |
| 171 | { | 171 | { |
| 172 | - if (tilingData_.convApiTiling.get_innerBatch() > 1) { | 172 | + if (tilingData_.get_innerBatch() > 1) { |
| 173 | return shapeInfo_.kh == 1 && shapeInfo_.kw == 1 && attrInfo_.padTop == 0 && attrInfo_.padBottom == 0 && | 173 | return shapeInfo_.kh == 1 && shapeInfo_.kw == 1 && attrInfo_.padTop == 0 && attrInfo_.padBottom == 0 && |
| 174 | attrInfo_.padLeft == 0 && attrInfo_.padRight == 0 && attrInfo_.strideH == 1 && attrInfo_.strideW == 1 && | 174 | attrInfo_.padLeft == 0 && attrInfo_.padRight == 0 && attrInfo_.strideH == 1 && attrInfo_.strideW == 1 && |
| 175 | attrInfo_.dilationH == 1 && attrInfo_.dilationW == 1 ? | 175 | attrInfo_.dilationH == 1 && attrInfo_.dilationW == 1 ? |
| @@ -181,7 +181,7 @@ uint64_t Conv2dBaseTiling::GetEnableInnerBatch() | |||
| 181 | uint64_t Conv2dBaseTiling::GetFmapCopyMode() | 181 | uint64_t Conv2dBaseTiling::GetFmapCopyMode() |
| 182 | { | 182 | { |
| 183 | // bUbKStep is always 0 except weight ub trans mode. | 183 | // bUbKStep is always 0 except weight ub trans mode. |
| 184 | - if (tilingData_.convApiTiling.get_khUb() > 0 && tilingData_.convApiTiling.get_kwUb() > 0) { | 184 | + if (tilingData_.get_khUb() > 0 && tilingData_.get_kwUb() > 0) { |
| 185 | return FMAP_DMA_MODE; | 185 | return FMAP_DMA_MODE; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| @@ -205,10 +205,10 @@ void Conv2dBaseTiling::ReSetTilingKeyPara() | |||
| 205 | tilingKeyPara_.fmpTiling = FMP_OTHER; | 205 | tilingKeyPara_.fmpTiling = FMP_OTHER; |
| 206 | } | 206 | } |
| 207 | bool sceneFlag = flagInfo_.convGroupType == ConvGroupType::OPT_GROUP_CONV && | 207 | bool sceneFlag = flagInfo_.convGroupType == ConvGroupType::OPT_GROUP_CONV && |
| 208 | - tilingKeyPara_.fmapCppyMode == FMAP_LOAD3D_MODE && tilingData_.convApiTiling.get_innerBatch() == 1 && | 208 | + tilingKeyPara_.fmapCppyMode == FMAP_LOAD3D_MODE && tilingData_.get_innerBatch() == 1 && |
| 209 | - tilingData_.convApiTiling.get_hoL1() == tilingData_.convApiTiling.get_hoL0(); | 209 | + tilingData_.get_hoL1() == tilingData_.get_hoL0(); |
| 210 | if (!flagInfo_.mSplitModeFlag) { | 210 | if (!flagInfo_.mSplitModeFlag) { |
| 211 | - sceneFlag = sceneFlag && tilingData_.convApiTiling.get_woL1() == tilingData_.convApiTiling.get_woL0(); | 211 | + sceneFlag = sceneFlag && tilingData_.get_woL1() == tilingData_.get_woL0(); |
| 212 | } | 212 | } |
| 213 | bool otherFlag = tilingKeyPara_.iterOrder == 0 && tilingKeyPara_.l1PingPong == L1_PB_ALL_OPEN; | 213 | bool otherFlag = tilingKeyPara_.iterOrder == 0 && tilingKeyPara_.l1PingPong == L1_PB_ALL_OPEN; |
| 214 | if (sceneFlag && otherFlag) { | 214 | if (sceneFlag && otherFlag) { |
| @@ -238,7 +238,7 @@ ge::graphStatus Conv2dBaseTiling::SetTilingKey() | |||
| 238 | tilingKeyPara_.l1PingPong = GetL1PingPongVal(); | 238 | tilingKeyPara_.l1PingPong = GetL1PingPongVal(); |
| 239 | tilingKeyPara_.l0PingPong = GetL0PingPongVal(); | 239 | tilingKeyPara_.l0PingPong = GetL0PingPongVal(); |
| 240 | tilingKeyPara_.outputOrder = GetOutputOrderVal(); | 240 | tilingKeyPara_.outputOrder = GetOutputOrderVal(); |
| 241 | - tilingKeyPara_.iterOrder = static_cast<uint64_t>(tilingData_.convApiTiling.get_iterateMNOrder()); | 241 | + tilingKeyPara_.iterOrder = static_cast<uint64_t>(tilingData_.get_iterateMNOrder()); |
| 242 | tilingKeyPara_.groupType = static_cast<uint64_t>(flagInfo_.convGroupType); | 242 | tilingKeyPara_.groupType = static_cast<uint64_t>(flagInfo_.convGroupType); |
| 243 | tilingKeyPara_.enableSmallChannel = static_cast<uint64_t>(flagInfo_.enableC04Flag); | 243 | tilingKeyPara_.enableSmallChannel = static_cast<uint64_t>(flagInfo_.enableC04Flag); |
| 244 | tilingKeyPara_.weightUbTrans = GetWeightUbTrans(); | 244 | tilingKeyPara_.weightUbTrans = GetWeightUbTrans(); |
| @@ -246,7 +246,7 @@ ge::graphStatus Conv2dBaseTiling::SetTilingKey() | |||
| 246 | tilingKeyPara_.innerBatch = GetEnableInnerBatch(); | 246 | tilingKeyPara_.innerBatch = GetEnableInnerBatch(); |
| 247 | tilingKeyPara_.disContinuous = static_cast<uint64_t>(flagInfo_.disContinuousFlag); | 247 | tilingKeyPara_.disContinuous = static_cast<uint64_t>(flagInfo_.disContinuousFlag); |
| 248 | if (IsWeightNZFormat(descInfo_.weightFormat)) { | 248 | if (IsWeightNZFormat(descInfo_.weightFormat)) { |
| 249 | - tilingKeyPara_.batchOne = static_cast<uint64_t>(tilingData_.convApiTiling.get_singleCoreBatch() == 1); | 249 | + tilingKeyPara_.batchOne = static_cast<uint64_t>(tilingData_.get_singleCoreBatch() == 1); |
| 250 | tilingKeyPara_.noPad = GetNoPad(); | 250 | tilingKeyPara_.noPad = GetNoPad(); |
| 251 | tilingKeyPara_.smallWeight = GetSmallWeightVal(); | 251 | tilingKeyPara_.smallWeight = GetSmallWeightVal(); |
| 252 | } | 252 | } |
| @@ -22,16 +22,76 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | - * Conv2DRunInfo define here | ||
| 26 | * BEGIN_TILING_DATA_DEF and TILING_DATA_FIELD_DEF should same with CANN | 25 | * BEGIN_TILING_DATA_DEF and TILING_DATA_FIELD_DEF should same with CANN |
| 27 | */ | 26 | */ |
| 28 | 27 | ||
| 29 | namespace optiling { | 28 | namespace optiling { |
| 30 | - BEGIN_TILING_DATA_DEF(Conv2DRunInfo) | 29 | + |
| 30 | + BEGIN_TILING_DATA_DEF(Conv2DTilingData) | ||
| 31 | + TILING_DATA_FIELD_DEF(uint64_t, orgHi); | ||
| 32 | + TILING_DATA_FIELD_DEF(uint64_t, orgWi); | ||
| 33 | + TILING_DATA_FIELD_DEF(uint64_t, orgHo); | ||
| 34 | + TILING_DATA_FIELD_DEF(uint64_t, orgWo); | ||
| 35 | + TILING_DATA_FIELD_DEF(uint64_t, orgHixWi); | ||
| 36 | + TILING_DATA_FIELD_DEF(uint64_t, singleCoreBatch); | ||
| 37 | + TILING_DATA_FIELD_DEF(uint64_t, singleCoreHo); | ||
| 38 | + TILING_DATA_FIELD_DEF(uint64_t, singleCoreWo); | ||
| 39 | + TILING_DATA_FIELD_DEF(uint64_t, unionDataXt); | ||
| 31 | TILING_DATA_FIELD_DEF(uint64_t, hin); | 40 | TILING_DATA_FIELD_DEF(uint64_t, hin); |
| 32 | TILING_DATA_FIELD_DEF(uint64_t, win); | 41 | TILING_DATA_FIELD_DEF(uint64_t, win); |
| 33 | TILING_DATA_FIELD_DEF(uint64_t, hout); | 42 | TILING_DATA_FIELD_DEF(uint64_t, hout); |
| 34 | TILING_DATA_FIELD_DEF(uint64_t, wout); | 43 | TILING_DATA_FIELD_DEF(uint64_t, wout); |
| 44 | + TILING_DATA_FIELD_DEF(uint32_t, orgCi); | ||
| 45 | + TILING_DATA_FIELD_DEF(uint32_t, orgCo); | ||
| 46 | + TILING_DATA_FIELD_DEF(uint32_t, singleCoreCi); | ||
| 47 | + TILING_DATA_FIELD_DEF(uint32_t, singleCoreCo); | ||
| 48 | + TILING_DATA_FIELD_DEF(uint32_t, hoL1); | ||
| 49 | + TILING_DATA_FIELD_DEF(uint32_t, woL1); | ||
| 50 | + TILING_DATA_FIELD_DEF(uint32_t, kAL1); | ||
| 51 | + TILING_DATA_FIELD_DEF(uint32_t, kBL1); | ||
| 52 | + TILING_DATA_FIELD_DEF(uint32_t, khL1); | ||
| 53 | + TILING_DATA_FIELD_DEF(uint32_t, kwL1); | ||
| 54 | + TILING_DATA_FIELD_DEF(uint32_t, nBL1); | ||
| 55 | + TILING_DATA_FIELD_DEF(uint32_t, hoL0); | ||
| 56 | + TILING_DATA_FIELD_DEF(uint32_t, woL0); | ||
| 57 | + TILING_DATA_FIELD_DEF(uint32_t, kL0); | ||
| 58 | + TILING_DATA_FIELD_DEF(uint32_t, nL0); | ||
| 59 | + TILING_DATA_FIELD_DEF(uint32_t, pBufferFlag); | ||
| 60 | + TILING_DATA_FIELD_DEF(uint32_t, groups); | ||
| 61 | + TILING_DATA_FIELD_DEF(uint32_t, enlarge); | ||
| 62 | + TILING_DATA_FIELD_DEF(uint32_t, singleCoreGroups); | ||
| 63 | + TILING_DATA_FIELD_DEF(uint32_t, singleCoreGroupOpt); | ||
| 64 | + TILING_DATA_FIELD_DEF(uint32_t, bUbNStep); | ||
| 65 | + TILING_DATA_FIELD_DEF(uint32_t, bUbKStep); | ||
| 66 | + TILING_DATA_FIELD_DEF(uint32_t, khUb); | ||
| 67 | + TILING_DATA_FIELD_DEF(uint32_t, kwUb); | ||
| 68 | + TILING_DATA_FIELD_DEF(uint32_t, kernelHxkernelW); | ||
| 69 | + TILING_DATA_FIELD_DEF(uint32_t, kernelHxkernelWxkernelD); | ||
| 70 | + TILING_DATA_FIELD_DEF(uint32_t, aL1SpaceSize); | ||
| 71 | + TILING_DATA_FIELD_DEF(uint32_t, multiNBL1); | ||
| 72 | + TILING_DATA_FIELD_DEF(uint32_t, cinAInCore); | ||
| 73 | + TILING_DATA_FIELD_DEF(uint32_t, cinATailInCore); | ||
| 74 | + TILING_DATA_FIELD_DEF(uint32_t, cinBInCore); | ||
| 75 | + TILING_DATA_FIELD_DEF(uint32_t, cinBTailInCore); | ||
| 76 | + TILING_DATA_FIELD_DEF(uint32_t, mStep); | ||
| 77 | + TILING_DATA_FIELD_DEF(uint32_t, kStep); | ||
| 78 | + TILING_DATA_FIELD_DEF(uint32_t, nStep); | ||
| 79 | + TILING_DATA_FIELD_DEF(uint32_t, fmapKStride); | ||
| 80 | + TILING_DATA_FIELD_DEF(uint32_t, weightKStride); | ||
| 81 | + TILING_DATA_FIELD_DEF(uint32_t, cinOffsetBlockInGM); | ||
| 82 | + TILING_DATA_FIELD_DEF(uint32_t, coutOffsetBlock); | ||
| 83 | + TILING_DATA_FIELD_DEF(uint32_t, nL1DivBlockSize); | ||
| 84 | + TILING_DATA_FIELD_DEF(uint32_t, kernelH); | ||
| 85 | + TILING_DATA_FIELD_DEF(uint32_t, kernelW); | ||
| 86 | + TILING_DATA_FIELD_DEF(uint32_t, strideH); | ||
| 87 | + TILING_DATA_FIELD_DEF(uint32_t, strideW); | ||
| 88 | + TILING_DATA_FIELD_DEF(uint32_t, dilationH); | ||
| 89 | + TILING_DATA_FIELD_DEF(uint32_t, dilationW); | ||
| 90 | + TILING_DATA_FIELD_DEF(uint32_t, padTop); | ||
| 91 | + TILING_DATA_FIELD_DEF(uint32_t, padBottom); | ||
| 92 | + TILING_DATA_FIELD_DEF(uint32_t, padLeft); | ||
| 93 | + TILING_DATA_FIELD_DEF(uint32_t, padRight); | ||
| 94 | + TILING_DATA_FIELD_DEF(uint32_t, innerBatch); | ||
| 35 | TILING_DATA_FIELD_DEF(uint32_t, batch); | 95 | TILING_DATA_FIELD_DEF(uint32_t, batch); |
| 36 | TILING_DATA_FIELD_DEF(uint32_t, cin); | 96 | TILING_DATA_FIELD_DEF(uint32_t, cin); |
| 37 | TILING_DATA_FIELD_DEF(uint32_t, cout); | 97 | TILING_DATA_FIELD_DEF(uint32_t, cout); |
| @@ -42,25 +102,25 @@ namespace optiling { | |||
| 42 | TILING_DATA_FIELD_DEF(uint32_t, nDim); | 102 | TILING_DATA_FIELD_DEF(uint32_t, nDim); |
| 43 | TILING_DATA_FIELD_DEF(uint32_t, hoDim); | 103 | TILING_DATA_FIELD_DEF(uint32_t, hoDim); |
| 44 | TILING_DATA_FIELD_DEF(uint32_t, woDim); | 104 | TILING_DATA_FIELD_DEF(uint32_t, woDim); |
| 45 | - TILING_DATA_FIELD_DEF(uint32_t, strideH); | ||
| 46 | - TILING_DATA_FIELD_DEF(uint32_t, strideW); | ||
| 47 | - TILING_DATA_FIELD_DEF(uint32_t, dilationH); | ||
| 48 | - TILING_DATA_FIELD_DEF(uint32_t, dilationW); | ||
| 49 | - TILING_DATA_FIELD_DEF(uint32_t, padTop); | ||
| 50 | - TILING_DATA_FIELD_DEF(uint32_t, padLeft); | ||
| 51 | - TILING_DATA_FIELD_DEF(uint32_t, groups); | ||
| 52 | - TILING_DATA_FIELD_DEF(uint32_t, enlarge); | ||
| 53 | TILING_DATA_FIELD_DEF(uint32_t, cinOpt); | 105 | TILING_DATA_FIELD_DEF(uint32_t, cinOpt); |
| 54 | TILING_DATA_FIELD_DEF(uint32_t, coutOpt); | 106 | TILING_DATA_FIELD_DEF(uint32_t, coutOpt); |
| 55 | TILING_DATA_FIELD_DEF(uint32_t, groupOpt); | 107 | TILING_DATA_FIELD_DEF(uint32_t, groupOpt); |
| 108 | + TILING_DATA_FIELD_DEF(uint8_t, iterateMNOrder); | ||
| 109 | + TILING_DATA_FIELD_DEF(uint8_t, biasFullLoadFlag); | ||
| 110 | + TILING_DATA_FIELD_DEF(uint8_t, fixpParamsFullLoadFlag); | ||
| 111 | + TILING_DATA_FIELD_DEF(uint8_t, hf32Enable); | ||
| 112 | + TILING_DATA_FIELD_DEF(uint8_t, hf32TransMode); | ||
| 56 | TILING_DATA_FIELD_DEF(uint8_t, hasBias); | 113 | TILING_DATA_FIELD_DEF(uint8_t, hasBias); |
| 57 | - END_TILING_DATA_DEF; | 114 | + TILING_DATA_FIELD_DEF(uint8_t, hasScale); |
| 58 | - | 115 | + TILING_DATA_FIELD_DEF(uint8_t, dualOutput); |
| 59 | - REGISTER_TILING_DATA_CLASS(Conv2DRunInfoOp, Conv2DRunInfo) | 116 | + TILING_DATA_FIELD_DEF(uint8_t, quantMode0); |
| 60 | - | 117 | + TILING_DATA_FIELD_DEF(uint8_t, reluMode0); |
| 61 | - BEGIN_TILING_DATA_DEF(Conv2DTilingData) | 118 | + TILING_DATA_FIELD_DEF(uint8_t, clipMode0); |
| 62 | - TILING_DATA_FIELD_DEF_STRUCT(TConv2DTiling, convApiTiling); | 119 | + TILING_DATA_FIELD_DEF(uint8_t, quantMode1); |
| 63 | - TILING_DATA_FIELD_DEF_STRUCT(Conv2DRunInfo, convRunInfo); | 120 | + TILING_DATA_FIELD_DEF(uint8_t, reluMode1); |
| 121 | + TILING_DATA_FIELD_DEF(uint8_t, clipMode1); | ||
| 122 | + TILING_DATA_FIELD_DEF(int8_t, offsetx); | ||
| 123 | + TILING_DATA_FIELD_DEF(int8_t, roundMode); | ||
| 64 | END_TILING_DATA_DEF; | 124 | END_TILING_DATA_DEF; |
| 65 | 125 | ||
| 66 | REGISTER_TILING_DATA_CLASS(Conv2DV2, Conv2DTilingData) | 126 | REGISTER_TILING_DATA_CLASS(Conv2DV2, Conv2DTilingData) |
| @@ -184,23 +184,23 @@ __aicore__ inline bool Conv2dBase<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYPE | |||
| 184 | 184 | ||
| 185 | if constexpr (A_FORMAT == ConvFormat::NCHW) { | 185 | if constexpr (A_FORMAT == ConvFormat::NCHW) { |
| 186 | if constexpr (isMMode) { | 186 | if constexpr (isMMode) { |
| 187 | - if (!InitSingleCoreData(convTilingData->convRunInfo.mDim, 1, 0, 0)) { | 187 | + if (!InitSingleCoreData(convTilingData->mDim, 1, 0, 0)) { |
| 188 | return false; | 188 | return false; |
| 189 | } | 189 | } |
| 190 | } else { | 190 | } else { |
| 191 | - if (!InitSingleCoreData(convTilingData->convRunInfo.hoDim * convTilingData->convRunInfo.woDim, 0, | 191 | + if (!InitSingleCoreData(convTilingData->hoDim * convTilingData->woDim, 0, |
| 192 | - convTilingData->convRunInfo.woDim, 1)) { | 192 | + convTilingData->woDim, 1)) { |
| 193 | return false; | 193 | return false; |
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | } else { | 196 | } else { |
| 197 | if constexpr (isMMode) { | 197 | if constexpr (isMMode) { |
| 198 | - if (!InitSingleCoreData(1, convTilingData->convRunInfo.nDim, 0, 0)) { | 198 | + if (!InitSingleCoreData(1, convTilingData->nDim, 0, 0)) { |
| 199 | return false; | 199 | return false; |
| 200 | } | 200 | } |
| 201 | } else { | 201 | } else { |
| 202 | - if (!InitSingleCoreData(1, 0, convTilingData->convRunInfo.woDim * convTilingData->convRunInfo.nDim, | 202 | + if (!InitSingleCoreData(1, 0, convTilingData->woDim * convTilingData->nDim, |
| 203 | - convTilingData->convRunInfo.nDim)) { | 203 | + convTilingData->nDim)) { |
| 204 | return false; | 204 | return false; |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| @@ -217,38 +217,38 @@ __aicore__ inline bool Conv2dBase<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYPE | |||
| 217 | { | 217 | { |
| 218 | DimDataToFill batchToFill(singleCoreBatch, batchIdxStart, isBatchDimTail); | 218 | DimDataToFill batchToFill(singleCoreBatch, batchIdxStart, isBatchDimTail); |
| 219 | bool isRealDim = | 219 | bool isRealDim = |
| 220 | - convCommon.CalcDimData(convTilingData->convRunInfo.hoDim * convTilingData->convRunInfo.nDim * convTilingData->convRunInfo.woDim, | 220 | + convCommon.CalcDimData(convTilingData->hoDim * convTilingData->nDim * convTilingData->woDim, |
| 221 | - convTilingData->convRunInfo.batchDim, convTilingData->convRunInfo.batch, convTilingData->convRunInfo.batch, batchToFill); | 221 | + convTilingData->batchDim, convTilingData->batch, convTilingData->batch, batchToFill); |
| 222 | if (unlikely(!isRealDim)) { | 222 | if (unlikely(!isRealDim)) { |
| 223 | return false; | 223 | return false; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | DimDataToFill nToFill(singleCoreN, nIdxStart, isNDimTail); | 226 | DimDataToFill nToFill(singleCoreN, nIdxStart, isNDimTail); |
| 227 | - isRealDim = convCommon.CalcNDimDataAlign(blockPerNDim, convTilingData->convRunInfo.nDim, | 227 | + isRealDim = convCommon.CalcNDimDataAlign(blockPerNDim, convTilingData->nDim, |
| 228 | - convTilingData->convRunInfo.cout, nToFill); | 228 | + convTilingData->cout, nToFill); |
| 229 | if (unlikely(!isRealDim)) { | 229 | if (unlikely(!isRealDim)) { |
| 230 | return false; | 230 | return false; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | if constexpr (isMMode) { | 233 | if constexpr (isMMode) { |
| 234 | DimDataToFill mToFill(singleCoreM, mIdxStart, isMDimTail); | 234 | DimDataToFill mToFill(singleCoreM, mIdxStart, isMDimTail); |
| 235 | - uint64_t totalM = convTilingData->convRunInfo.hout * convTilingData->convRunInfo.wout; | 235 | + uint64_t totalM = convTilingData->hout * convTilingData->wout; |
| 236 | - isRealDim = convCommon.CalcDimData(blockPerMDim, convTilingData->convRunInfo.mDim, convCommon.AlignB(totalM, M0), | 236 | + isRealDim = convCommon.CalcDimData(blockPerMDim, convTilingData->mDim, convCommon.AlignB(totalM, M0), |
| 237 | totalM, mToFill); | 237 | totalM, mToFill); |
| 238 | if (unlikely(!isRealDim)) { | 238 | if (unlikely(!isRealDim)) { |
| 239 | return false; | 239 | return false; |
| 240 | } | 240 | } |
| 241 | } else { | 241 | } else { |
| 242 | DimDataToFill hoToFill(singleCoreHo, hoIdxStart, isHoDimTail); | 242 | DimDataToFill hoToFill(singleCoreHo, hoIdxStart, isHoDimTail); |
| 243 | - isRealDim = convCommon.CalcDimData(blockPerHoDim, convTilingData->convRunInfo.hoDim, convTilingData->convRunInfo.hout, | 243 | + isRealDim = convCommon.CalcDimData(blockPerHoDim, convTilingData->hoDim, convTilingData->hout, |
| 244 | - convTilingData->convRunInfo.hout, hoToFill); | 244 | + convTilingData->hout, hoToFill); |
| 245 | if (unlikely(!isRealDim)) { | 245 | if (unlikely(!isRealDim)) { |
| 246 | return false; | 246 | return false; |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | DimDataToFill woToFill(singleCoreWo, woIdxStart, isWoDimTail); | 249 | DimDataToFill woToFill(singleCoreWo, woIdxStart, isWoDimTail); |
| 250 | - isRealDim = convCommon.CalcDimData(blockPerWoDim, convTilingData->convRunInfo.woDim, convTilingData->convRunInfo.wout, | 250 | + isRealDim = convCommon.CalcDimData(blockPerWoDim, convTilingData->woDim, convTilingData->wout, |
| 251 | - convTilingData->convRunInfo.wout, woToFill); | 251 | + convTilingData->wout, woToFill); |
| 252 | if (unlikely(!isRealDim)) { | 252 | if (unlikely(!isRealDim)) { |
| 253 | return false; | 253 | return false; |
| 254 | } | 254 | } |
| @@ -297,7 +297,7 @@ __aicore__ inline void Conv2dBase<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYPE | |||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | conv.SetWeight(filterGm); | 299 | conv.SetWeight(filterGm); |
| 300 | - if (convTilingData->convRunInfo.hasBias) { | 300 | + if (convTilingData->hasBias) { |
| 301 | conv.SetBias(biasGm); | 301 | conv.SetBias(biasGm); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| @@ -309,10 +309,10 @@ __aicore__ inline void Conv2dBase<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYPE | |||
| 309 | 309 | ||
| 310 | conv.SetFmap(fmapGm); | 310 | conv.SetFmap(fmapGm); |
| 311 | if constexpr (CONV_CFG::disContinuous) { | 311 | if constexpr (CONV_CFG::disContinuous) { |
| 312 | - conv.SetOrgBatch(convTilingData->convRunInfo.batch); | 312 | + conv.SetOrgBatch(convTilingData->batch); |
| 313 | } | 313 | } |
| 314 | if constexpr (CONV_CFG::isExtendConv2d) { | 314 | if constexpr (CONV_CFG::isExtendConv2d) { |
| 315 | - if (convTilingData->convApiTiling.dualOutput) { | 315 | + if (convTilingData->dualOutput) { |
| 316 | conv.IterateAll(outputGm, output1Gm); | 316 | conv.IterateAll(outputGm, output1Gm); |
| 317 | } else { | 317 | } else { |
| 318 | conv.IterateAll(outputGm); | 318 | conv.IterateAll(outputGm); |
| @@ -78,7 +78,7 @@ public: | |||
| 78 | } else { | 78 | } else { |
| 79 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE1_MTE3); | 79 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE1_MTE3); |
| 80 | // Each core deal with half of nBL1 at least n0, when nBL1 <= n0, vec1 doesn't have data to deal. | 80 | // Each core deal with half of nBL1 at least n0, when nBL1 <= n0, vec1 doesn't have data to deal. |
| 81 | - if (self->ctx.convTilingData->convApiTiling.nBL1 > BLOCK_L0_N) { | 81 | + if (self->ctx.convTilingData->nBL1 > BLOCK_L0_N) { |
| 82 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE1_MTE3); | 82 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE1_MTE3); |
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| @@ -99,12 +99,12 @@ public: | |||
| 99 | self->ctx.ddr2l1LoopH = 1; | 99 | self->ctx.ddr2l1LoopH = 1; |
| 100 | self->ctx.maxHoL1Iter = 0; | 100 | self->ctx.maxHoL1Iter = 0; |
| 101 | } else { | 101 | } else { |
| 102 | - self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL1); | 102 | + self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL1); |
| 103 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; | 103 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | if constexpr (Intf::hasWL1IterFlag) { | 106 | if constexpr (Intf::hasWL1IterFlag) { |
| 107 | - self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL1); | 107 | + self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL1); |
| 108 | } else { | 108 | } else { |
| 109 | self->ctx.ddr2l1LoopW = 1; | 109 | self->ctx.ddr2l1LoopW = 1; |
| 110 | } | 110 | } |
| @@ -127,21 +127,21 @@ public: | |||
| 127 | 127 | ||
| 128 | __aicore__ inline void C04InitNValue(Intf *self) | 128 | __aicore__ inline void C04InitNValue(Intf *self) |
| 129 | { | 129 | { |
| 130 | - self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->convApiTiling.nBL1; | 130 | + self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->nBL1; |
| 131 | - self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.nBL1 : self->ctx.nBL1Tail; | 131 | + self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->nBL1 : self->ctx.nBL1Tail; |
| 132 | 132 | ||
| 133 | if constexpr (!Intf::hasNL1IterFlag) { | 133 | if constexpr (!Intf::hasNL1IterFlag) { |
| 134 | self->ctx.ddr2l1LoopN = 1; | 134 | self->ctx.ddr2l1LoopN = 1; |
| 135 | self->ctx.maxNBL1Iter = 0; | 135 | self->ctx.maxNBL1Iter = 0; |
| 136 | } else { | 136 | } else { |
| 137 | - self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->convApiTiling.nBL1); | 137 | + self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->nBL1); |
| 138 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; | 138 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | __aicore__ inline void C04InitBuf(Intf *self) | 142 | __aicore__ inline void C04InitBuf(Intf *self) |
| 143 | { | 143 | { |
| 144 | - self->ctx.ubBufSize = self->ctx.convTilingData->convApiTiling.bUbNStep * self->ctx.convTilingData->convApiTiling.kBL1; | 144 | + self->ctx.ubBufSize = self->ctx.convTilingData->bUbNStep * self->ctx.convTilingData->kBL1; |
| 145 | self->ctx.pipe.InitBuffer(self->ctx.ndUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); | 145 | self->ctx.pipe.InitBuffer(self->ctx.ndUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); |
| 146 | self->ctx.pipe.InitBuffer(self->ctx.nzUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); | 146 | self->ctx.pipe.InitBuffer(self->ctx.nzUbBuf, self->ctx.ubBufSize * Intf::sizeOfWeight); |
| 147 | self->ctx.pipe.InitBuffer(self->ctx.indexUbBuf, REG_SIZE); | 147 | self->ctx.pipe.InitBuffer(self->ctx.indexUbBuf, REG_SIZE); |
| @@ -149,11 +149,11 @@ public: | |||
| 149 | self->ctx.ndTensor = self->ctx.ndUbBuf.template Get<typename Intf::WeightT>(); | 149 | self->ctx.ndTensor = self->ctx.ndUbBuf.template Get<typename Intf::WeightT>(); |
| 150 | self->ctx.nzTensor = self->ctx.nzUbBuf.template Get<typename Intf::WeightT>(); | 150 | self->ctx.nzTensor = self->ctx.nzUbBuf.template Get<typename Intf::WeightT>(); |
| 151 | 151 | ||
| 152 | - uint32_t aL1SpaceSize = self->ctx.convTilingData->convApiTiling.aL1SpaceSize; | 152 | + uint32_t aL1SpaceSize = self->ctx.convTilingData->aL1SpaceSize; |
| 153 | - if ((self->ctx.convTilingData->convApiTiling.pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { | 153 | + if ((self->ctx.convTilingData->pBufferFlag & AL1_DB_IDX) >> AL1_DB_OFFSET) { |
| 154 | aL1SpaceSize *= DOUBLE_BUF; | 154 | aL1SpaceSize *= DOUBLE_BUF; |
| 155 | } | 155 | } |
| 156 | - self->ctx.bL1SpaceSize = self->ctx.convTilingData->convApiTiling.nBL1 * self->ctx.convTilingData->convApiTiling.kBL1; | 156 | + self->ctx.bL1SpaceSize = self->ctx.convTilingData->nBL1 * self->ctx.convTilingData->kBL1; |
| 157 | 157 | ||
| 158 | if constexpr (Intf::bL1DBFlag) { | 158 | if constexpr (Intf::bL1DBFlag) { |
| 159 | self->ctx.pipe.InitBuffer(self->ctx.bL1TBuf, | 159 | self->ctx.pipe.InitBuffer(self->ctx.bL1TBuf, |
| @@ -170,17 +170,17 @@ public: | |||
| 170 | { | 170 | { |
| 171 | self->ctx.vecId = GetSubBlockIdx(); | 171 | self->ctx.vecId = GetSubBlockIdx(); |
| 172 | 172 | ||
| 173 | - self->ctx.singleCoreCo = self->ctx.convTilingData->convApiTiling.singleCoreCo; | 173 | + self->ctx.singleCoreCo = self->ctx.convTilingData->singleCoreCo; |
| 174 | - self->ctx.kSizeC04 = self->ctx.convTilingData->convApiTiling.kernelHxkernelW * C04_CIN_SIZE; | 174 | + self->ctx.kSizeC04 = self->ctx.convTilingData->kernelHxkernelW * C04_CIN_SIZE; |
| 175 | - self->ctx.ddr2l1LoopBatch = self->ctx.convTilingData->convApiTiling.singleCoreBatch; | 175 | + self->ctx.ddr2l1LoopBatch = self->ctx.convTilingData->singleCoreBatch; |
| 176 | 176 | ||
| 177 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { | 177 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { |
| 178 | - self->ctx.singleCoreM = self->ctx.convTilingData->convApiTiling.singleCoreHo; | 178 | + self->ctx.singleCoreM = self->ctx.convTilingData->singleCoreHo; |
| 179 | - self->ctx.mAL1 = self->ctx.convTilingData->convApiTiling.hoL1; | 179 | + self->ctx.mAL1 = self->ctx.convTilingData->hoL1; |
| 180 | - self->ctx.mL0 = self->ctx.convTilingData->convApiTiling.hoL0; | 180 | + self->ctx.mL0 = self->ctx.convTilingData->hoL0; |
| 181 | } else { | 181 | } else { |
| 182 | - self->ctx.singleCoreHo = self->ctx.convTilingData->convApiTiling.singleCoreHo; | 182 | + self->ctx.singleCoreHo = self->ctx.convTilingData->singleCoreHo; |
| 183 | - self->ctx.singleCoreWo = self->ctx.convTilingData->convApiTiling.singleCoreWo; | 183 | + self->ctx.singleCoreWo = self->ctx.convTilingData->singleCoreWo; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | C04InitBuf(self); | 186 | C04InitBuf(self); |
| @@ -196,14 +196,14 @@ public: | |||
| 196 | __aicore__ inline void C04UpdateNUbValue(Intf *self) | 196 | __aicore__ inline void C04UpdateNUbValue(Intf *self) |
| 197 | { | 197 | { |
| 198 | self->ctx.currentUbNStep = self->ctx.vecNIter == self->ctx.maxVecNIter ? | 198 | self->ctx.currentUbNStep = self->ctx.vecNIter == self->ctx.maxVecNIter ? |
| 199 | - self->ctx.bUbNTailStep : self->ctx.convTilingData->convApiTiling.bUbNStep; | 199 | + self->ctx.bUbNTailStep : self->ctx.convTilingData->bUbNStep; |
| 200 | self->ctx.currentUbNStepAilgn = AlignB(self->ctx.currentUbNStep, BLOCK_L0_N); | 200 | self->ctx.currentUbNStepAilgn = AlignB(self->ctx.currentUbNStep, BLOCK_L0_N); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | __aicore__ inline void C04UpdateNL1Value(Intf *self) | 203 | __aicore__ inline void C04UpdateNL1Value(Intf *self) |
| 204 | { | 204 | { |
| 205 | self->ctx.currentNBL1 = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? | 205 | self->ctx.currentNBL1 = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? |
| 206 | - self->ctx.nBL1Tail : self->ctx.convTilingData->convApiTiling.nBL1; | 206 | + self->ctx.nBL1Tail : self->ctx.convTilingData->nBL1; |
| 207 | self->ctx.currentNBL1Align = AlignB(self->ctx.currentNBL1, BLOCK_L0_N); | 207 | self->ctx.currentNBL1Align = AlignB(self->ctx.currentNBL1, BLOCK_L0_N); |
| 208 | 208 | ||
| 209 | if constexpr (!Intf::bL1DBFlag) { | 209 | if constexpr (!Intf::bL1DBFlag) { |
| @@ -219,10 +219,10 @@ public: | |||
| 219 | } | 219 | } |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | - self->ctx.vecNLoopTimes = CeilDiv(self->ctx.currentNBL1, self->ctx.convTilingData->convApiTiling.bUbNStep); | 222 | + self->ctx.vecNLoopTimes = CeilDiv(self->ctx.currentNBL1, self->ctx.convTilingData->bUbNStep); |
| 223 | self->ctx.maxVecNIter = self->ctx.vecNLoopTimes - 1; | 223 | self->ctx.maxVecNIter = self->ctx.vecNLoopTimes - 1; |
| 224 | - self->ctx.bUbNTailStep = self->ctx.currentNBL1 % self->ctx.convTilingData->convApiTiling.bUbNStep; | 224 | + self->ctx.bUbNTailStep = self->ctx.currentNBL1 % self->ctx.convTilingData->bUbNStep; |
| 225 | - self->ctx.bUbNTailStep = self->ctx.bUbNTailStep == 0 ? self->ctx.convTilingData->convApiTiling.bUbNStep : self->ctx.bUbNTailStep; | 225 | + self->ctx.bUbNTailStep = self->ctx.bUbNTailStep == 0 ? self->ctx.convTilingData->bUbNStep : self->ctx.bUbNTailStep; |
| 226 | 226 | ||
| 227 | self->ctx.currentNLoopRpSize = | 227 | self->ctx.currentNLoopRpSize = |
| 228 | self->ctx.nBL1Iter == self->ctx.maxNBL1Iter && self->ctx.vecNIter == self->ctx.maxVecNIter ? | 228 | self->ctx.nBL1Iter == self->ctx.maxNBL1Iter && self->ctx.vecNIter == self->ctx.maxVecNIter ? |
| @@ -330,7 +330,7 @@ public: | |||
| 330 | __aicore__ inline bool C04VecImpl(Intf *self) | 330 | __aicore__ inline bool C04VecImpl(Intf *self) |
| 331 | { | 331 | { |
| 332 | if constexpr (!Intf::bL1DBFlag) { | 332 | if constexpr (!Intf::bL1DBFlag) { |
| 333 | - if (self->ctx.convTilingData->convApiTiling.nBL1 <= BLOCK_L0_N && self->ctx.vecId == 1) { | 333 | + if (self->ctx.convTilingData->nBL1 <= BLOCK_L0_N && self->ctx.vecId == 1) { |
| 334 | return false; | 334 | return false; |
| 335 | } | 335 | } |
| 336 | } | 336 | } |
| @@ -47,14 +47,14 @@ using TypeFalse = struct { | |||
| 47 | template <class Intf> | 47 | template <class Intf> |
| 48 | static __aicore__ inline void InitKDirectionValueC04(Intf *self) | 48 | static __aicore__ inline void InitKDirectionValueC04(Intf *self) |
| 49 | { | 49 | { |
| 50 | - size_t multiKL1 = self->ctx.convTilingData->convApiTiling .kAL1 / self->ctx.convTilingData->convApiTiling .kL0; | 50 | + size_t multiKL1 = self->ctx.convTilingData->kAL1 / self->ctx.convTilingData->kL0; |
| 51 | self->ctx.maxKAL1Iter = 0; | 51 | self->ctx.maxKAL1Iter = 0; |
| 52 | self->ctx.maxKBL1Iter = 0; | 52 | self->ctx.maxKBL1Iter = 0; |
| 53 | self->ctx.maxKL0Iter = multiKL1 - 1; | 53 | self->ctx.maxKL0Iter = multiKL1 - 1; |
| 54 | self->ctx.ddr2l0LoopK = multiKL1; | 54 | self->ctx.ddr2l0LoopK = multiKL1; |
| 55 | - self->ctx.kAL1Tail = self->ctx.convTilingData->convApiTiling .kAL1; | 55 | + self->ctx.kAL1Tail = self->ctx.convTilingData->kAL1; |
| 56 | - self->ctx.kBL1Tail = self->ctx.convTilingData->convApiTiling .kBL1; | 56 | + self->ctx.kBL1Tail = self->ctx.convTilingData->kBL1; |
| 57 | - self->ctx.kL0Tail = self->ctx.convTilingData->convApiTiling .kL0; | 57 | + self->ctx.kL0Tail = self->ctx.convTilingData->kL0; |
| 58 | self->ctx.multiKAL1 = multiKL1; | 58 | self->ctx.multiKAL1 = multiKL1; |
| 59 | self->ctx.multiKBL1 = multiKL1; | 59 | self->ctx.multiKBL1 = multiKL1; |
| 60 | self->ctx.kAL1fullload = true; | 60 | self->ctx.kAL1fullload = true; |
| @@ -69,43 +69,43 @@ static __aicore__ inline void InitKDirectionValue(Intf *self) | |||
| 69 | InitKDirectionValueC04(self); | 69 | InitKDirectionValueC04(self); |
| 70 | return; | 70 | return; |
| 71 | } | 71 | } |
| 72 | - uint64_t totalKAlignK0 = AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling .kernelHxkernelW; | 72 | + uint64_t totalKAlignK0 = AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelW; |
| 73 | - self->ctx.maxKAL1Iter = CeilDiv(totalKAlignK0, self->ctx.convTilingData->convApiTiling .kAL1) - 1; | 73 | + self->ctx.maxKAL1Iter = CeilDiv(totalKAlignK0, self->ctx.convTilingData->kAL1) - 1; |
| 74 | - self->ctx.maxKBL1Iter = CeilDiv(totalKAlignK0, self->ctx.convTilingData->convApiTiling .kBL1) - 1; | 74 | + self->ctx.maxKBL1Iter = CeilDiv(totalKAlignK0, self->ctx.convTilingData->kBL1) - 1; |
| 75 | - self->ctx.ddr2l0LoopK = CeilDiv(totalKAlignK0, self->ctx.convTilingData->convApiTiling .kL0); | 75 | + self->ctx.ddr2l0LoopK = CeilDiv(totalKAlignK0, self->ctx.convTilingData->kL0); |
| 76 | self->ctx.maxKL0Iter = self->ctx.ddr2l0LoopK - 1; | 76 | self->ctx.maxKL0Iter = self->ctx.ddr2l0LoopK - 1; |
| 77 | - self->ctx.kAL1Tail = (self->ctx.singleCoreCi * self->ctx.convTilingData->convApiTiling .kernelHxkernelW) % self->ctx.convTilingData->convApiTiling .kAL1; | 77 | + self->ctx.kAL1Tail = (self->ctx.singleCoreCi * self->ctx.convTilingData->kernelHxkernelW) % self->ctx.convTilingData->kAL1; |
| 78 | - self->ctx.kAL1Tail = self->ctx.kAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling .kAL1 : self->ctx.kAL1Tail; | 78 | + self->ctx.kAL1Tail = self->ctx.kAL1Tail == 0 ? self->ctx.convTilingData->kAL1 : self->ctx.kAL1Tail; |
| 79 | - self->ctx.kBL1Tail = (self->ctx.singleCoreCi * self->ctx.convTilingData->convApiTiling .kernelHxkernelW) % self->ctx.convTilingData->convApiTiling .kBL1; | 79 | + self->ctx.kBL1Tail = (self->ctx.singleCoreCi * self->ctx.convTilingData->kernelHxkernelW) % self->ctx.convTilingData->kBL1; |
| 80 | - self->ctx.kBL1Tail = self->ctx.kBL1Tail == 0 ? self->ctx.convTilingData->convApiTiling .kBL1 : self->ctx.kBL1Tail; | 80 | + self->ctx.kBL1Tail = self->ctx.kBL1Tail == 0 ? self->ctx.convTilingData->kBL1 : self->ctx.kBL1Tail; |
| 81 | - self->ctx.kL0Tail = totalKAlignK0 % self->ctx.convTilingData->convApiTiling .kL0; | 81 | + self->ctx.kL0Tail = totalKAlignK0 % self->ctx.convTilingData->kL0; |
| 82 | if constexpr (Intf::k0 != Intf::k0FmapTail) { | 82 | if constexpr (Intf::k0 != Intf::k0FmapTail) { |
| 83 | - self->ctx.kAL0Tail = AlignB(self->ctx.singleCoreCi, Intf::k0FmapTail) * self->ctx.convTilingData->convApiTiling .kernelHxkernelW % | 83 | + self->ctx.kAL0Tail = AlignB(self->ctx.singleCoreCi, Intf::k0FmapTail) * self->ctx.convTilingData->kernelHxkernelW % |
| 84 | - self->ctx.convTilingData->convApiTiling .kL0; | 84 | + self->ctx.convTilingData->kL0; |
| 85 | - self->ctx.kAL0Tail = self->ctx.kAL0Tail == 0 ? self->ctx.convTilingData->convApiTiling .kL0 : self->ctx.kAL0Tail; | 85 | + self->ctx.kAL0Tail = self->ctx.kAL0Tail == 0 ? self->ctx.convTilingData->kL0 : self->ctx.kAL0Tail; |
| 86 | } | 86 | } |
| 87 | - self->ctx.kL0Tail = self->ctx.kL0Tail == 0 ? self->ctx.convTilingData->convApiTiling .kL0 : self->ctx.kL0Tail; | 87 | + self->ctx.kL0Tail = self->ctx.kL0Tail == 0 ? self->ctx.convTilingData->kL0 : self->ctx.kL0Tail; |
| 88 | - self->ctx.multiKAL1 = CeilDiv(self->ctx.convTilingData->convApiTiling .kAL1, self->ctx.convTilingData->convApiTiling .kL0); | 88 | + self->ctx.multiKAL1 = CeilDiv(self->ctx.convTilingData->kAL1, self->ctx.convTilingData->kL0); |
| 89 | - self->ctx.multiKBL1 = CeilDiv(self->ctx.convTilingData->convApiTiling .kBL1, self->ctx.convTilingData->convApiTiling .kL0); | 89 | + self->ctx.multiKBL1 = CeilDiv(self->ctx.convTilingData->kBL1, self->ctx.convTilingData->kL0); |
| 90 | 90 | ||
| 91 | if constexpr (Intf::kPreLoadFlag || Intf::WEIGHT_NZ_FLAG) { | 91 | if constexpr (Intf::kPreLoadFlag || Intf::WEIGHT_NZ_FLAG) { |
| 92 | - self->ctx.kBL1AlignK0Tail = totalKAlignK0 % self->ctx.convTilingData->convApiTiling .kBL1; | 92 | + self->ctx.kBL1AlignK0Tail = totalKAlignK0 % self->ctx.convTilingData->kBL1; |
| 93 | self->ctx.kBL1AlignK0Tail = | 93 | self->ctx.kBL1AlignK0Tail = |
| 94 | - self->ctx.kBL1AlignK0Tail == 0 ? self->ctx.convTilingData->convApiTiling .kBL1 : self->ctx.kBL1AlignK0Tail; | 94 | + self->ctx.kBL1AlignK0Tail == 0 ? self->ctx.convTilingData->kBL1 : self->ctx.kBL1AlignK0Tail; |
| 95 | } | 95 | } |
| 96 | if constexpr (Intf::kPreLoadFlag) { | 96 | if constexpr (Intf::kPreLoadFlag) { |
| 97 | - self->ctx.kAL1AlignK0Tail = totalKAlignK0 % self->ctx.convTilingData->convApiTiling .kAL1; | 97 | + self->ctx.kAL1AlignK0Tail = totalKAlignK0 % self->ctx.convTilingData->kAL1; |
| 98 | self->ctx.kAL1AlignK0Tail = | 98 | self->ctx.kAL1AlignK0Tail = |
| 99 | - self->ctx.kAL1AlignK0Tail == 0 ? self->ctx.convTilingData->convApiTiling .kAL1 : self->ctx.kAL1AlignK0Tail; | 99 | + self->ctx.kAL1AlignK0Tail == 0 ? self->ctx.convTilingData->kAL1 : self->ctx.kAL1AlignK0Tail; |
| 100 | self->ctx.lastLoopKAL1StartPos = self->ctx.ddr2l0LoopK - self->ctx.multiKAL1; | 100 | self->ctx.lastLoopKAL1StartPos = self->ctx.ddr2l0LoopK - self->ctx.multiKAL1; |
| 101 | self->ctx.lastLoopKBL1StartPos = self->ctx.ddr2l0LoopK - self->ctx.multiKBL1; | 101 | self->ctx.lastLoopKBL1StartPos = self->ctx.ddr2l0LoopK - self->ctx.multiKBL1; |
| 102 | self->ctx.lastLoopKAL1StartPosTail = | 102 | self->ctx.lastLoopKAL1StartPosTail = |
| 103 | - self->ctx.ddr2l0LoopK - CeilDiv(self->ctx.kAL1AlignK0Tail, self->ctx.convTilingData->convApiTiling .kL0); | 103 | + self->ctx.ddr2l0LoopK - CeilDiv(self->ctx.kAL1AlignK0Tail, self->ctx.convTilingData->kL0); |
| 104 | self->ctx.lastLoopKBL1StartPosTail = | 104 | self->ctx.lastLoopKBL1StartPosTail = |
| 105 | - self->ctx.ddr2l0LoopK - CeilDiv(self->ctx.kBL1AlignK0Tail, self->ctx.convTilingData->convApiTiling .kL0); | 105 | + self->ctx.ddr2l0LoopK - CeilDiv(self->ctx.kBL1AlignK0Tail, self->ctx.convTilingData->kL0); |
| 106 | } | 106 | } |
| 107 | if constexpr (Intf::isDmaFlag) { | 107 | if constexpr (Intf::isDmaFlag) { |
| 108 | - self->ctx.cinBL1 = self->ctx.convTilingData->convApiTiling .kBL1 / (self->ctx.convTilingData->convApiTiling .khL1 * self->ctx.convTilingData->convApiTiling .kwL1); | 108 | + self->ctx.cinBL1 = self->ctx.convTilingData->kBL1 / (self->ctx.convTilingData->khL1 * self->ctx.convTilingData->kwL1); |
| 109 | self->ctx.cinBL1LoopTimes = CeilDiv(self->ctx.singleCoreCi, self->ctx.cinBL1); | 109 | self->ctx.cinBL1LoopTimes = CeilDiv(self->ctx.singleCoreCi, self->ctx.cinBL1); |
| 110 | self->ctx.maxCinBL1Iter = self->ctx.cinBL1LoopTimes - 1; | 110 | self->ctx.maxCinBL1Iter = self->ctx.cinBL1LoopTimes - 1; |
| 111 | } | 111 | } |
| @@ -116,7 +116,7 @@ struct Init { | |||
| 116 | static __aicore__ inline void call(Intf *self, const void *__restrict convTiling) | 116 | static __aicore__ inline void call(Intf *self, const void *__restrict convTiling) |
| 117 | { | 117 | { |
| 118 | self->ctx.convTilingData = (Conv2DTilingData *)convTiling; | 118 | self->ctx.convTilingData = (Conv2DTilingData *)convTiling; |
| 119 | - self->ctx.singleCoreBatch = self->ctx.convTilingData->convApiTiling .singleCoreBatch; | 119 | + self->ctx.singleCoreBatch = self->ctx.convTilingData->singleCoreBatch; |
| 120 | InitBatchDirectionValue<Intf>(self); | 120 | InitBatchDirectionValue<Intf>(self); |
| 121 | if ASCEND_IS_AIC_CONV { | 121 | if ASCEND_IS_AIC_CONV { |
| 122 | InitBaseValue(self); | 122 | InitBaseValue(self); |
| @@ -134,16 +134,16 @@ struct Init { | |||
| 134 | InitSubApiParams<Intf>(self); | 134 | InitSubApiParams<Intf>(self); |
| 135 | 135 | ||
| 136 | if constexpr (Intf::groupOptPreloadFlag) { | 136 | if constexpr (Intf::groupOptPreloadFlag) { |
| 137 | - self->ctx.singleGroups = self->ctx.convTilingData->convApiTiling.singleCoreGroups; | 137 | + self->ctx.singleGroups = self->ctx.convTilingData->singleCoreGroups; |
| 138 | - self->ctx.singleGroupOpt = self->ctx.convTilingData->convApiTiling.singleCoreGroupOpt; | 138 | + self->ctx.singleGroupOpt = self->ctx.convTilingData->singleCoreGroupOpt; |
| 139 | - self->ctx.ciPerGroup = self->ctx.convTilingData->convApiTiling.orgCi / self->ctx.convTilingData->convApiTiling.groups; | 139 | + self->ctx.ciPerGroup = self->ctx.convTilingData->orgCi / self->ctx.convTilingData->groups; |
| 140 | if ASCEND_IS_AIC_CONV { | 140 | if ASCEND_IS_AIC_CONV { |
| 141 | InitKDirectionValue<Intf>(self); | 141 | InitKDirectionValue<Intf>(self); |
| 142 | OptGroupCalcBL1LoadTimes<Intf>(self); | 142 | OptGroupCalcBL1LoadTimes<Intf>(self); |
| 143 | } | 143 | } |
| 144 | } else if constexpr (Intf::groupOptFlag) { | 144 | } else if constexpr (Intf::groupOptFlag) { |
| 145 | - self->ctx.ciPerGroup = self->ctx.convTilingData->convApiTiling.orgCi / self->ctx.convTilingData->convApiTiling.groups; | 145 | + self->ctx.ciPerGroup = self->ctx.convTilingData->orgCi / self->ctx.convTilingData->groups; |
| 146 | - self->ctx.singleGroupOpt = self->ctx.convTilingData->convApiTiling.singleCoreGroupOpt; | 146 | + self->ctx.singleGroupOpt = self->ctx.convTilingData->singleCoreGroupOpt; |
| 147 | } else if constexpr (Intf::c04NDFlag) { | 147 | } else if constexpr (Intf::c04NDFlag) { |
| 148 | self->ctx.c04ProcessTools.C04InitIterValue(self); | 148 | self->ctx.c04ProcessTools.C04InitIterValue(self); |
| 149 | } else if constexpr (Intf::weightUbTrans) { | 149 | } else if constexpr (Intf::weightUbTrans) { |
| @@ -174,32 +174,32 @@ struct Init { | |||
| 174 | 174 | ||
| 175 | static __aicore__ inline void InitBaseValue(Intf *self) | 175 | static __aicore__ inline void InitBaseValue(Intf *self) |
| 176 | { | 176 | { |
| 177 | - self->ctx.dilatedKernelH = 1 + (self->ctx.convTilingData->convApiTiling.kernelH - 1) * self->ctx.convTilingData->convApiTiling.dilationH; | 177 | + self->ctx.dilatedKernelH = 1 + (self->ctx.convTilingData->kernelH - 1) * self->ctx.convTilingData->dilationH; |
| 178 | - self->ctx.dilatedKernelW = 1 + (self->ctx.convTilingData->convApiTiling.kernelW - 1) * self->ctx.convTilingData->convApiTiling.dilationW; | 178 | + self->ctx.dilatedKernelW = 1 + (self->ctx.convTilingData->kernelW - 1) * self->ctx.convTilingData->dilationW; |
| 179 | - self->ctx.singleCoreCi = self->ctx.convTilingData->convApiTiling.singleCoreCi; // Cin Size in Single Core | 179 | + self->ctx.singleCoreCi = self->ctx.convTilingData->singleCoreCi; // Cin Size in Single Core |
| 180 | uint64_t alignCinKhKw = | 180 | uint64_t alignCinKhKw = |
| 181 | - AlignB(self->ctx.convTilingData->convApiTiling.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 181 | + AlignB(self->ctx.convTilingData->singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelW; |
| 182 | - self->ctx.kAL1fullload = alignCinKhKw == self->ctx.convTilingData->convApiTiling.kAL1; | 182 | + self->ctx.kAL1fullload = alignCinKhKw == self->ctx.convTilingData->kAL1; |
| 183 | - self->ctx.kBL1fullload = alignCinKhKw == self->ctx.convTilingData->convApiTiling.kBL1; | 183 | + self->ctx.kBL1fullload = alignCinKhKw == self->ctx.convTilingData->kBL1; |
| 184 | - self->ctx.singleCoreCo = self->ctx.convTilingData->convApiTiling.singleCoreCo; // Cout Size in Single Core | 184 | + self->ctx.singleCoreCo = self->ctx.convTilingData->singleCoreCo; // Cout Size in Single Core |
| 185 | - self->ctx.fmapOneBatchSize = self->ctx.convTilingData->convApiTiling.orgCi * self->ctx.convTilingData->convApiTiling.orgHi * | 185 | + self->ctx.fmapOneBatchSize = self->ctx.convTilingData->orgCi * self->ctx.convTilingData->orgHi * |
| 186 | - self->ctx.convTilingData->convApiTiling.orgWi; | 186 | + self->ctx.convTilingData->orgWi; |
| 187 | - self->ctx.outputOneBatchSize = self->ctx.convTilingData->convApiTiling.orgCo * self->ctx.convTilingData->convApiTiling.orgHo * | 187 | + self->ctx.outputOneBatchSize = self->ctx.convTilingData->orgCo * self->ctx.convTilingData->orgHo * |
| 188 | - self->ctx.convTilingData->convApiTiling.orgWo; | 188 | + self->ctx.convTilingData->orgWo; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static __aicore__ inline void InitValueMMode(Intf *self) | 191 | static __aicore__ inline void InitValueMMode(Intf *self) |
| 192 | { | 192 | { |
| 193 | - self->ctx.mAL1 = self->ctx.convTilingData->convApiTiling.hoL1; | 193 | + self->ctx.mAL1 = self->ctx.convTilingData->hoL1; |
| 194 | - self->ctx.mL0 = self->ctx.convTilingData->convApiTiling.hoL0; | 194 | + self->ctx.mL0 = self->ctx.convTilingData->hoL0; |
| 195 | - self->ctx.singleCoreM = self->ctx.convTilingData->convApiTiling.singleCoreHo; | 195 | + self->ctx.singleCoreM = self->ctx.convTilingData->singleCoreHo; |
| 196 | InitMDirectionValue<Intf>(self); | 196 | InitMDirectionValue<Intf>(self); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | static __aicore__ inline void InitValueHWMode(Intf *self) | 199 | static __aicore__ inline void InitValueHWMode(Intf *self) |
| 200 | { | 200 | { |
| 201 | - self->ctx.singleCoreHo = self->ctx.convTilingData->convApiTiling.singleCoreHo; // Ho Size in Single Core | 201 | + self->ctx.singleCoreHo = self->ctx.convTilingData->singleCoreHo; // Ho Size in Single Core |
| 202 | - self->ctx.singleCoreWo = self->ctx.convTilingData->convApiTiling.singleCoreWo; // Wo Size in Single Core | 202 | + self->ctx.singleCoreWo = self->ctx.convTilingData->singleCoreWo; // Wo Size in Single Core |
| 203 | InitHoDirectionValue<Intf>(self); | 203 | InitHoDirectionValue<Intf>(self); |
| 204 | InitWoDirectionValue<Intf>(self); | 204 | InitWoDirectionValue<Intf>(self); |
| 205 | } | 205 | } |
| @@ -66,7 +66,7 @@ public: | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE1_MTE3); | 68 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE1_MTE3); |
| 69 | - if (self->ctx.convTilingData->convApiTiling.cinAInCore > Intf::k0) { | 69 | + if (self->ctx.convTilingData->cinAInCore > Intf::k0) { |
| 70 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE1_MTE3); | 70 | CrossCoreSetFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE1_MTE3); |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| @@ -74,7 +74,7 @@ public: | |||
| 74 | __aicore__ inline void DmaSyncWait(Intf *self) | 74 | __aicore__ inline void DmaSyncWait(Intf *self) |
| 75 | { | 75 | { |
| 76 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE3_MTE1); | 76 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(CV_SYNC_ID_MTE3_MTE1); |
| 77 | - if (self->ctx.convTilingData->convApiTiling.cinAInCore > Intf::k0) { | 77 | + if (self->ctx.convTilingData->cinAInCore > Intf::k0) { |
| 78 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); | 78 | CrossCoreWaitFlag<CV_ENHANCE_MODE, PIPE_MTE1>(VEC_ID_MAX + CV_SYNC_ID_MTE3_MTE1); |
| 79 | } | 79 | } |
| 80 | self->ctx.loadUB2L1Iter++; | 80 | self->ctx.loadUB2L1Iter++; |
| @@ -83,9 +83,9 @@ public: | |||
| 83 | __aicore__ inline void DmaCalcAL1LoadTimes(Intf *self) | 83 | __aicore__ inline void DmaCalcAL1LoadTimes(Intf *self) |
| 84 | { | 84 | { |
| 85 | if (!self->ctx.kAL1fullload) { | 85 | if (!self->ctx.kAL1fullload) { |
| 86 | - uint64_t ddr2L0LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->convApiTiling.nL0); | 86 | + uint64_t ddr2L0LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->nL0); |
| 87 | - uint64_t ddr2L0LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL0); | 87 | + uint64_t ddr2L0LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL0); |
| 88 | - uint64_t ddr2L0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL0); | 88 | + uint64_t ddr2L0LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL0); |
| 89 | self->ctx.ddr2l1LoopKA = self->ctx.maxKAL1Iter + 1; | 89 | self->ctx.ddr2l1LoopKA = self->ctx.maxKAL1Iter + 1; |
| 90 | 90 | ||
| 91 | self->ctx.aL1LoadTimes = ddr2L0LoopN * ddr2L0LoopH * ddr2L0LoopW * self->ctx.ddr2l1LoopKA * | 91 | self->ctx.aL1LoadTimes = ddr2L0LoopN * ddr2L0LoopH * ddr2L0LoopW * self->ctx.ddr2l1LoopKA * |
| @@ -103,59 +103,59 @@ public: | |||
| 103 | __aicore__ inline void DmaUpdateHWValue(Intf *self) | 103 | __aicore__ inline void DmaUpdateHWValue(Intf *self) |
| 104 | { | 104 | { |
| 105 | self->ctx.currentHoL1 = self->ctx.hoAL1Iter == self->ctx.maxHoL1Iter ? | 105 | self->ctx.currentHoL1 = self->ctx.hoAL1Iter == self->ctx.maxHoL1Iter ? |
| 106 | - self->ctx.hoAL1Tail : self->ctx.convTilingData->convApiTiling.hoL1; | 106 | + self->ctx.hoAL1Tail : self->ctx.convTilingData->hoL1; |
| 107 | 107 | ||
| 108 | self->ctx.currentWoL1 = self->ctx.woAL1Iter == self->ctx.maxWoL1Iter ? | 108 | self->ctx.currentWoL1 = self->ctx.woAL1Iter == self->ctx.maxWoL1Iter ? |
| 109 | - self->ctx.woAL1Tail : self->ctx.convTilingData->convApiTiling.woL1; | 109 | + self->ctx.woAL1Tail : self->ctx.convTilingData->woL1; |
| 110 | 110 | ||
| 111 | self->ctx.currentHoL1xWoL1Align = self->ctx.currentHoL1 * AlignB(self->ctx.currentWoL1, BLOCK_L0_M); | 111 | self->ctx.currentHoL1xWoL1Align = self->ctx.currentHoL1 * AlignB(self->ctx.currentWoL1, BLOCK_L0_M); |
| 112 | 112 | ||
| 113 | if (!self->ctx.kAL1fullload) { | 113 | if (!self->ctx.kAL1fullload) { |
| 114 | - self->ctx.l12l0LoopH = CeilDiv(self->ctx.currentHoL1, self->ctx.convTilingData->convApiTiling.hoL0); | 114 | + self->ctx.l12l0LoopH = CeilDiv(self->ctx.currentHoL1, self->ctx.convTilingData->hoL0); |
| 115 | - self->ctx.l12l0LoopW = CeilDiv(self->ctx.currentWoL1, self->ctx.convTilingData->convApiTiling.woL0); | 115 | + self->ctx.l12l0LoopW = CeilDiv(self->ctx.currentWoL1, self->ctx.convTilingData->woL0); |
| 116 | self->ctx.ddr2l1LoopInner = self->ctx.ddr2l1LoopTmp * self->ctx.l12l0LoopH * self->ctx.l12l0LoopW; | 116 | self->ctx.ddr2l1LoopInner = self->ctx.ddr2l1LoopTmp * self->ctx.l12l0LoopH * self->ctx.l12l0LoopW; |
| 117 | } | 117 | } |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | __aicore__ inline void DmaInitKValue(Intf *self) | 120 | __aicore__ inline void DmaInitKValue(Intf *self) |
| 121 | { | 121 | { |
| 122 | - self->ctx.kAL1Tail = (AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling.kernelHxkernelW) % self->ctx.convTilingData->convApiTiling.kAL1; | 122 | + self->ctx.kAL1Tail = (AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelW) % self->ctx.convTilingData->kAL1; |
| 123 | - self->ctx.kAL1Tail = self->ctx.kAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.kAL1 : self->ctx.kAL1Tail; | 123 | + self->ctx.kAL1Tail = self->ctx.kAL1Tail == 0 ? self->ctx.convTilingData->kAL1 : self->ctx.kAL1Tail; |
| 124 | - if (self->ctx.vecId == 0 && CeilDiv(self->ctx.convTilingData->convApiTiling.cinATailInCore, Intf::k0) > 1) { | 124 | + if (self->ctx.vecId == 0 && CeilDiv(self->ctx.convTilingData->cinATailInCore, Intf::k0) > 1) { |
| 125 | self->ctx.ciTail = Intf::k0; | 125 | self->ctx.ciTail = Intf::k0; |
| 126 | } else { | 126 | } else { |
| 127 | self->ctx.ciTail = self->ctx.singleCoreCi % Intf::k0; | 127 | self->ctx.ciTail = self->ctx.singleCoreCi % Intf::k0; |
| 128 | self->ctx.ciTail = self->ctx.ciTail == 0 ? Intf::k0 : self->ctx.ciTail; | 128 | self->ctx.ciTail = self->ctx.ciTail == 0 ? Intf::k0 : self->ctx.ciTail; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | - self->ctx.ddr2l1LoopKA = CeilDiv(AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->convApiTiling.kernelHxkernelW, | 131 | + self->ctx.ddr2l1LoopKA = CeilDiv(AlignB(self->ctx.singleCoreCi, Intf::k0) * self->ctx.convTilingData->kernelHxkernelW, |
| 132 | - self->ctx.convTilingData->convApiTiling.kAL1); | 132 | + self->ctx.convTilingData->kAL1); |
| 133 | self->ctx.maxKAL1Iter = self->ctx.ddr2l1LoopKA - 1; | 133 | self->ctx.maxKAL1Iter = self->ctx.ddr2l1LoopKA - 1; |
| 134 | self->ctx.kAL1fullload = self->ctx.ddr2l1LoopKA == 1; | 134 | self->ctx.kAL1fullload = self->ctx.ddr2l1LoopKA == 1; |
| 135 | 135 | ||
| 136 | - uint32_t currentCi1 = self->ctx.convTilingData->convApiTiling.cinAInCore / Intf::k0; | 136 | + uint32_t currentCi1 = self->ctx.convTilingData->cinAInCore / Intf::k0; |
| 137 | self->ctx.currentCi1Ub = CeilDiv(currentCi1, VEC_NUM); | 137 | self->ctx.currentCi1Ub = CeilDiv(currentCi1, VEC_NUM); |
| 138 | 138 | ||
| 139 | if (self->ctx.vecId == 1) { | 139 | if (self->ctx.vecId == 1) { |
| 140 | self->ctx.currentVec0Ci = self->ctx.currentCi1Ub * Intf::k0; | 140 | self->ctx.currentVec0Ci = self->ctx.currentCi1Ub * Intf::k0; |
| 141 | self->ctx.currentCi1Ub = currentCi1 - self->ctx.currentCi1Ub; | 141 | self->ctx.currentCi1Ub = currentCi1 - self->ctx.currentCi1Ub; |
| 142 | - self->ctx.vec0TotalSize = self->ctx.convTilingData->convApiTiling.hoL1 * self->ctx.convTilingData->convApiTiling.woL1 * self->ctx.currentVec0Ci * | 142 | + self->ctx.vec0TotalSize = self->ctx.convTilingData->hoL1 * self->ctx.convTilingData->woL1 * self->ctx.currentVec0Ci * |
| 143 | - self->ctx.convTilingData->convApiTiling.khL1 * self->ctx.convTilingData->convApiTiling.kwL1; | 143 | + self->ctx.convTilingData->khL1 * self->ctx.convTilingData->kwL1; |
| 144 | } | 144 | } |
| 145 | self->ctx.maxVecCi1Iter = self->ctx.currentCi1Ub - 1; | 145 | self->ctx.maxVecCi1Iter = self->ctx.currentCi1Ub - 1; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | __aicore__ inline void DmaInitHWValue(Intf *self) | 148 | __aicore__ inline void DmaInitHWValue(Intf *self) |
| 149 | { | 149 | { |
| 150 | - self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->convApiTiling.woL1; | 150 | + self->ctx.woAL1Tail = self->ctx.singleCoreWo % self->ctx.convTilingData->woL1; |
| 151 | - self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.woL1 : self->ctx.woAL1Tail; | 151 | + self->ctx.woAL1Tail = self->ctx.woAL1Tail == 0 ? self->ctx.convTilingData->woL1 : self->ctx.woAL1Tail; |
| 152 | 152 | ||
| 153 | - self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->convApiTiling.woL1); | 153 | + self->ctx.ddr2l1LoopW = CeilDiv(self->ctx.singleCoreWo, self->ctx.convTilingData->woL1); |
| 154 | self->ctx.maxWoL1Iter = self->ctx.ddr2l1LoopW - 1; | 154 | self->ctx.maxWoL1Iter = self->ctx.ddr2l1LoopW - 1; |
| 155 | 155 | ||
| 156 | - self->ctx.hoAL1Tail = self->ctx.singleCoreHo % self->ctx.convTilingData->convApiTiling.hoL1; | 156 | + self->ctx.hoAL1Tail = self->ctx.singleCoreHo % self->ctx.convTilingData->hoL1; |
| 157 | - self->ctx.hoAL1Tail = self->ctx.hoAL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.hoL1 : self->ctx.hoAL1Tail; | 157 | + self->ctx.hoAL1Tail = self->ctx.hoAL1Tail == 0 ? self->ctx.convTilingData->hoL1 : self->ctx.hoAL1Tail; |
| 158 | - self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->convApiTiling.hoL1); | 158 | + self->ctx.ddr2l1LoopH = CeilDiv(self->ctx.singleCoreHo, self->ctx.convTilingData->hoL1); |
| 159 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; | 159 | self->ctx.maxHoL1Iter = self->ctx.ddr2l1LoopH - 1; |
| 160 | 160 | ||
| 161 | DmaUpdateHWValue(self); | 161 | DmaUpdateHWValue(self); |
| @@ -164,31 +164,31 @@ public: | |||
| 164 | __aicore__ inline void DmaInitIterValue(Intf *self) | 164 | __aicore__ inline void DmaInitIterValue(Intf *self) |
| 165 | { | 165 | { |
| 166 | if constexpr (Intf::iterateMFirstFlag) { | 166 | if constexpr (Intf::iterateMFirstFlag) { |
| 167 | - self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->convApiTiling.nBL1; | 167 | + self->ctx.nBL1Tail = self->ctx.singleCoreCo % self->ctx.convTilingData->nBL1; |
| 168 | - self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->convApiTiling.nBL1 : self->ctx.nBL1Tail; | 168 | + self->ctx.nBL1Tail = self->ctx.nBL1Tail == 0 ? self->ctx.convTilingData->nBL1 : self->ctx.nBL1Tail; |
| 169 | 169 | ||
| 170 | - self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->convApiTiling.nBL1); | 170 | + self->ctx.ddr2l1LoopN = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->nBL1); |
| 171 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; | 171 | self->ctx.maxNBL1Iter = self->ctx.ddr2l1LoopN - 1; |
| 172 | 172 | ||
| 173 | if (!self->ctx.kAL1fullload) { | 173 | if (!self->ctx.kAL1fullload) { |
| 174 | - self->ctx.ddr2l1LoopTmp = self->ctx.convTilingData->convApiTiling.multiNBL1; | 174 | + self->ctx.ddr2l1LoopTmp = self->ctx.convTilingData->multiNBL1; |
| 175 | } | 175 | } |
| 176 | } else { | 176 | } else { |
| 177 | if (!self->ctx.kAL1fullload) { | 177 | if (!self->ctx.kAL1fullload) { |
| 178 | - self->ctx.ddr2l1LoopTmp = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->convApiTiling.nL0); | 178 | + self->ctx.ddr2l1LoopTmp = CeilDiv(self->ctx.singleCoreCo, self->ctx.convTilingData->nL0); |
| 179 | } | 179 | } |
| 180 | } | 180 | } |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | __aicore__ inline void DmaInitBuf(Intf *self) | 183 | __aicore__ inline void DmaInitBuf(Intf *self) |
| 184 | { | 184 | { |
| 185 | - self->ctx.ubBufSize = self->ctx.convTilingData->convApiTiling.hoL1 * AlignB(self->ctx.convTilingData->convApiTiling.woL1, BLOCK_L0_M) * | 185 | + self->ctx.ubBufSize = self->ctx.convTilingData->hoL1 * AlignB(self->ctx.convTilingData->woL1, BLOCK_L0_M) * |
| 186 | - self->ctx.convTilingData->convApiTiling.khUb * self->ctx.convTilingData->convApiTiling.kwUb * Intf::k0; | 186 | + self->ctx.convTilingData->khUb * self->ctx.convTilingData->kwUb * Intf::k0; |
| 187 | 187 | ||
| 188 | self->ctx.pipe.InitBuffer(self->ctx.ubBuf, self->ctx.ubBufSize * Intf::sizeOfFmap); | 188 | self->ctx.pipe.InitBuffer(self->ctx.ubBuf, self->ctx.ubBufSize * Intf::sizeOfFmap); |
| 189 | self->ctx.img2ColTensor = self->ctx.ubBuf.template Get<typename Intf::FmapT>(); | 189 | self->ctx.img2ColTensor = self->ctx.ubBuf.template Get<typename Intf::FmapT>(); |
| 190 | 190 | ||
| 191 | - self->ctx.pipe.InitBuffer(self->ctx.aL1TBuf, self->ctx.convTilingData->convApiTiling.aL1SpaceSize); | 191 | + self->ctx.pipe.InitBuffer(self->ctx.aL1TBuf, self->ctx.convTilingData->aL1SpaceSize); |
| 192 | self->ctx.al1 = self->ctx.aL1TBuf.template Get<typename Intf::FmapT>(); | 192 | self->ctx.al1 = self->ctx.aL1TBuf.template Get<typename Intf::FmapT>(); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| @@ -196,23 +196,23 @@ public: | |||
| 196 | { | 196 | { |
| 197 | self->ctx.vecId = GetSubBlockIdx(); | 197 | self->ctx.vecId = GetSubBlockIdx(); |
| 198 | 198 | ||
| 199 | - self->ctx.singleCoreCo = self->ctx.convTilingData->convApiTiling.singleCoreCo; | 199 | + self->ctx.singleCoreCo = self->ctx.convTilingData->singleCoreCo; |
| 200 | - self->ctx.singleCoreHo = self->ctx.convTilingData->convApiTiling.singleCoreHo; | 200 | + self->ctx.singleCoreHo = self->ctx.convTilingData->singleCoreHo; |
| 201 | - self->ctx.singleCoreWo = self->ctx.convTilingData->convApiTiling.singleCoreWo; | 201 | + self->ctx.singleCoreWo = self->ctx.convTilingData->singleCoreWo; |
| 202 | - self->ctx.singleCoreCi = self->ctx.convTilingData->convApiTiling.singleCoreCi; | 202 | + self->ctx.singleCoreCi = self->ctx.convTilingData->singleCoreCi; |
| 203 | - self->ctx.vecKhLoopTimes = CeilDiv(self->ctx.convTilingData->convApiTiling.khL1, self->ctx.convTilingData->convApiTiling.khUb); | 203 | + self->ctx.vecKhLoopTimes = CeilDiv(self->ctx.convTilingData->khL1, self->ctx.convTilingData->khUb); |
| 204 | self->ctx.maxVecKhIter = self->ctx.vecKhLoopTimes - 1; | 204 | self->ctx.maxVecKhIter = self->ctx.vecKhLoopTimes - 1; |
| 205 | - self->ctx.vecKwLoopTimes = CeilDiv(self->ctx.convTilingData->convApiTiling.kwL1, self->ctx.convTilingData->convApiTiling.kwUb); | 205 | + self->ctx.vecKwLoopTimes = CeilDiv(self->ctx.convTilingData->kwL1, self->ctx.convTilingData->kwUb); |
| 206 | self->ctx.maxVecKwIter = self->ctx.vecKwLoopTimes - 1; | 206 | self->ctx.maxVecKwIter = self->ctx.vecKwLoopTimes - 1; |
| 207 | - self->ctx.ddr2L1LoopKh = CeilDiv(self->ctx.convTilingData->convApiTiling.kernelH, self->ctx.convTilingData->convApiTiling.khL1); | 207 | + self->ctx.ddr2L1LoopKh = CeilDiv(self->ctx.convTilingData->kernelH, self->ctx.convTilingData->khL1); |
| 208 | self->ctx.maxKhAL1Iter = self->ctx.ddr2L1LoopKh - 1; | 208 | self->ctx.maxKhAL1Iter = self->ctx.ddr2L1LoopKh - 1; |
| 209 | - self->ctx.ddr2L1LoopKw = CeilDiv(self->ctx.convTilingData->convApiTiling.kernelW, self->ctx.convTilingData->convApiTiling.kwL1); | 209 | + self->ctx.ddr2L1LoopKw = CeilDiv(self->ctx.convTilingData->kernelW, self->ctx.convTilingData->kwL1); |
| 210 | self->ctx.maxKwAL1Iter = self->ctx.ddr2L1LoopKw - 1; | 210 | self->ctx.maxKwAL1Iter = self->ctx.ddr2L1LoopKw - 1; |
| 211 | - self->ctx.cinAL1 = self->ctx.convTilingData->convApiTiling.kAL1 / (self->ctx.convTilingData->convApiTiling.khL1 * self->ctx.convTilingData->convApiTiling.kwL1); | 211 | + self->ctx.cinAL1 = self->ctx.convTilingData->kAL1 / (self->ctx.convTilingData->khL1 * self->ctx.convTilingData->kwL1); |
| 212 | self->ctx.cinAL1LoopTimes = CeilDiv(self->ctx.singleCoreCi, self->ctx.cinAL1); | 212 | self->ctx.cinAL1LoopTimes = CeilDiv(self->ctx.singleCoreCi, self->ctx.cinAL1); |
| 213 | self->ctx.maxCinAL1Iter = self->ctx.cinAL1LoopTimes - 1; | 213 | self->ctx.maxCinAL1Iter = self->ctx.cinAL1LoopTimes - 1; |
| 214 | 214 | ||
| 215 | - self->ctx.fmapOneBatchSize = self->ctx.convTilingData->convApiTiling.orgCi * self->ctx.convTilingData->convApiTiling.orgHixWi; | 215 | + self->ctx.fmapOneBatchSize = self->ctx.convTilingData->orgCi * self->ctx.convTilingData->orgHixWi; |
| 216 | 216 | ||
| 217 | DmaInitBuf(self); | 217 | DmaInitBuf(self); |
| 218 | DmaInitKValue(self); | 218 | DmaInitKValue(self); |
| @@ -225,12 +225,12 @@ public: | |||
| 225 | 225 | ||
| 226 | __aicore__ inline void DmaCubeInit(Intf *self) | 226 | __aicore__ inline void DmaCubeInit(Intf *self) |
| 227 | { | 227 | { |
| 228 | - self->ctx.ddr2L1LoopKh = CeilDiv(self->ctx.convTilingData->convApiTiling.kernelH, self->ctx.convTilingData->convApiTiling.khL1); | 228 | + self->ctx.ddr2L1LoopKh = CeilDiv(self->ctx.convTilingData->kernelH, self->ctx.convTilingData->khL1); |
| 229 | self->ctx.maxKhAL1Iter = self->ctx.ddr2L1LoopKh - 1; | 229 | self->ctx.maxKhAL1Iter = self->ctx.ddr2L1LoopKh - 1; |
| 230 | - self->ctx.ddr2L1LoopKw = CeilDiv(self->ctx.convTilingData->convApiTiling.kernelW, self->ctx.convTilingData->convApiTiling.kwL1); | 230 | + self->ctx.ddr2L1LoopKw = CeilDiv(self->ctx.convTilingData->kernelW, self->ctx.convTilingData->kwL1); |
| 231 | self->ctx.maxKwAL1Iter = self->ctx.ddr2L1LoopKw - 1; | 231 | self->ctx.maxKwAL1Iter = self->ctx.ddr2L1LoopKw - 1; |
| 232 | - self->ctx.cinBL1 = CeilDiv(self->ctx.convTilingData->convApiTiling.kBL1, self->ctx.convTilingData->convApiTiling.khL1 * self->ctx.convTilingData->convApiTiling.kwL1); | 232 | + self->ctx.cinBL1 = CeilDiv(self->ctx.convTilingData->kBL1, self->ctx.convTilingData->khL1 * self->ctx.convTilingData->kwL1); |
| 233 | - self->ctx.cinBL1LoopTimes = CeilDiv(self->ctx.convTilingData->convApiTiling.singleCoreCi, self->ctx.cinBL1); | 233 | + self->ctx.cinBL1LoopTimes = CeilDiv(self->ctx.convTilingData->singleCoreCi, self->ctx.cinBL1); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | __aicore__ inline void DmaUpdateLoopInner(Intf *self) | 236 | __aicore__ inline void DmaUpdateLoopInner(Intf *self) |
| @@ -241,7 +241,7 @@ public: | |||
| 241 | 241 | ||
| 242 | if constexpr (Intf::iterateMFirstFlag) { | 242 | if constexpr (Intf::iterateMFirstFlag) { |
| 243 | self->ctx.ddr2l1LoopTmp = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? | 243 | self->ctx.ddr2l1LoopTmp = self->ctx.nBL1Iter == self->ctx.maxNBL1Iter ? |
| 244 | - CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->convApiTiling.nL0) : self->ctx.convTilingData->convApiTiling.multiNBL1; | 244 | + CeilDiv(self->ctx.nBL1Tail, self->ctx.convTilingData->nL0) : self->ctx.convTilingData->multiNBL1; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | self->ctx.ddr2l1LoopInner = self->ctx.ddr2l1LoopTmp * self->ctx.l12l0LoopH * self->ctx.l12l0LoopW; | 247 | self->ctx.ddr2l1LoopInner = self->ctx.ddr2l1LoopTmp * self->ctx.l12l0LoopH * self->ctx.l12l0LoopW; |
| @@ -99,14 +99,14 @@ __aicore__ inline bool GroupConv2d<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYP | |||
| 99 | hasScale = (extendParams != nullptr); | 99 | hasScale = (extendParams != nullptr); |
| 100 | convTilingData = &tilingData; | 100 | convTilingData = &tilingData; |
| 101 | if constexpr (CONV_CFG::isExtendConv2d) { | 101 | if constexpr (CONV_CFG::isExtendConv2d) { |
| 102 | - dualOutput = convTilingData->convApiTiling.dualOutput; | 102 | + dualOutput = convTilingData->dualOutput; |
| 103 | } | 103 | } |
| 104 | convCommon.Init(this, convTilingData, hasScale); | 104 | convCommon.Init(this, convTilingData, hasScale); |
| 105 | 105 | ||
| 106 | conv.Init(convTilingData); | 106 | conv.Init(convTilingData); |
| 107 | 107 | ||
| 108 | - ciPerGroup = convTilingData->convRunInfo.cin / convTilingData->convRunInfo.groups; | 108 | + ciPerGroup = convTilingData->cin / convTilingData->groups; |
| 109 | - coPerGroup = convTilingData->convRunInfo.cout / convTilingData->convRunInfo.groups; | 109 | + coPerGroup = convTilingData->cout / convTilingData->groups; |
| 110 | 110 | ||
| 111 | if (!InitSingleCoreData()) { | 111 | if (!InitSingleCoreData()) { |
| 112 | return false; | 112 | return false; |
| @@ -124,30 +124,30 @@ __aicore__ inline bool GroupConv2d<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYP | |||
| 124 | InitBlockNums(); | 124 | InitBlockNums(); |
| 125 | 125 | ||
| 126 | DimDataToFill batchToFill(this->singleCoreBatch, this->batchIdxStart, this->isBatchDimTail); | 126 | DimDataToFill batchToFill(this->singleCoreBatch, this->batchIdxStart, this->isBatchDimTail); |
| 127 | - bool isRealDim = convCommon.CalcDimData(this->batchBlockNums, convTilingData->convRunInfo.batchDim, convTilingData->convRunInfo.batch, | 127 | + bool isRealDim = convCommon.CalcDimData(this->batchBlockNums, convTilingData->batchDim, convTilingData->batch, |
| 128 | - convTilingData->convRunInfo.batch, batchToFill); | 128 | + convTilingData->batch, batchToFill); |
| 129 | if (unlikely(!isRealDim)) { | 129 | if (unlikely(!isRealDim)) { |
| 130 | return false; | 130 | return false; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | if constexpr (isMMode) { | 133 | if constexpr (isMMode) { |
| 134 | DimDataToFill mToFill(this->singleCoreM, this->mIdxStart, this->isMDimTail); | 134 | DimDataToFill mToFill(this->singleCoreM, this->mIdxStart, this->isMDimTail); |
| 135 | - uint64_t totalM = convTilingData->convRunInfo.hout * convTilingData->convRunInfo.wout; | 135 | + uint64_t totalM = convTilingData->hout * convTilingData->wout; |
| 136 | - isRealDim = convCommon.CalcDimData(this->hoBlockNums, convTilingData->convRunInfo.hoDim, convCommon.AlignB(totalM, M0), | 136 | + isRealDim = convCommon.CalcDimData(this->hoBlockNums, convTilingData->hoDim, convCommon.AlignB(totalM, M0), |
| 137 | totalM, mToFill); | 137 | totalM, mToFill); |
| 138 | if (unlikely(!isRealDim)) { | 138 | if (unlikely(!isRealDim)) { |
| 139 | return false; | 139 | return false; |
| 140 | } | 140 | } |
| 141 | } else { | 141 | } else { |
| 142 | DimDataToFill hoToFill(this->singleCoreHo, this->hoIdxStart, this->isHoDimTail); | 142 | DimDataToFill hoToFill(this->singleCoreHo, this->hoIdxStart, this->isHoDimTail); |
| 143 | - isRealDim = convCommon.CalcDimData(this->hoBlockNums, convTilingData->convRunInfo.hoDim, convTilingData->convRunInfo.hout, | 143 | + isRealDim = convCommon.CalcDimData(this->hoBlockNums, convTilingData->hoDim, convTilingData->hout, |
| 144 | - convTilingData->convRunInfo.hout, hoToFill); | 144 | + convTilingData->hout, hoToFill); |
| 145 | if (unlikely(!isRealDim)) { | 145 | if (unlikely(!isRealDim)) { |
| 146 | return false; | 146 | return false; |
| 147 | } | 147 | } |
| 148 | DimDataToFill woToFill(this->singleCoreWo, this->woIdxStart, this->isWoDimTail); | 148 | DimDataToFill woToFill(this->singleCoreWo, this->woIdxStart, this->isWoDimTail); |
| 149 | - isRealDim = convCommon.CalcDimData(this->woBlockNums, convTilingData->convRunInfo.woDim, convTilingData->convRunInfo.wout, | 149 | + isRealDim = convCommon.CalcDimData(this->woBlockNums, convTilingData->woDim, convTilingData->wout, |
| 150 | - convTilingData->convRunInfo.wout, woToFill); | 150 | + convTilingData->wout, woToFill); |
| 151 | if (unlikely(!isRealDim)) { | 151 | if (unlikely(!isRealDim)) { |
| 152 | return false; | 152 | return false; |
| 153 | } | 153 | } |
| @@ -170,28 +170,28 @@ __aicore__ inline void GroupConv2d<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYP | |||
| 170 | // NCHW: batchDim -> 'groupDim -> nDim' -> hoDim -> woDim / batchDim -> 'groupDim -> nDim' -> mDim | 170 | // NCHW: batchDim -> 'groupDim -> nDim' -> hoDim -> woDim / batchDim -> 'groupDim -> nDim' -> mDim |
| 171 | // NHWC: batchDim -> hoDim -> woDim -> 'groupDim -> nDim' / batchDim -> mDim -> 'groupDim -> nDim' | 171 | // NHWC: batchDim -> hoDim -> woDim -> 'groupDim -> nDim' / batchDim -> mDim -> 'groupDim -> nDim' |
| 172 | if constexpr (isMMode) { | 172 | if constexpr (isMMode) { |
| 173 | - this->batchBlockNums = convTilingData->convRunInfo.groupDim * convTilingData->convRunInfo.nDim * convTilingData->convRunInfo.hoDim; | 173 | + this->batchBlockNums = convTilingData->groupDim * convTilingData->nDim * convTilingData->hoDim; |
| 174 | if constexpr (A_FORMAT == ConvFormat::NCHW) { | 174 | if constexpr (A_FORMAT == ConvFormat::NCHW) { |
| 175 | - this->groupBlockNums = convTilingData->convRunInfo.nDim * convTilingData->convRunInfo.hoDim; | 175 | + this->groupBlockNums = convTilingData->nDim * convTilingData->hoDim; |
| 176 | - this->nBlockNums = convTilingData->convRunInfo.hoDim; | 176 | + this->nBlockNums = convTilingData->hoDim; |
| 177 | this->hoBlockNums = 1; | 177 | this->hoBlockNums = 1; |
| 178 | } else { | 178 | } else { |
| 179 | - this->hoBlockNums = convTilingData->convRunInfo.groupDim * convTilingData->convRunInfo.nDim; | 179 | + this->hoBlockNums = convTilingData->groupDim * convTilingData->nDim; |
| 180 | - this->groupBlockNums = convTilingData->convRunInfo.nDim; | 180 | + this->groupBlockNums = convTilingData->nDim; |
| 181 | this->nBlockNums = 1; | 181 | this->nBlockNums = 1; |
| 182 | } | 182 | } |
| 183 | } else { | 183 | } else { |
| 184 | - this->batchBlockNums = convTilingData->convRunInfo.groupDim * convTilingData->convRunInfo.nDim * convTilingData->convRunInfo.hoDim * | 184 | + this->batchBlockNums = convTilingData->groupDim * convTilingData->nDim * convTilingData->hoDim * |
| 185 | - convTilingData->convRunInfo.woDim; | 185 | + convTilingData->woDim; |
| 186 | if constexpr (A_FORMAT == ConvFormat::NCHW) { | 186 | if constexpr (A_FORMAT == ConvFormat::NCHW) { |
| 187 | - this->groupBlockNums = convTilingData->convRunInfo.nDim * convTilingData->convRunInfo.hoDim * convTilingData->convRunInfo.woDim; | 187 | + this->groupBlockNums = convTilingData->nDim * convTilingData->hoDim * convTilingData->woDim; |
| 188 | - this->nBlockNums = convTilingData->convRunInfo.hoDim * convTilingData->convRunInfo.woDim; | 188 | + this->nBlockNums = convTilingData->hoDim * convTilingData->woDim; |
| 189 | - this->hoBlockNums = convTilingData->convRunInfo.woDim; | 189 | + this->hoBlockNums = convTilingData->woDim; |
| 190 | this->woBlockNums = 1; | 190 | this->woBlockNums = 1; |
| 191 | } else { | 191 | } else { |
| 192 | - this->hoBlockNums = convTilingData->convRunInfo.woDim * convTilingData->convRunInfo.groupDim * convTilingData->convRunInfo.nDim; | 192 | + this->hoBlockNums = convTilingData->woDim * convTilingData->groupDim * convTilingData->nDim; |
| 193 | - this->woBlockNums = convTilingData->convRunInfo.groupDim * convTilingData->convRunInfo.nDim; | 193 | + this->woBlockNums = convTilingData->groupDim * convTilingData->nDim; |
| 194 | - this->groupBlockNums = convTilingData->convRunInfo.nDim; | 194 | + this->groupBlockNums = convTilingData->nDim; |
| 195 | this->nBlockNums = 1; | 195 | this->nBlockNums = 1; |
| 196 | } | 196 | } |
| 197 | } | 197 | } |
| @@ -202,14 +202,14 @@ __aicore__ inline bool GroupConv2d<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYP | |||
| 202 | InitSingleCoreDataOriGroup() | 202 | InitSingleCoreDataOriGroup() |
| 203 | { | 203 | { |
| 204 | DimDataToFill groupToFill(singleGroups, groupIdxStart, isGroupDimTail); | 204 | DimDataToFill groupToFill(singleGroups, groupIdxStart, isGroupDimTail); |
| 205 | - bool isRealDim = convCommon.CalcDimData(this->groupBlockNums, convTilingData->convRunInfo.groupDim, | 205 | + bool isRealDim = convCommon.CalcDimData(this->groupBlockNums, convTilingData->groupDim, |
| 206 | - convTilingData->convRunInfo.groups, convTilingData->convRunInfo.groups, groupToFill); | 206 | + convTilingData->groups, convTilingData->groups, groupToFill); |
| 207 | if (unlikely(!isRealDim)) { | 207 | if (unlikely(!isRealDim)) { |
| 208 | return false; | 208 | return false; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | DimDataToFill nToFill(this->singleCoreN, this->nIdxStart, this->isNDimTail); | 211 | DimDataToFill nToFill(this->singleCoreN, this->nIdxStart, this->isNDimTail); |
| 212 | - isRealDim = convCommon.CalcNDimDataAlign(this->nBlockNums, convTilingData->convRunInfo.nDim, coPerGroup, nToFill); | 212 | + isRealDim = convCommon.CalcNDimDataAlign(this->nBlockNums, convTilingData->nDim, coPerGroup, nToFill); |
| 213 | if (unlikely(!isRealDim)) { | 213 | if (unlikely(!isRealDim)) { |
| 214 | return false; | 214 | return false; |
| 215 | } | 215 | } |
| @@ -222,15 +222,15 @@ __aicore__ inline bool GroupConv2d<FMAP_TYPE, WEIGHT_TYPE, OUTPUT_TYPE, BIAS_TYP | |||
| 222 | InitSingleCoreDataOptGroup() | 222 | InitSingleCoreDataOptGroup() |
| 223 | { | 223 | { |
| 224 | DimDataToFill groupToFill(singleGroupOpt, groupIdxStart, isGroupDimTail); | 224 | DimDataToFill groupToFill(singleGroupOpt, groupIdxStart, isGroupDimTail); |
| 225 | - bool isRealDim = convCommon.CalcDimData(this->groupBlockNums, convTilingData->convRunInfo.groupDim, | 225 | + bool isRealDim = convCommon.CalcDimData(this->groupBlockNums, convTilingData->groupDim, |
| 226 | - convTilingData->convRunInfo.groupOpt, convTilingData->convRunInfo.groupOpt, groupToFill); | 226 | + convTilingData->groupOpt, convTilingData->groupOpt, groupToFill); |
| 227 | if (unlikely(!isRealDim)) { | 227 | if (unlikely(!isRealDim)) { |
| 228 | return false; | 228 | return false; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | DimDataToFill nToFill(singleCoOpt, this->nIdxStart, this->isNDimTail); | 231 | DimDataToFill nToFill(singleCoOpt, this->nIdxStart, this->isNDimTail); |
| 232 | - isRealDim = convCommon.CalcNDimDataAlign(this->nBlockNums, convTilingData->convRunInfo.nDim, | 232 | + isRealDim = convCommon.CalcNDimDataAlign(this->nBlockNums, convTilingData->nDim, |
| 233 | - convTilingData->convRunInfo.coutOpt, nToFill); | 233 | + convTilingData->coutOpt, nToFill); |
| 234 | if (unlikely(!isRealDim)) { | 234 | if (unlikely(!isRealDim)) { |
| 235 | return false; | 235 | return false; |
| 236 | } | 236 | } |
| @@ -31,7 +31,7 @@ public: | |||
| 31 | __aicore__ inline void SetIntf(Intf *self) | 31 | __aicore__ inline void SetIntf(Intf *self) |
| 32 | { | 32 | { |
| 33 | self_ = self; | 33 | self_ = self; |
| 34 | - buffAddr.dataLen = self_->ctx.convTilingData->convApiTiling.aL1SpaceSize; | 34 | + buffAddr.dataLen = self_->ctx.convTilingData->aL1SpaceSize; |
| 35 | buffAddr.logicPos = static_cast<uint8_t>(QuePosition::A1); | 35 | buffAddr.logicPos = static_cast<uint8_t>(QuePosition::A1); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| @@ -39,16 +39,16 @@ public: | |||
| 39 | { | 39 | { |
| 40 | if constexpr (Intf::isQuantScene) { | 40 | if constexpr (Intf::isQuantScene) { |
| 41 | uint16_t padValue = | 41 | uint16_t padValue = |
| 42 | - (static_cast<uint16_t>(self_->ctx.convTilingData->convApiTiling.offsetx)) << BIT_OFFSET_8 | | 42 | + (static_cast<uint16_t>(self_->ctx.convTilingData->offsetx)) << BIT_OFFSET_8 | |
| 43 | - (static_cast<uint16_t>(self_->ctx.convTilingData->convApiTiling.offsetx)); | 43 | + (static_cast<uint16_t>(self_->ctx.convTilingData->offsetx)); |
| 44 | InitConstValueParams<uint16_t> params( | 44 | InitConstValueParams<uint16_t> params( |
| 45 | - 1, static_cast<uint16_t>(self_->ctx.convTilingData->convApiTiling.aL1SpaceSize / C0_SIZE), 0, padValue); | 45 | + 1, static_cast<uint16_t>(self_->ctx.convTilingData->aL1SpaceSize / C0_SIZE), 0, padValue); |
| 46 | buffAddr.bufferAddr = self_->ctx.al1.GetPhyAddr(); | 46 | buffAddr.bufferAddr = self_->ctx.al1.GetPhyAddr(); |
| 47 | al1tmp.SetAddr(buffAddr); | 47 | al1tmp.SetAddr(buffAddr); |
| 48 | InitConstValue<uint16_t>(al1tmp, params); | 48 | InitConstValue<uint16_t>(al1tmp, params); |
| 49 | } else { | 49 | } else { |
| 50 | InitConstValueParams<typename Intf::FmapT> params( | 50 | InitConstValueParams<typename Intf::FmapT> params( |
| 51 | - 1, static_cast<uint16_t>(self_->ctx.convTilingData->convApiTiling.aL1SpaceSize / C0_SIZE), 0, 0); | 51 | + 1, static_cast<uint16_t>(self_->ctx.convTilingData->aL1SpaceSize / C0_SIZE), 0, 0); |
| 52 | InitConstValue<typename Intf::FmapT>(self_->ctx.al1, params); | 52 | InitConstValue<typename Intf::FmapT>(self_->ctx.al1, params); |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| @@ -64,22 +64,22 @@ public: | |||
| 64 | padList[PAD_IDX_T] = padTopL1; | 64 | padList[PAD_IDX_T] = padTopL1; |
| 65 | Load3DSetFMatrixCal(hiLoadL1, wiLoadL1, padList); | 65 | Load3DSetFMatrixCal(hiLoadL1, wiLoadL1, padList); |
| 66 | } | 66 | } |
| 67 | - Load3DSetPaddingCal(self_->ctx.convTilingData->convApiTiling.offsetx); | 67 | + Load3DSetPaddingCal(self_->ctx.convTilingData->offsetx); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | __aicore__ inline void SetLoad3dFMatrixNoPad(uint64_t wiLoadL1) | 70 | __aicore__ inline void SetLoad3dFMatrixNoPad(uint64_t wiLoadL1) |
| 71 | { | 71 | { |
| 72 | uint8_t padList[4] = {0}; | 72 | uint8_t padList[4] = {0}; |
| 73 | Load3DSetFMatrixCal(hiLoadL1, wiLoadL1, padList); | 73 | Load3DSetFMatrixCal(hiLoadL1, wiLoadL1, padList); |
| 74 | - Load3DSetPaddingCal(self_->ctx.convTilingData->convApiTiling.offsetx); | 74 | + Load3DSetPaddingCal(self_->ctx.convTilingData->offsetx); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | __aicore__ inline void SetLoad3dFMatrixForOptPreload() | 77 | __aicore__ inline void SetLoad3dFMatrixForOptPreload() |
| 78 | { | 78 | { |
| 79 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { | 79 | if constexpr (Intf::outputOrder == static_cast<int8_t>(ConvOutputOrder::M_MODE)) { |
| 80 | - SetLoad3dFMatrix(self_->ctx.convTilingData->convApiTiling.padLeft, | 80 | + SetLoad3dFMatrix(self_->ctx.convTilingData->padLeft, |
| 81 | - self_->ctx.convTilingData->convApiTiling.padRight, | 81 | + self_->ctx.convTilingData->padRight, |
| 82 | - self_->ctx.convTilingData->convApiTiling.orgWi); | 82 | + self_->ctx.convTilingData->orgWi); |
| 83 | } else { | 83 | } else { |
| 84 | SetLoad3dFMatrix(padLeftL1, padRightL1, wiLoadL1); | 84 | SetLoad3dFMatrix(padLeftL1, padRightL1, wiLoadL1); |
| 85 | } | 85 | } |
| @@ -106,18 +106,18 @@ public: | |||
| 106 | { | 106 | { |
| 107 | self_ = self; | 107 | self_ = self; |
| 108 | 108 | ||
| 109 | - hiLoadL1 = (self_->ctx.convTilingData->convApiTiling.orgHo - 1) * | 109 | + hiLoadL1 = (self_->ctx.convTilingData->orgHo - 1) * |
| 110 | - self_->ctx.convTilingData->convApiTiling.strideH + self_->ctx.dilatedKernelH; | 110 | + self_->ctx.convTilingData->strideH + self_->ctx.dilatedKernelH; |
| 111 | - hiLoadL1 = hiLoadL1 > self_->ctx.convTilingData->convApiTiling.orgHi ? | 111 | + hiLoadL1 = hiLoadL1 > self_->ctx.convTilingData->orgHi ? |
| 112 | - self_->ctx.convTilingData->convApiTiling.orgHi : hiLoadL1; | 112 | + self_->ctx.convTilingData->orgHi : hiLoadL1; |
| 113 | - realHixWi = hiLoadL1 * self_->ctx.convTilingData->convApiTiling.orgWi; | 113 | + realHixWi = hiLoadL1 * self_->ctx.convTilingData->orgWi; |
| 114 | 114 | ||
| 115 | - padList[PAD_IDX_L] = static_cast<uint8_t>(self_->ctx.convTilingData->convApiTiling.padLeft); | 115 | + padList[PAD_IDX_L] = static_cast<uint8_t>(self_->ctx.convTilingData->padLeft); |
| 116 | - padList[PAD_IDX_R] = static_cast<uint8_t>(self_->ctx.convTilingData->convApiTiling.padRight); | 116 | + padList[PAD_IDX_R] = static_cast<uint8_t>(self_->ctx.convTilingData->padRight); |
| 117 | - padList[PAD_IDX_T] = static_cast<uint8_t>(self_->ctx.convTilingData->convApiTiling.padTop); | 117 | + padList[PAD_IDX_T] = static_cast<uint8_t>(self_->ctx.convTilingData->padTop); |
| 118 | - Load3DSetPaddingCal(self_->ctx.convTilingData->convApiTiling.offsetx); | 118 | + Load3DSetPaddingCal(self_->ctx.convTilingData->offsetx); |
| 119 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::MULTI_BATCH)) { | 119 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::MULTI_BATCH)) { |
| 120 | - Load3DSetFMatrixCal(hiLoadL1, self_->ctx.convTilingData->convApiTiling.orgWi, padList); | 120 | + Load3DSetFMatrixCal(hiLoadL1, self_->ctx.convTilingData->orgWi, padList); |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | 123 | ||
| @@ -131,11 +131,11 @@ public: | |||
| 131 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { | 131 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { |
| 132 | if constexpr (Intf::formatFmap == ConvFormat::NCHW && Intf::c04Flag) { | 132 | if constexpr (Intf::formatFmap == ConvFormat::NCHW && Intf::c04Flag) { |
| 133 | Load3DSetFMatrixCal(self_->ctx.innerBatch, | 133 | Load3DSetFMatrixCal(self_->ctx.innerBatch, |
| 134 | - AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->convApiTiling.orgHixWi, Intf::k0) / C04_CIN_SIZE, | 134 | + AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->orgHixWi, Intf::k0) / C04_CIN_SIZE, |
| 135 | padList); | 135 | padList); |
| 136 | } else { | 136 | } else { |
| 137 | Load3DSetFMatrixCal(self_->ctx.innerBatch * hiLoadL1, | 137 | Load3DSetFMatrixCal(self_->ctx.innerBatch * hiLoadL1, |
| 138 | - self_->ctx.convTilingData->convApiTiling.orgWi, padList); | 138 | + self_->ctx.convTilingData->orgWi, padList); |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | if constexpr (Intf::disContinuousFlag) { | 141 | if constexpr (Intf::disContinuousFlag) { |
| @@ -143,10 +143,10 @@ public: | |||
| 143 | } else if constexpr (Intf::formatFmap == ConvFormat::NCHW) { | 143 | } else if constexpr (Intf::formatFmap == ConvFormat::NCHW) { |
| 144 | uint64_t aL1GmOffset = 0; | 144 | uint64_t aL1GmOffset = 0; |
| 145 | if constexpr (!Intf::isKL1NL0FullLoad) { | 145 | if constexpr (!Intf::isKL1NL0FullLoad) { |
| 146 | - aL1GmOffset += kAL1Iter * self_->ctx.convTilingData->convApiTiling.cinOffsetBlockInGM; | 146 | + aL1GmOffset += kAL1Iter * self_->ctx.convTilingData->cinOffsetBlockInGM; |
| 147 | } | 147 | } |
| 148 | if constexpr (!Intf::isOneBatch) { | 148 | if constexpr (!Intf::isOneBatch) { |
| 149 | - aL1GmOffset += batchIter * self_->ctx.convTilingData->convApiTiling.innerBatch * | 149 | + aL1GmOffset += batchIter * self_->ctx.convTilingData->innerBatch * |
| 150 | self_->ctx.fmapOneBatchSize; | 150 | self_->ctx.fmapOneBatchSize; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| @@ -161,10 +161,10 @@ public: | |||
| 161 | } else if constexpr (Intf::formatOutput == ConvFormat::NHWC) { | 161 | } else if constexpr (Intf::formatOutput == ConvFormat::NHWC) { |
| 162 | uint64_t aL1GmOffset = 0; | 162 | uint64_t aL1GmOffset = 0; |
| 163 | if constexpr (!Intf::isKL1NL0FullLoad) { | 163 | if constexpr (!Intf::isKL1NL0FullLoad) { |
| 164 | - aL1GmOffset += kAL1Iter * self_->ctx.convTilingData->convApiTiling.cinAInCore; | 164 | + aL1GmOffset += kAL1Iter * self_->ctx.convTilingData->cinAInCore; |
| 165 | } | 165 | } |
| 166 | if constexpr (!Intf::isOneBatch) { | 166 | if constexpr (!Intf::isOneBatch) { |
| 167 | - aL1GmOffset += batchIter * self_->ctx.convTilingData->convApiTiling.innerBatch * | 167 | + aL1GmOffset += batchIter * self_->ctx.convTilingData->innerBatch * |
| 168 | self_->ctx.fmapOneBatchSize; | 168 | self_->ctx.fmapOneBatchSize; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| @@ -181,9 +181,9 @@ public: | |||
| 181 | 181 | ||
| 182 | __aicore__ inline void LoadAL1InputHWNC(uint64_t kAL1Iter, uint64_t mAL1Iter, uint64_t batchIter) | 182 | __aicore__ inline void LoadAL1InputHWNC(uint64_t kAL1Iter, uint64_t mAL1Iter, uint64_t batchIter) |
| 183 | { | 183 | { |
| 184 | - uint64_t aL1GmOffset = batchIter * self_->ctx.convTilingData->convApiTiling.innerBatch * | 184 | + uint64_t aL1GmOffset = batchIter * self_->ctx.convTilingData->innerBatch * |
| 185 | - self_->ctx.convTilingData->convApiTiling.orgCi + | 185 | + self_->ctx.convTilingData->orgCi + |
| 186 | - kAL1Iter * self_->ctx.convTilingData->convApiTiling.cinAInCore; | 186 | + kAL1Iter * self_->ctx.convTilingData->cinAInCore; |
| 187 | 187 | ||
| 188 | Nd2NzParams intriParams; | 188 | Nd2NzParams intriParams; |
| 189 | SetNd2NzIntriParamsInputHWNC(intriParams, kAL1Iter); | 189 | SetNd2NzIntriParamsInputHWNC(intriParams, kAL1Iter); |
| @@ -194,33 +194,33 @@ private: | |||
| 194 | __aicore__ inline void SetDn2NzIntriParamsC04(Dn2NzParams &intriParams) | 194 | __aicore__ inline void SetDn2NzIntriParamsC04(Dn2NzParams &intriParams) |
| 195 | { | 195 | { |
| 196 | intriParams.dnNum = self_->ctx.innerBatch; | 196 | intriParams.dnNum = self_->ctx.innerBatch; |
| 197 | - intriParams.nValue = self_->ctx.convTilingData->convApiTiling.orgHixWi; | 197 | + intriParams.nValue = self_->ctx.convTilingData->orgHixWi; |
| 198 | - intriParams.dValue = self_->ctx.convTilingData->convApiTiling.orgCi; | 198 | + intriParams.dValue = self_->ctx.convTilingData->orgCi; |
| 199 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgHixWi; | 199 | + intriParams.srcDValue = self_->ctx.convTilingData->orgHixWi; |
| 200 | - intriParams.srcDnMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCi * | 200 | + intriParams.srcDnMatrixStride = self_->ctx.convTilingData->orgCi * |
| 201 | - self_->ctx.convTilingData->convApiTiling.orgHixWi; | 201 | + self_->ctx.convTilingData->orgHixWi; |
| 202 | intriParams.dstNzNStride = 1; | 202 | intriParams.dstNzNStride = 1; |
| 203 | intriParams.dstNzMatrixStride = | 203 | intriParams.dstNzMatrixStride = |
| 204 | - AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->convApiTiling.orgHixWi, Intf::k0); | 204 | + AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->orgHixWi, Intf::k0); |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | __aicore__ inline void SetDn2NzIntriParams(Dn2NzParams &intriParams, uint64_t kAL1Iter) | 207 | __aicore__ inline void SetDn2NzIntriParams(Dn2NzParams &intriParams, uint64_t kAL1Iter) |
| 208 | { | 208 | { |
| 209 | uint32_t al1Ci; | 209 | uint32_t al1Ci; |
| 210 | if constexpr (Intf::isKL1NL0FullLoad) { | 210 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 211 | - al1Ci = self_->ctx.convTilingData->convApiTiling.cinATailInCore; | 211 | + al1Ci = self_->ctx.convTilingData->cinATailInCore; |
| 212 | } else { | 212 | } else { |
| 213 | al1Ci = IsKAL1Tail(kAL1Iter) ? | 213 | al1Ci = IsKAL1Tail(kAL1Iter) ? |
| 214 | - self_->ctx.convTilingData->convApiTiling.cinATailInCore : | 214 | + self_->ctx.convTilingData->cinATailInCore : |
| 215 | - self_->ctx.convTilingData->convApiTiling.cinAInCore; | 215 | + self_->ctx.convTilingData->cinAInCore; |
| 216 | } | 216 | } |
| 217 | intriParams.dnNum = self_->ctx.innerBatch; | 217 | intriParams.dnNum = self_->ctx.innerBatch; |
| 218 | intriParams.nValue = realHixWi; | 218 | intriParams.nValue = realHixWi; |
| 219 | intriParams.dValue = al1Ci; | 219 | intriParams.dValue = al1Ci; |
| 220 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgHixWi; | 220 | + intriParams.srcDValue = self_->ctx.convTilingData->orgHixWi; |
| 221 | intriParams.dstNzNStride = 1; | 221 | intriParams.dstNzNStride = 1; |
| 222 | - intriParams.srcDnMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCi * | 222 | + intriParams.srcDnMatrixStride = self_->ctx.convTilingData->orgCi * |
| 223 | - self_->ctx.convTilingData->convApiTiling.orgHixWi; | 223 | + self_->ctx.convTilingData->orgHixWi; |
| 224 | 224 | ||
| 225 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { | 225 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { |
| 226 | intriParams.dstNzC0Stride = self_->ctx.innerBatch * realHixWi; | 226 | intriParams.dstNzC0Stride = self_->ctx.innerBatch * realHixWi; |
| @@ -235,36 +235,36 @@ private: | |||
| 235 | { | 235 | { |
| 236 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { | 236 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { |
| 237 | intriParams.ndNum = 1; | 237 | intriParams.ndNum = 1; |
| 238 | - intriParams.nValue = self_->ctx.innerBatch * self_->ctx.convTilingData->convApiTiling.orgHixWi; | 238 | + intriParams.nValue = self_->ctx.innerBatch * self_->ctx.convTilingData->orgHixWi; |
| 239 | } else { | 239 | } else { |
| 240 | intriParams.ndNum = self_->ctx.innerBatch; | 240 | intriParams.ndNum = self_->ctx.innerBatch; |
| 241 | intriParams.nValue = realHixWi; | 241 | intriParams.nValue = realHixWi; |
| 242 | - intriParams.srcNdMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCi * | 242 | + intriParams.srcNdMatrixStride = self_->ctx.convTilingData->orgCi * |
| 243 | - self_->ctx.convTilingData->convApiTiling.orgHixWi; | 243 | + self_->ctx.convTilingData->orgHixWi; |
| 244 | intriParams.dstNzNStride = 1; | 244 | intriParams.dstNzNStride = 1; |
| 245 | intriParams.dstNzMatrixStride = | 245 | intriParams.dstNzMatrixStride = |
| 246 | - AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->convApiTiling.orgHixWi, Intf::k0); | 246 | + AlignB(C04_CIN_SIZE * self_->ctx.convTilingData->orgHixWi, Intf::k0); |
| 247 | } | 247 | } |
| 248 | - intriParams.dValue = self_->ctx.convTilingData->convApiTiling.orgCi; | 248 | + intriParams.dValue = self_->ctx.convTilingData->orgCi; |
| 249 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgCi; | 249 | + intriParams.srcDValue = self_->ctx.convTilingData->orgCi; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | __aicore__ inline void SetNd2NzIntriParams(Nd2NzParams &intriParams, uint64_t kAL1Iter) | 252 | __aicore__ inline void SetNd2NzIntriParams(Nd2NzParams &intriParams, uint64_t kAL1Iter) |
| 253 | { | 253 | { |
| 254 | uint32_t al1Ci; | 254 | uint32_t al1Ci; |
| 255 | if constexpr (Intf::isKL1NL0FullLoad) { | 255 | if constexpr (Intf::isKL1NL0FullLoad) { |
| 256 | - al1Ci = self_->ctx.convTilingData->convApiTiling.cinATailInCore; | 256 | + al1Ci = self_->ctx.convTilingData->cinATailInCore; |
| 257 | } else { | 257 | } else { |
| 258 | al1Ci = IsKAL1Tail(kAL1Iter) ? | 258 | al1Ci = IsKAL1Tail(kAL1Iter) ? |
| 259 | - self_->ctx.convTilingData->convApiTiling.cinATailInCore : | 259 | + self_->ctx.convTilingData->cinATailInCore : |
| 260 | - self_->ctx.convTilingData->convApiTiling.cinAInCore; | 260 | + self_->ctx.convTilingData->cinAInCore; |
| 261 | } | 261 | } |
| 262 | intriParams.dValue = al1Ci; | 262 | intriParams.dValue = al1Ci; |
| 263 | intriParams.ndNum = self_->ctx.innerBatch; | 263 | intriParams.ndNum = self_->ctx.innerBatch; |
| 264 | intriParams.nValue = realHixWi; | 264 | intriParams.nValue = realHixWi; |
| 265 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgCi; | 265 | + intriParams.srcDValue = self_->ctx.convTilingData->orgCi; |
| 266 | - intriParams.srcNdMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCi * | 266 | + intriParams.srcNdMatrixStride = self_->ctx.convTilingData->orgCi * |
| 267 | - self_->ctx.convTilingData->convApiTiling.orgHixWi; | 267 | + self_->ctx.convTilingData->orgHixWi; |
| 268 | intriParams.dstNzNStride = 1; | 268 | intriParams.dstNzNStride = 1; |
| 269 | 269 | ||
| 270 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { | 270 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { |
| @@ -279,14 +279,14 @@ private: | |||
| 279 | __aicore__ inline void SetNd2NzIntriParamsInputHWNC(Nd2NzParams &intriParams, uint64_t kAL1Iter) | 279 | __aicore__ inline void SetNd2NzIntriParamsInputHWNC(Nd2NzParams &intriParams, uint64_t kAL1Iter) |
| 280 | { | 280 | { |
| 281 | uint32_t al1Ci = IsKAL1Tail(kAL1Iter) ? | 281 | uint32_t al1Ci = IsKAL1Tail(kAL1Iter) ? |
| 282 | - self_->ctx.convTilingData->convApiTiling.cinATailInCore : | 282 | + self_->ctx.convTilingData->cinATailInCore : |
| 283 | - self_->ctx.convTilingData->convApiTiling.cinAInCore; | 283 | + self_->ctx.convTilingData->cinAInCore; |
| 284 | intriParams.ndNum = self_->ctx.innerBatch; | 284 | intriParams.ndNum = self_->ctx.innerBatch; |
| 285 | intriParams.nValue = realHixWi; | 285 | intriParams.nValue = realHixWi; |
| 286 | intriParams.dValue = al1Ci; | 286 | intriParams.dValue = al1Ci; |
| 287 | - intriParams.srcNdMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCi; | 287 | + intriParams.srcNdMatrixStride = self_->ctx.convTilingData->orgCi; |
| 288 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgCi * | 288 | + intriParams.srcDValue = self_->ctx.convTilingData->orgCi * |
| 289 | - self_->ctx.convTilingData->convRunInfo.batch; | 289 | + self_->ctx.convTilingData->batch; |
| 290 | intriParams.dstNzNStride = 1; | 290 | intriParams.dstNzNStride = 1; |
| 291 | 291 | ||
| 292 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { | 292 | if constexpr (Intf::ConvParam::innerBatch == static_cast<int8_t>(ConvInnerBatch::KERNEL_1X1_MULTI_BATCH)) { |
| @@ -318,7 +318,7 @@ public: | |||
| 318 | { | 318 | { |
| 319 | self_ = self; | 319 | self_ = self; |
| 320 | 320 | ||
| 321 | - isOneByOneKernelScenario = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW == 1 && | 321 | + isOneByOneKernelScenario = self_->ctx.convTilingData->kernelHxkernelW == 1 && |
| 322 | !(AscendC::IsSameType<typename Intf::WeightT, hifloat8_t>::value) && | 322 | !(AscendC::IsSameType<typename Intf::WeightT, hifloat8_t>::value) && |
| 323 | !(AscendC::IsSameType<typename Intf::WeightT, fp8_e4m3fn_t>::value); | 323 | !(AscendC::IsSameType<typename Intf::WeightT, fp8_e4m3fn_t>::value); |
| 324 | } | 324 | } |
| @@ -350,14 +350,14 @@ private: | |||
| 350 | { | 350 | { |
| 351 | uint64_t bL1GmOffset; | 351 | uint64_t bL1GmOffset; |
| 352 | if constexpr (!Intf::hasNL1IterFlag) { | 352 | if constexpr (!Intf::hasNL1IterFlag) { |
| 353 | - bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->convApiTiling.kBL1; | 353 | + bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->kBL1; |
| 354 | } else { | 354 | } else { |
| 355 | bL1GmOffset = | 355 | bL1GmOffset = |
| 356 | - nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 * | 356 | + nBL1Iter * self_->ctx.convTilingData->nBL1 * |
| 357 | - self_->ctx.convTilingData->convApiTiling.coutOffsetBlock + | 357 | + self_->ctx.convTilingData->coutOffsetBlock + |
| 358 | - kBL1Iter * self_->ctx.convTilingData->convApiTiling.kBL1; | 358 | + kBL1Iter * self_->ctx.convTilingData->kBL1; |
| 359 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? | 359 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? |
| 360 | - self_->ctx.nBL1Tail : self_->ctx.convTilingData->convApiTiling.nBL1; | 360 | + self_->ctx.nBL1Tail : self_->ctx.convTilingData->nBL1; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | if (isOneByOneKernelScenario) { | 363 | if (isOneByOneKernelScenario) { |
| @@ -365,11 +365,11 @@ private: | |||
| 365 | intriParams.ndNum = 1; | 365 | intriParams.ndNum = 1; |
| 366 | intriParams.nValue = self_->ctx.currentNBL1; | 366 | intriParams.nValue = self_->ctx.currentNBL1; |
| 367 | intriParams.dValue = kBL1Iter == self_->ctx.maxKBL1Iter ? | 367 | intriParams.dValue = kBL1Iter == self_->ctx.maxKBL1Iter ? |
| 368 | - self_->ctx.kBL1Tail : self_->ctx.convTilingData->convApiTiling.kBL1; | 368 | + self_->ctx.kBL1Tail : self_->ctx.convTilingData->kBL1; |
| 369 | intriParams.srcNdMatrixStride = 0; | 369 | intriParams.srcNdMatrixStride = 0; |
| 370 | intriParams.srcDValue = | 370 | intriParams.srcDValue = |
| 371 | - self_->ctx.convTilingData->convApiTiling.orgCi / self_->ctx.convTilingData->convApiTiling.groups; | 371 | + self_->ctx.convTilingData->orgCi / self_->ctx.convTilingData->groups; |
| 372 | - intriParams.dstNzC0Stride = self_->ctx.convTilingData->convApiTiling.nBL1; | 372 | + intriParams.dstNzC0Stride = self_->ctx.convTilingData->nBL1; |
| 373 | intriParams.dstNzNStride = 1; | 373 | intriParams.dstNzNStride = 1; |
| 374 | intriParams.dstNzMatrixStride = 0; | 374 | intriParams.dstNzMatrixStride = 0; |
| 375 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], intriParams); | 375 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], intriParams); |
| @@ -377,43 +377,43 @@ private: | |||
| 377 | } | 377 | } |
| 378 | Dn2NzParams intriParams; | 378 | Dn2NzParams intriParams; |
| 379 | intriParams.dnNum = self_->ctx.currentNBL1; | 379 | intriParams.dnNum = self_->ctx.currentNBL1; |
| 380 | - intriParams.nValue = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 380 | + intriParams.nValue = self_->ctx.convTilingData->kernelHxkernelW; |
| 381 | intriParams.dValue = kBL1Iter == self_->ctx.maxKBL1Iter ? | 381 | intriParams.dValue = kBL1Iter == self_->ctx.maxKBL1Iter ? |
| 382 | - self_->ctx.convTilingData->convApiTiling.cinBTailInCore : | 382 | + self_->ctx.convTilingData->cinBTailInCore : |
| 383 | - self_->ctx.convTilingData->convApiTiling.cinBInCore; | 383 | + self_->ctx.convTilingData->cinBInCore; |
| 384 | - intriParams.srcDnMatrixStride = self_->ctx.convTilingData->convApiTiling.coutOffsetBlock; | 384 | + intriParams.srcDnMatrixStride = self_->ctx.convTilingData->coutOffsetBlock; |
| 385 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 385 | + intriParams.srcDValue = self_->ctx.convTilingData->kernelHxkernelW; |
| 386 | - intriParams.dstNzC0Stride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * | 386 | + intriParams.dstNzC0Stride = self_->ctx.convTilingData->kernelHxkernelW * |
| 387 | - self_->ctx.convTilingData->convApiTiling.nBL1; | 387 | + self_->ctx.convTilingData->nBL1; |
| 388 | - intriParams.dstNzNStride = self_->ctx.convTilingData->convApiTiling.nBL1; | 388 | + intriParams.dstNzNStride = self_->ctx.convTilingData->nBL1; |
| 389 | intriParams.dstNzMatrixStride = Intf::k0; | 389 | intriParams.dstNzMatrixStride = Intf::k0; |
| 390 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], intriParams); | 390 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], intriParams); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | __aicore__ inline void LoadBL1DataHWC(uint64_t kBL1Iter, uint64_t nBL1Iter) | 393 | __aicore__ inline void LoadBL1DataHWC(uint64_t kBL1Iter, uint64_t nBL1Iter) |
| 394 | { | 394 | { |
| 395 | - uint64_t bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->convApiTiling.cinBInCore * | 395 | + uint64_t bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->cinBInCore * |
| 396 | - self_->ctx.convTilingData->convApiTiling.orgCo; | 396 | + self_->ctx.convTilingData->orgCo; |
| 397 | if constexpr (Intf::hasNL1IterFlag) { | 397 | if constexpr (Intf::hasNL1IterFlag) { |
| 398 | - bL1GmOffset += nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1; | 398 | + bL1GmOffset += nBL1Iter * self_->ctx.convTilingData->nBL1; |
| 399 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? | 399 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? |
| 400 | - self_->ctx.nBL1Tail : self_->ctx.convTilingData->convApiTiling.nBL1; | 400 | + self_->ctx.nBL1Tail : self_->ctx.convTilingData->nBL1; |
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | Dn2NzParams intriParams; | 403 | Dn2NzParams intriParams; |
| 404 | - intriParams.dnNum = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 404 | + intriParams.dnNum = self_->ctx.convTilingData->kernelHxkernelW; |
| 405 | intriParams.nValue = self_->ctx.currentNBL1; | 405 | intriParams.nValue = self_->ctx.currentNBL1; |
| 406 | intriParams.dValue = kBL1Iter == self_->ctx.maxKBL1Iter ? | 406 | intriParams.dValue = kBL1Iter == self_->ctx.maxKBL1Iter ? |
| 407 | - self_->ctx.convTilingData->convApiTiling.cinBTailInCore : | 407 | + self_->ctx.convTilingData->cinBTailInCore : |
| 408 | - self_->ctx.convTilingData->convApiTiling.cinBInCore; | 408 | + self_->ctx.convTilingData->cinBInCore; |
| 409 | intriParams.srcDnMatrixStride = | 409 | intriParams.srcDnMatrixStride = |
| 410 | - self_->ctx.convTilingData->convApiTiling.orgCi / self_->ctx.convTilingData->convApiTiling.groups * | 410 | + self_->ctx.convTilingData->orgCi / self_->ctx.convTilingData->groups * |
| 411 | - self_->ctx.convTilingData->convApiTiling.orgCo; | 411 | + self_->ctx.convTilingData->orgCo; |
| 412 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgCo; | 412 | + intriParams.srcDValue = self_->ctx.convTilingData->orgCo; |
| 413 | - intriParams.dstNzC0Stride = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * | 413 | + intriParams.dstNzC0Stride = self_->ctx.convTilingData->kernelHxkernelW * |
| 414 | - self_->ctx.convTilingData->convApiTiling.nBL1; | 414 | + self_->ctx.convTilingData->nBL1; |
| 415 | intriParams.dstNzNStride = 1; | 415 | intriParams.dstNzNStride = 1; |
| 416 | - intriParams.dstNzMatrixStride = self_->ctx.convTilingData->convApiTiling.nBL1 * Intf::k0; | 416 | + intriParams.dstNzMatrixStride = self_->ctx.convTilingData->nBL1 * Intf::k0; |
| 417 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], intriParams); | 417 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], intriParams); |
| 418 | } | 418 | } |
| 419 | 419 | ||
| @@ -422,80 +422,80 @@ private: | |||
| 422 | uint64_t bL1GmOffset; | 422 | uint64_t bL1GmOffset; |
| 423 | if constexpr (!Intf::hasNL1IterFlag) { | 423 | if constexpr (!Intf::hasNL1IterFlag) { |
| 424 | bL1GmOffset = | 424 | bL1GmOffset = |
| 425 | - self_->ctx.cinBL1Iter * self_->ctx.cinBL1 * self_->ctx.convTilingData->convApiTiling.kernelHxkernelW + | 425 | + self_->ctx.cinBL1Iter * self_->ctx.cinBL1 * self_->ctx.convTilingData->kernelHxkernelW + |
| 426 | - self_->ctx.khBL1Iter * self_->ctx.convTilingData->convApiTiling.khL1 * | 426 | + self_->ctx.khBL1Iter * self_->ctx.convTilingData->khL1 * |
| 427 | - self_->ctx.convTilingData->convApiTiling.kernelW + | 427 | + self_->ctx.convTilingData->kernelW + |
| 428 | - self_->ctx.kwBL1Iter * self_->ctx.convTilingData->convApiTiling.kwL1; | 428 | + self_->ctx.kwBL1Iter * self_->ctx.convTilingData->kwL1; |
| 429 | } else { | 429 | } else { |
| 430 | bL1GmOffset = | 430 | bL1GmOffset = |
| 431 | - nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 * | 431 | + nBL1Iter * self_->ctx.convTilingData->nBL1 * |
| 432 | - self_->ctx.convTilingData->convApiTiling.coutOffsetBlock + | 432 | + self_->ctx.convTilingData->coutOffsetBlock + |
| 433 | - self_->ctx.cinBL1Iter * self_->ctx.cinBL1 * self_->ctx.convTilingData->convApiTiling.kernelHxkernelW + | 433 | + self_->ctx.cinBL1Iter * self_->ctx.cinBL1 * self_->ctx.convTilingData->kernelHxkernelW + |
| 434 | - self_->ctx.khBL1Iter * self_->ctx.convTilingData->convApiTiling.khL1 * | 434 | + self_->ctx.khBL1Iter * self_->ctx.convTilingData->khL1 * |
| 435 | - self_->ctx.convTilingData->convApiTiling.kernelW + | 435 | + self_->ctx.convTilingData->kernelW + |
| 436 | - self_->ctx.kwBL1Iter * self_->ctx.convTilingData->convApiTiling.kwL1; | 436 | + self_->ctx.kwBL1Iter * self_->ctx.convTilingData->kwL1; |
| 437 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? | 437 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? |
| 438 | - self_->ctx.nBL1Tail : self_->ctx.convTilingData->convApiTiling.nBL1; | 438 | + self_->ctx.nBL1Tail : self_->ctx.convTilingData->nBL1; |
| 439 | } | 439 | } |
| 440 | Dn2NzParams intriParams; | 440 | Dn2NzParams intriParams; |
| 441 | intriParams.dnNum = self_->ctx.currentNBL1; | 441 | intriParams.dnNum = self_->ctx.currentNBL1; |
| 442 | - intriParams.nValue = self_->ctx.convTilingData->convApiTiling.kwL1; | 442 | + intriParams.nValue = self_->ctx.convTilingData->kwL1; |
| 443 | intriParams.dValue = self_->ctx.cinBL1Iter == self_->ctx.maxCinBL1Iter ? | 443 | intriParams.dValue = self_->ctx.cinBL1Iter == self_->ctx.maxCinBL1Iter ? |
| 444 | - self_->ctx.convTilingData->convApiTiling.cinBTailInCore : | 444 | + self_->ctx.convTilingData->cinBTailInCore : |
| 445 | - self_->ctx.convTilingData->convApiTiling.cinBInCore; | 445 | + self_->ctx.convTilingData->cinBInCore; |
| 446 | - intriParams.srcDnMatrixStride = self_->ctx.convTilingData->convApiTiling.coutOffsetBlock; | 446 | + intriParams.srcDnMatrixStride = self_->ctx.convTilingData->coutOffsetBlock; |
| 447 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 447 | + intriParams.srcDValue = self_->ctx.convTilingData->kernelHxkernelW; |
| 448 | - intriParams.dstNzC0Stride = self_->ctx.convTilingData->convApiTiling.kwL1 * | 448 | + intriParams.dstNzC0Stride = self_->ctx.convTilingData->kwL1 * |
| 449 | - self_->ctx.convTilingData->convApiTiling.khL1 * | 449 | + self_->ctx.convTilingData->khL1 * |
| 450 | - self_->ctx.convTilingData->convApiTiling.nBL1; | 450 | + self_->ctx.convTilingData->nBL1; |
| 451 | - intriParams.dstNzNStride = self_->ctx.convTilingData->convApiTiling.nBL1; | 451 | + intriParams.dstNzNStride = self_->ctx.convTilingData->nBL1; |
| 452 | intriParams.dstNzMatrixStride = Intf::k0; | 452 | intriParams.dstNzMatrixStride = Intf::k0; |
| 453 | uint64_t bl1DstOffset = 0; | 453 | uint64_t bl1DstOffset = 0; |
| 454 | - for (uint16_t khIterIdx = 0; khIterIdx < self_->ctx.convTilingData->convApiTiling.khL1; khIterIdx++) { | 454 | + for (uint16_t khIterIdx = 0; khIterIdx < self_->ctx.convTilingData->khL1; khIterIdx++) { |
| 455 | - bl1DstOffset = khIterIdx * self_->ctx.convTilingData->convApiTiling.kwL1 * | 455 | + bl1DstOffset = khIterIdx * self_->ctx.convTilingData->kwL1 * |
| 456 | - self_->ctx.convTilingData->convApiTiling.nBL1 * Intf::k0; | 456 | + self_->ctx.convTilingData->nBL1 * Intf::k0; |
| 457 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1[bl1DstOffset], self_->ctx.bgm[bL1GmOffset], intriParams); | 457 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1[bl1DstOffset], self_->ctx.bgm[bL1GmOffset], intriParams); |
| 458 | - bL1GmOffset += self_->ctx.convTilingData->convApiTiling.kernelW; | 458 | + bL1GmOffset += self_->ctx.convTilingData->kernelW; |
| 459 | } | 459 | } |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | __aicore__ inline void LoadBL1DataKernelSplitHWC(uint64_t kBL1Iter, uint64_t nBL1Iter) | 462 | __aicore__ inline void LoadBL1DataKernelSplitHWC(uint64_t kBL1Iter, uint64_t nBL1Iter) |
| 463 | { | 463 | { |
| 464 | uint64_t bL1GmOffset = | 464 | uint64_t bL1GmOffset = |
| 465 | - self_->ctx.cinBL1Iter * self_->ctx.cinBL1 * self_->ctx.convTilingData->convApiTiling.orgCo + | 465 | + self_->ctx.cinBL1Iter * self_->ctx.cinBL1 * self_->ctx.convTilingData->orgCo + |
| 466 | - self_->ctx.khBL1Iter * self_->ctx.convTilingData->convApiTiling.khL1 * | 466 | + self_->ctx.khBL1Iter * self_->ctx.convTilingData->khL1 * |
| 467 | - self_->ctx.convTilingData->convApiTiling.kernelW * self_->ctx.convTilingData->convApiTiling.orgCi / | 467 | + self_->ctx.convTilingData->kernelW * self_->ctx.convTilingData->orgCi / |
| 468 | - self_->ctx.convTilingData->convApiTiling.groups * self_->ctx.convTilingData->convApiTiling.orgCo + | 468 | + self_->ctx.convTilingData->groups * self_->ctx.convTilingData->orgCo + |
| 469 | - self_->ctx.kwBL1Iter * self_->ctx.convTilingData->convApiTiling.kwL1 * | 469 | + self_->ctx.kwBL1Iter * self_->ctx.convTilingData->kwL1 * |
| 470 | - self_->ctx.convTilingData->convApiTiling.orgCi / self_->ctx.convTilingData->convApiTiling.groups * | 470 | + self_->ctx.convTilingData->orgCi / self_->ctx.convTilingData->groups * |
| 471 | - self_->ctx.convTilingData->convApiTiling.orgCo; | 471 | + self_->ctx.convTilingData->orgCo; |
| 472 | if constexpr (Intf::hasNL1IterFlag) { | 472 | if constexpr (Intf::hasNL1IterFlag) { |
| 473 | - bL1GmOffset += nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1; | 473 | + bL1GmOffset += nBL1Iter * self_->ctx.convTilingData->nBL1; |
| 474 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? | 474 | self_->ctx.currentNBL1 = nBL1Iter == self_->ctx.maxNBL1Iter ? |
| 475 | - self_->ctx.nBL1Tail : self_->ctx.convTilingData->convApiTiling.nBL1; | 475 | + self_->ctx.nBL1Tail : self_->ctx.convTilingData->nBL1; |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | Dn2NzParams intriParams; | 478 | Dn2NzParams intriParams; |
| 479 | - intriParams.dnNum = self_->ctx.convTilingData->convApiTiling.kwL1; | 479 | + intriParams.dnNum = self_->ctx.convTilingData->kwL1; |
| 480 | intriParams.nValue = self_->ctx.currentNBL1; | 480 | intriParams.nValue = self_->ctx.currentNBL1; |
| 481 | intriParams.dValue = self_->ctx.cinBL1Iter == self_->ctx.maxCinBL1Iter ? | 481 | intriParams.dValue = self_->ctx.cinBL1Iter == self_->ctx.maxCinBL1Iter ? |
| 482 | - self_->ctx.convTilingData->convApiTiling.cinBTailInCore : | 482 | + self_->ctx.convTilingData->cinBTailInCore : |
| 483 | - self_->ctx.convTilingData->convApiTiling.cinBInCore; | 483 | + self_->ctx.convTilingData->cinBInCore; |
| 484 | - intriParams.srcDnMatrixStride = self_->ctx.convTilingData->convApiTiling.orgCi / | 484 | + intriParams.srcDnMatrixStride = self_->ctx.convTilingData->orgCi / |
| 485 | - self_->ctx.convTilingData->convApiTiling.groups * self_->ctx.convTilingData->convApiTiling.orgCo; | 485 | + self_->ctx.convTilingData->groups * self_->ctx.convTilingData->orgCo; |
| 486 | - intriParams.srcDValue = self_->ctx.convTilingData->convApiTiling.orgCo; | 486 | + intriParams.srcDValue = self_->ctx.convTilingData->orgCo; |
| 487 | - intriParams.dstNzC0Stride = self_->ctx.convTilingData->convApiTiling.khL1 * | 487 | + intriParams.dstNzC0Stride = self_->ctx.convTilingData->khL1 * |
| 488 | - self_->ctx.convTilingData->convApiTiling.kwL1 * self_->ctx.convTilingData->convApiTiling.nBL1; | 488 | + self_->ctx.convTilingData->kwL1 * self_->ctx.convTilingData->nBL1; |
| 489 | intriParams.dstNzNStride = 1; | 489 | intriParams.dstNzNStride = 1; |
| 490 | - intriParams.dstNzMatrixStride = self_->ctx.convTilingData->convApiTiling.nBL1 * Intf::k0; | 490 | + intriParams.dstNzMatrixStride = self_->ctx.convTilingData->nBL1 * Intf::k0; |
| 491 | uint64_t bl1DstOffset = 0; | 491 | uint64_t bl1DstOffset = 0; |
| 492 | - for (uint16_t khIterIdx = 0; khIterIdx < self_->ctx.convTilingData->convApiTiling.khL1; khIterIdx++) { | 492 | + for (uint16_t khIterIdx = 0; khIterIdx < self_->ctx.convTilingData->khL1; khIterIdx++) { |
| 493 | - bl1DstOffset = khIterIdx * self_->ctx.convTilingData->convApiTiling.kwL1 * | 493 | + bl1DstOffset = khIterIdx * self_->ctx.convTilingData->kwL1 * |
| 494 | - self_->ctx.convTilingData->convApiTiling.nBL1 * Intf::k0; | 494 | + self_->ctx.convTilingData->nBL1 * Intf::k0; |
| 495 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1[bl1DstOffset], self_->ctx.bgm[bL1GmOffset], intriParams); | 495 | DataCopy<typename Intf::WeightT>(self_->ctx.bl1[bl1DstOffset], self_->ctx.bgm[bL1GmOffset], intriParams); |
| 496 | bL1GmOffset += | 496 | bL1GmOffset += |
| 497 | - self_->ctx.convTilingData->convApiTiling.kernelW * self_->ctx.convTilingData->convApiTiling.orgCi / | 497 | + self_->ctx.convTilingData->kernelW * self_->ctx.convTilingData->orgCi / |
| 498 | - self_->ctx.convTilingData->convApiTiling.groups * self_->ctx.convTilingData->convApiTiling.orgCo; | 498 | + self_->ctx.convTilingData->groups * self_->ctx.convTilingData->orgCo; |
| 499 | } | 499 | } |
| 500 | } | 500 | } |
| 501 | 501 | ||
| @@ -73,32 +73,32 @@ private: | |||
| 73 | { | 73 | { |
| 74 | if (unlikely(self_->ctx.isFirstIterate)) { | 74 | if (unlikely(self_->ctx.isFirstIterate)) { |
| 75 | // NDDMA Loop0 params | 75 | // NDDMA Loop0 params |
| 76 | - copyParams.loopInfo.loopSize[NDDMA_LOOP0_INDEX] = self_->ctx.convTilingData->convApiTiling.singleCoreCi; | 76 | + copyParams.loopInfo.loopSize[NDDMA_LOOP0_INDEX] = self_->ctx.convTilingData->singleCoreCi; |
| 77 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = | 77 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = |
| 78 | - self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 78 | + self_->ctx.convTilingData->kernelHxkernelW; |
| 79 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP0_INDEX] = 1; | 79 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP0_INDEX] = 1; |
| 80 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP0_INDEX] = | 80 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP0_INDEX] = |
| 81 | - C04_CIN_SIZE - self_->ctx.convTilingData->convApiTiling.singleCoreCi; | 81 | + C04_CIN_SIZE - self_->ctx.convTilingData->singleCoreCi; |
| 82 | // NDDMA Loop1 params | 82 | // NDDMA Loop1 params |
| 83 | - copyParams.loopInfo.loopSize[NDDMA_LOOP1_INDEX] = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 83 | + copyParams.loopInfo.loopSize[NDDMA_LOOP1_INDEX] = self_->ctx.convTilingData->kernelHxkernelW; |
| 84 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = 1; | 84 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = 1; |
| 85 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP1_INDEX] = C04_CIN_SIZE; | 85 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP1_INDEX] = C04_CIN_SIZE; |
| 86 | // NDDMA Loop2 params | 86 | // NDDMA Loop2 params |
| 87 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = | 87 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = |
| 88 | - self_->ctx.convTilingData->convApiTiling.kernelHxkernelW * | 88 | + self_->ctx.convTilingData->kernelHxkernelW * |
| 89 | - self_->ctx.convTilingData->convApiTiling.singleCoreCi; | 89 | + self_->ctx.convTilingData->singleCoreCi; |
| 90 | - copyParams.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = self_->ctx.convTilingData->convApiTiling.kBL1; | 90 | + copyParams.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = self_->ctx.convTilingData->kBL1; |
| 91 | copyParams.constantValue = 0; | 91 | copyParams.constantValue = 0; |
| 92 | } | 92 | } |
| 93 | copyParams.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = self_->ctx.currentUbNStep; | 93 | copyParams.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = self_->ctx.currentUbNStep; |
| 94 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP2_INDEX] = self_->ctx.currentNLoopRpSize; | 94 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP2_INDEX] = self_->ctx.currentNLoopRpSize; |
| 95 | 95 | ||
| 96 | - srcOffset = (self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 96 | + srcOffset = (self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 97 | - self_->ctx.vecNIter * self_->ctx.convTilingData->convApiTiling.bUbNStep) * | 97 | + self_->ctx.vecNIter * self_->ctx.convTilingData->bUbNStep) * |
| 98 | - self_->ctx.convTilingData->convApiTiling.coutOffsetBlock; | 98 | + self_->ctx.convTilingData->coutOffsetBlock; |
| 99 | if constexpr (!Intf::bL1DBFlag) { | 99 | if constexpr (!Intf::bL1DBFlag) { |
| 100 | if (self_->ctx.vecId == 1) { | 100 | if (self_->ctx.vecId == 1) { |
| 101 | - srcOffset += self_->ctx.nBL1Vec0 * self_->ctx.convTilingData->convApiTiling.coutOffsetBlock; | 101 | + srcOffset += self_->ctx.nBL1Vec0 * self_->ctx.convTilingData->coutOffsetBlock; |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| @@ -108,25 +108,25 @@ private: | |||
| 108 | if (unlikely(self_->ctx.isFirstIterate)) { | 108 | if (unlikely(self_->ctx.isFirstIterate)) { |
| 109 | // NDDMA Loop0 params | 109 | // NDDMA Loop0 params |
| 110 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = 1; | 110 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = 1; |
| 111 | - copyParams.loopInfo.loopDstStride[NDDMA_LOOP0_INDEX] = self_->ctx.convTilingData->convApiTiling.kBL1; | 111 | + copyParams.loopInfo.loopDstStride[NDDMA_LOOP0_INDEX] = self_->ctx.convTilingData->kBL1; |
| 112 | // NDDMA Loop1 params | 112 | // NDDMA Loop1 params |
| 113 | - copyParams.loopInfo.loopSize[NDDMA_LOOP1_INDEX] = self_->ctx.convTilingData->convApiTiling.singleCoreCi; | 113 | + copyParams.loopInfo.loopSize[NDDMA_LOOP1_INDEX] = self_->ctx.convTilingData->singleCoreCi; |
| 114 | - copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = self_->ctx.convTilingData->convApiTiling.orgCo; | 114 | + copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = self_->ctx.convTilingData->orgCo; |
| 115 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP1_INDEX] = 1; | 115 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP1_INDEX] = 1; |
| 116 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP1_INDEX] = | 116 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP1_INDEX] = |
| 117 | - C04_CIN_SIZE - self_->ctx.convTilingData->convApiTiling.singleCoreCi; | 117 | + C04_CIN_SIZE - self_->ctx.convTilingData->singleCoreCi; |
| 118 | // NDDMA Loop2 params | 118 | // NDDMA Loop2 params |
| 119 | - copyParams.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = self_->ctx.convTilingData->convApiTiling.kernelHxkernelW; | 119 | + copyParams.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = self_->ctx.convTilingData->kernelHxkernelW; |
| 120 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = | 120 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = |
| 121 | - self_->ctx.convTilingData->convApiTiling.orgCo * self_->ctx.convTilingData->convApiTiling.singleCoreCi; | 121 | + self_->ctx.convTilingData->orgCo * self_->ctx.convTilingData->singleCoreCi; |
| 122 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = C04_CIN_SIZE; | 122 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = C04_CIN_SIZE; |
| 123 | copyParams.constantValue = 0; | 123 | copyParams.constantValue = 0; |
| 124 | } | 124 | } |
| 125 | copyParams.loopInfo.loopSize[NDDMA_LOOP0_INDEX] = self_->ctx.currentUbNStep; | 125 | copyParams.loopInfo.loopSize[NDDMA_LOOP0_INDEX] = self_->ctx.currentUbNStep; |
| 126 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP0_INDEX] = self_->ctx.currentNLoopRpSize; | 126 | copyParams.loopInfo.loopRpSize[NDDMA_LOOP0_INDEX] = self_->ctx.currentNLoopRpSize; |
| 127 | 127 | ||
| 128 | - srcOffset = self_->ctx.nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 + | 128 | + srcOffset = self_->ctx.nBL1Iter * self_->ctx.convTilingData->nBL1 + |
| 129 | - self_->ctx.vecNIter * self_->ctx.convTilingData->convApiTiling.bUbNStep; | 129 | + self_->ctx.vecNIter * self_->ctx.convTilingData->bUbNStep; |
| 130 | if constexpr (!Intf::bL1DBFlag) { | 130 | if constexpr (!Intf::bL1DBFlag) { |
| 131 | if (self_->ctx.vecId == 1) { | 131 | if (self_->ctx.vecId == 1) { |
| 132 | srcOffset += self_->ctx.nBL1Vec0; | 132 | srcOffset += self_->ctx.nBL1Vec0; |
| @@ -159,11 +159,11 @@ public: | |||
| 159 | SetIndex(); | 159 | SetIndex(); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | - uint16_t kLoopTimes = self_->ctx.convTilingData->convApiTiling.kBL1 / Intf::k0; | 162 | + uint16_t kLoopTimes = self_->ctx.convTilingData->kBL1 / Intf::k0; |
| 163 | uint16_t nLoopTimes = self_->ctx.currentUbNStepAilgn / BLOCK_L0_N * CO0_LOOP_TIMES; | 163 | uint16_t nLoopTimes = self_->ctx.currentUbNStepAilgn / BLOCK_L0_N * CO0_LOOP_TIMES; |
| 164 | 164 | ||
| 165 | uint32_t srcKStride = Intf::k0; | 165 | uint32_t srcKStride = Intf::k0; |
| 166 | - uint32_t srcNStride = coPerReg * self_->ctx.convTilingData->convApiTiling.kBL1; | 166 | + uint32_t srcNStride = coPerReg * self_->ctx.convTilingData->kBL1; |
| 167 | uint32_t dstKStride = Intf::k0 * self_->ctx.currentUbNStepAilgn; | 167 | uint32_t dstKStride = Intf::k0 * self_->ctx.currentUbNStepAilgn; |
| 168 | uint32_t dstNStride = Intf::k0 * coPerReg; | 168 | uint32_t dstNStride = Intf::k0 * coPerReg; |
| 169 | 169 | ||
| @@ -213,7 +213,7 @@ private: | |||
| 213 | uint8_t dstOffset = Intf::k0; | 213 | uint8_t dstOffset = Intf::k0; |
| 214 | uint8_t elesPerRepeat = Intf::k0; | 214 | uint8_t elesPerRepeat = Intf::k0; |
| 215 | uint32_t maskL = Intf::k0; | 215 | uint32_t maskL = Intf::k0; |
| 216 | - IndexT nStride = static_cast<IndexT>(self_->ctx.convTilingData->convApiTiling.kBL1); | 216 | + IndexT nStride = static_cast<IndexT>(self_->ctx.convTilingData->kBL1); |
| 217 | 217 | ||
| 218 | __VEC_SCOPE__ | 218 | __VEC_SCOPE__ |
| 219 | { | 219 | { |
| @@ -254,13 +254,13 @@ public: | |||
| 254 | __aicore__ inline void LoadUB2L1() | 254 | __aicore__ inline void LoadUB2L1() |
| 255 | { | 255 | { |
| 256 | if (unlikely(self_->ctx.isFirstIterate)) { | 256 | if (unlikely(self_->ctx.isFirstIterate)) { |
| 257 | - copyParams.blockCount = self_->ctx.convTilingData->convApiTiling.kBL1 / Intf::k0; | 257 | + copyParams.blockCount = self_->ctx.convTilingData->kBL1 / Intf::k0; |
| 258 | copyParams.srcStride = 0; | 258 | copyParams.srcStride = 0; |
| 259 | } | 259 | } |
| 260 | copyParams.blockLen = self_->ctx.currentUbNStepAilgn; | 260 | copyParams.blockLen = self_->ctx.currentUbNStepAilgn; |
| 261 | - copyParams.dstStride = self_->ctx.convTilingData->convApiTiling.nBL1 - self_->ctx.currentUbNStepAilgn; | 261 | + copyParams.dstStride = self_->ctx.convTilingData->nBL1 - self_->ctx.currentUbNStepAilgn; |
| 262 | 262 | ||
| 263 | - uint64_t dstOffset = self_->ctx.vecNIter * self_->ctx.convTilingData->convApiTiling.bUbNStep * Intf::k0; | 263 | + uint64_t dstOffset = self_->ctx.vecNIter * self_->ctx.convTilingData->bUbNStep * Intf::k0; |
| 264 | if (self_->ctx.vecId == 1) { | 264 | if (self_->ctx.vecId == 1) { |
| 265 | if constexpr (Intf::bL1DBFlag) { | 265 | if constexpr (Intf::bL1DBFlag) { |
| 266 | dstOffset += self_->ctx.bL1SpaceSize; | 266 | dstOffset += self_->ctx.bL1SpaceSize; |
| @@ -33,14 +33,14 @@ public: | |||
| 33 | { | 33 | { |
| 34 | self_ = self; | 34 | self_ = self; |
| 35 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { | 35 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { |
| 36 | - srcCiStride = self_->ctx.convTilingData->convApiTiling.orgHixWi * Intf::k0; | 36 | + srcCiStride = self_->ctx.convTilingData->orgHixWi * Intf::k0; |
| 37 | } else if constexpr (Intf::formatFmap == ConvFormat::NHWC) { | 37 | } else if constexpr (Intf::formatFmap == ConvFormat::NHWC) { |
| 38 | srcCiStride = Intf::k0; | 38 | srcCiStride = Intf::k0; |
| 39 | } | 39 | } |
| 40 | srcKhStride = | 40 | srcKhStride = |
| 41 | - self_->ctx.convTilingData->convApiTiling.khUb * self_->ctx.convTilingData->convApiTiling.dilationH; | 41 | + self_->ctx.convTilingData->khUb * self_->ctx.convTilingData->dilationH; |
| 42 | srcKwStride = | 42 | srcKwStride = |
| 43 | - self_->ctx.convTilingData->convApiTiling.kwUb * self_->ctx.convTilingData->convApiTiling.dilationW; | 43 | + self_->ctx.convTilingData->kwUb * self_->ctx.convTilingData->dilationW; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | __aicore__ inline void LoadGM2UB() | 46 | __aicore__ inline void LoadGM2UB() |
| @@ -49,28 +49,28 @@ public: | |||
| 49 | self_->ctx.khAL1Iter = self_->ctx.kAL1Iter / self_->ctx.ddr2L1LoopKw % self_->ctx.ddr2L1LoopKh; | 49 | self_->ctx.khAL1Iter = self_->ctx.kAL1Iter / self_->ctx.ddr2L1LoopKw % self_->ctx.ddr2L1LoopKh; |
| 50 | self_->ctx.cinAL1Iter = (self_->ctx.kAL1Iter / (self_->ctx.ddr2L1LoopKw * self_->ctx.ddr2L1LoopKh)) % | 50 | self_->ctx.cinAL1Iter = (self_->ctx.kAL1Iter / (self_->ctx.ddr2L1LoopKw * self_->ctx.ddr2L1LoopKh)) % |
| 51 | self_->ctx.cinAL1LoopTimes; | 51 | self_->ctx.cinAL1LoopTimes; |
| 52 | - srckhAL1IterOffset = self_->ctx.khAL1Iter * self_->ctx.convTilingData->convApiTiling.dilationH * | 52 | + srckhAL1IterOffset = self_->ctx.khAL1Iter * self_->ctx.convTilingData->dilationH * |
| 53 | - self_->ctx.convTilingData->convApiTiling.khL1 + self_->ctx.vecKhIter * srcKhStride; | 53 | + self_->ctx.convTilingData->khL1 + self_->ctx.vecKhIter * srcKhStride; |
| 54 | - srckwAL1IterOffset = self_->ctx.kwAL1Iter * self_->ctx.convTilingData->convApiTiling.dilationW * | 54 | + srckwAL1IterOffset = self_->ctx.kwAL1Iter * self_->ctx.convTilingData->dilationW * |
| 55 | - self_->ctx.convTilingData->convApiTiling.kwL1 + self_->ctx.vecKwIter * srcKwStride; | 55 | + self_->ctx.convTilingData->kwL1 + self_->ctx.vecKwIter * srcKwStride; |
| 56 | if (unlikely(self_->ctx.isFirstIterate)) { | 56 | if (unlikely(self_->ctx.isFirstIterate)) { |
| 57 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { | 57 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { |
| 58 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = | 58 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = |
| 59 | - self_->ctx.convTilingData->convApiTiling.orgHixWi; | 59 | + self_->ctx.convTilingData->orgHixWi; |
| 60 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = | 60 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = |
| 61 | - self_->ctx.convTilingData->convApiTiling.dilationW; | 61 | + self_->ctx.convTilingData->dilationW; |
| 62 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = | 62 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = |
| 63 | - self_->ctx.convTilingData->convApiTiling.dilationH * | 63 | + self_->ctx.convTilingData->dilationH * |
| 64 | - self_->ctx.convTilingData->convApiTiling.orgWi; | 64 | + self_->ctx.convTilingData->orgWi; |
| 65 | } else { | 65 | } else { |
| 66 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = 1; | 66 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP0_INDEX] = 1; |
| 67 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = | 67 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP1_INDEX] = |
| 68 | - self_->ctx.convTilingData->convApiTiling.dilationW * | 68 | + self_->ctx.convTilingData->dilationW * |
| 69 | - self_->ctx.convTilingData->convApiTiling.orgCi; | 69 | + self_->ctx.convTilingData->orgCi; |
| 70 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = | 70 | copyParams.loopInfo.loopSrcStride[NDDMA_LOOP2_INDEX] = |
| 71 | - self_->ctx.convTilingData->convApiTiling.dilationH * | 71 | + self_->ctx.convTilingData->dilationH * |
| 72 | - self_->ctx.convTilingData->convApiTiling.orgWi * | 72 | + self_->ctx.convTilingData->orgWi * |
| 73 | - self_->ctx.convTilingData->convApiTiling.orgCi; | 73 | + self_->ctx.convTilingData->orgCi; |
| 74 | } | 74 | } |
| 75 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP0_INDEX] = 1; | 75 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP0_INDEX] = 1; |
| 76 | } | 76 | } |
| @@ -90,9 +90,9 @@ public: | |||
| 90 | uint32_t baseOffset = self_->ctx.batchIter * self_->ctx.fmapOneBatchSize + | 90 | uint32_t baseOffset = self_->ctx.batchIter * self_->ctx.fmapOneBatchSize + |
| 91 | self_->ctx.vecCi1Iter * srcCiStride; | 91 | self_->ctx.vecCi1Iter * srcCiStride; |
| 92 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { | 92 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { |
| 93 | - baseOffset += self_->ctx.cinAL1Iter * self_->ctx.convTilingData->convApiTiling.cinOffsetBlockInGM; | 93 | + baseOffset += self_->ctx.cinAL1Iter * self_->ctx.convTilingData->cinOffsetBlockInGM; |
| 94 | if (self_->ctx.vecId == 1) { | 94 | if (self_->ctx.vecId == 1) { |
| 95 | - baseOffset += self_->ctx.currentVec0Ci * self_->ctx.convTilingData->convApiTiling.orgHixWi; | 95 | + baseOffset += self_->ctx.currentVec0Ci * self_->ctx.convTilingData->orgHixWi; |
| 96 | } | 96 | } |
| 97 | } else { | 97 | } else { |
| 98 | baseOffset += self_->ctx.cinAL1Iter * self_->ctx.cinAL1; | 98 | baseOffset += self_->ctx.cinAL1Iter * self_->ctx.cinAL1; |
| @@ -101,13 +101,13 @@ public: | |||
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | - hoL1Idx = self_->ctx.hoAL1Iter * self_->ctx.convTilingData->convApiTiling.hoL1 * | 104 | + hoL1Idx = self_->ctx.hoAL1Iter * self_->ctx.convTilingData->hoL1 * |
| 105 | - self_->ctx.convTilingData->convApiTiling.strideH; | 105 | + self_->ctx.convTilingData->strideH; |
| 106 | - woL1Idx = self_->ctx.woAL1Iter * self_->ctx.convTilingData->convApiTiling.woL1 * | 106 | + woL1Idx = self_->ctx.woAL1Iter * self_->ctx.convTilingData->woL1 * |
| 107 | - self_->ctx.convTilingData->convApiTiling.strideW; | 107 | + self_->ctx.convTilingData->strideW; |
| 108 | uint32_t dstHoStride = AlignB(self_->ctx.currentWoL1, BLOCK_L0_M) * Intf::k0; | 108 | uint32_t dstHoStride = AlignB(self_->ctx.currentWoL1, BLOCK_L0_M) * Intf::k0; |
| 109 | uint32_t dstKwStride = self_->ctx.currentHoL1xWoL1Align * Intf::k0; | 109 | uint32_t dstKwStride = self_->ctx.currentHoL1xWoL1Align * Intf::k0; |
| 110 | - uint32_t dstKhStride = dstKwStride * self_->ctx.convTilingData->convApiTiling.kwUb; | 110 | + uint32_t dstKhStride = dstKwStride * self_->ctx.convTilingData->kwUb; |
| 111 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP1_INDEX] = dstKwStride; | 111 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP1_INDEX] = dstKwStride; |
| 112 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = dstKhStride; | 112 | copyParams.loopInfo.loopDstStride[NDDMA_LOOP2_INDEX] = dstKhStride; |
| 113 | uint32_t srcOffset = 0; | 113 | uint32_t srcOffset = 0; |
| @@ -118,17 +118,17 @@ public: | |||
| 118 | continue; | 118 | continue; |
| 119 | } | 119 | } |
| 120 | copyParams.loopInfo.loopSize[NDDMA_LOOP1_INDEX] = | 120 | copyParams.loopInfo.loopSize[NDDMA_LOOP1_INDEX] = |
| 121 | - self_->ctx.convTilingData->convApiTiling.kwUb - kwUbOnPadLeft - kwUbOnPadRight; | 121 | + self_->ctx.convTilingData->kwUb - kwUbOnPadLeft - kwUbOnPadRight; |
| 122 | copyParams.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = | 122 | copyParams.loopInfo.loopSize[NDDMA_LOOP2_INDEX] = |
| 123 | - self_->ctx.convTilingData->convApiTiling.khUb - khUbOnPadTop - khUbOnPadBottom; | 123 | + self_->ctx.convTilingData->khUb - khUbOnPadTop - khUbOnPadBottom; |
| 124 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { | 124 | if constexpr (Intf::formatFmap == ConvFormat::NCHW) { |
| 125 | srcOffset = baseOffset + | 125 | srcOffset = baseOffset + |
| 126 | - hIdxWithPadStart * self_->ctx.convTilingData->convApiTiling.orgWi + wIdxWithPadStart; | 126 | + hIdxWithPadStart * self_->ctx.convTilingData->orgWi + wIdxWithPadStart; |
| 127 | } else { | 127 | } else { |
| 128 | srcOffset = baseOffset + | 128 | srcOffset = baseOffset + |
| 129 | - hIdxWithPadStart * self_->ctx.convTilingData->convApiTiling.orgWi * | 129 | + hIdxWithPadStart * self_->ctx.convTilingData->orgWi * |
| 130 | - self_->ctx.convTilingData->convApiTiling.orgCi + | 130 | + self_->ctx.convTilingData->orgCi + |
| 131 | - wIdxWithPadStart * self_->ctx.convTilingData->convApiTiling.orgCi; | 131 | + wIdxWithPadStart * self_->ctx.convTilingData->orgCi; |
| 132 | } | 132 | } |
| 133 | uint32_t dstOffset = hoIdx * dstHoStride + woIdx * Intf::k0; | 133 | uint32_t dstOffset = hoIdx * dstHoStride + woIdx * Intf::k0; |
| 134 | if (unlikely(khUbOnPadTop != 0)) { | 134 | if (unlikely(khUbOnPadTop != 0)) { |
| @@ -151,32 +151,32 @@ private: | |||
| 151 | 151 | ||
| 152 | __aicore__ inline bool IsOnPadAndUpdateKernelSize(uint16_t hoIdx, uint16_t woIdx) | 152 | __aicore__ inline bool IsOnPadAndUpdateKernelSize(uint16_t hoIdx, uint16_t woIdx) |
| 153 | { | 153 | { |
| 154 | - hIdxWithPadStart = hoL1Idx + hoIdx * self_->ctx.convTilingData->convApiTiling.strideH + srckhAL1IterOffset; | 154 | + hIdxWithPadStart = hoL1Idx + hoIdx * self_->ctx.convTilingData->strideH + srckhAL1IterOffset; |
| 155 | - wIdxWithPadStart = woL1Idx + woIdx * self_->ctx.convTilingData->convApiTiling.strideW + srckwAL1IterOffset; | 155 | + wIdxWithPadStart = woL1Idx + woIdx * self_->ctx.convTilingData->strideW + srckwAL1IterOffset; |
| 156 | 156 | ||
| 157 | hIdxWithPadStartOrg = hIdxWithPadStart + self_->ctx.hiStartPos; | 157 | hIdxWithPadStartOrg = hIdxWithPadStart + self_->ctx.hiStartPos; |
| 158 | wIdxWithPadStartOrg = wIdxWithPadStart + self_->ctx.wiStartPos; | 158 | wIdxWithPadStartOrg = wIdxWithPadStart + self_->ctx.wiStartPos; |
| 159 | hIdxWithPadStart = self_->ctx.hiStartPos < 0 ? hIdxWithPadStart + self_->ctx.hiStartPos : hIdxWithPadStart; | 159 | hIdxWithPadStart = self_->ctx.hiStartPos < 0 ? hIdxWithPadStart + self_->ctx.hiStartPos : hIdxWithPadStart; |
| 160 | wIdxWithPadStart = self_->ctx.wiStartPos < 0 ? wIdxWithPadStart + self_->ctx.wiStartPos : wIdxWithPadStart; | 160 | wIdxWithPadStart = self_->ctx.wiStartPos < 0 ? wIdxWithPadStart + self_->ctx.wiStartPos : wIdxWithPadStart; |
| 161 | - hIdxWithPadEndOrg = hIdxWithPadStartOrg + (self_->ctx.convTilingData->convApiTiling.khUb - 1) * | 161 | + hIdxWithPadEndOrg = hIdxWithPadStartOrg + (self_->ctx.convTilingData->khUb - 1) * |
| 162 | - self_->ctx.convTilingData->convApiTiling.dilationH; | 162 | + self_->ctx.convTilingData->dilationH; |
| 163 | - wIdxWithPadEndOrg = wIdxWithPadStartOrg + (self_->ctx.convTilingData->convApiTiling.kwUb - 1) * | 163 | + wIdxWithPadEndOrg = wIdxWithPadStartOrg + (self_->ctx.convTilingData->kwUb - 1) * |
| 164 | - self_->ctx.convTilingData->convApiTiling.dilationW; | 164 | + self_->ctx.convTilingData->dilationW; |
| 165 | 165 | ||
| 166 | kwUbOnPadLeft = 0; | 166 | kwUbOnPadLeft = 0; |
| 167 | kwUbOnPadRight = 0; | 167 | kwUbOnPadRight = 0; |
| 168 | khUbOnPadTop = 0; | 168 | khUbOnPadTop = 0; |
| 169 | khUbOnPadBottom = 0; | 169 | khUbOnPadBottom = 0; |
| 170 | if (unlikely(wIdxWithPadEndOrg < 0 || | 170 | if (unlikely(wIdxWithPadEndOrg < 0 || |
| 171 | - wIdxWithPadStartOrg >= static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi) || | 171 | + wIdxWithPadStartOrg >= static_cast<int64_t>(self_->ctx.convTilingData->orgWi) || |
| 172 | hIdxWithPadEndOrg < 0 || | 172 | hIdxWithPadEndOrg < 0 || |
| 173 | - hIdxWithPadStartOrg >= static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi))) { | 173 | + hIdxWithPadStartOrg >= static_cast<int64_t>(self_->ctx.convTilingData->orgHi))) { |
| 174 | return true; | 174 | return true; |
| 175 | } | 175 | } |
| 176 | if (likely(hIdxWithPadStartOrg >= 0 && | 176 | if (likely(hIdxWithPadStartOrg >= 0 && |
| 177 | - hIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi) && | 177 | + hIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->orgHi) && |
| 178 | wIdxWithPadStartOrg >= 0 && | 178 | wIdxWithPadStartOrg >= 0 && |
| 179 | - wIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi))) { | 179 | + wIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->orgWi))) { |
| 180 | return false; | 180 | return false; |
| 181 | } | 181 | } |
| 182 | UpdateRealKernelSize(); | 182 | UpdateRealKernelSize(); |
| @@ -188,44 +188,44 @@ private: | |||
| 188 | { | 188 | { |
| 189 | // update real khUbSize in fmap. | 189 | // update real khUbSize in fmap. |
| 190 | if (hIdxWithPadStartOrg < 0 && | 190 | if (hIdxWithPadStartOrg < 0 && |
| 191 | - hIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi)) { | 191 | + hIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->orgHi)) { |
| 192 | - khUbOnPadTop = (-hIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->convApiTiling.dilationH + 1; | 192 | + khUbOnPadTop = (-hIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->dilationH + 1; |
| 193 | - hIdxWithPadStart += khUbOnPadTop * self_->ctx.convTilingData->convApiTiling.dilationH; | 193 | + hIdxWithPadStart += khUbOnPadTop * self_->ctx.convTilingData->dilationH; |
| 194 | } else if (hIdxWithPadStartOrg >= 0 && | 194 | } else if (hIdxWithPadStartOrg >= 0 && |
| 195 | - hIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi)) { | 195 | + hIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->orgHi)) { |
| 196 | uint32_t khUbOnFmapCountTemp = | 196 | uint32_t khUbOnFmapCountTemp = |
| 197 | - (static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi) - 1 - hIdxWithPadStartOrg) / | 197 | + (static_cast<int64_t>(self_->ctx.convTilingData->orgHi) - 1 - hIdxWithPadStartOrg) / |
| 198 | - self_->ctx.convTilingData->convApiTiling.dilationH + 1; | 198 | + self_->ctx.convTilingData->dilationH + 1; |
| 199 | - khUbOnPadBottom = self_->ctx.convTilingData->convApiTiling.khUb - khUbOnFmapCountTemp; | 199 | + khUbOnPadBottom = self_->ctx.convTilingData->khUb - khUbOnFmapCountTemp; |
| 200 | } else if (hIdxWithPadStartOrg < 0 && | 200 | } else if (hIdxWithPadStartOrg < 0 && |
| 201 | - hIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi)) { | 201 | + hIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->orgHi)) { |
| 202 | - khUbOnPadTop = (-hIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->convApiTiling.dilationH + 1; | 202 | + khUbOnPadTop = (-hIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->dilationH + 1; |
| 203 | - hIdxWithPadStart += khUbOnPadTop * self_->ctx.convTilingData->convApiTiling.dilationH; | 203 | + hIdxWithPadStart += khUbOnPadTop * self_->ctx.convTilingData->dilationH; |
| 204 | uint32_t khUbOnPadTopAndFmapCountTemp = | 204 | uint32_t khUbOnPadTopAndFmapCountTemp = |
| 205 | - (static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgHi) - 1 - hIdxWithPadStartOrg) / | 205 | + (static_cast<int64_t>(self_->ctx.convTilingData->orgHi) - 1 - hIdxWithPadStartOrg) / |
| 206 | - self_->ctx.convTilingData->convApiTiling.dilationH + 1; | 206 | + self_->ctx.convTilingData->dilationH + 1; |
| 207 | - khUbOnPadBottom = self_->ctx.convTilingData->convApiTiling.khUb - khUbOnPadTopAndFmapCountTemp; | 207 | + khUbOnPadBottom = self_->ctx.convTilingData->khUb - khUbOnPadTopAndFmapCountTemp; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | // update real kwUbSize in fmap. | 210 | // update real kwUbSize in fmap. |
| 211 | if (wIdxWithPadStartOrg < 0 && | 211 | if (wIdxWithPadStartOrg < 0 && |
| 212 | - wIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi)) { | 212 | + wIdxWithPadEndOrg < static_cast<int64_t>(self_->ctx.convTilingData->orgWi)) { |
| 213 | - kwUbOnPadLeft = (-wIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->convApiTiling.dilationW + 1; | 213 | + kwUbOnPadLeft = (-wIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->dilationW + 1; |
| 214 | - wIdxWithPadStart += kwUbOnPadLeft * self_->ctx.convTilingData->convApiTiling.dilationW; | 214 | + wIdxWithPadStart += kwUbOnPadLeft * self_->ctx.convTilingData->dilationW; |
| 215 | } else if (wIdxWithPadStartOrg >= 0 && | 215 | } else if (wIdxWithPadStartOrg >= 0 && |
| 216 | - wIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi)) { | 216 | + wIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->orgWi)) { |
| 217 | uint32_t kwUbOnFmapCountTemp = | 217 | uint32_t kwUbOnFmapCountTemp = |
| 218 | - (static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi) - 1 - wIdxWithPadStartOrg) / | 218 | + (static_cast<int64_t>(self_->ctx.convTilingData->orgWi) - 1 - wIdxWithPadStartOrg) / |
| 219 | - self_->ctx.convTilingData->convApiTiling.dilationW + 1; | 219 | + self_->ctx.convTilingData->dilationW + 1; |
| 220 | - kwUbOnPadRight = self_->ctx.convTilingData->convApiTiling.kwUb - kwUbOnFmapCountTemp; | 220 | + kwUbOnPadRight = self_->ctx.convTilingData->kwUb - kwUbOnFmapCountTemp; |
| 221 | } else if (wIdxWithPadStartOrg < 0 && | 221 | } else if (wIdxWithPadStartOrg < 0 && |
| 222 | - wIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi)) { | 222 | + wIdxWithPadEndOrg >= static_cast<int64_t>(self_->ctx.convTilingData->orgWi)) { |
| 223 | - kwUbOnPadLeft = (-wIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->convApiTiling.dilationW + 1; | 223 | + kwUbOnPadLeft = (-wIdxWithPadStartOrg - 1) / self_->ctx.convTilingData->dilationW + 1; |
| 224 | - wIdxWithPadStart += kwUbOnPadLeft * self_->ctx.convTilingData->convApiTiling.dilationW; | 224 | + wIdxWithPadStart += kwUbOnPadLeft * self_->ctx.convTilingData->dilationW; |
| 225 | uint32_t kwUbOnPadLeftAndFmapCountTemp = | 225 | uint32_t kwUbOnPadLeftAndFmapCountTemp = |
| 226 | - (static_cast<int64_t>(self_->ctx.convTilingData->convApiTiling.orgWi) - 1 - wIdxWithPadStartOrg) / | 226 | + (static_cast<int64_t>(self_->ctx.convTilingData->orgWi) - 1 - wIdxWithPadStartOrg) / |
| 227 | - self_->ctx.convTilingData->convApiTiling.dilationW + 1; | 227 | + self_->ctx.convTilingData->dilationW + 1; |
| 228 | - kwUbOnPadRight = self_->ctx.convTilingData->convApiTiling.kwUb - kwUbOnPadLeftAndFmapCountTemp; | 228 | + kwUbOnPadRight = self_->ctx.convTilingData->kwUb - kwUbOnPadLeftAndFmapCountTemp; |
| 229 | } | 229 | } |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -269,21 +269,21 @@ public: | |||
| 269 | self_ = self; | 269 | self_ = self; |
| 270 | 270 | ||
| 271 | dstStrideBase = | 271 | dstStrideBase = |
| 272 | - (self_->ctx.convTilingData->convApiTiling.kwL1 - self_->ctx.convTilingData->convApiTiling.kwUb) * Intf::k0; | 272 | + (self_->ctx.convTilingData->kwL1 - self_->ctx.convTilingData->kwUb) * Intf::k0; |
| 273 | ci1StrideBase = | 273 | ci1StrideBase = |
| 274 | - self_->ctx.convTilingData->convApiTiling.khL1 * self_->ctx.convTilingData->convApiTiling.kwL1 * Intf::k0; | 274 | + self_->ctx.convTilingData->khL1 * self_->ctx.convTilingData->kwL1 * Intf::k0; |
| 275 | khStrideBase = | 275 | khStrideBase = |
| 276 | - self_->ctx.convTilingData->convApiTiling.khUb * self_->ctx.convTilingData->convApiTiling.kwL1 * Intf::k0; | 276 | + self_->ctx.convTilingData->khUb * self_->ctx.convTilingData->kwL1 * Intf::k0; |
| 277 | - kwStrideBase = self_->ctx.convTilingData->convApiTiling.kwUb * Intf::k0; | 277 | + kwStrideBase = self_->ctx.convTilingData->kwUb * Intf::k0; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | __aicore__ inline void LoadUB2L1() | 280 | __aicore__ inline void LoadUB2L1() |
| 281 | { | 281 | { |
| 282 | if (unlikely(self_->ctx.isFirstIterate)) { | 282 | if (unlikely(self_->ctx.isFirstIterate)) { |
| 283 | - copyParams.blockCount = self_->ctx.convTilingData->convApiTiling.khUb; | 283 | + copyParams.blockCount = self_->ctx.convTilingData->khUb; |
| 284 | copyParams.srcStride = 0; | 284 | copyParams.srcStride = 0; |
| 285 | } | 285 | } |
| 286 | - copyParams.blockLen = self_->ctx.currentHoL1xWoL1Align * self_->ctx.convTilingData->convApiTiling.kwUb; | 286 | + copyParams.blockLen = self_->ctx.currentHoL1xWoL1Align * self_->ctx.convTilingData->kwUb; |
| 287 | copyParams.dstStride = self_->ctx.currentHoL1xWoL1Align * dstStrideBase; | 287 | copyParams.dstStride = self_->ctx.currentHoL1xWoL1Align * dstStrideBase; |
| 288 | 288 | ||
| 289 | uint64_t dstOffset = self_->ctx.vecCi1Iter * self_->ctx.currentHoL1xWoL1Align * ci1StrideBase + | 289 | uint64_t dstOffset = self_->ctx.vecCi1Iter * self_->ctx.currentHoL1xWoL1Align * ci1StrideBase + |
| @@ -33,14 +33,14 @@ public: | |||
| 33 | self_ = self; | 33 | self_ = self; |
| 34 | maxNBL1Iter_ = self->ctx.maxNBL1Iter; | 34 | maxNBL1Iter_ = self->ctx.maxNBL1Iter; |
| 35 | maxKBL1Iter_ = self->ctx.maxKBL1Iter; | 35 | maxKBL1Iter_ = self->ctx.maxKBL1Iter; |
| 36 | - orgCoAlignN0 = AlignB(self_->ctx.convTilingData->convApiTiling.orgCo, BLOCK_L0_N); | 36 | + orgCoAlignN0 = AlignB(self_->ctx.convTilingData->orgCo, BLOCK_L0_N); |
| 37 | if constexpr (Intf::groupOptNZFlag) { | 37 | if constexpr (Intf::groupOptNZFlag) { |
| 38 | self->ctx.coPerGroup = | 38 | self->ctx.coPerGroup = |
| 39 | - self->ctx.convTilingData->convApiTiling.orgCo / self->ctx.convTilingData->convApiTiling.groups; | 39 | + self->ctx.convTilingData->orgCo / self->ctx.convTilingData->groups; |
| 40 | - self->ctx.coOpt = self->ctx.coPerGroup * self->ctx.convTilingData->convApiTiling.enlarge; | 40 | + self->ctx.coOpt = self->ctx.coPerGroup * self->ctx.convTilingData->enlarge; |
| 41 | orgCoAlignN0 = AlignB(self->ctx.coOpt, BLOCK_L0_N); | 41 | orgCoAlignN0 = AlignB(self->ctx.coOpt, BLOCK_L0_N); |
| 42 | } else { | 42 | } else { |
| 43 | - orgCoAlignN0 = AlignB(self_->ctx.convTilingData->convApiTiling.orgCo, BLOCK_L0_N); | 43 | + orgCoAlignN0 = AlignB(self_->ctx.convTilingData->orgCo, BLOCK_L0_N); |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| @@ -53,18 +53,18 @@ public: | |||
| 53 | { | 53 | { |
| 54 | uint64_t bL1GmOffset; | 54 | uint64_t bL1GmOffset; |
| 55 | if constexpr (!Intf::hasNL1IterFlag) { | 55 | if constexpr (!Intf::hasNL1IterFlag) { |
| 56 | - bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->convApiTiling.kBL1 * orgCoAlignN0; | 56 | + bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->kBL1 * orgCoAlignN0; |
| 57 | } else { | 57 | } else { |
| 58 | - bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->convApiTiling.kBL1 * orgCoAlignN0 + | 58 | + bL1GmOffset = kBL1Iter * self_->ctx.convTilingData->kBL1 * orgCoAlignN0 + |
| 59 | - nBL1Iter * self_->ctx.convTilingData->convApiTiling.nBL1 * Intf::k0; | 59 | + nBL1Iter * self_->ctx.convTilingData->nBL1 * Intf::k0; |
| 60 | self_->ctx.currentNBL1 = nBL1Iter == maxNBL1Iter_ ? | 60 | self_->ctx.currentNBL1 = nBL1Iter == maxNBL1Iter_ ? |
| 61 | - self_->ctx.nBL1Tail : self_->ctx.convTilingData->convApiTiling.nBL1; | 61 | + self_->ctx.nBL1Tail : self_->ctx.convTilingData->nBL1; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | - uint64_t currentKBL1 = self_->ctx.convTilingData->convApiTiling.kBL1; | 64 | + uint64_t currentKBL1 = self_->ctx.convTilingData->kBL1; |
| 65 | if constexpr (!Intf::c04Flag) { | 65 | if constexpr (!Intf::c04Flag) { |
| 66 | currentKBL1 = kBL1Iter == maxKBL1Iter_ ? | 66 | currentKBL1 = kBL1Iter == maxKBL1Iter_ ? |
| 67 | - self_->ctx.kBL1AlignK0Tail : self_->ctx.convTilingData->convApiTiling.kBL1; | 67 | + self_->ctx.kBL1AlignK0Tail : self_->ctx.convTilingData->kBL1; |
| 68 | } | 68 | } |
| 69 | DataCopyPadExtParams<typename Intf::WeightT> padParams; | 69 | DataCopyPadExtParams<typename Intf::WeightT> padParams; |
| 70 | DataCopyExtParams dataCopyParams; | 70 | DataCopyExtParams dataCopyParams; |
| @@ -76,7 +76,7 @@ public: | |||
| 76 | dataCopyParams.blockCount = CeilDiv(currentKBL1, Intf::k0); | 76 | dataCopyParams.blockCount = CeilDiv(currentKBL1, Intf::k0); |
| 77 | dataCopyParams.blockLen = self_->ctx.currentNBL1 * C0_SIZE; | 77 | dataCopyParams.blockLen = self_->ctx.currentNBL1 * C0_SIZE; |
| 78 | dataCopyParams.srcStride = (orgCoAlignN0 - self_->ctx.currentNBL1) * C0_SIZE; | 78 | dataCopyParams.srcStride = (orgCoAlignN0 - self_->ctx.currentNBL1) * C0_SIZE; |
| 79 | - dataCopyParams.dstStride = self_->ctx.convTilingData->convApiTiling.nBL1 - self_->ctx.currentNBL1; | 79 | + dataCopyParams.dstStride = self_->ctx.convTilingData->nBL1 - self_->ctx.currentNBL1; |
| 80 | } | 80 | } |
| 81 | DataCopyPad<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], dataCopyParams, padParams); | 81 | DataCopyPad<typename Intf::WeightT>(self_->ctx.bl1, self_->ctx.bgm[bL1GmOffset], dataCopyParams, padParams); |
| 82 | } | 82 | } |