diff --git a/ads/common/ops/kernels/op_host/add_custom.cpp b/ads/common/ops/kernels/op_host/add_custom.cpp index 95037bc53de23d23b07d88f21be09e64bcefc7f6..6fe44675d579119e8ae182b81f04e1644dcbb374 100644 --- a/ads/common/ops/kernels/op_host/add_custom.cpp +++ b/ads/common/ops/kernels/op_host/add_custom.cpp @@ -26,7 +26,13 @@ namespace ge { static ge::graphStatus InferShape(gert::InferShapeContext* context) { const gert::Shape* x1_shape = context->GetInputShape(0); + if (x1_shape == nullptr) { + return ge::GRAPH_FAILED; + } gert::Shape* y_shape = context->GetOutputShape(0); + if (y_shape == nullptr) { + return ge::GRAPH_FAILED; + } *y_shape = *x1_shape; return GRAPH_SUCCESS; } diff --git a/ads/common/ops/kernels/op_host/dynamic_scatter.cpp b/ads/common/ops/kernels/op_host/dynamic_scatter.cpp index e6b30b14eb81fef6ecac7939f9f26b4fe2ea7b34..f6e156765e5dd0d489fa53edb264b819b2369a21 100644 --- a/ads/common/ops/kernels/op_host/dynamic_scatter.cpp +++ b/ads/common/ops/kernels/op_host/dynamic_scatter.cpp @@ -171,8 +171,13 @@ namespace ge { static ge::graphStatus InferShape(gert::InferShapeContext* context) { const gert::Shape* featShape = context->GetInputShape(0); - + if (featShape == nullptr) { + return ge::GRAPH_FAILED; + } gert::Shape* outShape = context->GetOutputShape(0); + if (outShape == nullptr) { + return ge::GRAPH_FAILED; + } outShape->SetDim(0, -1); outShape->SetDim(1, featShape->GetDim(1)); return GRAPH_SUCCESS; diff --git a/ads/common/ops/kernels/op_host/dynamic_voxelization.cpp b/ads/common/ops/kernels/op_host/dynamic_voxelization.cpp index 016fef57c7bc9ad99e8a609908df88beb844f417..3c8093c645fe2fed67731f1efcfff7fa91a16c4f 100644 --- a/ads/common/ops/kernels/op_host/dynamic_voxelization.cpp +++ b/ads/common/ops/kernels/op_host/dynamic_voxelization.cpp @@ -13,6 +13,9 @@ static ge::graphStatus TilingForDynamicVox(gert::TilingContext* context) DynamicVoxTilingData tiling; // get core num auto platformInfoPtr = context->GetPlatformInfo(); + if (platformInfoPtr == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendPlatformInfo = platform_ascendc::PlatformAscendC(platformInfoPtr); uint32_t coreNum = ascendPlatformInfo.GetCoreNumAic(); if (coreNum == 0) { @@ -22,6 +25,9 @@ static ge::graphStatus TilingForDynamicVox(gert::TilingContext* context) // get tiling param auto ptsShape = context->GetInputShape(0)->GetStorageShape(); auto attrsPtr = context->GetAttrs(); + if (attrsPtr == nullptr) { + return ge::GRAPH_FAILED; + } float coorsMinX = *(attrsPtr->GetAttrPointer(0)); float coorsMinY = *(attrsPtr->GetAttrPointer(1)); float coorsMinZ = *(attrsPtr->GetAttrPointer(2)); @@ -67,7 +73,13 @@ namespace ge { static ge::graphStatus InferShapeForDynamicVoxel(gert::InferShapeContext* context) { const gert::Shape* ptsShape = context->GetInputShape(0); + if (ptsShape == nullptr) { + return ge::GRAPH_FAILED; + } gert::Shape* coorsShape = context->GetOutputShape(0); + if (coorsShape == nullptr) { + return ge::GRAPH_FAILED; + } coorsShape->SetDimNum(0); coorsShape->AppendDim(ptsShape->GetDim(0)); coorsShape->AppendDim(3); diff --git a/ads/common/ops/kernels/op_host/furthest_point_sampling_with_dist.cpp b/ads/common/ops/kernels/op_host/furthest_point_sampling_with_dist.cpp index 4fa290dc5c7137099626ce0350f716c2eb66c61c..59007262d34758d451818413a7c71497e56568bf 100644 --- a/ads/common/ops/kernels/op_host/furthest_point_sampling_with_dist.cpp +++ b/ads/common/ops/kernels/op_host/furthest_point_sampling_with_dist.cpp @@ -7,6 +7,9 @@ static ge::graphStatus TilingForFurthestPointSamplingWithDist(gert::TilingContex { FurthestPointSamplingWithDistTilingData tiling; auto platformInfo = context->GetPlatformInfo(); + if (platformInfo == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); static uint32_t core_num = ascendcPlatform.GetCoreNumAiv(); uint64_t UB_size; @@ -14,7 +17,9 @@ static ge::graphStatus TilingForFurthestPointSamplingWithDist(gert::TilingContex auto dist_shape = context->GetInputShape(0)->GetStorageShape(); auto attrs = context->GetAttrs(); - + if (attrs == nullptr) { + return ge::GRAPH_FAILED; + } if (core_num == 0) { return ge::GRAPH_FAILED; } @@ -81,11 +86,19 @@ namespace ge { static ge::graphStatus InferShape(gert::InferShapeContext* context) { const gert::Shape* points_dist_shape = context->GetInputShape(0); - + if (points_dist_shape == nullptr) { + return ge::GRAPH_FAILED; + } auto attrs = context->GetAttrs(); + if (attrs == nullptr) { + return ge::GRAPH_FAILED; + } const int32_t* points_num = attrs->GetAttrPointer(0); gert::Shape* idx_shape = context->GetOutputShape(0); + if (idx_shape == nullptr) { + return ge::GRAPH_FAILED; + } idx_shape->AppendDim(points_dist_shape->GetDim(0)); idx_shape->AppendDim(*points_num); return GRAPH_SUCCESS; diff --git a/ads/common/ops/kernels/op_host/multi_scale_deformable_attention_grad.cpp b/ads/common/ops/kernels/op_host/multi_scale_deformable_attention_grad.cpp index bb907232a758c342ccda454ea767c090aebba8fa..6e88df394abe43bf4a79856cb964da7eb2d57e04 100644 --- a/ads/common/ops/kernels/op_host/multi_scale_deformable_attention_grad.cpp +++ b/ads/common/ops/kernels/op_host/multi_scale_deformable_attention_grad.cpp @@ -23,6 +23,9 @@ namespace optiling auto samplingLocationsShape = context->GetInputTensor(3)->GetStorageShape(); auto platformInfoptr = context->GetPlatformInfo(); + if (platformInfoptr == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendplatformInfo = platform_ascendc::PlatformAscendC(platformInfoptr); uint32_t coreNum = ascendplatformInfo.GetCoreNumAiv(); context->SetBlockDim(coreNum); @@ -49,12 +52,19 @@ namespace ge static ge::graphStatus InferShapeForMultiScaleDeformableAttentionGrad(gert::InferShapeContext *context) { const gert::Shape *value_shape = context->GetInputShape(0); + if (value_shape == nullptr) { + return ge::GRAPH_FAILED; + } const gert::Shape *sampling_locations_shape = context->GetInputShape(3); - + if (sampling_locations_shape == nullptr) { + return ge::GRAPH_FAILED; + } gert::Shape *grad_value_shape = context->GetOutputShape(0); gert::Shape *grad_sample_loc_shape = context->GetOutputShape(1); gert::Shape *grad_attn_weight_shape = context->GetOutputShape(2); - + if ((grad_value_shape == nullptr) || (grad_sample_loc_shape == nullptr) || (grad_attn_weight_shape == nullptr)) { + return ge::GRAPH_FAILED; + } grad_value_shape->AppendDim(value_shape->GetDim(0)); grad_value_shape->AppendDim(value_shape->GetDim(1)); grad_value_shape->AppendDim(value_shape->GetDim(2)); diff --git a/ads/common/ops/kernels/op_host/multi_scale_deformable_attn_function_v2.cpp b/ads/common/ops/kernels/op_host/multi_scale_deformable_attn_function_v2.cpp index 845b50f0b4f02517ad3f6667aff6c57304ccdd37..fee87aa531990ad32d17c35d6866f47c3ab5cd44 100644 --- a/ads/common/ops/kernels/op_host/multi_scale_deformable_attn_function_v2.cpp +++ b/ads/common/ops/kernels/op_host/multi_scale_deformable_attn_function_v2.cpp @@ -23,6 +23,9 @@ namespace optiling auto samplingLocationsShape = context->GetInputTensor(3)->GetStorageShape(); auto platformInfoptr = context->GetPlatformInfo(); + if (platformInfoptr == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendplatformInfo = platform_ascendc::PlatformAscendC(platformInfoptr); uint32_t coreNum = ascendplatformInfo.GetCoreNumAiv(); context->SetBlockDim(coreNum); @@ -49,10 +52,17 @@ namespace ge static ge::graphStatus InferShapeForMultiScaleDeformableAttnFunctionV2(gert::InferShapeContext *context) { const gert::Shape *valueShape = context->GetInputShape(0); + if (valueShape == nullptr) { + return ge::GRAPH_FAILED; + } const gert::Shape *samplingLocationsShape = context->GetInputShape(3); - + if (samplingLocationsShape == nullptr) { + return ge::GRAPH_FAILED; + } gert::Shape *y_shape = context->GetOutputShape(0); - + if (y_shape == nullptr) { + return ge::GRAPH_FAILED; + } y_shape->SetDimNum(0); y_shape->AppendDim(valueShape->GetDim(0)); y_shape->AppendDim(samplingLocationsShape->GetDim(1)); diff --git a/ads/common/ops/kernels/op_host/nms3d.cpp b/ads/common/ops/kernels/op_host/nms3d.cpp index 2ee0219c8b027be8a3afa3dbdf7e8fe11628dd17..a0010858725763108e8357607e2801a7314f70e6 100644 --- a/ads/common/ops/kernels/op_host/nms3d.cpp +++ b/ads/common/ops/kernels/op_host/nms3d.cpp @@ -8,8 +8,10 @@ namespace optiling { static ge::graphStatus Nms3dTilingFunc(gert::TilingContext *context) { Nms3dTilingData tiling; - auto platformInfo = context->GetPlatformInfo(); + if (platformInfo == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); static uint32_t coreNum = ascendcPlatform.GetCoreNumAiv(); @@ -17,6 +19,9 @@ static ge::graphStatus Nms3dTilingFunc(gert::TilingContext *context) auto maskShape = context->GetOutputShape(0)->GetStorageShape(); auto dtype = context->GetInputDesc(0)->GetDataType(); auto attrs = context->GetAttrs(); + if (attrs == nullptr) { + return ge::GRAPH_FAILED; + } uint32_t boxNum = boxShape.GetDim(0); uint32_t maskNum = maskShape.GetDim(1); uint32_t dataAlign = 16; diff --git a/ads/common/ops/kernels/op_host/nms3d_normal_tiling.cpp b/ads/common/ops/kernels/op_host/nms3d_normal_tiling.cpp index 4561203bc9b4415ad247834ca54da0fda0db92dd..4520788f001b0fd105d165358fef5b2f47066829 100644 --- a/ads/common/ops/kernels/op_host/nms3d_normal_tiling.cpp +++ b/ads/common/ops/kernels/op_host/nms3d_normal_tiling.cpp @@ -10,6 +10,9 @@ static ge::graphStatus Nms3dNormalTilingFunc(gert::TilingContext* context) Nms3dNormalTilingData tiling; auto platformInfo = context->GetPlatformInfo(); + if (platformInfo == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendcPlatform = platform_ascendc::PlatformAscendC(platformInfo); static uint32_t coreNum = ascendcPlatform.GetCoreNumAiv(); @@ -17,6 +20,9 @@ static ge::graphStatus Nms3dNormalTilingFunc(gert::TilingContext* context) auto maskShape = context->GetOutputShape(0)->GetStorageShape(); auto dtype = context->GetInputDesc(0)->GetDataType(); auto attrs = context->GetAttrs(); + if (attrs == nullptr) { + return ge::GRAPH_FAILED; + } uint32_t boxNum = boxShape.GetDim(0); uint32_t maskNum = maskShape.GetDim(1); uint32_t dataAlign = 16; diff --git a/ads/common/ops/kernels/op_host/points_in_box.cpp b/ads/common/ops/kernels/op_host/points_in_box.cpp index acac1cbd9343b0d9dbc796b96b487815496cbd3e..121d6e7a4cc5bb6d09216bd8ecd590726389f390 100644 --- a/ads/common/ops/kernels/op_host/points_in_box.cpp +++ b/ads/common/ops/kernels/op_host/points_in_box.cpp @@ -20,6 +20,9 @@ static ge::graphStatus TilingFunc(gert::TilingContext* context) { PointsInBoxTilingData tiling; auto platformInfoptr = context->GetPlatformInfo(); + if (platformInfoptr == nullptr) { + return ge::GRAPH_FAILED; + } auto ascendplatformInfo = platform_ascendc::PlatformAscendC(platformInfoptr); auto core_number = ascendplatformInfo.GetCoreNumAiv(); uint32_t totalresult = context->GetInputTensor(1)->GetShapeSize() / 3; @@ -63,7 +66,13 @@ namespace ge { static ge::graphStatus InferShape(gert::InferShapeContext* context) { const gert::Shape* pts_shape = context->GetInputShape(1); + if (pts_shape == nullptr) { + return ge::GRAPH_FAILED; + } gert::Shape* y_shape = context->GetOutputShape(0); + if (y_shape == nullptr) { + return ge::GRAPH_FAILED; + } y_shape->SetDimNum(0); y_shape->AppendDim(pts_shape->GetDim(0)); y_shape->AppendDim(pts_shape->GetDim(1));