Merged
AllGatherMMV2 MX量化支持传入右矩阵非转置 #10488
wuziyuAdd on Aug 24
AllGatherMMV2 MX量化支持传入右矩阵非转置 #10488
Merged
Merged fromDeleted :pass_preintocann/ops-transformermaster
Total: 5 files changed+75-55
| @@ -92,9 +92,7 @@ __aicore__ inline constexpr uint32_t GetVectorRegSize() | |||
| 92 | 92 | ||
| 93 | class Mc2QuantBmmAswBlock { | 93 | class Mc2QuantBmmAswBlock { |
| 94 | public: | 94 | public: |
| 95 | - __aicore__ inline Mc2QuantBmmAswBlock() | 95 | + __aicore__ inline Mc2QuantBmmAswBlock() {} |
| 96 | - { | ||
| 97 | - } | ||
| 98 | __aicore__ inline void Init(const DequantBmm::Mc2QuantBatchMatmulV3TilingDataParams *tilingData, uint32_t blockIdx); | 96 | __aicore__ inline void Init(const DequantBmm::Mc2QuantBatchMatmulV3TilingDataParams *tilingData, uint32_t blockIdx); |
| 99 | __aicore__ inline void UpdateBasicIndex(uint64_t roundIdx); | 97 | __aicore__ inline void UpdateBasicIndex(uint64_t roundIdx); |
| 100 | __aicore__ inline void UpdateBasicIndex4AL1FullLoad(uint64_t roundIdx); | 98 | __aicore__ inline void UpdateBasicIndex4AL1FullLoad(uint64_t roundIdx); |
| @@ -197,6 +195,9 @@ __aicore__ inline void Mc2QuantBmmAswBlock::UpdateBlockParams(uint64_t roundIdx) | |||
| 197 | singleCoreNSplit = DequantBmm::Align(singleCoreNSplit, static_cast<uint64_t>(K0_INT8)); | 195 | singleCoreNSplit = DequantBmm::Align(singleCoreNSplit, static_cast<uint64_t>(K0_INT8)); |
| 198 | } | 196 | } |
| 199 | } | 197 | } |
| 198 | + if (tilingData_->adaptiveSlidingWin.alignNTailSplit) { | ||
| 199 | + singleCoreNSplit = DequantBmm::Align(singleCoreNSplit, static_cast<uint64_t>(BMM_BLOCK_NUM)); | ||
| 200 | + } | ||
| 200 | uint64_t mSplitIdx = (blockIdx_ % params_.totalTailTile) % tilingData_->adaptiveSlidingWin.mTailTile; | 201 | uint64_t mSplitIdx = (blockIdx_ % params_.totalTailTile) % tilingData_->adaptiveSlidingWin.mTailTile; |
| 201 | uint64_t nSplitIdx = (blockIdx_ % params_.totalTailTile) / tilingData_->adaptiveSlidingWin.mTailTile; | 202 | uint64_t nSplitIdx = (blockIdx_ % params_.totalTailTile) / tilingData_->adaptiveSlidingWin.mTailTile; |
| 202 | params_.mSplitAddrOffset = mSplitIdx * singleCoreMSplit; | 203 | params_.mSplitAddrOffset = mSplitIdx * singleCoreMSplit; |
| @@ -245,6 +246,9 @@ __aicore__ inline void Mc2QuantBmmAswBlock::UpdateBlockParams4AL1FullLoad(uint64 | |||
| 245 | singleCoreNSplit = DequantBmm::Align(singleCoreNSplit, static_cast<uint64_t>(K0_INT8)); | 246 | singleCoreNSplit = DequantBmm::Align(singleCoreNSplit, static_cast<uint64_t>(K0_INT8)); |
| 246 | } | 247 | } |
| 247 | } | 248 | } |
| 249 | + if (tilingData_->adaptiveSlidingWin.alignNTailSplit) { | ||
| 250 | + singleCoreNSplit = DequantBmm::Align(singleCoreNSplit, static_cast<uint64_t>(BMM_BLOCK_NUM)); | ||
| 251 | + } | ||
| 248 | uint64_t mSplitIdx = blockIdx_ % params_.mCnt; | 252 | uint64_t mSplitIdx = blockIdx_ % params_.mCnt; |
| 249 | uint64_t nSplitIdx = blockIdx_ / params_.mCnt % tilingData_->adaptiveSlidingWin.nTailTile; | 253 | uint64_t nSplitIdx = blockIdx_ / params_.mCnt % tilingData_->adaptiveSlidingWin.nTailTile; |
| 250 | params_.mSplitAddrOffset = mSplitIdx * singleCoreMSplit; | 254 | params_.mSplitAddrOffset = mSplitIdx * singleCoreMSplit; |
| @@ -74,6 +74,7 @@ struct Mc2L2cacheTileParams { | |||
| 74 | struct Mc2SlidingWindowParams { | 74 | struct Mc2SlidingWindowParams { |
| 75 | uint32_t mTailTile = 0; | 75 | uint32_t mTailTile = 0; |
| 76 | uint32_t nTailTile = 0; | 76 | uint32_t nTailTile = 0; |
| 77 | + uint32_t alignNTailSplit = 0; | ||
| 77 | }; | 78 | }; |
| 78 | #pragma pack(pop) | 79 | #pragma pack(pop) |
| 79 | 80 | ||
| @@ -341,7 +341,7 @@ aclnnStatus aclnnAllGatherMatmulV2( | |||
| 341 | - x1、x2:的数据类型支持FLOAT16、BFLOAT16、FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1。 | 341 | - x1、x2:的数据类型支持FLOAT16、BFLOAT16、FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1。 |
| 342 | - bias:如果x1的数据类型是FLOAT16、BFLOAT16,则bias的数据类型必须为FLOAT16、BFLOAT16。如果x1的数据类型是FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1时,在pertensor和mx量化场景下,bias的数据类型必须为FLOAT。在perblock场景下,仅支持输入为nullptr。 | 342 | - bias:如果x1的数据类型是FLOAT16、BFLOAT16,则bias的数据类型必须为FLOAT16、BFLOAT16。如果x1的数据类型是FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1时,在pertensor和mx量化场景下,bias的数据类型必须为FLOAT。在perblock场景下,仅支持输入为nullptr。 |
| 343 | - x1Scale:当x1和x2数据类型为FLOAT16、BFLOAT16时,仅支持输入为nullptr。在pertensor场景下,shape为[1]。在perblock场景下,shape为[ceilDiv(m, 128), ceilDiv(k, 128)]。在pertensor和perblock场景下,数据类型支持FLOAT。在mx量化场景下,数据类型为FLOAT8_E8M0,shape为(m, ceilDiv(k, 64), 2)。 | 343 | - x1Scale:当x1和x2数据类型为FLOAT16、BFLOAT16时,仅支持输入为nullptr。在pertensor场景下,shape为[1]。在perblock场景下,shape为[ceilDiv(m, 128), ceilDiv(k, 128)]。在pertensor和perblock场景下,数据类型支持FLOAT。在mx量化场景下,数据类型为FLOAT8_E8M0,shape为(m, ceilDiv(k, 64), 2)。 |
| 344 | - - x2Scale:当x1和x2数据类型为FLOAT16、BFLOAT16时,仅支持输入为nullptr。在pertensor场景下,shape为[1]。在perblock场景下,shape为[ceilDiv(k, 128), ceilDiv(n, 128)]。在pertensor和perblock场景下,数据类型支持FLOAT。在mx场景下,数据类型为FLOAT8_E8M0,shape为(n, ceilDiv(k, 64), 2),仅支持转置场景。 | 344 | + - x2Scale:当x1和x2数据类型为FLOAT16、BFLOAT16时,仅支持输入为nullptr。在pertensor场景下,shape为[1]。在perblock场景下,shape为[ceilDiv(k, 128), ceilDiv(n, 128)]。在pertensor和perblock场景下,数据类型支持FLOAT。在mx场景下,数据类型为FLOAT8_E8M0,转置场景下shape为(n, ceilDiv(k, 64), 2),非转置场景下shape为(ceilDiv(k, 64), n, 2)。 |
| 345 | - commMode:当前版本仅支持输入“ai_cpu”或“ccu”。 | 345 | - commMode:当前版本仅支持输入“ai_cpu”或“ccu”。 |
| 346 | - output:如果x1类型为FLOAT16、BFLOAT16,则output类型与x1保持一致。如果x1类型为FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1,则数据类型支持FLOAT16、BFLOAT16、FLOAT。 | 346 | - output:如果x1类型为FLOAT16、BFLOAT16,则output类型与x1保持一致。如果x1类型为FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1,则数据类型支持FLOAT16、BFLOAT16、FLOAT。 |
| 347 | - gatherOut:数据类型支持FLOAT16、BFLOAT16、FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1。 | 347 | - gatherOut:数据类型支持FLOAT16、BFLOAT16、FLOAT8_E4M3FN、FLOAT8_E5M2、HIFLOAT8、FLOAT4_E2M1。 |
| @@ -447,7 +447,7 @@ aclnnStatus aclnnAllGatherMatmulV2( | |||
| 447 | - 当x1、x2的数据类型为FLOAT16/BFLOAT16/HIFLOAT8/FLOAT4_E2M1时,x1和x2数据类型需要保持一致。 | 447 | - 当x1、x2的数据类型为FLOAT16/BFLOAT16/HIFLOAT8/FLOAT4_E2M1时,x1和x2数据类型需要保持一致。 |
| 448 | - 当x1、x2数据类型为FLOAT8_E4M3FN/FLOAT8_E5M2时,x1和x2数据类型可以为其中一种。 | 448 | - 当x1、x2数据类型为FLOAT8_E4M3FN/FLOAT8_E5M2时,x1和x2数据类型可以为其中一种。 |
| 449 | - 当x1、x2数据类型为FLOAT16/BFLOAT16/HIFLOAT8/FLOAT8_E4M3FN/FLOAT8_E5M2时,x2矩阵支持转置/不转置场景,x1矩阵只支持不转置场景。 | 449 | - 当x1、x2数据类型为FLOAT16/BFLOAT16/HIFLOAT8/FLOAT8_E4M3FN/FLOAT8_E5M2时,x2矩阵支持转置/不转置场景,x1矩阵只支持不转置场景。 |
| 450 | - - 当x1、x2数据类型为FLOAT4_E2M1时,x2矩阵只支持转置场景,x1矩阵只支持不转置场景,且k轴需要为偶数。 | 450 | + - 当x1、x2数据类型为FLOAT4_E2M1时,x2矩阵支持转置/不转置场景,x1矩阵只支持不转置场景,k轴需要为偶数,且当x2矩阵非转置时,n轴也需要为偶数。 |
| 451 | - 当groupSize取值为549764202624,bias必须为空。 | 451 | - 当groupSize取值为549764202624,bias必须为空。 |
| 452 | - 支持2、4、8、16、32、64卡。 | 452 | - 支持2、4、8、16、32、64卡。 |
| 453 | - 支持CCU通信引擎和AICPU通信引擎,CCU仅支持单机UB域内互联,AICPU可支持跨机UB域内互联。 | 453 | - 支持CCU通信引擎和AICPU通信引擎,CCU仅支持单机UB域内互联,AICPU可支持跨机UB域内互联。 |
| @@ -155,10 +155,12 @@ ge::graphStatus AllGatherQuantBmmTiling::CheckMXFP4Input() | |||
| 155 | OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "kValue", std::to_string(args_.kValue).c_str(), | 155 | OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "kValue", std::to_string(args_.kValue).c_str(), |
| 156 | "The value of K must be even in mxfp4 scene"), | 156 | "The value of K must be even in mxfp4 scene"), |
| 157 | return ge::GRAPH_FAILED); | 157 | return ge::GRAPH_FAILED); |
| 158 | - OP_TILING_CHECK((!args_.isBTrans), | 158 | + // mxfp4: N must be even when x2 is not transposed |
| 159 | - OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "BTrans", std::to_string(args_.isBTrans).c_str(), | 159 | + OP_TILING_CHECK( |
| 160 | - "x2 only support transpose"), | 160 | + (!args_.isBTrans) && (args_.nValue % EVEN_ALIGN != 0), |
| 161 | - return ge::GRAPH_FAILED); | 161 | + OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "nValue", std::to_string(args_.nValue).c_str(), |
| 162 | + "The value of N must be even when x2 is not transposed in mxfp4 scene"), | ||
| 163 | + return ge::GRAPH_FAILED); | ||
| 162 | OP_TILING_CHECK((scaleInv1Desc->GetDataType() != ge::DataType::DT_FLOAT8_E8M0), | 164 | OP_TILING_CHECK((scaleInv1Desc->GetDataType() != ge::DataType::DT_FLOAT8_E8M0), |
| 163 | OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( | 165 | OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON( |
| 164 | opName_, "scale1", (Ops::Base::ToString(scaleInv1Desc->GetDataType())).c_str(), | 166 | opName_, "scale1", (Ops::Base::ToString(scaleInv1Desc->GetDataType())).c_str(), |
| @@ -262,43 +264,43 @@ ge::graphStatus AllGatherQuantBmmTiling::CheckMXFPScaleInput() | |||
| 262 | "scale2FirstDim=%lu, scale2SecondDim=%lu, scale2ThirdDim=%lu, mValue=%lu, ceilKAlign=%lu, nValue=%lu.", | 264 | "scale2FirstDim=%lu, scale2SecondDim=%lu, scale2ThirdDim=%lu, mValue=%lu, ceilKAlign=%lu, nValue=%lu.", |
| 263 | scale1FirstDim, scale1SecondDim, scale1ThirdDim, scale2FirstDim, scale2SecondDim, scale2ThirdDim, | 265 | scale1FirstDim, scale1SecondDim, scale1ThirdDim, scale2FirstDim, scale2SecondDim, scale2ThirdDim, |
| 264 | args_.mValue, ceilKAlign, args_.nValue); | 266 | args_.mValue, ceilKAlign, args_.nValue); |
| 265 | - OP_TILING_CHECK((scale1FirstDim != args_.mValue) || (scale1SecondDim != ceilKAlign) || | 267 | + OP_TILING_CHECK( |
| 266 | - (scale1ThirdDim != EVEN_ALIGN), | 268 | + (scale1FirstDim != args_.mValue) || (scale1SecondDim != ceilKAlign) || (scale1ThirdDim != EVEN_ALIGN), |
| 267 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( | 269 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 268 | - opName_, "x1Scale", | 270 | + opName_, "x1Scale", |
| 269 | - (std::string("[") + std::to_string(scale1FirstDim) + ", " + std::to_string(scale1SecondDim) + | 271 | + (std::string("[") + std::to_string(scale1FirstDim) + ", " + std::to_string(scale1SecondDim) + ", " + |
| 270 | - ", " + std::to_string(scale1ThirdDim) + "]") | 272 | + std::to_string(scale1ThirdDim) + "]") |
| 271 | - .c_str(), | 273 | + .c_str(), |
| 272 | - (std::string("The shape of x1Scale must be [") + std::to_string(args_.mValue) + ", " + | 274 | + (std::string("The shape of x1Scale must be [") + std::to_string(args_.mValue) + ", " + |
| 273 | - std::to_string(ceilKAlign) + ", " + std::to_string(EVEN_ALIGN) + "]") | 275 | + std::to_string(ceilKAlign) + ", " + std::to_string(EVEN_ALIGN) + "]") |
| 274 | - .c_str()), | 276 | + .c_str()), |
| 275 | - return ge::GRAPH_FAILED); | 277 | + return ge::GRAPH_FAILED); |
| 276 | 278 | ||
| 277 | bool isTransB = *context_->GetAttrs()->GetAttrPointer<bool>(IS_TRANS_B); | 279 | bool isTransB = *context_->GetAttrs()->GetAttrPointer<bool>(IS_TRANS_B); |
| 278 | if (isTransB) { | 280 | if (isTransB) { |
| 279 | - OP_TILING_CHECK((scale2FirstDim != args_.nValue) || (scale2SecondDim != ceilKAlign) || | 281 | + OP_TILING_CHECK( |
| 280 | - (scale2ThirdDim != EVEN_ALIGN), | 282 | + (scale2FirstDim != args_.nValue) || (scale2SecondDim != ceilKAlign) || (scale2ThirdDim != EVEN_ALIGN), |
| 281 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( | 283 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 282 | - opName_, "x2Scale", | 284 | + opName_, "x2Scale", |
| 283 | - (std::string("[") + std::to_string(scale2FirstDim) + ", " + | 285 | + (std::string("[") + std::to_string(scale2FirstDim) + ", " + std::to_string(scale2SecondDim) + ", " + |
| 284 | - std::to_string(scale2SecondDim) + ", " + std::to_string(scale2ThirdDim) + "]") | 286 | + std::to_string(scale2ThirdDim) + "]") |
| 285 | - .c_str(), | 287 | + .c_str(), |
| 286 | - (std::string("The shape of x2Scale must be [") + std::to_string(args_.nValue) + ", " + | 288 | + (std::string("The shape of x2Scale must be [") + std::to_string(args_.nValue) + ", " + |
| 287 | - std::to_string(ceilKAlign) + ", " + std::to_string(EVEN_ALIGN) + "]") | 289 | + std::to_string(ceilKAlign) + ", " + std::to_string(EVEN_ALIGN) + "]") |
| 288 | - .c_str()), | 290 | + .c_str()), |
| 289 | - return ge::GRAPH_FAILED); | 291 | + return ge::GRAPH_FAILED); |
| 290 | } else { | 292 | } else { |
| 291 | - OP_TILING_CHECK((scale2FirstDim != ceilKAlign) || (scale2SecondDim != args_.nValue) || | 293 | + OP_TILING_CHECK( |
| 292 | - (scale2ThirdDim != EVEN_ALIGN), | 294 | + (scale2FirstDim != ceilKAlign) || (scale2SecondDim != args_.nValue) || (scale2ThirdDim != EVEN_ALIGN), |
| 293 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( | 295 | + OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 294 | - opName_, "x2Scale", | 296 | + opName_, "x2Scale", |
| 295 | - (std::string("[") + std::to_string(scale2FirstDim) + ", " + | 297 | + (std::string("[") + std::to_string(scale2FirstDim) + ", " + std::to_string(scale2SecondDim) + ", " + |
| 296 | - std::to_string(scale2SecondDim) + ", " + std::to_string(scale2ThirdDim) + "]") | 298 | + std::to_string(scale2ThirdDim) + "]") |
| 297 | - .c_str(), | 299 | + .c_str(), |
| 298 | - (std::string("The shape of x2Scale must be [") + std::to_string(ceilKAlign) + ", " + | 300 | + (std::string("The shape of x2Scale must be [") + std::to_string(ceilKAlign) + ", " + |
| 299 | - std::to_string(args_.nValue) + ", " + std::to_string(EVEN_ALIGN) + "]") | 301 | + std::to_string(args_.nValue) + ", " + std::to_string(EVEN_ALIGN) + "]") |
| 300 | - .c_str()), | 302 | + .c_str()), |
| 301 | - return ge::GRAPH_FAILED); | 303 | + return ge::GRAPH_FAILED); |
| 302 | } | 304 | } |
| 303 | scale1kSpaceSize_ = args_.rankDim * scale1FirstDim * scale1SecondDim * sizeof(ge::DT_FLOAT8_E8M0); | 305 | scale1kSpaceSize_ = args_.rankDim * scale1FirstDim * scale1SecondDim * sizeof(ge::DT_FLOAT8_E8M0); |
| 304 | OP_LOGI(opName_, "scale1kSpaceSize_=%lu.", scale1kSpaceSize_); | 306 | OP_LOGI(opName_, "scale1kSpaceSize_=%lu.", scale1kSpaceSize_); |
| @@ -334,7 +336,7 @@ ge::graphStatus AllGatherQuantBmmTiling::SetQuantScene() | |||
| 334 | auto scaleInv1Desc = context_->GetOptionalInputDesc(SCALE_INV1); | 336 | auto scaleInv1Desc = context_->GetOptionalInputDesc(SCALE_INV1); |
| 335 | auto scaleInv2Desc = context_->GetOptionalInputDesc(SCALE_INV2); | 337 | auto scaleInv2Desc = context_->GetOptionalInputDesc(SCALE_INV2); |
| 336 | OP_TILING_CHECK(isFp4_ && ((scaleInv1Shape->GetStorageShape().GetDimNum() != DIM_NUM_IS_THREE) || | 338 | OP_TILING_CHECK(isFp4_ && ((scaleInv1Shape->GetStorageShape().GetDimNum() != DIM_NUM_IS_THREE) || |
| 337 | - (scaleInv2Shape->GetStorageShape().GetDimNum() != DIM_NUM_IS_THREE)), | 339 | + (scaleInv2Shape->GetStorageShape().GetDimNum() != DIM_NUM_IS_THREE)), |
| 338 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( | 340 | OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON( |
| 339 | opName_, "x1Scale and x2Scale", | 341 | opName_, "x1Scale and x2Scale", |
| 340 | (std::to_string(scaleInv1Shape->GetStorageShape().GetDimNum()) + "D and " + | 342 | (std::to_string(scaleInv1Shape->GetStorageShape().GetDimNum()) + "D and " + |
| @@ -425,12 +427,12 @@ ge::graphStatus AllGatherQuantBmmTiling::CheckInputValid() | |||
| 425 | .c_str(), | 427 | .c_str(), |
| 426 | "The dtypes of scale1 and scale2 must be the same"), | 428 | "The dtypes of scale1 and scale2 must be the same"), |
| 427 | return ge::GRAPH_FAILED); | 429 | return ge::GRAPH_FAILED); |
| 428 | - OP_TILING_CHECK((args_.geAType == ge::DataType::DT_HIFLOAT8) && | 430 | + OP_TILING_CHECK( |
| 429 | - (scaleInv1Desc->GetDataType() != ge::DataType::DT_FLOAT), | 431 | + (args_.geAType == ge::DataType::DT_HIFLOAT8) && (scaleInv1Desc->GetDataType() != ge::DataType::DT_FLOAT), |
| 430 | - OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "scale1", | 432 | + OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "scale1", |
| 431 | - Ops::Base::ToString(scaleInv1Desc->GetDataType()).c_str(), | 433 | + Ops::Base::ToString(scaleInv1Desc->GetDataType()).c_str(), |
| 432 | - "The dtype of scale1 must be float32"), | 434 | + "The dtype of scale1 must be float32"), |
| 433 | - return ge::GRAPH_FAILED); | 435 | + return ge::GRAPH_FAILED); |
| 434 | 436 | ||
| 435 | OP_TILING_CHECK( | 437 | OP_TILING_CHECK( |
| 436 | (((scaleInv1Desc->GetDataType() != ge::DataType::DT_FLOAT) && | 438 | (((scaleInv1Desc->GetDataType() != ge::DataType::DT_FLOAT) && |
| @@ -731,7 +733,6 @@ CutResult AllGatherQuantBmmTiling::GetTilingResult() | |||
| 731 | return result; | 733 | return result; |
| 732 | } | 734 | } |
| 733 | 735 | ||
| 734 | - | ||
| 735 | Mc2Tiling::RCSTiling &AllGatherQuantBmmTiling::MutableRCSTilingDataA5() | 736 | Mc2Tiling::RCSTiling &AllGatherQuantBmmTiling::MutableRCSTilingDataA5() |
| 736 | { | 737 | { |
| 737 | return allGatherMatmulTilingDataFp8_->param; | 738 | return allGatherMatmulTilingDataFp8_->param; |
| @@ -805,6 +806,10 @@ ge::graphStatus AllGatherQuantBmmTiling::DoAdaptSlidWindowTiling() | |||
| 805 | if (args_.nValue != 0) { | 806 | if (args_.nValue != 0) { |
| 806 | AllGatherQuantBmmHelper mmLocalTile(*this, allGatherMatmulTilingDataFp8_->quantBmmv3LocalTiling, true); | 807 | AllGatherQuantBmmHelper mmLocalTile(*this, allGatherMatmulTilingDataFp8_->quantBmmv3LocalTiling, true); |
| 807 | MC2_CHECK_LOG_RET(opName_, mmLocalTile.DoTiling()); | 808 | MC2_CHECK_LOG_RET(opName_, mmLocalTile.DoTiling()); |
| 809 | + if (isFp4_ && !args_.isBTrans) { | ||
| 810 | + OP_LOGI(opName_, "enable alignNTailSplit for local tiling"); | ||
| 811 | + MutableTCubeLocalTilingWindowParam().alignNTailSplit = 1; | ||
| 812 | + } | ||
| 808 | } | 813 | } |
| 809 | args_.mValue = (quantMmMode_ == mc2tiling::Mc2QuantMode::PERTENSOR_MODE) ? | 814 | args_.mValue = (quantMmMode_ == mc2tiling::Mc2QuantMode::PERTENSOR_MODE) ? |
| 810 | (tileMValue_ * (args_.rankDim - 1) * (MutableRCSTilingDataA5().tileCnt)) : | 815 | (tileMValue_ * (args_.rankDim - 1) * (MutableRCSTilingDataA5().tileCnt)) : |
| @@ -814,6 +819,10 @@ ge::graphStatus AllGatherQuantBmmTiling::DoAdaptSlidWindowTiling() | |||
| 814 | // 当N=0时,跳过matmul tiling,避免shape检查失败 | 819 | // 当N=0时,跳过matmul tiling,避免shape检查失败 |
| 815 | if (args_.nValue != 0) { | 820 | if (args_.nValue != 0) { |
| 816 | MC2_CHECK_LOG_RET(opName_, mmTile.DoTiling()); | 821 | MC2_CHECK_LOG_RET(opName_, mmTile.DoTiling()); |
| 822 | + if (isFp4_ && !args_.isBTrans) { | ||
| 823 | + OP_LOGI(opName_, "enable alignNTailSplit for tile tiling"); | ||
| 824 | + MutableTCubeTileTilingWindowParam().alignNTailSplit = 1; | ||
| 825 | + } | ||
| 817 | } | 826 | } |
| 818 | if (quantMmMode_ == mc2tiling::Mc2QuantMode::PERBLOCK_MODE) { | 827 | if (quantMmMode_ == mc2tiling::Mc2QuantMode::PERBLOCK_MODE) { |
| 819 | MutableTCubeTileTilingData().M = tileMValue_; | 828 | MutableTCubeTileTilingData().M = tileMValue_; |
| @@ -830,6 +839,10 @@ ge::graphStatus AllGatherQuantBmmTiling::DoAdaptSlidWindowTiling() | |||
| 830 | // 当N=0时,跳过matmul tiling,避免shape检查失败 | 839 | // 当N=0时,跳过matmul tiling,避免shape检查失败 |
| 831 | if (args_.nValue != 0) { | 840 | if (args_.nValue != 0) { |
| 832 | MC2_CHECK_LOG_RET(opName_, mmTail.DoTiling()); | 841 | MC2_CHECK_LOG_RET(opName_, mmTail.DoTiling()); |
| 842 | + if (isFp4_ && !args_.isBTrans) { | ||
| 843 | + OP_LOGI(opName_, "enable alignNTailSplit for tail tiling"); | ||
| 844 | + MutableTCubeTailTilingWindowParam().alignNTailSplit = 1; | ||
| 845 | + } | ||
| 833 | } | 846 | } |
| 834 | if (quantMmMode_ == mc2tiling::Mc2QuantMode::PERBLOCK_MODE) { | 847 | if (quantMmMode_ == mc2tiling::Mc2QuantMode::PERBLOCK_MODE) { |
| 835 | MutableTCubeTailTilingData().M = tailMValue_; | 848 | MutableTCubeTailTilingData().M = tailMValue_; |
| @@ -840,7 +853,8 @@ ge::graphStatus AllGatherQuantBmmTiling::DoAdaptSlidWindowTiling() | |||
| 840 | } | 853 | } |
| 841 | 854 | ||
| 842 | AllGatherQuantBmmTiling::AllGatherQuantBmmTiling(gert::TilingContext *context) | 855 | AllGatherQuantBmmTiling::AllGatherQuantBmmTiling(gert::TilingContext *context) |
| 843 | - : AllGatherMatmulTilingBase(context), allGatherMatmulTilingDataFp8_(&allGatherMatmulTilingDataFp8Self_) | 856 | + : AllGatherMatmulTilingBase(context), |
| 857 | + allGatherMatmulTilingDataFp8_(&allGatherMatmulTilingDataFp8Self_) | ||
| 844 | { | 858 | { |
| 845 | allGatherMatmulTilingDataFp8_ = context_->GetTilingData<AllGatherMatmulTilingDataFp8>(); | 859 | allGatherMatmulTilingDataFp8_ = context_->GetTilingData<AllGatherMatmulTilingDataFp8>(); |
| 846 | } | 860 | } |
| @@ -1031,9 +1045,9 @@ void AllGatherQuantBmmHelper::PrintTilingInputParam(Mc2QuantBatchMatmulInfo &qua | |||
| 1031 | AllGatherQuantBmmHelper::AllGatherQuantBmmHelper(AllGatherQuantBmmTiling &allGatherQuantBmmTiling, | 1045 | AllGatherQuantBmmHelper::AllGatherQuantBmmHelper(AllGatherQuantBmmTiling &allGatherQuantBmmTiling, |
| 1032 | DequantBmm::Mc2QuantBatchMatmulV3TilingDataParams &data, bool isLocal) | 1046 | DequantBmm::Mc2QuantBatchMatmulV3TilingDataParams &data, bool isLocal) |
| 1033 | : Mc2AdaptiveSlidingWindowTiling(allGatherQuantBmmTiling.context_, &data), | 1047 | : Mc2AdaptiveSlidingWindowTiling(allGatherQuantBmmTiling.context_, &data), |
| 1034 | - tilingProcesser_(allGatherQuantBmmTiling), isLocal_(isLocal) | 1048 | + tilingProcesser_(allGatherQuantBmmTiling), |
| 1035 | -{ | 1049 | + isLocal_(isLocal) |
| 1036 | -} | 1050 | +{} |
| 1037 | // 注册Tiling类 | 1051 | // 注册Tiling类 |
| 1038 | REGISTER_TILING_TEMPLATE_WITH_ARCH(AllGatherMatmulV2, AllGatherQuantBmmTiling, static_cast<int32_t>(NpuArch::DAV_3510), | 1052 | REGISTER_TILING_TEMPLATE_WITH_ARCH(AllGatherMatmulV2, AllGatherQuantBmmTiling, static_cast<int32_t>(NpuArch::DAV_3510), |
| 1039 | 1); | 1053 | 1); |
| @@ -102,7 +102,8 @@ ut_mxfp4_e2m1_e8m0_y_fp16_rank8_k8192_with_bias_950,SUCCESS,512 8192,FLOAT4_E2M1 | |||
| 102 | ut_mxfp4_e2m1_e8m0_y_fp16_rank2_k256_with_bias_950,SUCCESS,512 256,FLOAT4_E2M1,ND,128 256,FLOAT4_E2M1,ND,128,FLOAT,ND,512 4 2,FLOAT8_E8M0,ND,128 4 2,FLOAT8_E8M0,ND,,,,1024 128,FLOAT16,ND,1024 256,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,2,0,4295032864,0,0,FLOAT16,ai_cpu,Ascend950,32,262144,322, | 102 | ut_mxfp4_e2m1_e8m0_y_fp16_rank2_k256_with_bias_950,SUCCESS,512 256,FLOAT4_E2M1,ND,128 256,FLOAT4_E2M1,ND,128,FLOAT,ND,512 4 2,FLOAT8_E8M0,ND,128 4 2,FLOAT8_E8M0,ND,,,,1024 128,FLOAT16,ND,1024 256,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,2,0,4295032864,0,0,FLOAT16,ai_cpu,Ascend950,32,262144,322, |
| 103 | ut_mxfp4_k_odd_257_fail_950,FAILED,512 257,FLOAT4_E2M1,ND,128 257,FLOAT4_E2M1,ND,,,,512 5 2,FLOAT8_E8M0,ND,128 5 2,FLOAT8_E8M0,ND,,,,4096 128,FLOAT16,ND,4096 257,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, | 103 | ut_mxfp4_k_odd_257_fail_950,FAILED,512 257,FLOAT4_E2M1,ND,128 257,FLOAT4_E2M1,ND,,,,512 5 2,FLOAT8_E8M0,ND,128 5 2,FLOAT8_E8M0,ND,,,,4096 128,FLOAT16,ND,4096 257,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, |
| 104 | ut_mxfp4_k_not_mul32_272_fail_950,SUCCESS,512 272,FLOAT4_E2M1,ND,128 272,FLOAT4_E2M1,ND,,,,512 5 2,FLOAT8_E8M0,ND,128 5 2,FLOAT8_E8M0,ND,,,,4096 128,FLOAT16,ND,4096 272,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,330, | 104 | ut_mxfp4_k_not_mul32_272_fail_950,SUCCESS,512 272,FLOAT4_E2M1,ND,128 272,FLOAT4_E2M1,ND,,,,512 5 2,FLOAT8_E8M0,ND,128 5 2,FLOAT8_E8M0,ND,,,,4096 128,FLOAT16,ND,4096 272,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,330, |
| 105 | -ut_mxfp4_trans_b_false_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,8192 1280,FLOAT4_E2M1,ND,,,,512 128 2,FLOAT8_E8M0,ND,128 1280 2,FLOAT8_E8M0,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,0,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, | 105 | +ut_mxfp4_trans_b_false_succ_950,SUCCESS,512 8192,FLOAT4_E2M1,ND,8192 1280,FLOAT4_E2M1,ND,,,,512 128 2,FLOAT8_E8M0,ND,128 1280 2,FLOAT8_E8M0,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,0,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,328, |
| 106 | +ut_mxfp4_trans_b_false_n_odd_1281_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,8192 1281,FLOAT4_E2M1,ND,,,,512 128 2,FLOAT8_E8M0,ND,128 1281 2,FLOAT8_E8M0,ND,,,,4096 1281,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,0,0,0,8,0,4295032864,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, | ||
| 106 | ut_mxfp4_x2_fp8_dtype_mismatch_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,1280 8192,FLOAT8_E4M3FN,ND,,,,1,FLOAT8_E8M0,ND,1,FLOAT8_E8M0,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,0,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, | 107 | ut_mxfp4_x2_fp8_dtype_mismatch_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,1280 8192,FLOAT8_E4M3FN,ND,,,,1,FLOAT8_E8M0,ND,1,FLOAT8_E8M0,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,0,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, |
| 107 | ut_mxfp4_x1scale_float_not_e8m0_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,1280 8192,FLOAT4_E2M1,ND,,,,1,FLOAT,ND,1,FLOAT8_E8M0,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,0,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, | 108 | ut_mxfp4_x1scale_float_not_e8m0_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,1280 8192,FLOAT4_E2M1,ND,,,,1,FLOAT,ND,1,FLOAT8_E8M0,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,0,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, |
| 108 | ut_mxfp4_x2scale_float_not_e8m0_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,1280 8192,FLOAT4_E2M1,ND,,,,1,FLOAT8_E8M0,ND,1,FLOAT,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,0,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, | 109 | ut_mxfp4_x2scale_float_not_e8m0_fail_950,FAILED,512 8192,FLOAT4_E2M1,ND,1280 8192,FLOAT4_E2M1,ND,,,,1,FLOAT8_E8M0,ND,1,FLOAT,ND,,,,4096 1280,FLOAT16,ND,4096 8192,FLOAT4_E2M1,ND,,,,hcclCom,0,1,0,0,8,0,0,0,0,FLOAT,ai_cpu,Ascend950,32,262144,0, |