已合并
aclnnAddRmsNormDynamicQuantV2 接口资料修改+新增输出校验 #4402
aclnnAddRmsNormDynamicQuantV2 接口资料修改+新增输出校验 #4402
已合并
guoxu7创建于 4月29日
3 个文件变更+14-6
@@ -58,14 +58,14 @@
58 $$58 $$
59 scale2Out=\begin{cases}59 scale2Out=\begin{cases}
60 row\_max(abs(input2))/127 & outputMask[1]=True\ ||\ (outputMask\ = null\ \&\ smoothScale1Optional\ != null\ \&\ smoothScale2Optional\ != null) \\60 row\_max(abs(input2))/127 & outputMask[1]=True\ ||\ (outputMask\ = null\ \&\ smoothScale1Optional\ != null\ \&\ smoothScale2Optional\ != null) \\
61- 无效输出 & outputMask[1]=False\ ||\ (outputMask\ = null\ \&\ smoothScale1Optional\ != null\ \&\ smoothScale2Optional\ = null)61+ 无效输出 & outputMask[1]=False\ ||\ (outputMask\ = null\ \&\ (smoothScale1Optional\ = null\ ||\ smoothScale2Optional\ = null))
62 \end{cases}62 \end{cases}
63 $$63 $$
64 64
65 $$65 $$
66 y2Out=\begin{cases}66 y2Out=\begin{cases}
67 round(input2/scale2Out) & outputMask[1]=True\ ||\ (outputMask\ = null\ \&\ smoothScale1Optional\ != null\ \&\ smoothScale2Optional\ != null)\\67 round(input2/scale2Out) & outputMask[1]=True\ ||\ (outputMask\ = null\ \&\ smoothScale1Optional\ != null\ \&\ smoothScale2Optional\ != null)\\
68- 无效输出 & outputMask[1]=False\ ||\ (outputMask\ = null\ \&\ smoothScale1Optional\ != null\ \&\ smoothScale2Optional\ = null)68+ 无效输出 & outputMask[1]=False\ ||\ (outputMask\ = null\ \&\ (smoothScale1Optional\ = null\ ||\ smoothScale2Optional\ = null))
69 \end{cases}69 \end{cases}
70 $$70 $$
71 71
@@ -60,14 +60,14 @@
60 scale2Out=\begin{cases}60 scale2Out=\begin{cases}
61 row\_max(abs(input2))/127 & (outputMask[1]=True\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ smoothScale2Optional)) \& y2Out为INT8 \\61 row\_max(abs(input2))/127 & (outputMask[1]=True\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ smoothScale2Optional)) \& y2Out为INT8 \\
62 row\_max(abs(input2))/7 & (outputMask[1]=True\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ smoothScale2Optional)) \& y2Out为INT4 \\62 row\_max(abs(input2))/7 & (outputMask[1]=True\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ smoothScale2Optional)) \& y2Out为INT4 \\
63- 无效输出 & outputMask[1]=False\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ !smoothScale2Optional)63+ 无效输出 & outputMask[1]=False\ ||\ (!outputMask\ \&\ (!smoothScale1Optional\ ||\ !smoothScale2Optional))
64 \end{cases}64 \end{cases}
65 $$65 $$
66 66 
67 $$67 $$
68 y2Out=\begin{cases}68 y2Out=\begin{cases}
69 round(input2/scale2Out) & outputMask[1]=True\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ smoothScale2Optional)\\69 round(input2/scale2Out) & outputMask[1]=True\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ smoothScale2Optional)\\
70- 无效输出 & outputMask[1]=False\ ||\ (!outputMask\ \&\ smoothScale1Optional\ \&\ !smoothScale2Optional)70+ 无效输出 & outputMask[1]=False\ ||\ (!outputMask\ \&\ (!smoothScale1Optional\ ||\ !smoothScale2Optional))
71 \end{cases}71 \end{cases}
72 $$72 $$
73 73 
@@ -224,7 +224,7 @@ aclnnStatus aclnnAddRmsNormDynamicQuantV2(
224 <td>y2Out(aclTensor*)</td>224 <td>y2Out(aclTensor*)</td>
225 <td>输出</td>225 <td>输出</td>
226 <td>表示量化输出Tensor,对应公式中的`y2Out`。</td>226 <td>表示量化输出Tensor,对应公式中的`y2Out`。</td>
227- <td><ul><li>支持空Tensor。</li><li>如果`y2Out`为有效输出时,shape需要与`y1Out`保持一致;如果`y2Out`为无效输出时,shape为[1]。</li></ul></td>227+ <td><ul><li>支持空Tensor。</li><li>如果`y2Out`为有效输出时,shape和数据类型需要与`y1Out`保持一致;如果`y2Out`为无效输出时,shape为[1]。</li></ul></td>
228 <td>INT4、INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN</td>228 <td>INT4、INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN</td>
229 <td>ND</td>229 <td>ND</td>
230 <td>2-8</td>230 <td>2-8</td>
@@ -372,6 +372,7 @@ aclnnStatus aclnnAddRmsNormDynamicQuantV2(
372 - <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>372 - <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>
373 - 参数`y1Out``y2Out`数据类型仅支持int4和int8。373 - 参数`y1Out``y2Out`数据类型仅支持int4和int8。
374 - <term>Ascend 950PR/Ascend 950DT</term>374 - <term>Ascend 950PR/Ascend 950DT</term>
375+ - 暂不支持可选属性`output_mask`的配置。
375 - 参数`y1Out``y2Out`数据类型不支持int4。376 - 参数`y1Out``y2Out`数据类型不支持int4。
376- 确定性计算:377- 确定性计算:
377 - aclnnAddRmsNormDynamicQuantV2默认确定性实现。378 - aclnnAddRmsNormDynamicQuantV2默认确定性实现。
@@ -116,7 +116,14 @@ static bool CheckDtypeValid(
116 116 
117 OP_CHECK_DTYPE_NOT_MATCH(scale1Out, op::DataType::DT_FLOAT, return false);117 OP_CHECK_DTYPE_NOT_MATCH(scale1Out, op::DataType::DT_FLOAT, return false);
118 OP_CHECK_DTYPE_NOT_MATCH(scale2Out, op::DataType::DT_FLOAT, return false);118 OP_CHECK_DTYPE_NOT_MATCH(scale2Out, op::DataType::DT_FLOAT, return false);
119- 119+ // 当y2Out为无效输出时,y2out的shape必须为[1]
120+ if (Ops::NN::AclnnUtil::IsRegbase() && (smoothScale1Optional == nullptr || smoothScale2Optional == nullptr)) {
121+ auto shape = y2Out->GetViewShape();
122+ if (shape.GetDimNum() != 1 || shape.GetDim(0) != 1) {
123+ OP_LOGE(ACLNN_ERR_PARAM_INVALID, "When y2Out is an invalid output, y2Out'shape must be [1].");
124+ return false;
125+ }
126+ }
120 return true;127 return true;
121}128}
122 129