已合并
LI&QLI&QSFA&SFA err msg fix #9198
jerry_ming创建于 7月27日
LI&QLI&QSFA&SFA err msg fix #9198
已合并
共 8 个文件变更+85-108
Mattention/kv_quant_sparse_flash_attention/op_host/kv_quant_sparse_flash_attention_infershape.cpp+4-8
| @@ -32,10 +32,8 @@ constexpr uint32_t DIM_NUM_4 = 4; | |||
| 32 | 32 | ||
| 33 | ge::graphStatus InferShapeKvQuantSparseFlashAttention(gert::InferShapeContext *context) | 33 | ge::graphStatus InferShapeKvQuantSparseFlashAttention(gert::InferShapeContext *context) |
| 34 | { | 34 | { |
| 35 | - OP_CHECK_IF(context == nullptr, | 35 | + OP_CHECK_IF(context == nullptr, OP_LOGE("KvQuantSparseFlashAttention", "InferShapeContext is nullptr"), |
| 36 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("KvQuantSparseFlashAttention", "InferShapeContext", | 36 | + return ge::GRAPH_FAILED); |
| 37 | - "InferShapeContext is nullptr"), | ||
| 38 | - return ge::GRAPH_FAILED); | ||
| 39 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INPUT_INDEX); | 37 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INPUT_INDEX); |
| 40 | OP_CHECK_NULL_WITH_CONTEXT(context, queryShape); | 38 | OP_CHECK_NULL_WITH_CONTEXT(context, queryShape); |
| 41 | gert::Shape *attentionOutShape = context->GetOutputShape(0); | 39 | gert::Shape *attentionOutShape = context->GetOutputShape(0); |
| @@ -69,10 +67,8 @@ ge::graphStatus InferShapeKvQuantSparseFlashAttention(gert::InferShapeContext *c | |||
| 69 | 67 | ||
| 70 | ge::graphStatus InferDataTypeKvQuantSparseFlashAttention(gert::InferDataTypeContext *context) | 68 | ge::graphStatus InferDataTypeKvQuantSparseFlashAttention(gert::InferDataTypeContext *context) |
| 71 | { | 69 | { |
| 72 | - OP_CHECK_IF(context == nullptr, | 70 | + OP_CHECK_IF(context == nullptr, OP_LOGE("KvQuantSparseFlashAttention", "InferShapeContext is nullptr"), |
| 73 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("KvQuantSparseFlashAttention", "InferShapeContext", | 71 | + return ge::GRAPH_FAILED); |
| 74 | - "InferShapeContext is nullptr"), | ||
| 75 | - return ge::GRAPH_FAILED); | ||
| 76 | const auto inputDataType = context->GetInputDataType(QUERY_INPUT_INDEX); | 72 | const auto inputDataType = context->GetInputDataType(QUERY_INPUT_INDEX); |
| 77 | context->SetOutputDataType(0, inputDataType); | 73 | context->SetOutputDataType(0, inputDataType); |
| 78 | return ge::GRAPH_SUCCESS; | 74 | return ge::GRAPH_SUCCESS; |
| @@ -869,8 +869,7 @@ ge::graphStatus QSFATilingCheck::CheckBlockTable() const | |||
| 869 | { | 869 | { |
| 870 | if (kvStorageMode_ != KvStorageMode::PAGE_ATTENTION) { | 870 | if (kvStorageMode_ != KvStorageMode::PAGE_ATTENTION) { |
| 871 | OP_CHECK_IF(opParamInfo_.blockTable.tensor != nullptr, | 871 | OP_CHECK_IF(opParamInfo_.blockTable.tensor != nullptr, |
| 872 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, BLOCK_TABLE_NAME.c_str(), | 872 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, BLOCK_TABLE_NAME.c_str(), |
| 873 | - Ops::Base::ToString(opParamInfo_.blockTable.tensor->GetStorageShape()).c_str(), | ||
| 874 | "When the layout_kv is " + QSFALayoutToSerialString(kvLayout_) + ", block_table should be null"), | 873 | "When the layout_kv is " + QSFALayoutToSerialString(kvLayout_) + ", block_table should be null"), |
| 875 | return ge::GRAPH_FAILED); | 874 | return ge::GRAPH_FAILED); |
| 876 | return ge::GRAPH_SUCCESS; | 875 | return ge::GRAPH_SUCCESS; |
| @@ -982,10 +981,10 @@ ge::graphStatus QSFATilingCheck::CheckKVShape() | |||
| 982 | return CheckKVShapeForPageAttention(); | 981 | return CheckKVShapeForPageAttention(); |
| 983 | } | 982 | } |
| 984 | 983 | ||
| 985 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "key", | 984 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "key", |
| 986 | - Ops::Base::ToString(opParamInfo_.key.shape->GetStorageShape()).c_str(), | 985 | + "Storage mode of key and value is " + std::to_string(static_cast<int32_t>(kvStorageMode_)) + |
| 987 | - "storage mode of key and value is " + std::to_string(static_cast<int32_t>(kvStorageMode_)) + | ||
| 988 | ", it is incorrect"); | 986 | ", it is incorrect"); |
| 987 | + | ||
| 989 | return ge::GRAPH_FAILED; | 988 | return ge::GRAPH_FAILED; |
| 990 | } | 989 | } |
| 991 | 990 | ||
| @@ -1065,7 +1064,7 @@ ge::graphStatus QSFATilingCheck::CheckActualSeqLensDType() | |||
| 1065 | } | 1064 | } |
| 1066 | if (opParamInfo_.actualSeqLengths.desc->GetDataType() != ge::DT_INT32) { | 1065 | if (opParamInfo_.actualSeqLengths.desc->GetDataType() != ge::DT_INT32) { |
| 1067 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "actualSeqLengths", | 1066 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "actualSeqLengths", |
| 1068 | - QSFADataTypeToSerialString(opParamInfo_.actualSeqLengthsQ.desc->GetDataType()).c_str(), | 1067 | + QSFADataTypeToSerialString(opParamInfo_.actualSeqLengths.desc->GetDataType()).c_str(), |
| 1069 | "The dtype of actualSeqLengths must be DT_INT32"); | 1068 | "The dtype of actualSeqLengths must be DT_INT32"); |
| 1070 | } | 1069 | } |
| 1071 | return ge::GRAPH_SUCCESS; | 1070 | return ge::GRAPH_SUCCESS; |
| @@ -1557,8 +1556,7 @@ ge::graphStatus QSFAInfoParser::GetActualSeqLenQSize(uint32_t &size) | |||
| 1557 | ge::graphStatus QSFAInfoParser::GetOpName() | 1556 | ge::graphStatus QSFAInfoParser::GetOpName() |
| 1558 | { | 1557 | { |
| 1559 | if (context_->GetNodeName() == nullptr) { | 1558 | if (context_->GetNodeName() == nullptr) { |
| 1560 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("KvQuantSparseFlashAttention", "opName", | 1559 | + OP_LOGE("KvQuantSparseFlashAttention", "opName got from TilingContext is nullptr"); |
| 1561 | - "opName got from TilingContext is nullptr"); | ||
| 1562 | return ge::GRAPH_FAILED; | 1560 | return ge::GRAPH_FAILED; |
| 1563 | } | 1561 | } |
| 1564 | opName_ = context_->GetNodeName(); | 1562 | opName_ = context_->GetNodeName(); |
| @@ -2005,8 +2003,7 @@ void QSFAInfoParser::FillTilingInfoAttrsAndLayouts(QSFATilingInfo &qsfaInfo) | |||
| 2005 | ge::graphStatus QSFAInfoParser::Parse(QSFATilingInfo &qsfaInfo) | 2003 | ge::graphStatus QSFAInfoParser::Parse(QSFATilingInfo &qsfaInfo) |
| 2006 | { | 2004 | { |
| 2007 | if (context_ == nullptr) { | 2005 | if (context_ == nullptr) { |
| 2008 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("KvQuantSparseFlashAttention", "tiling context", | 2006 | + OP_LOGE("KvQuantSparseFlashAttention", "tiling context is nullptr"); |
| 2009 | - "tiling context is nullptr"); | ||
| 2010 | return ge::GRAPH_FAILED; | 2007 | return ge::GRAPH_FAILED; |
| 2011 | } | 2008 | } |
| 2012 | if (ge::GRAPH_SUCCESS != GetOpName() || | 2009 | if (ge::GRAPH_SUCCESS != GetOpName() || |
| @@ -31,8 +31,7 @@ constexpr uint32_t ATTR_RETURN_VALUE_INDEX = 6; | |||
| 31 | static ge::graphStatus InferShapeLightningIndexer(gert::InferShapeContext *context) | 31 | static ge::graphStatus InferShapeLightningIndexer(gert::InferShapeContext *context) |
| 32 | { | 32 | { |
| 33 | OP_CHECK_IF(context == nullptr, | 33 | OP_CHECK_IF(context == nullptr, |
| 34 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("LightningIndexer", "InferShapeContext", | 34 | + OP_LOGE("LightningIndexer", "InferShapeContext is nullptr"), |
| 35 | - "InferShapeContext is nullptr"), | ||
| 36 | return ge::GRAPH_FAILED); | 35 | return ge::GRAPH_FAILED); |
| 37 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INDEX); | 36 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INDEX); |
| 38 | OP_CHECK_NULL_WITH_CONTEXT(context, queryShape); | 37 | OP_CHECK_NULL_WITH_CONTEXT(context, queryShape); |
| @@ -98,8 +97,7 @@ static ge::graphStatus InferShapeLightningIndexer(gert::InferShapeContext *conte | |||
| 98 | static ge::graphStatus InferDataTypeLightningIndexer(gert::InferDataTypeContext *context) | 97 | static ge::graphStatus InferDataTypeLightningIndexer(gert::InferDataTypeContext *context) |
| 99 | { | 98 | { |
| 100 | OP_CHECK_IF(context == nullptr, | 99 | OP_CHECK_IF(context == nullptr, |
| 101 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("LightningIndexer", "InferDataTypeContext", | 100 | + OP_LOGE("LightningIndexer", "InferDataTypeContext is nullptr"), |
| 102 | - "InferDataTypeContext is nullptr"), | ||
| 103 | return ge::GRAPH_FAILED); | 101 | return ge::GRAPH_FAILED); |
| 104 | OP_LOGI(context->GetNodeName(), "Enter LightningIndexer InferDataType impl."); | 102 | OP_LOGI(context->GetNodeName(), "Enter LightningIndexer InferDataType impl."); |
| 105 | // default set q's dtype as fia's output type | 103 | // default set q's dtype as fia's output type |
| @@ -112,12 +112,12 @@ ge::graphStatus LIInfoParser::CheckTensorDescriptions() const | |||
| 112 | "Desc of tensor weights is nullptr"), | 112 | "Desc of tensor weights is nullptr"), |
| 113 | return ge::GRAPH_FAILED); | 113 | return ge::GRAPH_FAILED); |
| 114 | OP_CHECK_IF(opParamInfo_.attenOut.desc == nullptr, | 114 | OP_CHECK_IF(opParamInfo_.attenOut.desc == nullptr, |
| 115 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attenOut", | 115 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "sparse_indices", |
| 116 | - "Desc of tensor attenOut is nullptr"), | 116 | + "Desc of tensor sparse_indices is nullptr"), |
| 117 | return ge::GRAPH_FAILED); | 117 | return ge::GRAPH_FAILED); |
| 118 | OP_CHECK_IF(opParamInfo_.valuesOut.desc == nullptr, | 118 | OP_CHECK_IF(opParamInfo_.valuesOut.desc == nullptr, |
| 119 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "valuesOut", | 119 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "sparse_values", |
| 120 | - "Desc of tensor valuesOut is nullptr"), | 120 | + "Desc of tensor sparse_values is nullptr"), |
| 121 | return ge::GRAPH_FAILED); | 121 | return ge::GRAPH_FAILED); |
| 122 | 122 | ||
| 123 | return ge::GRAPH_SUCCESS; | 123 | return ge::GRAPH_SUCCESS; |
| @@ -176,8 +176,7 @@ ge::graphStatus LIInfoParser::CheckRequiredParaExistence() const | |||
| 176 | ge::graphStatus LIInfoParser::GetOpName() | 176 | ge::graphStatus LIInfoParser::GetOpName() |
| 177 | { | 177 | { |
| 178 | if (context_->GetNodeName() == nullptr) { | 178 | if (context_->GetNodeName() == nullptr) { |
| 179 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("LightningIndexer", "opName", | 179 | + OP_LOGE("LightningIndexer", "opName got from TilingContext is nullptr"); |
| 180 | - "opName got from TilingContext is nullptr"); | ||
| 181 | return ge::GRAPH_FAILED; | 180 | return ge::GRAPH_FAILED; |
| 182 | } | 181 | } |
| 183 | opName_ = context_->GetNodeName(); | 182 | opName_ = context_->GetNodeName(); |
| @@ -188,8 +187,7 @@ ge::graphStatus LIInfoParser::GetNpuInfo() | |||
| 188 | { | 187 | { |
| 189 | platformInfo_ = context_->GetPlatformInfo(); | 188 | platformInfo_ = context_->GetPlatformInfo(); |
| 190 | OP_CHECK_IF(platformInfo_ == nullptr, | 189 | OP_CHECK_IF(platformInfo_ == nullptr, |
| 191 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "GetPlatformInfo", | 190 | + OP_LOGE(opName_, "GetPlatformInfo is nullptr"), |
| 192 | - "GetPlatformInfo is nullptr"), | ||
| 193 | return ge::GRAPH_FAILED); | 191 | return ge::GRAPH_FAILED); |
| 194 | 192 | ||
| 195 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo_); | 193 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo_); |
| @@ -205,12 +203,10 @@ ge::graphStatus LIInfoParser::GetNpuInfo() | |||
| 205 | return GRAPH_FAILED; | 203 | return GRAPH_FAILED; |
| 206 | } | 204 | } |
| 207 | OP_CHECK_IF(context_->GetWorkspaceSizes(1) == nullptr, | 205 | OP_CHECK_IF(context_->GetWorkspaceSizes(1) == nullptr, |
| 208 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "workSpaceSize", | 206 | + OP_LOGE(opName_, "workSpaceSize got from ge is nullptr"), |
| 209 | - "workSpaceSize got from ge is nullptr"), | ||
| 210 | return ge::GRAPH_FAILED); | 207 | return ge::GRAPH_FAILED); |
| 211 | OP_CHECK_IF(context_->GetRawTilingData() == nullptr, | 208 | OP_CHECK_IF(context_->GetRawTilingData() == nullptr, |
| 212 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "RawTilingData", | 209 | + OP_LOGE(opName_, "RawTilingData got from GE context is nullptr"), |
| 213 | - "RawTilingData got from GE context is nullptr"), | ||
| 214 | return ge::GRAPH_FAILED); | 210 | return ge::GRAPH_FAILED); |
| 215 | 211 | ||
| 216 | return ge::GRAPH_SUCCESS; | 212 | return ge::GRAPH_SUCCESS; |
| @@ -304,6 +300,11 @@ ge::graphStatus LIInfoParser::GetAndCheckAttrParaInfo() | |||
| 304 | "input attr sparse_count must > 0 and <= 8192." | 300 | "input attr sparse_count must > 0 and <= 8192." |
| 305 | " And when sparse_count > 2048, sparse_count must be an integer multiple of 1024"), | 301 | " And when sparse_count > 2048, sparse_count must be an integer multiple of 1024"), |
| 306 | return ge::GRAPH_FAILED); | 302 | return ge::GRAPH_FAILED); |
| 303 | + | ||
| 304 | + if (*opParamInfo_.sparseCount > 8192) { | ||
| 305 | + OP_LOGW(opName_, "Sparse_count should > 0 and <= 8192."); | ||
| 306 | + } | ||
| 307 | + | ||
| 307 | OP_CHECK_IF(!((*opParamInfo_.sparseMode == 0) || (*opParamInfo_.sparseMode == SPARSE_MODE_LOWER)), | 308 | OP_CHECK_IF(!((*opParamInfo_.sparseMode == 0) || (*opParamInfo_.sparseMode == SPARSE_MODE_LOWER)), |
| 308 | OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "sparse_mode", | 309 | OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "sparse_mode", |
| 309 | std::to_string(*opParamInfo_.sparseMode), "sparse_count must be 0 or 3"), return ge::GRAPH_FAILED); | 310 | std::to_string(*opParamInfo_.sparseMode), "sparse_count must be 0 or 3"), return ge::GRAPH_FAILED); |
| @@ -352,18 +353,18 @@ ge::graphStatus LIInfoParser::GetAndCheckInOutDataType() | |||
| 352 | return ge::GRAPH_FAILED); | 353 | return ge::GRAPH_FAILED); |
| 353 | if (npuArch_ == NpuArch::DAV_3510) { | 354 | if (npuArch_ == NpuArch::DAV_3510) { |
| 354 | OP_CHECK_IF((inputQType_ != weightsType_), | 355 | OP_CHECK_IF((inputQType_ != weightsType_), |
| 355 | - OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(opName_, "query, key, and weights", | 356 | + OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(opName_, "query, key and weights", |
| 356 | LIDataTypeToSerialString(inputQType_) + ", " + LIDataTypeToSerialString(inputKType_) + | 357 | LIDataTypeToSerialString(inputQType_) + ", " + LIDataTypeToSerialString(inputKType_) + |
| 357 | "and " + LIDataTypeToSerialString(inputKType_), | 358 | "and " + LIDataTypeToSerialString(inputKType_), |
| 358 | - "The dtype of query, key, and weights must be same"), | 359 | + "The dtype of query, key and weights must be same"), |
| 359 | return ge::GRAPH_FAILED); | 360 | return ge::GRAPH_FAILED); |
| 360 | } else { | 361 | } else { |
| 361 | if (weightsType_ != ge::DT_FLOAT) { | 362 | if (weightsType_ != ge::DT_FLOAT) { |
| 362 | OP_CHECK_IF((inputQType_ != weightsType_), | 363 | OP_CHECK_IF((inputQType_ != weightsType_), |
| 363 | - OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(opName_, "query, key, and weights", | 364 | + OP_LOGE_FOR_INVALID_DTYPES_WITH_REASON(opName_, "query, key and weights", |
| 364 | LIDataTypeToSerialString(inputQType_) + ", " + LIDataTypeToSerialString(inputKType_) + | 365 | LIDataTypeToSerialString(inputQType_) + ", " + LIDataTypeToSerialString(inputKType_) + |
| 365 | "and " + LIDataTypeToSerialString(inputKType_), | 366 | "and " + LIDataTypeToSerialString(inputKType_), |
| 366 | - "The dtype of query, key, and weights must be same"), | 367 | + "The dtype of query, key and weights must be same"), |
| 367 | return ge::GRAPH_FAILED); | 368 | return ge::GRAPH_FAILED); |
| 368 | } else { | 369 | } else { |
| 369 | OP_CHECK_IF((weightsType_ != ge::DT_FLOAT), | 370 | OP_CHECK_IF((weightsType_ != ge::DT_FLOAT), |
| @@ -768,7 +769,7 @@ ge::graphStatus LIInfoParser::ValidateInputShapesMatchQbsnd() | |||
| 768 | OP_CHECK_IF(opParamInfo_.key.shape->GetStorageShape().GetDim(0) != bSize_, | 769 | OP_CHECK_IF(opParamInfo_.key.shape->GetStorageShape().GetDim(0) != bSize_, |
| 769 | OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "query and key", | 770 | OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "query and key", |
| 770 | Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + " and " + | 771 | Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + " and " + |
| 771 | - Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()), | 772 | + Ops::Base::ToString(opParamInfo_.key.shape->GetStorageShape()), |
| 772 | "BSND case input query, key dim 0 are " + | 773 | "BSND case input query, key dim 0 are " + |
| 773 | std::to_string(bSize_) + ", " + | 774 | std::to_string(bSize_) + ", " + |
| 774 | std::to_string(opParamInfo_.key.shape->GetStorageShape().GetDim(0)) + | 775 | std::to_string(opParamInfo_.key.shape->GetStorageShape().GetDim(0)) + |
| @@ -32,8 +32,7 @@ constexpr uint32_t DIM_NUM_4 = 4; | |||
| 32 | static ge::graphStatus InferShapeQuantLightningIndexer(gert::InferShapeContext *context) | 32 | static ge::graphStatus InferShapeQuantLightningIndexer(gert::InferShapeContext *context) |
| 33 | { | 33 | { |
| 34 | if (context == nullptr) { | 34 | if (context == nullptr) { |
| 35 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("QuantLightningIndexer", "InferShapeContext", | 35 | + OP_LOGE("QuantLightningIndexer", "context is nullptr"); |
| 36 | - "context is nullptr"); | ||
| 37 | return ge::GRAPH_FAILED; | 36 | return ge::GRAPH_FAILED; |
| 38 | } | 37 | } |
| 39 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INDEX); | 38 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INDEX); |
| @@ -80,8 +79,7 @@ static ge::graphStatus InferShapeQuantLightningIndexer(gert::InferShapeContext * | |||
| 80 | static ge::graphStatus InferDataTypeQuantLightningIndexer(gert::InferDataTypeContext *context) | 79 | static ge::graphStatus InferDataTypeQuantLightningIndexer(gert::InferDataTypeContext *context) |
| 81 | { | 80 | { |
| 82 | if (context == nullptr) { | 81 | if (context == nullptr) { |
| 83 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("QuantLightningIndexer", "InferDataTypeContext", | 82 | + OP_LOGE("QuantLightningIndexer", "InferDataTypeContext context is nullptr"); |
| 84 | - "InferDataTypeContext context is nullptr"); | ||
| 85 | return ge::GRAPH_FAILED; | 83 | return ge::GRAPH_FAILED; |
| 86 | } | 84 | } |
| 87 | OP_LOGD(context->GetNodeName(), "Enter QuantLightningIndexer InferDataType impl."); | 85 | OP_LOGD(context->GetNodeName(), "Enter QuantLightningIndexer InferDataType impl."); |
| @@ -95,8 +95,8 @@ ge::graphStatus QLIInfoParser::CheckTensorShapes() const | |||
| 95 | "Shape of tensor key_dequant_scale is nullptr"), | 95 | "Shape of tensor key_dequant_scale is nullptr"), |
| 96 | return ge::GRAPH_FAILED); | 96 | return ge::GRAPH_FAILED); |
| 97 | OP_CHECK_IF(opParamInfo_.attenOut.shape == nullptr, | 97 | OP_CHECK_IF(opParamInfo_.attenOut.shape == nullptr, |
| 98 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attenOut", | 98 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "sparse_indices", |
| 99 | - "Shape of tensor output is nullptr"), | 99 | + "Shape of tensor sparse_indices is nullptr"), |
| 100 | return ge::GRAPH_FAILED); | 100 | return ge::GRAPH_FAILED); |
| 101 | return ge::GRAPH_SUCCESS; | 101 | return ge::GRAPH_SUCCESS; |
| 102 | } | 102 | } |
| @@ -124,8 +124,8 @@ ge::graphStatus QLIInfoParser::CheckTensorDescriptions() const | |||
| 124 | "Desc of tensor key_dequant_scale is nullptr"), | 124 | "Desc of tensor key_dequant_scale is nullptr"), |
| 125 | return ge::GRAPH_FAILED); | 125 | return ge::GRAPH_FAILED); |
| 126 | OP_CHECK_IF(opParamInfo_.attenOut.desc == nullptr, | 126 | OP_CHECK_IF(opParamInfo_.attenOut.desc == nullptr, |
| 127 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attenOut", | 127 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "sparse_indices", |
| 128 | - "Desc of tensor output is nullptr"), | 128 | + "Desc of tensor sparse_indices is nullptr"), |
| 129 | return ge::GRAPH_FAILED); | 129 | return ge::GRAPH_FAILED); |
| 130 | return ge::GRAPH_SUCCESS; | 130 | return ge::GRAPH_SUCCESS; |
| 131 | } | 131 | } |
| @@ -185,8 +185,7 @@ ge::graphStatus QLIInfoParser::CheckRequiredParaExistence() const | |||
| 185 | ge::graphStatus QLIInfoParser::GetOpName() | 185 | ge::graphStatus QLIInfoParser::GetOpName() |
| 186 | { | 186 | { |
| 187 | if (context_->GetNodeName() == nullptr) { | 187 | if (context_->GetNodeName() == nullptr) { |
| 188 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("QuantLightningIndexer", "opName", | 188 | + OP_LOGE("QuantLightningIndexer", "opName got from TilingContext is nullptr"); |
| 189 | - "opName got from TilingContext is nullptr"); | ||
| 190 | return ge::GRAPH_FAILED; | 189 | return ge::GRAPH_FAILED; |
| 191 | } | 190 | } |
| 192 | opName_ = context_->GetNodeName(); | 191 | opName_ = context_->GetNodeName(); |
| @@ -197,8 +196,7 @@ ge::graphStatus QLIInfoParser::GetNpuInfo() | |||
| 197 | { | 196 | { |
| 198 | platformInfo_ = context_->GetPlatformInfo(); | 197 | platformInfo_ = context_->GetPlatformInfo(); |
| 199 | OP_CHECK_IF(platformInfo_ == nullptr, | 198 | OP_CHECK_IF(platformInfo_ == nullptr, |
| 200 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "GetPlatformInfo", | 199 | + OP_LOGE(opName_, "GetPlatformInfo is nullptr"), |
| 201 | - "GetPlatformInfo is nullptr"), | ||
| 202 | return ge::GRAPH_FAILED); | 200 | return ge::GRAPH_FAILED); |
| 203 | 201 | ||
| 204 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo_); | 202 | auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo_); |
| @@ -212,12 +210,10 @@ ge::graphStatus QLIInfoParser::GetNpuInfo() | |||
| 212 | return GRAPH_FAILED; | 210 | return GRAPH_FAILED; |
| 213 | } | 211 | } |
| 214 | OP_CHECK_IF(context_->GetWorkspaceSizes(1) == nullptr, | 212 | OP_CHECK_IF(context_->GetWorkspaceSizes(1) == nullptr, |
| 215 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "workSpaceSize", | 213 | + OP_LOGE(opName_, "workSpaceSize got from ge is nullptr"), |
| 216 | - "workSpaceSize got from ge is nullptr"), | ||
| 217 | return ge::GRAPH_FAILED); | 214 | return ge::GRAPH_FAILED); |
| 218 | OP_CHECK_IF(context_->GetRawTilingData() == nullptr, | 215 | OP_CHECK_IF(context_->GetRawTilingData() == nullptr, |
| 219 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "RawTilingData", | 216 | + OP_LOGE(opName_, "RawTilingData got from GE context is nullptr"), |
| 220 | - "RawTilingData got from GE context is nullptr"), | ||
| 221 | return ge::GRAPH_FAILED); | 217 | return ge::GRAPH_FAILED); |
| 222 | 218 | ||
| 223 | return ge::GRAPH_SUCCESS; | 219 | return ge::GRAPH_SUCCESS; |
| @@ -258,8 +254,7 @@ ge::graphStatus QLIInfoParser::GetAttrParaInfo() | |||
| 258 | { | 254 | { |
| 259 | auto attrs = context_->GetAttrs(); | 255 | auto attrs = context_->GetAttrs(); |
| 260 | OP_CHECK_IF(attrs == nullptr, | 256 | OP_CHECK_IF(attrs == nullptr, |
| 261 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attrs", | 257 | + OP_LOGE(opName_, "attrs got from GE is nullptr"), |
| 262 | - "attrs got from ge is nullptr"), | ||
| 263 | return ge::GRAPH_FAILED); | 258 | return ge::GRAPH_FAILED); |
| 264 | 259 | ||
| 265 | OP_LOGI(context_->GetNodeName(), "GetAttrParaInfo start"); | 260 | OP_LOGI(context_->GetNodeName(), "GetAttrParaInfo start"); |
| @@ -513,9 +508,8 @@ ge::graphStatus QLIInfoParser::GetAndCheckOptionalInput() | |||
| 513 | "The dtype of block_table must be int32"), return ge::GRAPH_FAILED); | 508 | "The dtype of block_table must be int32"), return ge::GRAPH_FAILED); |
| 514 | } else { | 509 | } else { |
| 515 | OP_CHECK_IF(opParamInfo_.blockTable.tensor != nullptr, | 510 | OP_CHECK_IF(opParamInfo_.blockTable.tensor != nullptr, |
| 516 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "block_table", | 511 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON( |
| 517 | - Ops::Base::ToString(opParamInfo_.blockTable.tensor->GetStorageShape()).c_str(), | 512 | + opName_, "block_table", "When Layout_key is not PA_BSND, block_table must be null"), |
| 518 | - "when key layout is not PA_BSND, input block_table must be null"), | ||
| 519 | return ge::GRAPH_FAILED); | 513 | return ge::GRAPH_FAILED); |
| 520 | } | 514 | } |
| 521 | 515 | ||
| @@ -820,7 +814,7 @@ ge::graphStatus QLIInfoParser::ValidateInputShapesMatch() | |||
| 820 | ((opParamInfo_.actualSeqLengthsK.tensor->GetShapeSize() != bSize_) || | 814 | ((opParamInfo_.actualSeqLengthsK.tensor->GetShapeSize() != bSize_) || |
| 821 | (opParamInfo_.blockTable.tensor != nullptr && | 815 | (opParamInfo_.blockTable.tensor != nullptr && |
| 822 | opParamInfo_.blockTable.tensor->GetStorageShape().GetDim(0) != bSize_)), | 816 | opParamInfo_.blockTable.tensor->GetStorageShape().GetDim(0) != bSize_)), |
| 823 | - OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "query actual_seq_lengths_key and block_table", | 817 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "query, actual_seq_lengths_key and block_table", |
| 824 | Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + ", " + | 818 | Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + ", " + |
| 825 | Ops::Base::ToString(opParamInfo_.actualSeqLengthsK.tensor->GetStorageShape()) + " and " + | 819 | Ops::Base::ToString(opParamInfo_.actualSeqLengthsK.tensor->GetStorageShape()) + " and " + |
| 826 | Ops::Base::ToString(opParamInfo_.blockTable.tensor->GetStorageShape()), | 820 | Ops::Base::ToString(opParamInfo_.blockTable.tensor->GetStorageShape()), |
| @@ -885,7 +879,7 @@ ge::graphStatus QLIInfoParser::ValidateInputShapesMatch() | |||
| 885 | opParamInfo_.actualSeqLengthsK.tensor->GetShapeSize() != bSize_) || | 879 | opParamInfo_.actualSeqLengthsK.tensor->GetShapeSize() != bSize_) || |
| 886 | (opParamInfo_.attenOut.shape->GetStorageShape().GetDim(0) != bSize_)), | 880 | (opParamInfo_.attenOut.shape->GetStorageShape().GetDim(0) != bSize_)), |
| 887 | OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, | 881 | OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, |
| 888 | - "query, weights, actual_seq_lengths_key, and sparse_indices", | 882 | + "query, weights, actual_seq_lengths_key and sparse_indices", |
| 889 | Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + ", " + | 883 | Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + ", " + |
| 890 | Ops::Base::ToString(opParamInfo_.weights.shape->GetStorageShape()) + ", " + | 884 | Ops::Base::ToString(opParamInfo_.weights.shape->GetStorageShape()) + ", " + |
| 891 | Ops::Base::ToString(opParamInfo_.actualSeqLengthsK.tensor->GetStorageShape()) + " and " + | 885 | Ops::Base::ToString(opParamInfo_.actualSeqLengthsK.tensor->GetStorageShape()) + " and " + |
| @@ -947,10 +941,10 @@ ge::graphStatus QLIInfoParser::ValidateInputShapesMatch() | |||
| 947 | return ge::GRAPH_FAILED); | 941 | return ge::GRAPH_FAILED); |
| 948 | // -----------------------check N2------------------- | 942 | // -----------------------check N2------------------- |
| 949 | OP_CHECK_IF((opParamInfo_.attenOut.shape->GetStorageShape().GetDim(outN2Dim) != n2Size_), | 943 | OP_CHECK_IF((opParamInfo_.attenOut.shape->GetStorageShape().GetDim(outN2Dim) != n2Size_), |
| 950 | - OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "query and sparse_indices", | 944 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(opName_, "key and sparse_indices", |
| 951 | - Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + " and " + | 945 | + Ops::Base::ToString(opParamInfo_.key.shape->GetStorageShape()) + " and " + |
| 952 | Ops::Base::ToString(opParamInfo_.attenOut.shape->GetStorageShape()), | 946 | Ops::Base::ToString(opParamInfo_.attenOut.shape->GetStorageShape()), |
| 953 | - "input query and output sparse_indices shape n2 dim must be same"), | 947 | + "input key and output sparse_indices shape n2 dim must be same"), |
| 954 | return ge::GRAPH_FAILED); | 948 | return ge::GRAPH_FAILED); |
| 955 | // -----------------------check sparse_count------------------- | 949 | // -----------------------check sparse_count------------------- |
| 956 | OP_CHECK_IF((opParamInfo_.attenOut.shape->GetStorageShape().GetDim(outN2Dim + 1) != *opParamInfo_.sparseCount), | 950 | OP_CHECK_IF((opParamInfo_.attenOut.shape->GetStorageShape().GetDim(outN2Dim + 1) != *opParamInfo_.sparseCount), |
| @@ -1070,11 +1064,11 @@ ge::graphStatus QLIInfoParser::CheckContiguous() | |||
| 1070 | } | 1064 | } |
| 1071 | } | 1065 | } |
| 1072 | } | 1066 | } |
| 1073 | - OP_CHECK_IF(keyNonContiguous || scaleNonContiguous, | 1067 | + OP_CHECK_IF( |
| 1074 | - OP_LOGE_FOR_INVALID_VALUE_WITH_REASON(opName_, "keyNonContiguous and scaleNonContiguous", | 1068 | + keyNonContiguous || scaleNonContiguous, |
| 1075 | - std::string(keyNonContiguous ? "true" : "false") + " and " + | 1069 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON( |
| 1076 | - std::string(scaleNonContiguous ? "true" : "false"), | 1070 | + opName_, "key and key_dequant_scale", |
| 1077 | - "key and keyscale only support non-continuous keying on the 0-axis in PA scenarios."), | 1071 | + "Key and key_dequant_scale only supports non-contiguous tensor on the 0-axis in PA scenarios"), |
| 1078 | return ge::GRAPH_FAILED); | 1072 | return ge::GRAPH_FAILED); |
| 1079 | 1073 | ||
| 1080 | return ge::GRAPH_SUCCESS; | 1074 | return ge::GRAPH_SUCCESS; |
| @@ -1249,8 +1243,7 @@ ge::graphStatus QuantLightningIndexerTiling::DoTiling(QLITilingInfo *tilingInfo) | |||
| 1249 | ge::graphStatus TilingForQuantLightningIndexer(gert::TilingContext *context) | 1243 | ge::graphStatus TilingForQuantLightningIndexer(gert::TilingContext *context) |
| 1250 | { | 1244 | { |
| 1251 | OP_CHECK_IF(context == nullptr, | 1245 | OP_CHECK_IF(context == nullptr, |
| 1252 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("QuantLightningIndexer", "TilingContext", | 1246 | + OP_LOGE("QuantLightningIndexer", "Tilingcontext is null"), |
| 1253 | - "Tilingcontext is null"), | ||
| 1254 | return ge::GRAPH_FAILED); | 1247 | return ge::GRAPH_FAILED); |
| 1255 | QLITilingInfo QLIInfo; | 1248 | QLITilingInfo QLIInfo; |
| 1256 | QLIInfoParser QLIInfoParser(context); | 1249 | QLIInfoParser QLIInfoParser(context); |
| @@ -40,8 +40,7 @@ constexpr uint32_t OUTPUT_INDEX_2 = 2; | |||
| 40 | ge::graphStatus InferShapeSparseFlashAttention(gert::InferShapeContext *context) | 40 | ge::graphStatus InferShapeSparseFlashAttention(gert::InferShapeContext *context) |
| 41 | { | 41 | { |
| 42 | OP_CHECK_IF(context == nullptr, | 42 | OP_CHECK_IF(context == nullptr, |
| 43 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("SparseFlashAttention", "InferShapeContext", | 43 | + OP_LOGE("SparseFlashAttention", "InferShapeContext is nullptr"), |
| 44 | - "InferShapeContext is nullptr"), | ||
| 45 | return ge::GRAPH_FAILED); | 44 | return ge::GRAPH_FAILED); |
| 46 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INPUT_INDEX); | 45 | const gert::Shape *queryShape = context->GetInputShape(QUERY_INPUT_INDEX); |
| 47 | OP_CHECK_NULL_WITH_CONTEXT(context, queryShape); | 46 | OP_CHECK_NULL_WITH_CONTEXT(context, queryShape); |
| @@ -117,8 +116,7 @@ ge::graphStatus InferShapeSparseFlashAttention(gert::InferShapeContext *context) | |||
| 117 | ge::graphStatus InferDataTypeSparseFlashAttention(gert::InferDataTypeContext *context) | 116 | ge::graphStatus InferDataTypeSparseFlashAttention(gert::InferDataTypeContext *context) |
| 118 | { | 117 | { |
| 119 | OP_CHECK_IF(context == nullptr, | 118 | OP_CHECK_IF(context == nullptr, |
| 120 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("SparseFlashAttention", "InferShapeContext", | 119 | + OP_LOGE("SparseFlashAttention", "InferShapeContext is nullptr"), |
| 121 | - "InferShapeContext is nullptr"), | ||
| 122 | return ge::GRAPH_FAILED); | 120 | return ge::GRAPH_FAILED); |
| 123 | const auto inputDataType = context->GetInputDataType(QUERY_INPUT_INDEX); | 121 | const auto inputDataType = context->GetInputDataType(QUERY_INPUT_INDEX); |
| 124 | context->SetOutputDataType(OUTPUT_INDEX_0, inputDataType); | 122 | context->SetOutputDataType(OUTPUT_INDEX_0, inputDataType); |
| @@ -656,7 +656,7 @@ ge::graphStatus SFATilingCheck::CheckDimNumInLayoutSupport(const SFALayout &layo | |||
| 656 | OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(opName_, name.c_str(), | 656 | OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(opName_, name.c_str(), |
| 657 | std::to_string(shape->GetStorageShape().GetDimNum()).c_str(), | 657 | std::to_string(shape->GetStorageShape().GetDimNum()).c_str(), |
| 658 | "When layout is " + SFALayoutToSerialString(layout) + | 658 | "When layout is " + SFALayoutToSerialString(layout) + |
| 659 | - ", the shape dim of " + name + "should be " + std::to_string(sfaDimIt->second)), | 659 | + ", the shape dim of " + name + " should be " + std::to_string(sfaDimIt->second)), |
| 660 | return ge::GRAPH_FAILED); | 660 | return ge::GRAPH_FAILED); |
| 661 | return ge::GRAPH_SUCCESS; | 661 | return ge::GRAPH_SUCCESS; |
| 662 | } | 662 | } |
| @@ -823,18 +823,16 @@ ge::graphStatus SFATilingCheck::CheckRopeExistence() | |||
| 823 | std::to_string(*opParamInfo_.attentionMode).c_str(), "attentionMode only support 2"), | 823 | std::to_string(*opParamInfo_.attentionMode).c_str(), "attentionMode only support 2"), |
| 824 | return ge::GRAPH_FAILED); | 824 | return ge::GRAPH_FAILED); |
| 825 | OP_CHECK_IF((opParamInfo_.queryRope.tensor != nullptr && opParamInfo_.keyRope.tensor == nullptr), | 825 | OP_CHECK_IF((opParamInfo_.queryRope.tensor != nullptr && opParamInfo_.keyRope.tensor == nullptr), |
| 826 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "query_rope", | 826 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON( |
| 827 | - Ops::Base::ToString(opParamInfo_.queryRope.tensor->GetStorageShape()), | 827 | + opName_, "query_rope", "Key_rope is an empty tensor, query_rope must also be an empty tensor"), |
| 828 | - "keyRope is an empty tensor, queryRope must also be an empty tensor"), | ||
| 829 | return ge::GRAPH_FAILED); | 828 | return ge::GRAPH_FAILED); |
| 830 | OP_CHECK_IF((opParamInfo_.queryRope.tensor == nullptr && opParamInfo_.keyRope.tensor != nullptr), | 829 | OP_CHECK_IF((opParamInfo_.queryRope.tensor == nullptr && opParamInfo_.keyRope.tensor != nullptr), |
| 831 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "key_rope", | 830 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON( |
| 832 | - Ops::Base::ToString(opParamInfo_.keyRope.tensor->GetStorageShape()), | 831 | + opName_, "key_rope", "Query_rope is an empty tensor, key_rope must also be an empty tensor"), |
| 833 | - "queryRope is an empty tensor, keyRope must also be an empty tensor"), | ||
| 834 | return ge::GRAPH_FAILED); | 832 | return ge::GRAPH_FAILED); |
| 835 | OP_CHECK_IF(opParamInfo_.keyRope.desc == nullptr || opParamInfo_.queryRope.desc == nullptr, | 833 | OP_CHECK_IF(opParamInfo_.keyRope.desc == nullptr || opParamInfo_.queryRope.desc == nullptr, |
| 836 | OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "query_rope and key_rope", | 834 | OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "query_rope and key_rope", |
| 837 | - "In Mla situation, desc of queryRope and key_rope should not be null"), | 835 | + "In Mla situation, desc of query_rope and key_rope should not be null"), |
| 838 | return ge::GRAPH_FAILED); | 836 | return ge::GRAPH_FAILED); |
| 839 | return ge::GRAPH_SUCCESS; | 837 | return ge::GRAPH_SUCCESS; |
| 840 | } | 838 | } |
| @@ -979,9 +977,9 @@ ge::graphStatus SFATilingCheck::CheckBlockTable() const | |||
| 979 | { | 977 | { |
| 980 | if (kvStorageMode_ != KvStorageMode::PAGE_ATTENTION) { | 978 | if (kvStorageMode_ != KvStorageMode::PAGE_ATTENTION) { |
| 981 | OP_CHECK_IF(opParamInfo_.blockTable.tensor != nullptr, | 979 | OP_CHECK_IF(opParamInfo_.blockTable.tensor != nullptr, |
| 982 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, BLOCK_TABLE_NAME.c_str(), | 980 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, BLOCK_TABLE_NAME.c_str(), |
| 983 | - Ops::Base::ToString(opParamInfo_.blockTable.tensor->GetStorageShape()).c_str(), | 981 | + "When the layout_kv is " + SFALayoutToSerialString(kvLayout_) + |
| 984 | - "When the layout_kv is " + SFALayoutToSerialString(kvLayout_) + ", block_table should be null"), | 982 | + ", block_table should be null"), |
| 985 | return ge::GRAPH_FAILED); | 983 | return ge::GRAPH_FAILED); |
| 986 | return ge::GRAPH_SUCCESS; | 984 | return ge::GRAPH_SUCCESS; |
| 987 | } | 985 | } |
| @@ -1097,9 +1095,8 @@ ge::graphStatus SFATilingCheck::CheckSoftmaxMax() | |||
| 1097 | { | 1095 | { |
| 1098 | if (*opParamInfo_.returnSoftmaxLse) { | 1096 | if (*opParamInfo_.returnSoftmaxLse) { |
| 1099 | OP_CHECK_IF(opParamInfo_.softmaxMax.shape->GetStorageShape().GetShapeSize() == 0, | 1097 | OP_CHECK_IF(opParamInfo_.softmaxMax.shape->GetStorageShape().GetShapeSize() == 0, |
| 1100 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "SoftmaxMax", | 1098 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON( |
| 1101 | - Ops::Base::ToString(opParamInfo_.softmaxMax.shape->GetStorageShape()).c_str(), | 1099 | + opName_, "softmax_max", "When return_softmax_lse is true, softmax_max tensor cannot be empty tensor"), |
| 1102 | - "When return_softmax_lse is true, SoftmaxMax tensor cannot be empty tensor"), | ||
| 1103 | return ge::GRAPH_FAILED); | 1100 | return ge::GRAPH_FAILED); |
| 1104 | // type类型校验 | 1101 | // type类型校验 |
| 1105 | OP_CHECK_IF(opParamInfo_.softmaxMax.desc->GetDataType() != ge::DT_FLOAT, | 1102 | OP_CHECK_IF(opParamInfo_.softmaxMax.desc->GetDataType() != ge::DT_FLOAT, |
| @@ -1123,9 +1120,8 @@ ge::graphStatus SFATilingCheck::CheckSoftmaxSum() | |||
| 1123 | { | 1120 | { |
| 1124 | if (*opParamInfo_.returnSoftmaxLse) { | 1121 | if (*opParamInfo_.returnSoftmaxLse) { |
| 1125 | OP_CHECK_IF(opParamInfo_.softmaxSum.shape->GetStorageShape().GetShapeSize() == 0, | 1122 | OP_CHECK_IF(opParamInfo_.softmaxSum.shape->GetStorageShape().GetShapeSize() == 0, |
| 1126 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "softmaxSum", | 1123 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON( |
| 1127 | - Ops::Base::ToString(opParamInfo_.softmaxSum.shape->GetStorageShape()).c_str(), | 1124 | + opName_, "softmax_sum", "When return_softmax_lse is true, softmax_sum tensor cannot be empty tensor"), |
| 1128 | - "When return_softmax_lse is true, softmaxSum tensor cannot be empty tensor"), | ||
| 1129 | return ge::GRAPH_FAILED); | 1125 | return ge::GRAPH_FAILED); |
| 1130 | OP_CHECK_IF(opParamInfo_.softmaxSum.desc->GetDataType() != ge::DT_FLOAT, | 1126 | OP_CHECK_IF(opParamInfo_.softmaxSum.desc->GetDataType() != ge::DT_FLOAT, |
| 1131 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "softmaxSum", | 1127 | OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(opName_, "softmaxSum", |
| @@ -1217,10 +1213,10 @@ ge::graphStatus SFATilingCheck::CheckVAndKRopeShape() | |||
| 1217 | return CheckVAndKRopeShapeForPageAttention(); | 1213 | return CheckVAndKRopeShapeForPageAttention(); |
| 1218 | } | 1214 | } |
| 1219 | 1215 | ||
| 1220 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "key", | 1216 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "key", |
| 1221 | - Ops::Base::ToString(opParamInfo_.key.shape->GetStorageShape()).c_str(), | 1217 | + "Storage mode of key and value is " + std::to_string(static_cast<int32_t>(kvStorageMode_)) + |
| 1222 | - "storage mode of key and value is " + std::to_string(static_cast<int32_t>(kvStorageMode_)) + | 1218 | + ", it is incorrect"); |
| 1223 | - ", it is incorrect"); | 1219 | + |
| 1224 | return ge::GRAPH_FAILED; | 1220 | return ge::GRAPH_FAILED; |
| 1225 | } | 1221 | } |
| 1226 | 1222 | ||
| @@ -1405,9 +1401,11 @@ ge::graphStatus SFATilingCheck::CheckFeatureMlaNoQuantShape() const | |||
| 1405 | } | 1401 | } |
| 1406 | 1402 | ||
| 1407 | OP_CHECK_IF(qkHeadDim_ != 512, | 1403 | OP_CHECK_IF(qkHeadDim_ != 512, |
| 1408 | - OP_LOGE_FOR_INVALID_SHAPE_WITH_REASON(opName_, "query", | 1404 | + OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON( |
| 1409 | - Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()).c_str(), | 1405 | + opName_, "query and key", |
| 1410 | - "k_head_dim only support 512, but got " + std::to_string(qkHeadDim_)), | 1406 | + Ops::Base::ToString(opParamInfo_.query.shape->GetStorageShape()) + " and " + |
| 1407 | + Ops::Base::ToString(opParamInfo_.key.shape->GetStorageShape()).c_str(), | ||
| 1408 | + "The head num of query and key only support 512, but got " + std::to_string(qkHeadDim_)), | ||
| 1411 | return ge::GRAPH_FAILED); | 1409 | return ge::GRAPH_FAILED); |
| 1412 | 1410 | ||
| 1413 | OP_CHECK_IF(qkHeadDim_ != vHeadDim_, | 1411 | OP_CHECK_IF(qkHeadDim_ != vHeadDim_, |
| @@ -1627,8 +1625,8 @@ ge::graphStatus SFAInfoParser::CheckTensorShapes() const | |||
| 1627 | "Shape of tensor sparseIndices is nullptr"), | 1625 | "Shape of tensor sparseIndices is nullptr"), |
| 1628 | return ge::GRAPH_FAILED); | 1626 | return ge::GRAPH_FAILED); |
| 1629 | OP_CHECK_IF(opParamInfo_.attenOut.shape == nullptr, | 1627 | OP_CHECK_IF(opParamInfo_.attenOut.shape == nullptr, |
| 1630 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attenOut", | 1628 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attention_out", |
| 1631 | - "Shape of tensor output is nullptr"), | 1629 | + "Shape of tensor attention_out is nullptr"), |
| 1632 | return ge::GRAPH_FAILED); | 1630 | return ge::GRAPH_FAILED); |
| 1633 | OP_CHECK_IF(opParamInfo_.softmaxMax.shape == nullptr, | 1631 | OP_CHECK_IF(opParamInfo_.softmaxMax.shape == nullptr, |
| 1634 | OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "softmaxMax", | 1632 | OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "softmaxMax", |
| @@ -1665,8 +1663,8 @@ ge::graphStatus SFAInfoParser::CheckTensorDescriptions() const | |||
| 1665 | "Desc of tensor sparseIndices is nullptr"), | 1663 | "Desc of tensor sparseIndices is nullptr"), |
| 1666 | return ge::GRAPH_FAILED); | 1664 | return ge::GRAPH_FAILED); |
| 1667 | OP_CHECK_IF(opParamInfo_.attenOut.desc == nullptr, | 1665 | OP_CHECK_IF(opParamInfo_.attenOut.desc == nullptr, |
| 1668 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attenOut", | 1666 | + OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "attention_out", |
| 1669 | - "Desc of tensor output is nullptr"), | 1667 | + "Desc of tensor attention_out is nullptr"), |
| 1670 | return ge::GRAPH_FAILED); | 1668 | return ge::GRAPH_FAILED); |
| 1671 | OP_CHECK_IF(opParamInfo_.softmaxMax.desc == nullptr, | 1669 | OP_CHECK_IF(opParamInfo_.softmaxMax.desc == nullptr, |
| 1672 | OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "softmaxMax", | 1670 | OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON(opName_, "softmaxMax", |
| @@ -1742,8 +1740,7 @@ ge::graphStatus SFAInfoParser::GetActualSeqLenQSize(uint32_t &size) | |||
| 1742 | ge::graphStatus SFAInfoParser::GetOpName() | 1740 | ge::graphStatus SFAInfoParser::GetOpName() |
| 1743 | { | 1741 | { |
| 1744 | if (context_->GetNodeName() == nullptr) { | 1742 | if (context_->GetNodeName() == nullptr) { |
| 1745 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("SparseFlashAttention", "opName", | 1743 | + OP_LOGE("SparseFlashAttention", "opName got from TilingContext is nullptr"); |
| 1746 | - "opName got from TilingContext is nullptr"); | ||
| 1747 | return ge::GRAPH_FAILED; | 1744 | return ge::GRAPH_FAILED; |
| 1748 | } | 1745 | } |
| 1749 | opName_ = context_->GetNodeName(); | 1746 | opName_ = context_->GetNodeName(); |
| @@ -2190,8 +2187,7 @@ void SFAInfoParser::FillTilingInfoAttrsAndLayouts(SFATilingInfo &sfaInfo) | |||
| 2190 | ge::graphStatus SFAInfoParser::Parse(SFATilingInfo &sfaInfo) | 2187 | ge::graphStatus SFAInfoParser::Parse(SFATilingInfo &sfaInfo) |
| 2191 | { | 2188 | { |
| 2192 | if (context_ == nullptr) { | 2189 | if (context_ == nullptr) { |
| 2193 | - OP_LOGE_FOR_INVALID_ARGUMENT_WITH_REASON("SparseFlashAttention", "SFATilingInfo", | 2190 | + OP_LOGE("SparseFlashAttention", "SFATilingInfo is nullptr"); |
| 2194 | - "SFATilingInfo is nullptr"); | ||
| 2195 | return ge::GRAPH_FAILED; | 2191 | return ge::GRAPH_FAILED; |
| 2196 | } | 2192 | } |
| 2197 | 2193 | ||