已合并
整数attr获取风险整改 #2725
zhangqijia1创建于 3月16日
整数attr获取风险整改 #2725
已合并
共 5 个文件变更+8-8
| @@ -160,7 +160,7 @@ ge::graphStatus EmbeddingBagTiling::Init() | |||
| 160 | OP_CHECK_IF( | 160 | OP_CHECK_IF( |
| 161 | (numOffset_ == 0), OP_LOGE(tilingContext_, "If include_last_offset is true, offset size should greater than 1"), | 161 | (numOffset_ == 0), OP_LOGE(tilingContext_, "If include_last_offset is true, offset size should greater than 1"), |
| 162 | return ge::GRAPH_FAILED); | 162 | return ge::GRAPH_FAILED); |
| 163 | - paddingIdx_ = *attrs->GetAttrPointer<int>(PADDING_IDX_INDEX); | 163 | + paddingIdx_ = *attrs->GetAttrPointer<int64_t>(PADDING_IDX_INDEX); |
| 164 | GetUsedCore(); | 164 | GetUsedCore(); |
| 165 | 165 | ||
| 166 | ge::DataType weightDatatype = tilingContext_->GetInputDesc(WEIGHT_INPUT_INDEX)->GetDataType(); | 166 | ge::DataType weightDatatype = tilingContext_->GetInputDesc(WEIGHT_INPUT_INDEX)->GetDataType(); |
| @@ -107,7 +107,7 @@ ge::graphStatus LinearIndexTiling::Init() | |||
| 107 | 107 | ||
| 108 | // 输入是二维时,indices会被slice成一维 | 108 | // 输入是二维时,indices会被slice成一维 |
| 109 | // 输入是三维时,indices会被slice成二维 | 109 | // 输入是三维时,indices会被slice成二维 |
| 110 | - int dim = *(attrs->GetAttrPointer<int>(0)); | 110 | + int64_t dim = *(attrs->GetAttrPointer<int64_t>(0)); |
| 111 | bool combine = *(attrs->GetAttrPointer<bool>(1)); | 111 | bool combine = *(attrs->GetAttrPointer<bool>(1)); |
| 112 | if (dim < 0) { | 112 | if (dim < 0) { |
| 113 | dim += varShapeSize; | 113 | dim += varShapeSize; |
| @@ -102,7 +102,7 @@ ge::graphStatus InferDataType4NonZero(gert::InferDataTypeContext* context) | |||
| 102 | OP_LOGD(context->GetNodeName(), "InferDtype4NonZero enter"); | 102 | OP_LOGD(context->GetNodeName(), "InferDtype4NonZero enter"); |
| 103 | auto attrsPtr = context->GetAttrs(); | 103 | auto attrsPtr = context->GetAttrs(); |
| 104 | OP_CHECK_NULL_WITH_CONTEXT(context, attrsPtr); | 104 | OP_CHECK_NULL_WITH_CONTEXT(context, attrsPtr); |
| 105 | - const int32_t* dstDtype = attrsPtr->GetAttrPointer<int32_t>(1); | 105 | + const int64_t* dstDtype = attrsPtr->GetAttrPointer<int64_t>(1); |
| 106 | OP_CHECK_NULL_WITH_CONTEXT(context, dstDtype); | 106 | OP_CHECK_NULL_WITH_CONTEXT(context, dstDtype); |
| 107 | ge::DataType outDtype = static_cast<ge::DataType>(*dstDtype); | 107 | ge::DataType outDtype = static_cast<ge::DataType>(*dstDtype); |
| 108 | OP_LOGI(context->GetNodeName(), "set output dtype: %s", ToString(outDtype).c_str()); | 108 | OP_LOGI(context->GetNodeName(), "set output dtype: %s", ToString(outDtype).c_str()); |
| @@ -151,7 +151,7 @@ ge::graphStatus ScatterElementsV2Tiling310P::Init() { | |||
| 151 | const gert::StorageShape* updatesShape = context->GetInputShape(2); | 151 | const gert::StorageShape* updatesShape = context->GetInputShape(2); |
| 152 | auto attrs = context->GetAttrs(); | 152 | auto attrs = context->GetAttrs(); |
| 153 | 153 | ||
| 154 | - int axis = *(attrs->GetAttrPointer<int>(0)); | 154 | + int64_t axis = *(attrs->GetAttrPointer<int64_t>(0)); |
| 155 | const char* reduce = attrs->GetAttrPointer<char>(1); | 155 | const char* reduce = attrs->GetAttrPointer<char>(1); |
| 156 | if (strcmp(reduce, "none") == 0) { | 156 | if (strcmp(reduce, "none") == 0) { |
| 157 | tilingData.computeMode = 0; | 157 | tilingData.computeMode = 0; |
| @@ -338,7 +338,7 @@ ge::graphStatus ScatterElementsV2Tiling::Init() | |||
| 338 | uint32_t inputDataAlign = dataAlign / inputSize; | 338 | uint32_t inputDataAlign = dataAlign / inputSize; |
| 339 | uint32_t indexDataAlign = dataAlign / indicesSize; | 339 | uint32_t indexDataAlign = dataAlign / indicesSize; |
| 340 | 340 | ||
| 341 | - const int* dim = (attrs->GetAttrPointer<int>(0)); | 341 | + const int64_t* dim = (attrs->GetAttrPointer<int64_t>(0)); |
| 342 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, dim); | 342 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, dim); |
| 343 | const char* reduce = attrs->GetAttrPointer<char>(1); | 343 | const char* reduce = attrs->GetAttrPointer<char>(1); |
| 344 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, reduce); | 344 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, reduce); |
| @@ -580,7 +580,7 @@ bool ScatterElementsV2Tiling::CacheOpSupport() { | |||
| 580 | auto attrs = tilingContext->GetAttrs(); | 580 | auto attrs = tilingContext->GetAttrs(); |
| 581 | auto inputDtype = tilingContext->GetInputDesc(INPUT_0)->GetDataType(); | 581 | auto inputDtype = tilingContext->GetInputDesc(INPUT_0)->GetDataType(); |
| 582 | 582 | ||
| 583 | - const int* dim = (attrs->GetAttrPointer<int>(0)); | 583 | + const int64_t* dim = (attrs->GetAttrPointer<int64_t>(0)); |
| 584 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, dim); | 584 | OP_CHECK_NULL_WITH_CONTEXT(tilingContext, dim); |
| 585 | auto inputShape = tilingContext->GetInputShape(INPUT_0)->GetStorageShape(); | 585 | auto inputShape = tilingContext->GetInputShape(INPUT_0)->GetStorageShape(); |
| 586 | auto inputDimNum = inputShape.GetDimNum(); | 586 | auto inputDimNum = inputShape.GetDimNum(); |
| @@ -754,7 +754,7 @@ ge::graphStatus ScatterElementsV2Tiling::RunCacheOpTiling() { | |||
| 754 | 754 | ||
| 755 | auto inputDimNum = inputShape.GetDimNum(); | 755 | auto inputDimNum = inputShape.GetDimNum(); |
| 756 | auto attrs = tilingContext->GetAttrs(); | 756 | auto attrs = tilingContext->GetAttrs(); |
| 757 | - const int* dim = (attrs->GetAttrPointer<int>(0)); | 757 | + const int64_t* dim = (attrs->GetAttrPointer<int64_t>(0)); |
| 758 | realDim = (*dim < 0 ? *dim + inputDimNum : *dim); | 758 | realDim = (*dim < 0 ? *dim + inputDimNum : *dim); |
| 759 | 759 | ||
| 760 | SetDimsByAxisType(inputShape, indicesShape, updatesShape, inputDimNum); | 760 | SetDimsByAxisType(inputShape, indicesShape, updatesShape, inputDimNum); |
| @@ -32,7 +32,7 @@ static const std::initializer_list<op::DataType> AICORE_DTYPE_SUPPORT_LIST = { | |||
| 32 | 32 | ||
| 33 | static const std::initializer_list<op::DataType> ASCEND910B_AICORE_DTYPE_SUPPORT_LIST = { | 33 | static const std::initializer_list<op::DataType> ASCEND910B_AICORE_DTYPE_SUPPORT_LIST = { |
| 34 | op::DataType::DT_FLOAT, op::DataType::DT_FLOAT16, op::DataType::DT_BOOL, op::DataType::DT_BF16, | 34 | op::DataType::DT_FLOAT, op::DataType::DT_FLOAT16, op::DataType::DT_BOOL, op::DataType::DT_BF16, |
| 35 | - op::DataType::DT_INT64, op::DataType::DT_INT8}; | 35 | + op::DataType::DT_INT64, op::DataType::DT_INT8, op::DataType::DT_INT32, op::DataType::DT_INT16}; |
| 36 | 36 | ||
| 37 | static const std::initializer_list<op::DataType> ASCEND950_AICORE_DTYPE_SUPPORT_LIST = { | 37 | static const std::initializer_list<op::DataType> ASCEND950_AICORE_DTYPE_SUPPORT_LIST = { |
| 38 | op::DataType::DT_FLOAT, op::DataType::DT_FLOAT16, op::DataType::DT_BOOL, op::DataType::DT_BF16, | 38 | op::DataType::DT_FLOAT, op::DataType::DT_FLOAT16, op::DataType::DT_BOOL, op::DataType::DT_BF16, |