已合并
aclnnAmpUpdateScale tiling增加校验 #3824
sunchun创建于 7月6日
aclnnAmpUpdateScale tiling增加校验 #3824
已合并
sunchun创建于 7月6日
2 个文件变更+23-7
@@ -212,6 +212,14 @@ aclnnStatus aclnnAmpUpdateScale(
212 <th>描述</th>212 <th>描述</th>
213 </tr></thead>213 </tr></thead>
214 <tbody>214 <tbody>
215+ <tr>
216+ <td rowspan="2">ACLNN_ERR_INNER_TILING_ERROR</td>
217+ <td rowspan="2">561002</td>
218+ <td>输入currentScale、growthTracker、foundInf的shape不是标量[1]。</td>
219+ </tr>
220+ <tr>
221+ <td>growthInterval超出取值范围[1, 2147483647]。</td>
222+ </tr>
215 <tr>223 <tr>
216 <td>ACLNN_ERR_PARAM_NULLPTR</td>224 <td>ACLNN_ERR_PARAM_NULLPTR</td>
217 <td>161001</td>225 <td>161001</td>
@@ -33,7 +33,7 @@ namespace optiling {
33 33 
34class AmpUpdateScaleTiling {34class AmpUpdateScaleTiling {
35public:35public:
36- explicit AmpUpdateScaleTiling(gert::TilingContext* context) : TilingContext(context){};36+ explicit AmpUpdateScaleTiling(gert::TilingContext* context) : TilingContext(context) {};
37 ge::graphStatus Init();37 ge::graphStatus Init();
38 ge::graphStatus RunKernelTiling();38 ge::graphStatus RunKernelTiling();
39 void TilingDataPrint() const;39 void TilingDataPrint() const;
@@ -73,14 +73,20 @@ ge::graphStatus AmpUpdateScaleTiling::Init()
73 // 校验输入 tensor 的 shape 均为标量 [1]73 // 校验输入 tensor 的 shape 均为标量 [1]
74 constexpr int kInputNum = 3;74 constexpr int kInputNum = 3;
75 const char* kInputNames[kInputNum] = {"currentScale", "growthTracker", "foundInf"};75 const char* kInputNames[kInputNum] = {"currentScale", "growthTracker", "foundInf"};
76+ constexpr int64_t kScalarDimNum = 1;
76 for (int i = 0; i < kInputNum; i++) {77 for (int i = 0; i < kInputNum; i++) {
77 auto inputShape = TilingContext->GetInputShape(i);78 auto inputShape = TilingContext->GetInputShape(i);
78 OP_CHECK_NULL_WITH_CONTEXT(TilingContext, inputShape);79 OP_CHECK_NULL_WITH_CONTEXT(TilingContext, inputShape);
79- int64_t shapeSize = inputShape->GetStorageShape().GetShapeSize();80+ auto storageShape = inputShape->GetStorageShape();
81+ OP_CHECK_IF(storageShape.GetDimNum() != kScalarDimNum,
82+ OP_LOGE_FOR_INVALID_SHAPEDIM(TilingContext->GetNodeName(), kInputNames[i],
83+ std::to_string(storageShape.GetDimNum()).c_str(), "scalar [1]"),
84+ return ge::GRAPH_FAILED);
85+ int64_t shapeSize = storageShape.GetShapeSize();
80 OP_CHECK_IF(shapeSize != 1,86 OP_CHECK_IF(shapeSize != 1,
81- OP_LOGE_FOR_INVALID_SHAPESIZES_WITH_REASON(TilingContext->GetNodeName(), kInputNames[i],87+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(TilingContext->GetNodeName(), kInputNames[i],
82- std::to_string(shapeSize).c_str(),88+ std::to_string(shapeSize).c_str(),
83- "The shape of input must be scalar [1]"),89+ "The shape of input must be scalar [1]"),
84 return ge::GRAPH_FAILED);90 return ge::GRAPH_FAILED);
85 }91 }
86 return ge::GRAPH_SUCCESS;92 return ge::GRAPH_SUCCESS;
@@ -122,7 +128,9 @@ void AmpUpdateScaleTiling::TilingDataPrint() const
122static ge::graphStatus TilingAmpUpdateScale(gert::TilingContext* context)128static ge::graphStatus TilingAmpUpdateScale(gert::TilingContext* context)
123{129{
124 AmpUpdateScaleTiling tilingObject(context);130 AmpUpdateScaleTiling tilingObject(context);
125- tilingObject.Init();131+ if (tilingObject.Init() != ge::GRAPH_SUCCESS) {
132+ return ge::GRAPH_FAILED;
133+ }
126 return tilingObject.RunKernelTiling();134 return tilingObject.RunKernelTiling();
127}135}
128 136 
@@ -135,4 +143,4 @@ struct AmpUpdateScaleCompileInfo {};
135IMPL_OP_OPTILING(AmpUpdateScale)143IMPL_OP_OPTILING(AmpUpdateScale)
136 .Tiling(TilingAmpUpdateScale)144 .Tiling(TilingAmpUpdateScale)
137 .TilingParse<AmpUpdateScaleCompileInfo>(TilingPrepareForAmpUpdateScale);145 .TilingParse<AmpUpdateScaleCompileInfo>(TilingPrepareForAmpUpdateScale);
138-} // namespace optiling146+} // namespace optiling