已合并
aclnn文件加上芯片标签 #7981
zhouwenfang创建于 7月27日
aclnn文件加上芯片标签 #7981
已合并
共 44 个文件变更+1064-567
| @@ -433,7 +433,7 @@ | |||
| 433 | <td>✓</td> | 433 | <td>✓</td> |
| 434 | <td>✓</td> | 434 | <td>✓</td> |
| 435 | <td>✓</td> | 435 | <td>✓</td> |
| 436 | - <td>✓✗</td> | 436 | + <td>✗</td> |
| 437 | <td>AI Core</td> | 437 | <td>AI Core</td> |
| 438 | <td>该算子暂无Ascend C代码实现,欢迎开发者补充贡献,贡献方式参考<a href="../../CONTRIBUTING.md">贡献指南</a>。</td> | 438 | <td>该算子暂无Ascend C代码实现,欢迎开发者补充贡献,贡献方式参考<a href="../../CONTRIBUTING.md">贡献指南</a>。</td> |
| 439 | </tr> | 439 | </tr> |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -23,7 +33,7 @@ | |||
| 23 | X_{dq} = X_q \times 2^{sf - bias} | 33 | X_{dq} = X_q \times 2^{sf - bias} |
| 24 | $$ | 34 | $$ |
| 25 | 35 | ||
| 26 | - - 其中 $sf$ 是缩放因子,由输入mxscale提供;$bias$是指数位的偏移,对于FLOAT8_E8M0格式,$bias=127$;$X_q$是量化得到的FLOAT4/FLOAT8张量;$X_{dq}$ 是反量化得到的FLOAT16/BFLOAT16/FLOAT32张量。 | 36 | + - 其中$sf$是缩放因子,由输入mxscale提供;$bias$是指数位的偏移,对于FLOAT8_E8M0格式,$bias=127$;$X_q$是量化得到的FLOAT4/FLOAT8张量;$X_{dq}$是反量化得到的FLOAT16/BFLOAT16/FLOAT32张量。 |
| 27 | 37 | ||
| 28 | ## 函数原型 | 38 | ## 函数原型 |
| 29 | 39 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:不支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | × | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -174,15 +184,19 @@ aclnnStatus aclnnAscendAntiQuant( | |||
| 174 | </tbody> | 184 | </tbody> |
| 175 | </table> | 185 | </table> |
| 176 | 186 | ||
| 187 | + <!-- npu="310p" id7 --> | ||
| 177 | - <term>Atlas 推理系列产品</term>: | 188 | - <term>Atlas 推理系列产品</term>: |
| 178 | - 数据类型: | 189 | - 数据类型: |
| 179 | - 入参`x`仅支持INT8。 | 190 | - 入参`x`仅支持INT8。 |
| 180 | - 入参`scale`、`offset`和出参`y`不支持BFLOAT16。 | 191 | - 入参`scale`、`offset`和出参`y`不支持BFLOAT16。 |
| 181 | - 入参`dstType`仅支持取值1,表示FLOAT16。 | 192 | - 入参`dstType`仅支持取值1,表示FLOAT16。 |
| 182 | - 入参`scale`、`offset`仅支持一维,且只能等于x尾轴大小或1,当x为int32类型时,必须为x尾轴大小的8倍。 | 193 | - 入参`scale`、`offset`仅支持一维,且只能等于x尾轴大小或1,当x为int32类型时,必须为x尾轴大小的8倍。 |
| 194 | + <!-- end id7 --> | ||
| 195 | + <!-- npu="A3,910b" id8 --> | ||
| 183 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 196 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 184 | - 入参`x`仅支持INT4、INT8、INT32。 | 197 | - 入参`x`仅支持INT4、INT8、INT32。 |
| 185 | - 入参`scale`、`offset`仅支持一维,且只能等于x尾轴大小或1,当x为int32类型时,必须为x尾轴大小的8倍。 | 198 | - 入参`scale`、`offset`仅支持一维,且只能等于x尾轴大小或1,当x为int32类型时,必须为x尾轴大小的8倍。 |
| 199 | + <!-- end id8 --> | ||
| 186 | 200 | ||
| 187 | - **返回值** | 201 | - **返回值** |
| 188 | 202 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:不支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | × | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -173,15 +183,19 @@ aclnnStatus aclnnAscendQuant( | |||
| 173 | </tbody> | 183 | </tbody> |
| 174 | </table> | 184 | </table> |
| 175 | 185 | ||
| 186 | + <!-- npu="A3,910b" id7 --> | ||
| 176 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 187 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 177 | 188 | ||
| 178 | - 参数`x`、`scale`、`offset`的数据格式为NZ时,数据类型仅支持FLOAT32。 | 189 | - 参数`x`、`scale`、`offset`的数据格式为NZ时,数据类型仅支持FLOAT32。 |
| 179 | - 当数据格式为NZ时,出参`y`的数据类型支持INT32。 | 190 | - 当数据格式为NZ时,出参`y`的数据类型支持INT32。 |
| 191 | + <!-- end id7 --> | ||
| 180 | 192 | ||
| 193 | + <!-- npu="310p" id8 --> | ||
| 181 | - <term>Atlas 推理系列产品</term>: | 194 | - <term>Atlas 推理系列产品</term>: |
| 182 | - 入参`x`、`scale`、`offset`的数据类型不支持BFLOAT16,数据格式不支持NZ。 | 195 | - 入参`x`、`scale`、`offset`的数据类型不支持BFLOAT16,数据格式不支持NZ。 |
| 183 | - 出参`y`数据类型仅支持INT8,数据格式不支持NZ。 | 196 | - 出参`y`数据类型仅支持INT8,数据格式不支持NZ。 |
| 184 | - 入参`dstType`仅支持取值2,表示INT8。 | 197 | - 入参`dstType`仅支持取值2,表示INT8。 |
| 198 | + <!-- end id8 --> | ||
| 185 | 199 | ||
| 186 | - **返回值** | 200 | - **返回值** |
| 187 | 201 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -184,6 +194,7 @@ aclnnStatus aclnnAscendQuantV3( | |||
| 184 | </tbody> | 194 | </tbody> |
| 185 | </table> | 195 | </table> |
| 186 | 196 | ||
| 197 | + <!-- npu="A3,910b" id7 --> | ||
| 187 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 198 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 188 | 199 | ||
| 189 | - 参数`x`、`scale`、`offset`的数据格式为NZ时,数据类型仅支持FLOAT32。 | 200 | - 参数`x`、`scale`、`offset`的数据格式为NZ时,数据类型仅支持FLOAT32。 |
| @@ -191,18 +202,23 @@ aclnnStatus aclnnAscendQuantV3( | |||
| 191 | - 入参`roundMode`:支持取值round,ceil,trunc,floor。当输入`x`的数据格式为NZ时,支持取值round。 | 202 | - 入参`roundMode`:支持取值round,ceil,trunc,floor。当输入`x`的数据格式为NZ时,支持取值round。 |
| 192 | - 入参`dstType`支持取值2,3,29,分别表示INT8、INT32、INT4。当输入`x`的数据格式为NZ时,支持取值3,表示INT32。 | 203 | - 入参`dstType`支持取值2,3,29,分别表示INT8、INT32、INT4。当输入`x`的数据格式为NZ时,支持取值3,表示INT32。 |
| 193 | - 入参`axis`支持指定x的最后两个维度(假设输入x维度是xDimNum,axis取值范围是[-2,-1]或[xDimNum-2,xDimNum-1])。 | 204 | - 入参`axis`支持指定x的最后两个维度(假设输入x维度是xDimNum,axis取值范围是[-2,-1]或[xDimNum-2,xDimNum-1])。 |
| 205 | + <!-- end id7 --> | ||
| 194 | 206 | ||
| 207 | + <!-- npu="950" id8 --> | ||
| 195 | - <term>Ascend 950PR/Ascend 950DT</term>: | 208 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 196 | - 参数`x`、`scale`、`offset`的数据格式不支持NZ。 | 209 | - 参数`x`、`scale`、`offset`的数据格式不支持NZ。 |
| 197 | - 入参`roundMode`:`dstType`表示FLOAT8_E5M2或FLOAT8_E4M3FN时,只支持round。`dstType`表示HIFLOAT8时,支持round和hybrid。`dstType`表示其他类型时,支持round,ceil,trunc和floor。 | 210 | - 入参`roundMode`:`dstType`表示FLOAT8_E5M2或FLOAT8_E4M3FN时,只支持round。`dstType`表示HIFLOAT8时,支持round和hybrid。`dstType`表示其他类型时,支持round,ceil,trunc和floor。 |
| 198 | - 入参`axis`支持指定x的最后两个维度(假设输入x维度是xDimNum,axis取值范围是[-2,-1]或[xDimNum-2,xDimNum-1])。 | 211 | - 入参`axis`支持指定x的最后两个维度(假设输入x维度是xDimNum,axis取值范围是[-2,-1]或[xDimNum-2,xDimNum-1])。 |
| 212 | + <!-- end id8 --> | ||
| 199 | 213 | ||
| 214 | + <!-- npu="310p" id9 --> | ||
| 200 | - <term>Atlas 推理系列产品</term>: | 215 | - <term>Atlas 推理系列产品</term>: |
| 201 | - 入参`x`、`scale`、`offset`的数据类型不支持BFLOAT16,数据格式不支持NZ。 | 216 | - 入参`x`、`scale`、`offset`的数据类型不支持BFLOAT16,数据格式不支持NZ。 |
| 202 | - 出参`y`数据类型仅支持INT8,数据格式不支持NZ。 | 217 | - 出参`y`数据类型仅支持INT8,数据格式不支持NZ。 |
| 203 | - 入参`roundMode`:支持取值round,ceil,trunc,floor。 | 218 | - 入参`roundMode`:支持取值round,ceil,trunc,floor。 |
| 204 | - 入参`dstType`仅支持取值2,表示INT8。 | 219 | - 入参`dstType`仅支持取值2,表示INT8。 |
| 205 | - 入参`axis`只支持指定x的最后一个维度(假设输入x维度是xDimNum,axis取值是-1或xDimNum-1)。 | 220 | - 入参`axis`只支持指定x的最后一个维度(假设输入x维度是xDimNum,axis取值是-1或xDimNum-1)。 |
| 221 | + <!-- end id9 --> | ||
| 206 | 222 | ||
| 207 | - **返回值** | 223 | - **返回值** |
| 208 | 224 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -101,7 +111,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 101 | <td>weightScaleOptional(aclTensor*)</td> | 111 | <td>weightScaleOptional(aclTensor*)</td> |
| 102 | <td>输入</td> | 112 | <td>输入</td> |
| 103 | <td>weight的反量化scale,公式中的weightScaleOptional。</td> | 113 | <td>weight的反量化scale,公式中的weightScaleOptional。</td> |
| 104 | - <td><ul><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:shape表示为[H],且取值H和x最后一维保持一致。</li><li><term>Ascend 950PR/Ascend 950DT</term>:shape表示为[H]或[groupNum, H],且取值H和x最后一维保持一致。当groupIndexOptional为空指针时,shape为[H];当groupIndexOptional不为空指针时,shape为[groupNum, H]。</li><li>可选参数,支持传空指针。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> | 114 | + <td><ul><li>可选参数,支持传空指针。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> |
| 105 | <td>FLOAT</td> | 115 | <td>FLOAT</td> |
| 106 | <td>ND</td> | 116 | <td>ND</td> |
| 107 | <td>1或2</td> | 117 | <td>1或2</td> |
| @@ -111,7 +121,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 111 | <td>activationScaleOptional(aclTensor*)</td> | 121 | <td>activationScaleOptional(aclTensor*)</td> |
| 112 | <td>输入</td> | 122 | <td>输入</td> |
| 113 | <td>激活函数的反量化scale,公式中的activationScaleOptional。</td> | 123 | <td>激活函数的反量化scale,公式中的activationScaleOptional。</td> |
| 114 | - <td><ul><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:shape为[N..., 1],最后一维为1,其余和x保持一致。</li><li><term>Ascend 950PR/Ascend 950DT</term>:shape为[N,...],shape不超过7维不小于1维,维度比x的维度少一维,且shape与对应维度的x的shape一致。</li><li>可选参数,支持传空指针。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> | 124 | + <td><ul><li>可选参数,支持传空指针。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> |
| 115 | <td>FLOAT</td> | 125 | <td>FLOAT</td> |
| 116 | <td>ND</td> | 126 | <td>ND</td> |
| 117 | <td>1</td> | 127 | <td>1</td> |
| @@ -131,7 +141,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 131 | <td>quantScaleOptional(aclTensor*)</td> | 141 | <td>quantScaleOptional(aclTensor*)</td> |
| 132 | <td>输入</td> | 142 | <td>输入</td> |
| 133 | <td>量化的scale,公式中的quantScaleOptional。</td> | 143 | <td>量化的scale,公式中的quantScaleOptional。</td> |
| 134 | - <td><ul><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:当quantModeOptional为static时,shape表示为shape[1];quantModeOptional为dynamic时,shape维数为1维,值为x的最后一维的二分之一,shape表示为shape[H/2]。可选参数,支持传空指针。</li><li><term>Ascend 950PR/Ascend 950DT</term>:仅支持FLOAT,仅支持quantModeOptional为dynamic的场景。当quantModeOptional为dynamic时,shape表示为[H/2]或[groupNum, H/2]。当groupIndexOptional为空指针时,shape为[H/2];当groupIndexOptional不为空指针时,shape为[groupNum, H/2]。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> | 144 | + <td>不支持空Tensor。输入不支持包含±inf或nan。</td> |
| 135 | <td>FLOAT、FLOAT16</td> | 145 | <td>FLOAT、FLOAT16</td> |
| 136 | <td>ND</td> | 146 | <td>ND</td> |
| 137 | <td>1或2</td> | 147 | <td>1或2</td> |
| @@ -141,7 +151,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 141 | <td>quantOffsetOptional(aclTensor*)</td> | 151 | <td>quantOffsetOptional(aclTensor*)</td> |
| 142 | <td>输入</td> | 152 | <td>输入</td> |
| 143 | <td>量化的offset,公式中的quantOffsetOptional。</td> | 153 | <td>量化的offset,公式中的quantOffsetOptional。</td> |
| 144 | - <td><ul><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:当quantModeOptional为static时,shape为1维,值为1,shape表示为shape[1]:quantModeOptional为dynamic时,shape维数为1维,值为x的最后一维的二分之一,shape表示为shape[H/2]。可选参数,支持传空指针。</li><li><term>Ascend 950PR/Ascend 950DT</term>:暂时不支持此参数。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> | 154 | + <td>不支持空Tensor。输入不支持包含±inf或nan。</td> |
| 145 | <td>FLOAT</td> | 155 | <td>FLOAT</td> |
| 146 | <td>ND</td> | 156 | <td>ND</td> |
| 147 | <td>-</td> | 157 | <td>-</td> |
| @@ -151,7 +161,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 151 | <td>groupIndexOptional(aclTensor*)</td> | 161 | <td>groupIndexOptional(aclTensor*)</td> |
| 152 | <td>输入</td> | 162 | <td>输入</td> |
| 153 | <td>MoE分组需要的group_index。</td> | 163 | <td>MoE分组需要的group_index。</td> |
| 154 | - <td><ul><li><term>Ascend 950PR/Ascend 950DT</term>:仅支持INT64。shape为[groupNum],groupNum大于等于1。可选参数,支持传空指针。</li><li>可选参数,支持传空指针。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> | 164 | + <td><ul><li>可选参数,支持传空指针。</li><li>不支持空Tensor。输入不支持包含±inf或nan。</li></ul></td> |
| 155 | <td>INT32、INT64</td> | 165 | <td>INT32、INT64</td> |
| 156 | <td>ND</td> | 166 | <td>ND</td> |
| 157 | <td>1</td> | 167 | <td>1</td> |
| @@ -171,7 +181,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 171 | <td>quantModeOptional(char*)</td> | 181 | <td>quantModeOptional(char*)</td> |
| 172 | <td>输入</td> | 182 | <td>输入</td> |
| 173 | <td>表示使用动态量化还是静态量化。</td> | 183 | <td>表示使用动态量化还是静态量化。</td> |
| 174 | - <td><ul><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持“dynamic”和“static"。</li><li><term>Ascend 950PR/Ascend 950DT</term>:仅支持“dynamic”,支持传入空指针,传入空指针时,则默认使用“static”。</li></ul></td> | 184 | + <td>-</td> |
| 175 | <td>-</td> | 185 | <td>-</td> |
| 176 | <td>-</td> | 186 | <td>-</td> |
| 177 | <td>-</td> | 187 | <td>-</td> |
| @@ -181,7 +191,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 181 | <td>yOut(aclTensor*)</td> | 191 | <td>yOut(aclTensor*)</td> |
| 182 | <td>输出</td> | 192 | <td>输出</td> |
| 183 | <td>-</td> | 193 | <td>-</td> |
| 184 | - <td><ul><li><term>Ascend 950PR/Ascend 950DT</term>:shape为[N...,H/2],yOut的尾轴需要小超过5120。</li><li>不支持空Tensor。</li></ul></td> | 194 | + <td>不支持空Tensor。</td> |
| 185 | <td>INT8</td> | 195 | <td>INT8</td> |
| 186 | <td>ND</td> | 196 | <td>ND</td> |
| 187 | <td>-</td> | 197 | <td>-</td> |
| @@ -191,7 +201,7 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 191 | <td>scaleOut(aclTensor*)</td> | 201 | <td>scaleOut(aclTensor*)</td> |
| 192 | <td>输出</td> | 202 | <td>输出</td> |
| 193 | <td>-</td> | 203 | <td>-</td> |
| 194 | - <td><ul><li><term>Ascend 950PR/Ascend 950DT</term>:shape不超过7维,不小于1维,shape为[N,...],shape与yOut去除尾轴后的shape一致。</li><li>不支持空Tensor。</li></ul></td> | 204 | + <td>不支持空Tensor。</td> |
| 195 | <td>FLOAT</td> | 205 | <td>FLOAT</td> |
| 196 | <td>ND</td> | 206 | <td>ND</td> |
| 197 | <td>-</td> | 207 | <td>-</td> |
| @@ -220,6 +230,26 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 220 | </tbody> | 230 | </tbody> |
| 221 | </table> | 231 | </table> |
| 222 | 232 | ||
| 233 | + <!-- npu="910b" id7 --> | ||
| 234 | + - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>: | ||
| 235 | + - weightScaleOptional参数中,shape表示为[H],且取值H和x最后一维保持一致。 | ||
| 236 | + - activationScaleOptional参数中,shape为[N..., 1],最后一维为1,其余和x保持一致。 | ||
| 237 | + - quantScaleOptional参数中,当quantModeOptional为static时,shape表示为shape[1];quantModeOptional为dynamic时,shape维数为1维,值为x的最后一维的二分之一,shape表示为shape[H/2]。可选参数,支持传空指针。 | ||
| 238 | + - quantOffsetOptional参数中,当quantModeOptional为static时,shape为1维,值为1,shape表示为shape[1]:quantModeOptional为dynamic时,shape维数为1维,值为x的最后一维的二分之一,shape表示为shape[H/2]。可选参数,支持传空指针。 | ||
| 239 | + - quantModeOptional参数中,支持“dynamic”和“static"。 | ||
| 240 | + <!-- end id7 --> | ||
| 241 | + <!-- npu="950" id8 --> | ||
| 242 | + - <term>Ascend 950PR/Ascend 950DT</term>: | ||
| 243 | + - weightScaleOptional参数中,shape表示为[H]或[groupNum, H],且取值H和x最后一维保持一致。当groupIndexOptional为空指针时,shape为[H];当groupIndexOptional不为空指针时,shape为[groupNum, H]。 | ||
| 244 | + - activationScaleOptional参数中,shape为[N,...],shape不超过7维不小于1维,维度比x的维度少一维,且shape与对应维度的x的shape一致。 | ||
| 245 | + - quantScaleOptional参数中,仅支持FLOAT,仅支持quantModeOptional为dynamic的场景。当quantModeOptional为dynamic时,shape表示为[H/2]或[groupNum, H/2]。当groupIndexOptional为空指针时,shape为[H/2];当groupIndexOptional不为空指针时,shape为[groupNum, H/2]。 | ||
| 246 | + - quantOffsetOptional参数中,暂时不支持该参数。 | ||
| 247 | + - groupIndexOptional参数中,仅支持INT64。shape为[groupNum],groupNum大于等于1。可选参数,支持传空指针。 | ||
| 248 | + - quantModeOptional参数中,仅支持“dynamic”,支持传入空指针,传入空指针时,则默认使用“static”。 | ||
| 249 | + - yOut参数中,shape为[N...,H/2],yOut的尾轴需要小超过5120。 | ||
| 250 | + - scaleOut参数中,shape不超过7维,不小于1维,shape为[N,...],shape与yOut去除尾轴后的shape一致。 | ||
| 251 | + <!-- end id8 --> | ||
| 252 | + | ||
| 223 | - **返回值:** | 253 | - **返回值:** |
| 224 | 254 | ||
| 225 | aclnnStatus:返回状态码,具体参见[aclnn返回码](../../../docs/zh/context/aclnn_return_code.md)。 | 255 | aclnnStatus:返回状态码,具体参见[aclnn返回码](../../../docs/zh/context/aclnn_return_code.md)。 |
| @@ -313,17 +343,23 @@ aclnnStatus aclnnDequantSwigluQuant( | |||
| 313 | - 确定性计算: | 343 | - 确定性计算: |
| 314 | - aclnnDequantSwigluQuant默认确定性实现。 | 344 | - aclnnDequantSwigluQuant默认确定性实现。 |
| 315 | 345 | ||
| 346 | +<!-- npu="910b" id9 --> | ||
| 316 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>: | 347 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>: |
| 317 | - x的最后一维需要是2的倍数,且x的维数必须大于1维。 | 348 | - x的最后一维需要是2的倍数,且x的维数必须大于1维。 |
| 318 | - 当quantModeOptional为static时,quantScaleOptional和quantOffsetOptional为1维,值为1;quantModeOptional为dynamic时,quantScaleOptional和quantOffsetOptional的维数为1维,值为x的最后一维除以2。 | 349 | - 当quantModeOptional为static时,quantScaleOptional和quantOffsetOptional为1维,值为1;quantModeOptional为dynamic时,quantScaleOptional和quantOffsetOptional的维数为1维,值为x的最后一维除以2。 |
| 350 | +<!-- end id9 --> | ||
| 351 | +<!-- npu="950" id10 --> | ||
| 319 | - <term>Ascend 950PR/Ascend 950DT</term>: | 352 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 320 | - 输入x的最后一维需要是2的倍数,且x的维数必须大于1维。 | 353 | - 输入x的最后一维需要是2的倍数,且x的维数必须大于1维。 |
| 321 | - 当输入x的数据类型为INT32时,weightScaleOptional不能为空;当输入x的数据类型不为INT32时,weightScaleOptional不允许输入,传入空指针。 | 354 | - 当输入x的数据类型为INT32时,weightScaleOptional不能为空;当输入x的数据类型不为INT32时,weightScaleOptional不允许输入,传入空指针。 |
| 322 | - 当输入x的数据类型不为INT32时,activationScaleOptional不允许输入,传入空指针。 | 355 | - 当输入x的数据类型不为INT32时,activationScaleOptional不允许输入,传入空指针。 |
| 323 | - 当输入x的数据类型不为INT32时,biasOptional不允许输入,传入空指针。 | 356 | - 当输入x的数据类型不为INT32时,biasOptional不允许输入,传入空指针。 |
| 324 | - 输出yOut的尾轴不超过5120。 | 357 | - 输出yOut的尾轴不超过5120。 |
| 358 | +<!-- end id10 --> | ||
| 325 | 359 | ||
| 326 | -- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:算子支持的输入张量的内存大小有上限,校验公式:weightScaleOptional张量内存大小+biasOptional张量内存大小+quantScaleOptional张量内存大小+quantOffsetOptional张量内存大小 + (activationScaleOptional张量内存大小 + scaleOut张量内存大小)/40 + x张量最后一维H内存大小 * 10 < 192KB。 | 360 | +<!-- npu="A3,910b" id11 --> |
| 361 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:算子支持的输入张量的内存大小有上限,校验公式:weightScaleOptional张量内存大小+biasOptional张量内存大小+quantScaleOptional张量内存大小+quantOffsetOptional张量内存大小 +(activationScaleOptional张量内存大小 + scaleOut张量内存大小)/40 + x张量最后一维H内存大小 * 10 < 192KB。 | ||
| 362 | +<!-- end id11 --> | ||
| 327 | 363 | ||
| 328 | ## 调用示例 | 364 | ## 调用示例 |
| 329 | 365 | ||
| @@ -2,22 +2,37 @@ | |||
| 2 | 2 | ||
| 3 | ## 产品支持情况 | 3 | ## 产品支持情况 |
| 4 | 4 | ||
| 5 | -|产品 | 是否支持 | | 5 | +<!-- npu="950" id1 --> |
| 6 | -|:-------------------------|:----------:| | 6 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 7 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 7 | +<!-- end id1 --> |
| 8 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 8 | +<!-- npu="A3" id2 --> |
| 9 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 9 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 10 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 10 | +<!-- end id2 --> |
| 11 | -| <term>Atlas 推理系列产品</term> | × | | 11 | +<!-- npu="910b" id3 --> |
| 12 | -| <term>Atlas 训练系列产品</term> | × | | 12 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="910" id6 --> | ||
| 21 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 13 | 23 | ||
| 14 | ## 功能说明 | 24 | ## 功能说明 |
| 15 | 25 | ||
| 16 | - 接口功能:在Swish门控线性单元激活函数前后添加dequant和quant操作,实现x的DequantSwigluQuant计算。本接口相较于[aclnnDequantSwigluQuant](aclnnDequantSwigluQuant.md)有两类新增参数: | 26 | - 接口功能:在Swish门控线性单元激活函数前后添加dequant和quant操作,实现x的DequantSwigluQuant计算。本接口相较于[aclnnDequantSwigluQuant](aclnnDequantSwigluQuant.md)有两类新增参数: |
| 17 | 27 | ||
| 28 | + <!-- npu="950" id9 --> | ||
| 18 | 1)新增了三个<term>Ascend 950PR/Ascend 950DT</term>上使用的输入参数:dstType、roundModeOptional、activateDim。 | 29 | 1)新增了三个<term>Ascend 950PR/Ascend 950DT</term>上使用的输入参数:dstType、roundModeOptional、activateDim。 |
| 30 | + <!-- end id9 --> | ||
| 31 | + | ||
| 32 | + <!-- npu="950,A3,910b" id8 --> | ||
| 33 | + 2)在<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>和<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>上,新增了四个参数用于GPT-OSS使用的变体SwiGLU:swigluMode、clampLimit、gluAlpha和gluBias;在<term>Ascend 950PR/Ascend 950DT</term>上使用该接口时,需要给这四个参数设置默认值。请根据实际情况选择合适的接口。 | ||
| 34 | + <!-- end id8 --> | ||
| 19 | 35 | ||
| 20 | - 2)在Atlas A2和Atlas A3芯片上,新增了四个参数用于GPT-OSS使用的变体SwiGLU:swigluMode、clampLimit、gluAlpha和gluBias;在<term>Ascend 950PR/Ascend 950DT</term>上使用该接口时,需要给这四个参数设置默认值。请根据实际情况选择合适的接口。 | ||
| 21 | - swigluMode为0时的计算公式: | 36 | - swigluMode为0时的计算公式: |
| 22 | 37 | ||
| 23 | $$ | 38 | $$ |
| @@ -158,7 +173,7 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 158 | <td>x(aclTensor*)</td> | 173 | <td>x(aclTensor*)</td> |
| 159 | <td>输入</td> | 174 | <td>输入</td> |
| 160 | <td>输入待处理的数据,公式中的x。</td> | 175 | <td>输入待处理的数据,公式中的x。</td> |
| 161 | - <td><ul><li>shape为[X1,X2,...Xn,2H],shape不超过8维,不小于2维。</li><li>输入x对应activateDim的维度需要是2的倍数。</li><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:仅支持输入为2维,数据类型为INT32、BFLOAT16。</li><li>不支持空Tensor,输入不支持包含±inf或nan。</li></ul></td> | 176 | + <td><ul><li>shape为[X1,X2,...Xn,2H],shape不超过8维,不小于2维。</li><li>输入x对应activateDim的维度需要是2的倍数。</li><li>不支持空Tensor,输入不支持包含±inf或nan。</li></ul></td> |
| 162 | <td>FLOAT16、BFLOAT16、INT32</td> | 177 | <td>FLOAT16、BFLOAT16、INT32</td> |
| 163 | <td>ND</td> | 178 | <td>ND</td> |
| 164 | <td>2-8</td> | 179 | <td>2-8</td> |
| @@ -198,7 +213,7 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 198 | <td>quantScaleOptional(aclTensor*)</td> | 213 | <td>quantScaleOptional(aclTensor*)</td> |
| 199 | <td>输入</td> | 214 | <td>输入</td> |
| 200 | <td>量化的scale,公式中的quantScaleOptional。</td> | 215 | <td>量化的scale,公式中的quantScaleOptional。</td> |
| 201 | - <td><ul><li>当quantModeOptional为static时,shape为1维,值为1,shape表示为shape[1]。</li><li>当quantModeOptional为dynamic时,shape为1维或2维,shape表示为[H], [2H]或[groupNum, H]。</li><li>当groupIndexOptional为空指针且activateDim为尾轴时,shape为[H]。</li><li>当groupIndexOptional不为空指针且activateDim为尾轴时,shape为[groupNum, H]。</li><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:当quantModeOptional为static时,shape表示为[groupNum]或[groupNum, H],当quantModeOptional为dynamic时,shape表示为[groupNum]或[groupNum, H]。</li><li>不支持空Tensor,输入不支持包含±inf或nan。</li></ul></td> | 216 | + <td><ul><li>当quantModeOptional为static时,shape为1维,值为1,shape表示为shape[1]。</li><li>当quantModeOptional为dynamic时,shape为1维或2维,shape表示为[H], [2H]或[groupNum, H]。</li><li>当groupIndexOptional为空指针且activateDim为尾轴时,shape为[H]。</li><li>当groupIndexOptional不为空指针且activateDim为尾轴时,shape为[groupNum, H]。</li><li>不支持空Tensor,输入不支持包含±inf或nan。</li></ul></td> |
| 202 | <td>FLOAT、FLOAT16</td> | 217 | <td>FLOAT、FLOAT16</td> |
| 203 | <td>ND</td> | 218 | <td>ND</td> |
| 204 | <td>-</td> | 219 | <td>-</td> |
| @@ -218,7 +233,7 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 218 | <td>groupIndexOptional(aclTensor*)</td> | 233 | <td>groupIndexOptional(aclTensor*)</td> |
| 219 | <td>输入</td> | 234 | <td>输入</td> |
| 220 | <td>MoE分组需要的group_index。</td> | 235 | <td>MoE分组需要的group_index。</td> |
| 221 | - <td><ul><li>shape支持1维或2维的Tensor,shape为[groupNum]或[groupNum, 2],groupNum大于等于1。</li><li>可选参数,支持传空指针。</li><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:仅支持输入为1维[groupNum],不支持空指针。</li><li>不支持空Tensor,输入不支持包含±inf或nan。</li></ul></td> | 236 | + <td><ul><li>shape支持1维或2维的Tensor,shape为[groupNum]或[groupNum, 2],groupNum大于等于1。</li><li>可选参数,支持传空指针。</li><li>不支持空Tensor,输入不支持包含±inf或nan。</li></ul></td> |
| 222 | <td>INT64</td> | 237 | <td>INT64</td> |
| 223 | <td>ND</td> | 238 | <td>ND</td> |
| 224 | <td>1或2</td> | 239 | <td>1或2</td> |
| @@ -248,7 +263,7 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 248 | <td>dstType(int64_t)</td> | 263 | <td>dstType(int64_t)</td> |
| 249 | <td>输入</td> | 264 | <td>输入</td> |
| 250 | <td>表示指定输出y的数据类型。</td> | 265 | <td>表示指定输出y的数据类型。</td> |
| 251 | - <td><ul><li>dstType的取值范围是:[2, 34,35, 36, 40, 41],分别对应INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN、FLOAT4_E2M1、FLOAT4_E1M2。</li><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:仅支持输入为2-INT8。</li></ul></td> | 266 | + <td><ul><li>dstType的取值范围是:[2, 34,35, 36, 40, 41],分别对应INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN、FLOAT4_E2M1、FLOAT4_E1M2。</li></ul></td> |
| 252 | <td>-</td> | 267 | <td>-</td> |
| 253 | <td>-</td> | 268 | <td>-</td> |
| 254 | <td>-</td> | 269 | <td>-</td> |
| @@ -258,7 +273,7 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 258 | <td>roundModeOptional(char*)</td> | 273 | <td>roundModeOptional(char*)</td> |
| 259 | <td>输入</td> | 274 | <td>输入</td> |
| 260 | <td>表示对输出y结果的舍入模式。</td> | 275 | <td>表示对输出y结果的舍入模式。</td> |
| 261 | - <td><ul><li>取值范围是:["rint", "round", "floor", "ceil", "trunc"]。</li><li>当输出y的数据类型为INT8、FLOAT8_E5M2、FLOAT8_E4M3FN时,仅支持"rint"模式。</li><li>当输出y的数据类型为HIFLOAT8时,仅支持"round"模式。</li><li>支持传入空指针,传入空指针时,则默认使用“rint”。</li><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:仅支持输入为空指针或"rint"。</li></ul></td> | 276 | + <td><ul><li>取值范围是:["rint", "round", "floor", "ceil", "trunc"]。</li><li>当输出y的数据类型为INT8、FLOAT8_E5M2、FLOAT8_E4M3FN时,仅支持"rint"模式。</li><li>当输出y的数据类型为HIFLOAT8时,仅支持"round"模式。</li><li>支持传入空指针,传入空指针时,则默认使用“rint”。</li></ul></td> |
| 262 | <td>-</td> | 277 | <td>-</td> |
| 263 | <td>-</td> | 278 | <td>-</td> |
| 264 | <td>-</td> | 279 | <td>-</td> |
| @@ -268,7 +283,7 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 268 | <td>activateDim(int64_t)</td> | 283 | <td>activateDim(int64_t)</td> |
| 269 | <td>输入</td> | 284 | <td>输入</td> |
| 270 | <td>表示进行swish计算时,选择的指定切分轴。</td> | 285 | <td>表示进行swish计算时,选择的指定切分轴。</td> |
| 271 | - <td><ul><li>activateDim的取值范围是:[-xDim, xDim - 1](其中xDim指输入x的维度)。</li><li>当activateDim对应的不是x的尾轴时,不允许输入groupIndexOptional。</li><li>当activateDim对应的不是x的尾轴时,quantModeOptional仅支持static。</li><li><term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:仅支持-1。</li></ul></td> | 286 | + <td><ul><li>activateDim的取值范围是:[-xDim, xDim - 1](其中xDim指输入x的维度)。</li><li>当activateDim对应的不是x的尾轴时,不允许输入groupIndexOptional。</li><li>当activateDim对应的不是x的尾轴时,quantModeOptional仅支持static。</li></ul></td> |
| 272 | <td>-</td> | 287 | <td>-</td> |
| 273 | <td>-</td> | 288 | <td>-</td> |
| 274 | <td>-</td> | 289 | <td>-</td> |
| @@ -357,6 +372,16 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 357 | </tbody> | 372 | </tbody> |
| 358 | </table> | 373 | </table> |
| 359 | 374 | ||
| 375 | + <!-- npu="A3,910b" id7 --> | ||
| 376 | + - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | ||
| 377 | + - x参数中,仅支持输入为2维,数据类型为INT32、BFLOAT16。 | ||
| 378 | + - quantScaleOptional参数中,当quantModeOptional为static时,shape表示为[groupNum]或[groupNum, H],当quantModeOptional为dynamic时,shape表示为[groupNum]或[groupNum, H]。 | ||
| 379 | + - groupIndexOptional参数中,仅支持输入为1维[groupNum],不支持空指针。 | ||
| 380 | + - dstType参数中,仅支持输入为2-INT8。 | ||
| 381 | + - roundModeOptional参数中,仅支持输入为空指针或“rint”。 | ||
| 382 | + - activateDim参数中,仅支持-1。 | ||
| 383 | + <!-- end id7 --> | ||
| 384 | + | ||
| 360 | - **返回值:** | 385 | - **返回值:** |
| 361 | 386 | ||
| 362 | aclnnStatus:返回状态码,具体参见[aclnn返回码](../../../docs/zh/context/aclnn_return_code.md)。 | 387 | aclnnStatus:返回状态码,具体参见[aclnn返回码](../../../docs/zh/context/aclnn_return_code.md)。 |
| @@ -462,10 +487,12 @@ aclnnStatus aclnnDequantSwigluQuantV2( | |||
| 462 | - 当activateDim对应的维度不是x的尾轴时,输出yOut的尾轴不超过5120。 | 487 | - 当activateDim对应的维度不是x的尾轴时,输出yOut的尾轴不超过5120。 |
| 463 | - groupIndexOptional所有元素之和不能大于输入x除尾轴之外的剩余轴的乘积。 | 488 | - groupIndexOptional所有元素之和不能大于输入x除尾轴之外的剩余轴的乘积。 |
| 464 | - 输出yOut和scaleOut超出groupIndexOptional所有元素之和的部分未进行清理处理,该部分内存为垃圾数据。 | 489 | - 输出yOut和scaleOut超出groupIndexOptional所有元素之和的部分未进行清理处理,该部分内存为垃圾数据。 |
| 490 | +<!-- npu="A3,910b" id10 --> | ||
| 465 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 491 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 466 | - 当groupIndexOptional输入时,算子支持的输入张量的内存大小有上限,x的尾轴不超过7232。 | 492 | - 当groupIndexOptional输入时,算子支持的输入张量的内存大小有上限,x的尾轴不超过7232。 |
| 467 | - x的最后一维必须能被64整除。 | 493 | - x的最后一维必须能被64整除。 |
| 468 | - quant_mode为dynamic时,quant_offset必须为空。 | 494 | - quant_mode为dynamic时,quant_offset必须为空。 |
| 495 | +<!-- end id10 --> | ||
| 469 | 496 | ||
| 470 | ## 调用示例 | 497 | ## 调用示例 |
| 471 | 498 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -67,7 +77,7 @@ | |||
| 67 | 77 | ||
| 68 | ## 函数原型 | 78 | ## 函数原型 |
| 69 | 79 | ||
| 70 | -每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用"aclnnDynamicBlockMxQuantGetWorkspaceSize"接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用"aclnnDynamicBlockMxQuant"接口执行计算。 | 80 | +每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用“aclnnDynamicBlockMxQuantGetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnDynamicBlockMxQuant”接口执行计算。 |
| 71 | 81 | ||
| 72 | ```cpp | 82 | ```cpp |
| 73 | aclnnStatus aclnnDynamicBlockMxQuantGetWorkspaceSize( | 83 | aclnnStatus aclnnDynamicBlockMxQuantGetWorkspaceSize( |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -188,12 +198,15 @@ aclnnStatus aclnnDynamicBlockQuant( | |||
| 188 | </tbody> | 198 | </tbody> |
| 189 | </table> | 199 | </table> |
| 190 | 200 | ||
| 201 | + <!-- npu="A3,910b" id7 --> | ||
| 191 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 202 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 192 | - 参数`roundModeOptional`只支持rint。 | 203 | - 参数`roundModeOptional`只支持rint。 |
| 193 | - 参数`dstType`仅支持取值2,代表INT8。 | 204 | - 参数`dstType`仅支持取值2,代表INT8。 |
| 194 | - 参数`rowBlockSize`仅支持取值1。 | 205 | - 参数`rowBlockSize`仅支持取值1。 |
| 195 | - 参数`colBlockSize`仅支持取值128。 | 206 | - 参数`colBlockSize`仅支持取值128。 |
| 196 | - 参数`yOut`的数据类型仅支持INT8。 | 207 | - 参数`yOut`的数据类型仅支持INT8。 |
| 208 | + <!-- end id7 --> | ||
| 209 | + <!-- npu="950" id8 --> | ||
| 197 | - <term>Ascend 950PR/Ascend 950DT</term>: | 210 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 198 | - 参数`x`、`yOut`、`scaleOut`的shape仅支持2维或3维。 | 211 | - 参数`x`、`yOut`、`scaleOut`的shape仅支持2维或3维。 |
| 199 | - 参数`roundModeOptional`的取值与参数`yOut`的数据类型存在对应关系: | 212 | - 参数`roundModeOptional`的取值与参数`yOut`的数据类型存在对应关系: |
| @@ -201,6 +214,7 @@ aclnnStatus aclnnDynamicBlockQuant( | |||
| 201 | - 当输出`yOut`的数据类型是INT8、FLOAT8_E4M3FN、FLOAT8_E5M2时,参数`roundModeOptional`支持设置为rint。 | 214 | - 当输出`yOut`的数据类型是INT8、FLOAT8_E4M3FN、FLOAT8_E5M2时,参数`roundModeOptional`支持设置为rint。 |
| 202 | - 参数`dstType`支持取值2、34、35、36,分别代表INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN。 | 215 | - 参数`dstType`支持取值2、34、35、36,分别代表INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN。 |
| 203 | - 参数`yOut`的数据类型支持INT8、HIFLOAT8、FLOAT8_E4M3FN、FLOAT8_E5M2。 | 216 | - 参数`yOut`的数据类型支持INT8、HIFLOAT8、FLOAT8_E4M3FN、FLOAT8_E5M2。 |
| 217 | + <!-- end id8 --> | ||
| 204 | 218 | ||
| 205 | - **返回值** | 219 | - **返回值** |
| 206 | 220 | ||
| @@ -285,6 +299,7 @@ aclnnStatus aclnnDynamicBlockQuant( | |||
| 285 | 299 | ||
| 286 | 示例代码如下,仅供参考,具体编译和执行过程请参考[编译与运行样例](../../../docs/zh/context/compile_and_run_sample.md)。 | 300 | 示例代码如下,仅供参考,具体编译和执行过程请参考[编译与运行样例](../../../docs/zh/context/compile_and_run_sample.md)。 |
| 287 | 301 | ||
| 302 | +<!-- npu="A3,910b" id9 --> | ||
| 288 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 303 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 289 | 304 | ||
| 290 | ```Cpp | 305 | ```Cpp |
| @@ -451,6 +466,8 @@ aclnnStatus aclnnDynamicBlockQuant( | |||
| 451 | } | 466 | } |
| 452 | ``` | 467 | ``` |
| 453 | 468 | ||
| 469 | +<!-- end id9 --> | ||
| 470 | +<!-- npu="950" id10 --> | ||
| 454 | - <term>Ascend 950PR/Ascend 950DT</term>: | 471 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 455 | 472 | ||
| 456 | ```Cpp | 473 | ```Cpp |
| @@ -604,3 +621,4 @@ aclnnStatus aclnnDynamicBlockQuant( | |||
| 604 | return 0; | 621 | return 0; |
| 605 | } | 622 | } |
| 606 | ``` | 623 | ``` |
| 624 | +<!-- end id10 --> | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -199,6 +209,7 @@ aclnnStatus aclnnDynamicBlockQuantV2( | |||
| 199 | </tbody> | 209 | </tbody> |
| 200 | </table> | 210 | </table> |
| 201 | 211 | ||
| 212 | + <!-- npu="A3,910b" id7 --> | ||
| 202 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 213 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 203 | - 参数`roundModeOptional`只支持rint。 | 214 | - 参数`roundModeOptional`只支持rint。 |
| 204 | - 参数`dstType`仅支持取值2,代表INT8。 | 215 | - 参数`dstType`仅支持取值2,代表INT8。 |
| @@ -206,6 +217,8 @@ aclnnStatus aclnnDynamicBlockQuantV2( | |||
| 206 | - 参数`colBlockSize`仅支持取值1或128。 | 217 | - 参数`colBlockSize`仅支持取值1或128。 |
| 207 | - 参数`dstTypeMax`仅支持取值0。 | 218 | - 参数`dstTypeMax`仅支持取值0。 |
| 208 | - 参数`yOut`的数据类型仅支持INT8。 | 219 | - 参数`yOut`的数据类型仅支持INT8。 |
| 220 | + <!-- end id7 --> | ||
| 221 | + <!-- npu="950" id8 --> | ||
| 209 | - <term>Ascend 950PR/Ascend 950DT</term>: | 222 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 210 | - 参数`x`、`yOut`、`scaleOut`的shape仅支持2维或3维。 | 223 | - 参数`x`、`yOut`、`scaleOut`的shape仅支持2维或3维。 |
| 211 | - 参数`roundModeOptional`的取值与参数`yOut`的数据类型存在对应关系: | 224 | - 参数`roundModeOptional`的取值与参数`yOut`的数据类型存在对应关系: |
| @@ -213,6 +226,7 @@ aclnnStatus aclnnDynamicBlockQuantV2( | |||
| 213 | - 当输出`yOut`的数据类型是INT8、FLOAT8_E4M3FN、FLOAT8_E5M2时,参数`roundModeOptional`支持设置为rint。 | 226 | - 当输出`yOut`的数据类型是INT8、FLOAT8_E4M3FN、FLOAT8_E5M2时,参数`roundModeOptional`支持设置为rint。 |
| 214 | - 参数`dstType`支持取值2、34、35、36,分别代表INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN。 | 227 | - 参数`dstType`支持取值2、34、35、36,分别代表INT8、HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3FN。 |
| 215 | - 参数`yOut`的数据类型支持INT8、HIFLOAT8、FLOAT8_E4M3FN、FLOAT8_E5M2。 | 228 | - 参数`yOut`的数据类型支持INT8、HIFLOAT8、FLOAT8_E4M3FN、FLOAT8_E5M2。 |
| 229 | + <!-- end id8 --> | ||
| 216 | 230 | ||
| 217 | - **返回值:** | 231 | - **返回值:** |
| 218 | 232 | ||
| @@ -300,6 +314,7 @@ aclnnStatus aclnnDynamicBlockQuantV2( | |||
| 300 | 314 | ||
| 301 | 示例代码如下,仅供参考,具体编译和执行过程请参考[编译与运行样例](../../../docs/zh/context/compile_and_run_sample.md)。 | 315 | 示例代码如下,仅供参考,具体编译和执行过程请参考[编译与运行样例](../../../docs/zh/context/compile_and_run_sample.md)。 |
| 302 | 316 | ||
| 317 | +<!-- npu="A3,910b" id9 --> | ||
| 303 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 318 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 304 | 319 | ||
| 305 | ```Cpp | 320 | ```Cpp |
| @@ -465,7 +480,9 @@ aclnnStatus aclnnDynamicBlockQuantV2( | |||
| 465 | return 0; | 480 | return 0; |
| 466 | } | 481 | } |
| 467 | ``` | 482 | ``` |
| 483 | +<!-- end id9 --> | ||
| 468 | 484 | ||
| 485 | +<!-- npu="950" id10 --> | ||
| 469 | - <term>Ascend 950PR/Ascend 950DT</term>: | 486 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 470 | 487 | ||
| 471 | ```Cpp | 488 | ```Cpp |
| @@ -619,3 +636,4 @@ aclnnStatus aclnnDynamicBlockQuantV2( | |||
| 619 | return 0; | 636 | return 0; |
| 620 | } | 637 | } |
| 621 | ``` | 638 | ``` |
| 639 | +<!-- end id10 --> | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -19,7 +29,7 @@ | |||
| 19 | - 可选功能:融合smooth scale运算,在对数据输入x进行量化前先进行x=x*smooth_scale(广播逐元素乘法)。 | 29 | - 可选功能:融合smooth scale运算,在对数据输入x进行量化前先进行x=x*smooth_scale(广播逐元素乘法)。 |
| 20 | 30 | ||
| 21 | - 计算公式: | 31 | - 计算公式: |
| 22 | - - 将输入x在尾轴上按$k_0$ = level0BlockSize个数分组,一组$k_0$个数 $\{\{x_i\}_{i=1}^{k_0}\}$ 动态量化为 $\{level0Scale, \{temp_i\}_{i=1}^{k_0}\}$, $k_0$ = level0BlockSize,然后将temp在尾轴上按$k_1$ = level1BlockSize个数分组,一组$k_1$个数 $\{\{temp_i\}_{i=1}^{k_1}\}$ 动态量化为 $\{level1Scale, \{y_i\}_{i=1}^{k_1}\}$, $k_1$ = level1BlockSize | 32 | + - 将输入x在尾轴上按$k_0$ = level0BlockSize个数分组,一组$k_0$个数$\{\{x_i\}_{i=1}^{k_0}\}$动态量化为$\{level0Scale, \{temp_i\}_{i=1}^{k_0}\}$, $k_0$ = level0BlockSize,然后将temp在尾轴上按$k_1$ = level1BlockSize个数分组,一组$k_1$个数$\{\{temp_i\}_{i=1}^{k_1}\}$动态量化为$\{level1Scale, \{y_i\}_{i=1}^{k_1}\}$, $k_1$ = level1BlockSize |
| 23 | 33 | ||
| 24 | $$ | 34 | $$ |
| 25 | input\_max_i = max_i(abs(x_i)) | 35 | input\_max_i = max_i(abs(x_i)) |
| @@ -45,7 +55,7 @@ | |||
| 45 | y_i = cast\_to\_FP4\_E2M1(temp_i/level1Scale, round\_mode), \space i\space from\space 1\space to\space level1BlockSize | 55 | y_i = cast\_to\_FP4\_E2M1(temp_i/level1Scale, round\_mode), \space i\space from\space 1\space to\space level1BlockSize |
| 46 | $$ | 56 | $$ |
| 47 | 57 | ||
| 48 | - - 量化后的 $y_{i}$ 按对应的 $x_{i}$ 的位置组成输出yOut,level0Scale按尾轴对应的分组组成输出level0ScaleOut,level1Scale按尾轴对应的分组组成输出level1ScaleOut。 | 58 | + - 量化后的$y_{i}$按对应的$x_{i}$的位置组成输出yOut,level0Scale按尾轴对应的分组组成输出level0ScaleOut,level1Scale按尾轴对应的分组组成输出level1ScaleOut。 |
| 49 | 59 | ||
| 50 | - max_i代表求第i个分组中的最大值 | 60 | - max_i代表求第i个分组中的最大值 |
| 51 | 61 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -19,7 +29,7 @@ | |||
| 19 | 29 | ||
| 20 | - 计算公式: | 30 | - 计算公式: |
| 21 | - 场景1,当scaleAlg为0时: | 31 | - 场景1,当scaleAlg为0时: |
| 22 | - - 将输入x在axis维度上按k = blocksize个数分组,一组k个数 $\{\{V_i\}_{i=1}^{k}\}$ 动态量化为 $\{mxscale1, \{P_i\}_{i=1}^{k}\}$, k = blocksize | 32 | + - 将输入x在axis维度上按k = blocksize个数分组,一组k个数$\{\{V_i\}_{i=1}^{k}\}$动态量化为$\{mxscale1, \{P_i\}_{i=1}^{k}\}$, k = blocksize |
| 23 | 33 | ||
| 24 | $$ | 34 | $$ |
| 25 | shared\_exp = floor(log_2(max_i(|V_i|))) - emax \\ | 35 | shared\_exp = floor(log_2(max_i(|V_i|))) - emax \\ |
| @@ -27,7 +37,7 @@ | |||
| 27 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 37 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 28 | $$ | 38 | $$ |
| 29 | 39 | ||
| 30 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 40 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 31 | 41 | ||
| 32 | - emax: 对应数据类型的最大正则数的指数位。 | 42 | - emax: 对应数据类型的最大正则数的指数位。 |
| 33 | 43 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -19,7 +29,7 @@ | |||
| 19 | 29 | ||
| 20 | - 计算公式: | 30 | - 计算公式: |
| 21 | - 场景1,当scaleAlg为0时: | 31 | - 场景1,当scaleAlg为0时: |
| 22 | - - 将输入x在axis维度上按k = blocksize个数分组,一组k个数 $\{\{V_i\}_{i=1}^{k}\}$ 动态量化为 $\{mxscale1, \{P_i\}_{i=1}^{k}\}$, k = blocksize | 32 | + - 将输入x在axis维度上按k = blocksize个数分组,一组k个数$\{\{V_i\}_{i=1}^{k}\}$动态量化为$\{mxscale1, \{P_i\}_{i=1}^{k}\}$, k = blocksize |
| 23 | 33 | ||
| 24 | $$ | 34 | $$ |
| 25 | shared\_exp = floor(log_2(max_i(|V_i|))) - emax \\ | 35 | shared\_exp = floor(log_2(max_i(|V_i|))) - emax \\ |
| @@ -27,7 +37,7 @@ | |||
| 27 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 37 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 28 | $$ | 38 | $$ |
| 29 | 39 | ||
| 30 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 40 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 31 | 41 | ||
| 32 | - emax: 对应数据类型的最大正则数的指数位。 | 42 | - emax: 对应数据类型的最大正则数的指数位。 |
| 33 | 43 | ||
| @@ -66,7 +76,7 @@ | |||
| 66 | $$ | 76 | $$ |
| 67 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 77 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 68 | $$ | 78 | $$ |
| 69 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 79 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 70 | - 当dstTypeMax != 0.0/6.0/7.0时: | 80 | - 当dstTypeMax != 0.0/6.0/7.0时: |
| 71 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 81 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 72 | - 找到该块中数值的最大绝对值: | 82 | - 找到该块中数值的最大绝对值: |
| @@ -86,7 +96,7 @@ | |||
| 86 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ | 96 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ |
| 87 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ | 97 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ |
| 88 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 | 98 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 |
| 89 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 99 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 90 | 100 | ||
| 91 | ## 函数原型 | 101 | ## 函数原型 |
| 92 | 102 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -27,7 +37,7 @@ | |||
| 27 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 37 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 28 | $$ | 38 | $$ |
| 29 | 39 | ||
| 30 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 40 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 31 | 41 | ||
| 32 | - emax: 对应数据类型的最大正则数的指数位。 | 42 | - emax: 对应数据类型的最大正则数的指数位。 |
| 33 | 43 | ||
| @@ -40,7 +50,7 @@ | |||
| 40 | 50 | ||
| 41 | - 场景2,当scaleAlg为1时,只涉及FP8类型: | 51 | - 场景2,当scaleAlg为1时,只涉及FP8类型: |
| 42 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 52 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 43 | - - 找到该块中数值的最大绝对值: | 53 | + - 找到该块中数值的最大绝对值: |
| 44 | $$ | 54 | $$ |
| 45 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) | 55 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) |
| 46 | $$ | 56 | $$ |
| @@ -70,7 +80,7 @@ | |||
| 70 | $$ | 80 | $$ |
| 71 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 81 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 72 | $$ | 82 | $$ |
| 73 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 83 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 74 | - 当dstTypeMax != 0.0/6.0/7.0时: | 84 | - 当dstTypeMax != 0.0/6.0/7.0时: |
| 75 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 85 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 76 | - 找到该块中数值的最大绝对值: | 86 | - 找到该块中数值的最大绝对值: |
| @@ -90,11 +100,11 @@ | |||
| 90 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ | 100 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ |
| 91 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ | 101 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ |
| 92 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 | 102 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 |
| 93 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 103 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 94 | 104 | ||
| 95 | ## 函数原型 | 105 | ## 函数原型 |
| 96 | 106 | ||
| 97 | -每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用"aclnnDynamicMxQuantV3GetWorkspaceSize"接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用"aclnnDynamicMxQuantV3"接口执行计算。 | 107 | +每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用“aclnnDynamicMxQuantV3GetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnDynamicMxQuantV3”接口执行计算。 |
| 98 | 108 | ||
| 99 | ```cpp | 109 | ```cpp |
| 100 | aclnnStatus aclnnDynamicMxQuantV3GetWorkspaceSize( | 110 | aclnnStatus aclnnDynamicMxQuantV3GetWorkspaceSize( |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -49,7 +59,7 @@ | |||
| 49 | P_j = cast\_to\_dst\_type(V_j/mxscale2, round\_mode), \space j\space from\space 1\space to\space 32 | 59 | P_j = cast\_to\_dst\_type(V_j/mxscale2, round\_mode), \space j\space from\space 1\space to\space 32 |
| 50 | $$ | 60 | $$ |
| 51 | 61 | ||
| 52 | - - -1轴量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出y1Out,mxscale1按对应的-1轴维度上的分组组成输出mxscale1Out。-2轴量化后的 $P_{j}$ 按对应的 $V_{j}$ 的位置组成输出y2Out,mxscale2按对应的-2轴维度上的分组组成输出mxscale2Out。 | 62 | + - -1轴量化后的$P_{i}$按对应的$V_{i}$的位置组成输出y1Out,mxscale1按对应的-1轴维度上的分组组成输出mxscale1Out。-2轴量化后的$P_{j}$按对应的$V_{j}$的位置组成输出y2Out,mxscale2按对应的-2轴维度上的分组组成输出mxscale2Out。 |
| 53 | 63 | ||
| 54 | - emax: 对应数据类型的最大正则数的指数位。 | 64 | - emax: 对应数据类型的最大正则数的指数位。 |
| 55 | 65 | ||
| @@ -62,7 +72,7 @@ | |||
| 62 | 72 | ||
| 63 | - 场景2,当scaleAlg为1时,只涉及FP8类型(CuBALS Scale计算算法): | 73 | - 场景2,当scaleAlg为1时,只涉及FP8类型(CuBALS Scale计算算法): |
| 64 | - **-1轴量化**:将输入x在-1轴上按照32个数进行分组,每组长度为32,对每组单独计算一个块缩放因子$S_{fp32}^b$,再把组内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一组不足32个元素,把缺失值视为0,按照完整组处理。 | 74 | - **-1轴量化**:将输入x在-1轴上按照32个数进行分组,每组长度为32,对每组单独计算一个块缩放因子$S_{fp32}^b$,再把组内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一组不足32个元素,把缺失值视为0,按照完整组处理。 |
| 65 | - - 找到该组中数值的最大绝对值: | 75 | + - 找到该组中数值的最大绝对值: |
| 66 | $$ | 76 | $$ |
| 67 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{32}) | 77 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{32}) |
| 68 | $$ | 78 | $$ |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -49,7 +59,7 @@ | |||
| 49 | P_j = cast\_to\_dst\_type(V_j/mxscale2, round\_mode), \space j\space from\space 1\space to\space 32 | 59 | P_j = cast\_to\_dst\_type(V_j/mxscale2, round\_mode), \space j\space from\space 1\space to\space 32 |
| 50 | $$ | 60 | $$ |
| 51 | 61 | ||
| 52 | - - -1轴量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出y1Out,mxscale1按对应的-1轴维度上的分组组成输出mxscale1Out。-2轴量化后的 $P_{j}$ 按对应的 $V_{j}$ 的位置组成输出y2Out,mxscale2按对应的-2轴维度上的分组组成输出mxscale2Out。 | 62 | + - -1轴量化后的$P_{i}$按对应的$V_{i}$的位置组成输出y1Out,mxscale1按对应的-1轴维度上的分组组成输出mxscale1Out。-2轴量化后的$P_{j}$按对应的$V_{j}$的位置组成输出y2Out,mxscale2按对应的-2轴维度上的分组组成输出mxscale2Out。 |
| 53 | 63 | ||
| 54 | - emax: 对应数据类型的最大正则数的指数位。 | 64 | - emax: 对应数据类型的最大正则数的指数位。 |
| 55 | 65 | ||
| @@ -62,7 +72,7 @@ | |||
| 62 | 72 | ||
| 63 | - 场景2,当scaleAlg为1时,只涉及FP8类型(CuBALS Scale计算算法): | 73 | - 场景2,当scaleAlg为1时,只涉及FP8类型(CuBALS Scale计算算法): |
| 64 | - **-1轴量化**:将输入x在-1轴上按照32个数进行分组,每组长度为32,对每组单独计算一个块缩放因子$S_{fp32}^b$,再把组内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一组不足32个元素,把缺失值视为0,按照完整组处理。 | 74 | - **-1轴量化**:将输入x在-1轴上按照32个数进行分组,每组长度为32,对每组单独计算一个块缩放因子$S_{fp32}^b$,再把组内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一组不足32个元素,把缺失值视为0,按照完整组处理。 |
| 65 | - - 找到该组中数值的最大绝对值: | 75 | + - 找到该组中数值的最大绝对值: |
| 66 | $$ | 76 | $$ |
| 67 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{32}) | 77 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{32}) |
| 68 | $$ | 78 | $$ |
| @@ -98,7 +108,7 @@ | |||
| 98 | - -1轴量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出y1Out,mxscale1按对应的-1轴维度上的分组组成输出mxscale1Out。-2轴量化后的 $P_{j}$ 按对应的 $V_{j}$ 的位置组成输出y2Out,mxscale2按对应的-2轴维度上的分组组成输出mxscale2Out。 | 108 | - -1轴量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出y1Out,mxscale1按对应的-1轴维度上的分组组成输出mxscale1Out。-2轴量化后的 $P_{j}$ 按对应的 $V_{j}$ 的位置组成输出y2Out,mxscale2按对应的-2轴维度上的分组组成输出mxscale2Out。 |
| 99 | - 当dstTypeMax != 0.0/6.0/7.0时: | 109 | - 当dstTypeMax != 0.0/6.0/7.0时: |
| 100 | - **-1轴量化**:将输入x在-1轴上按照32个数进行分组,每组长度为32,对每组单独计算一个块缩放因子$S_{fp32}^b$,再把组内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP4_E2M1。如果最后一组不足32个元素,把缺失值视为0,按照完整组处理。 | 110 | - **-1轴量化**:将输入x在-1轴上按照32个数进行分组,每组长度为32,对每组单独计算一个块缩放因子$S_{fp32}^b$,再把组内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP4_E2M1。如果最后一组不足32个元素,把缺失值视为0,按照完整组处理。 |
| 101 | - - 找到该组中数值的最大绝对值: | 111 | + - 找到该组中数值的最大绝对值: |
| 102 | $$ | 112 | $$ |
| 103 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{32}) | 113 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{32}) |
| 104 | $$ | 114 | $$ |
| @@ -120,7 +130,7 @@ | |||
| 120 | 130 | ||
| 121 | ## 函数原型 | 131 | ## 函数原型 |
| 122 | 132 | ||
| 123 | -每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用"aclnnDynamicMxQuantWithDualAxisV2GetWorkspaceSize"接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用"aclnnDynamicMxQuantWithDualAxisV2"接口执行计算。 | 133 | +每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用“aclnnDynamicMxQuantWithDualAxisV2GetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnDynamicMxQuantWithDualAxisV2”接口执行计算。 |
| 124 | 134 | ||
| 125 | ```cpp | 135 | ```cpp |
| 126 | aclnnStatus aclnnDynamicMxQuantWithDualAxisV2GetWorkspaceSize( | 136 | aclnnStatus aclnnDynamicMxQuantWithDualAxisV2GetWorkspaceSize( |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | √ | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -155,13 +165,15 @@ aclnnStatus aclnnDynamicQuant( | |||
| 155 | </tbody> | 165 | </tbody> |
| 156 | </table> | 166 | </table> |
| 157 | 167 | ||
| 158 | - - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 168 | + <!-- npu="A3,910b" id7 --> |
| 159 | - | 169 | + - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:出参`yOut`的数据类型仅支持INT4、INT8、INT32。 |
| 160 | - 出参`yOut`的数据类型仅支持INT4、INT8、INT32。 | 170 | + <!-- end id7 --> |
| 171 | + <!-- npu="910,310p" id8 --> | ||
| 161 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>: | 172 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>: |
| 162 | - 入参`x`、`smoothScalesOptional`的数据类型仅支持FLOAT16。 | 173 | - 入参`x`、`smoothScalesOptional`的数据类型仅支持FLOAT16。 |
| 163 | - 出参`yOut`的数据类型仅支持INT8。 | 174 | - 出参`yOut`的数据类型仅支持INT8。 |
| 164 | - 入参`smoothScalesOptional`为预留参数,当前版本不参与计算。 | 175 | - 入参`smoothScalesOptional`为预留参数,当前版本不参与计算。 |
| 176 | + <!-- end id8 --> | ||
| 165 | 177 | ||
| 166 | - **返回值** | 178 | - **返回值** |
| 167 | 179 | ||
| @@ -250,12 +262,16 @@ aclnnStatus aclnnDynamicQuant( | |||
| 250 | 262 | ||
| 251 | ## 约束说明 | 263 | ## 约束说明 |
| 252 | 264 | ||
| 265 | +<!-- npu="950,A3,910b" id9 --> | ||
| 253 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>: | 266 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>: |
| 254 | - yOut的数据类型为INT4时,需满足x和yOut的最后一维能被2整除。不支持非连续场景。 | 267 | - yOut的数据类型为INT4时,需满足x和yOut的最后一维能被2整除。不支持非连续场景。 |
| 255 | - yOut的数据类型为INT32时,需满足x的最后一维能被8整除。 | 268 | - yOut的数据类型为INT32时,需满足x的最后一维能被8整除。 |
| 269 | +<!-- end id9 --> | ||
| 270 | +<!-- npu="910,310p" id10 --> | ||
| 256 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>:输入x的最后一维需满足被32整除,暂时只支持对称量化,不支持BFLOAT16数据类型。 | 271 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>:输入x的最后一维需满足被32整除,暂时只支持对称量化,不支持BFLOAT16数据类型。 |
| 257 | - 确定性计算: | 272 | - 确定性计算: |
| 258 | - aclnnDynamicQuant默认确定性实现。 | 273 | - aclnnDynamicQuant默认确定性实现。 |
| 274 | +<!-- end id10 --> | ||
| 259 | 275 | ||
| 260 | ## 调用示例 | 276 | ## 调用示例 |
| 261 | 277 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -313,9 +323,9 @@ aclnnStatus aclnnDynamicQuantV3( | |||
| 313 | - 确定性计算: | 323 | - 确定性计算: |
| 314 | - aclnnDynamicQuantV3默认确定性实现。 | 324 | - aclnnDynamicQuantV3默认确定性实现。 |
| 315 | 325 | ||
| 316 | - yOut的数据类型为INT4时,需满足x和yOut的最后一维能被2整除。不支持非连续场景。 | 326 | +- yOut的数据类型为INT4时,需满足x和yOut的最后一维能被2整除。不支持非连续场景。 |
| 317 | - yOut的数据类型为INT32时,需满足x的最后一维能被8整除。 | 327 | +- yOut的数据类型为INT32时,需满足x的最后一维能被8整除。 |
| 318 | - 当有groupIndexOptional时,专家数不超过x剔除最后一维的各个维度乘积。groupIndexOptional的值需要是一组不小于零且非递减的数组,且最后一个值和x剔除最后一维的各个维度乘积相等。若不满足该条件,结果无实际意义。 | 328 | +- 当有groupIndexOptional时,专家数不超过x剔除最后一维的各个维度乘积。groupIndexOptional的值需要是一组不小于零且非递减的数组,且最后一个值和x剔除最后一维的各个维度乘积相等。若不满足该条件,结果无实际意义。 |
| 319 | 329 | ||
| 320 | ## 调用示例 | 330 | ## 调用示例 |
| 321 | 331 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -323,9 +333,9 @@ aclnnStatus aclnnDynamicQuantV4( | |||
| 323 | - 确定性计算: | 333 | - 确定性计算: |
| 324 | - aclnnDynamicQuantV4默认确定性实现。 | 334 | - aclnnDynamicQuantV4默认确定性实现。 |
| 325 | 335 | ||
| 326 | -yOut的数据类型为INT4时,需满足x和yOut的最后一维能被2整除。不支持非连续场景。 | 336 | +- yOut的数据类型为INT4时,需满足x和yOut的最后一维能被2整除。不支持非连续场景。 |
| 327 | -yOut的数据类型为INT32时,需满足x的最后一维能被8整除。 | 337 | +- yOut的数据类型为INT32时,需满足x的最后一维能被8整除。 |
| 328 | -当有groupIndexOptional时,专家数不超过x剔除最后一维的各个维度乘积。groupIndexOptional的值需要是一组不小于零且非递减的数组,且最后一个值和x剔除最后一维的各个维度乘积相等。若不满足该条件,结果无实际意义。 | 338 | +- 当有groupIndexOptional时,专家数不超过x剔除最后一维的各个维度乘积。groupIndexOptional的值需要是一组不小于零且非递减的数组,且最后一个值和x剔除最后一维的各个维度乘积相等。若不满足该条件,结果无实际意义。 |
| 329 | 339 | ||
| 330 | ## 调用示例 | 340 | ## 调用示例 |
| 331 | 341 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | √ | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -222,14 +232,16 @@ aclnnStatus aclnnDynamicQuantV2( | |||
| 222 | </tbody> | 232 | </tbody> |
| 223 | </table> | 233 | </table> |
| 224 | 234 | ||
| 225 | - - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 235 | + <!-- npu="A3,910b" id7 --> |
| 226 | - | 236 | + - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:出参`yOut`的数据类型仅支持INT4、INT8、INT32。 |
| 227 | - 出参`yOut`的数据类型仅支持INT4、INT8、INT32。 | 237 | + <!-- end id7 --> |
| 238 | + <!-- npu="910,310p" id8 --> | ||
| 228 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>: | 239 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>: |
| 229 | - 入参`x`仅支持FLOAT16。 | 240 | - 入参`x`仅支持FLOAT16。 |
| 230 | - 入参`smoothScalesOptional`、`groupIndexOptional`为预留参数,当前版本不参与计算。 | 241 | - 入参`smoothScalesOptional`、`groupIndexOptional`为预留参数,当前版本不参与计算。 |
| 231 | - 入参`dstType`只支持配置为2。 | 242 | - 入参`dstType`只支持配置为2。 |
| 232 | - 出参`yOut`只支持INT8。 | 243 | - 出参`yOut`只支持INT8。 |
| 244 | + <!-- end id8 --> | ||
| 233 | 245 | ||
| 234 | - **返回值** | 246 | - **返回值** |
| 235 | 247 | ||
| @@ -318,10 +330,14 @@ aclnnStatus aclnnDynamicQuantV2( | |||
| 318 | 330 | ||
| 319 | ## 约束说明 | 331 | ## 约束说明 |
| 320 | 332 | ||
| 333 | +<!-- npu="950,A3,910b" id9 --> | ||
| 321 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>: | 334 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>: |
| 322 | - `yOut`的数据类型为INT4时,需满足`x`和`yOut`的最后一维能被2整除。 | 335 | - `yOut`的数据类型为INT4时,需满足`x`和`yOut`的最后一维能被2整除。 |
| 323 | - `yOut`的数据类型为INT32时,需满足`x`的最后一维能被8整除。 | 336 | - `yOut`的数据类型为INT32时,需满足`x`的最后一维能被8整除。 |
| 337 | +<!-- end id9 --> | ||
| 338 | +<!-- npu="910,310p" id10 --> | ||
| 324 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>:输入x的最后一维需满足被32整除,暂时只支持对称量化,不支持BFLOAT16数据类型。 | 339 | - <term>Atlas 推理系列产品</term>、<term>Atlas 训练系列产品</term>:输入x的最后一维需满足被32整除,暂时只支持对称量化,不支持BFLOAT16数据类型。 |
| 340 | +<!-- end id10 --> | ||
| 325 | - 确定性计算: | 341 | - 确定性计算: |
| 326 | - aclnnDynamicQuantV2默认确定性实现。 | 342 | - aclnnDynamicQuantV2默认确定性实现。 |
| 327 | 343 | ||
Mquant/fake_quant_affine_cachemask/docs/aclnnFakeQuantPerChannelAffineCachemask.md+106-96文件内容审核中,请稍后刷新重试
Mquant/fake_quant_affine_cachemask/docs/aclnnFakeQuantPerTensorAffineCachemask.md+106-96文件内容审核中,请稍后刷新重试
| @@ -59,7 +59,7 @@ | |||
| 59 | 59 | ||
| 60 | pergroup量化方式 | 60 | pergroup量化方式 |
| 61 | 61 | ||
| 62 | - 1. 矩阵乘后x''的shape为[M,N1,N2],在计算pergroup量化方式其中的mx_quantize时,需reshape为[M,N1*N2],记为x2 | 62 | + 1. 矩阵乘后x''的shape为[M,N1,N2],在计算pergroup量化方式其中的mx_quantize时,需reshape为[M,N1*N2],记为x2 |
| 63 | 63 | ||
| 64 | 2. 在x2第二维上按照groupsize进行分组,包含元素e0,e1...e31。计算出emax | 64 | 2. 在x2第二维上按照groupsize进行分组,包含元素e0,e1...e31。计算出emax |
| 65 | 65 | ||
| @@ -68,7 +68,7 @@ | |||
| 68 | 68 | ||
| 69 | pergroup量化方式: | 69 | pergroup量化方式: |
| 70 | - 当dstTypeMax = 0.0时: | 70 | - 当dstTypeMax = 0.0时: |
| 71 | - 1. 矩阵乘后x''的shape为[M,N1,N2],在计算pergroup量化方式其中的mx_quantize时,需reshape为[M,N1*N2],记为x2 | 71 | + 1. 矩阵乘后x''的shape为[M,N1,N2],在计算pergroup量化方式其中的mx_quantize时,需reshape为[M,N1*N2],记为x2 |
| 72 | 72 | ||
| 73 | 2. 在x2第二维上按照groupsize进行分组,包含元素e0,e1...e31。计算出emax | 73 | 2. 在x2第二维上按照groupsize进行分组,包含元素e0,e1...e31。计算出emax |
| 74 | 74 | ||
| @@ -109,10 +109,10 @@ | |||
| 109 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 109 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 110 | $$ | 110 | $$ |
| 111 | 111 | ||
| 112 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 112 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 113 | - 当dstTypeMax != 0.0/6.0/7.0时: | 113 | - 当dstTypeMax != 0.0/6.0/7.0时: |
| 114 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 114 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 115 | - - 找到该块中数值的最大绝对值: | 115 | + - 找到该块中数值的最大绝对值: |
| 116 | 116 | ||
| 117 | $$ | 117 | $$ |
| 118 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) | 118 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) |
| @@ -135,7 +135,7 @@ | |||
| 135 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ | 135 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ |
| 136 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ | 136 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ |
| 137 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 | 137 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 |
| 138 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 138 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 139 | 139 | ||
| 140 | ## 函数原型 | 140 | ## 函数原型 |
| 141 | 141 | ||
| @@ -70,7 +70,7 @@ | |||
| 70 | 70 | ||
| 71 | pergroup量化方式: | 71 | pergroup量化方式: |
| 72 | - 当dstTypeMax = 0.0时: | 72 | - 当dstTypeMax = 0.0时: |
| 73 | - 1. 矩阵乘后x''的shape为[M,N1,N2],在计算pergroup量化方式其中的mx_quantize时,需reshape为[M,N1*N2],记为x2 | 73 | + 1. 矩阵乘后x''的shape为[M,N1,N2],在计算pergroup量化方式其中的mx_quantize时,需reshape为[M,N1*N2],记为x2 |
| 74 | 74 | ||
| 75 | 2. 在x2第二维上按照groupsize进行分组,包含元素e0,e1...e31。计算出emax | 75 | 2. 在x2第二维上按照groupsize进行分组,包含元素e0,e1...e31。计算出emax |
| 76 | 76 | ||
| @@ -111,10 +111,10 @@ | |||
| 111 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 111 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 112 | $$ | 112 | $$ |
| 113 | 113 | ||
| 114 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 114 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 115 | - 当dstTypeMax != 0.0/6.0/7.0时: | 115 | - 当dstTypeMax != 0.0/6.0/7.0时: |
| 116 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 116 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 117 | - - 找到该块中数值的最大绝对值: | 117 | + - 找到该块中数值的最大绝对值: |
| 118 | 118 | ||
| 119 | $$ | 119 | $$ |
| 120 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) | 120 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) |
| @@ -137,7 +137,7 @@ | |||
| 137 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ | 137 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ |
| 138 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ | 138 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ |
| 139 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 | 139 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 |
| 140 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 140 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 141 | 141 | ||
| 142 | ## 函数原型 | 142 | ## 函数原型 |
| 143 | 143 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:不支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | × | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,22 +4,32 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| 18 | -- 接口功能:根据传入的分组索引的起始值(`groupIndex`),对各个group以基本块的粒度进行目标数据类型为`float4/float8`的动态MX量化。 | 28 | +- 接口功能:根据传入的分组索引的起始值(`groupIndex`),对各个group以基本块的粒度进行目标数据类型为`float4/float8`的动态MX量化。 |
| 19 | 29 | ||
| 20 | - 计算公式: | 30 | - 计算公式: |
| 21 | - 场景1,当`scaleAlg`为0时: | 31 | - 场景1,当`scaleAlg`为0时: |
| 22 | - - 将输入`x`在第0维上先按照`groupIndex`进行分组,每个group内按k = blocksize个数分组,一组k个数 {{x<sub>i</sub>}<sub>i=1</sub><sup>k</sup>} 计算出这组数对应的量化尺度`mxscale_pre`, {mxscale_pre, {P<sub>i</sub>}<sub>i=1</sub><sup>k</sup>},计算公式为下面公式(1)(2)。 | 32 | + - 将输入`x`在第0维上先按照`groupIndex`进行分组,每个group内按k = blocksize个数分组,一组k个数{{x<sub>i</sub>}<sub>i=1</sub><sup>k</sup>}计算出这组数对应的量化尺度`mxscale_pre`, {mxscale_pre, {P<sub>i</sub>}<sub>i=1</sub><sup>k</sup>},计算公式为下面公式(1)(2)。 |
| 23 | 33 | ||
| 24 | $$ | 34 | $$ |
| 25 | shared\_exp = floor(log_2(max_i(|V_i|))) - emax \tag{1} | 35 | shared\_exp = floor(log_2(max_i(|V_i|))) - emax \tag{1} |
| @@ -35,7 +45,7 @@ | |||
| 35 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize \tag{3} | 45 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize \tag{3} |
| 36 | $$ | 46 | $$ |
| 37 | 47 | ||
| 38 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出`y`,`mxscale_pre`按对应的`groupIndex`分组,分组内第一个维度pad为偶数,组成输出`mxscale`。 | 48 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出`y`,`mxscale_pre`按对应的`groupIndex`分组,分组内第一个维度pad为偶数,组成输出`mxscale`。 |
| 39 | 49 | ||
| 40 | - `emax`:对应数据类型的最大正则数的指数位。 | 50 | - `emax`:对应数据类型的最大正则数的指数位。 |
| 41 | 51 | ||
| @@ -48,7 +58,7 @@ | |||
| 48 | 58 | ||
| 49 | - 场景2,当`scaleAlg`为1时,只涉及FP8类型: | 59 | - 场景2,当`scaleAlg`为1时,只涉及FP8类型: |
| 50 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 60 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 51 | - - 找到该块中数值的最大绝对值: | 61 | + - 找到该块中数值的最大绝对值: |
| 52 | 62 | ||
| 53 | $$ | 63 | $$ |
| 54 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) | 64 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) |
| @@ -81,7 +91,7 @@ | |||
| 81 | $$ | 91 | $$ |
| 82 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 92 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 83 | $$ | 93 | $$ |
| 84 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出`y`,按对应维度上的分组组成输出`mxscale`。 | 94 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出`y`,按对应维度上的分组组成输出`mxscale`。 |
| 85 | - 当`dstTypeMax != 0.0/6.0/7.0(FP4_E2M1)`或`dstTypeMax != 1.875(FP4_E1M2)`时: | 95 | - 当`dstTypeMax != 0.0/6.0/7.0(FP4_E2M1)`或`dstTypeMax != 1.875(FP4_E1M2)`时: |
| 86 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 96 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 87 | - 找到该块中数值的最大绝对值: | 97 | - 找到该块中数值的最大绝对值: |
| @@ -101,7 +111,7 @@ | |||
| 101 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ | 111 | - 计算块缩放因子:$S_{ue8m0}^b=2^{E_{int}^b}$ |
| 102 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ | 112 | - 计算块转换因子:$R_{fp32}^b=\frac{1}{fp32(S_{ue8m0}^b)}$ |
| 103 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 | 113 | - 应用到量化的最终步骤,对于每个块内元素,$d^i = DType(d_{fp32}^i \cdot R_{fp32}^n)$,最终输出的量化结果是$\left(S^b, [d^i]_{i=1}^k\right)$,其中$S^b$代表块的缩放因子,这里指$S_{ue8m0}^b$,$[d^i]_{i=1}^k$代表块内量化后的数据。 |
| 104 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出`y`,按对应维度上的分组组成输出`mxscale`。 | 114 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出`y`,按对应维度上的分组组成输出`mxscale`。 |
| 105 | 115 | ||
| 106 | ## 函数原型 | 116 | ## 函数原型 |
| 107 | 117 | ||
| @@ -4,17 +4,29 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | +<!-- npu="950" id1 --> | ||
| 7 | - <term>Ascend 950PR/Ascend 950DT</term>:支持 | 8 | - <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | +<!-- end id1 --> | ||
| 10 | +<!-- npu="A3" id2 --> | ||
| 8 | - <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 | 11 | - <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | +<!-- end id2 --> | ||
| 13 | +<!-- npu="910b" id3 --> | ||
| 9 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 | 14 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 10 | - <term>Atlas 200I/500 A2 推理产品</term>:不支持 | 17 | - <term>Atlas 200I/500 A2 推理产品</term>:不支持 |
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 11 | - <term>Atlas 推理系列产品</term>:不支持 | 20 | - <term>Atlas 推理系列产品</term>:不支持 |
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 12 | - <term>Atlas 训练系列产品</term>:不支持 | 23 | - <term>Atlas 训练系列产品</term>:不支持 |
| 24 | +<!-- end id6 --> | ||
| 13 | 25 | ||
| 14 | ## 功能说明 | 26 | ## 功能说明 |
| 15 | 27 | ||
| 16 | -- 接口功能:对二维输入 x 进行分组动态 MX 双轴量化。算子在单次调用中基于 groupIndex 完成 -1 轴和 -2 轴量化,输出 y1Out、y1ScaleOut、y2Out 和 y2ScaleOut。两个量化轴均依据 groupIndex 确定分组范围:在各分组内,-1 轴按列方向进行 MX 量化,-2 轴按行方向进行 MX 量化。 | 28 | +- 接口功能:对二维输入x进行分组动态MX双轴量化。算子在单次调用中基于groupIndex完成-1轴和-2轴量化,输出y1Out、y1ScaleOut、y2Out和y2ScaleOut。两个量化轴均依据groupIndex确定分组范围:在各分组内,-1轴按列方向进行MX量化,-2轴按行方向进行MX量化。 |
| 17 | -- 计算说明:量化以 32 个元素为一个 MX block。scaleAlg = 1 时,每个 block 生成 FLOAT8_E8M0 类型 scale,并使用该 scale 将 block 内元素转换为 dstDtype 指定的数据类型。 | 29 | +- 计算说明:量化以32个元素为一个MX block。scaleAlg = 1时,每个block生成FLOAT8_E8M0类型scale,并使用该scale将block内元素转换为dstDtype指定的数据类型。 |
| 18 | 30 | ||
| 19 | - 计算公式: | 31 | - 计算公式: |
| 20 | 32 | ||
| @@ -74,7 +86,7 @@ | |||
| 74 | 86 | ||
| 75 | ## 函数原型 | 87 | ## 函数原型 |
| 76 | 88 | ||
| 77 | -每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用aclnnGroupedDynamicMxQuantWithDualAxisGetWorkspaceSize接口获取计算所需workspace大小以及包含算子计算流程的执行器,再调用aclnnGroupedDynamicMxQuantWithDualAxis接口执行计算。 | 89 | +每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用“aclnnGroupedDynamicMxQuantWithDualAxisGetWorkspaceSize”接口获取计算所需workspace大小以及包含算子计算流程的执行器,再调用“aclnnGroupedDynamicMxQuantWithDualAxis”接口执行计算。 |
| 78 | 90 | ||
| 79 | ```cpp | 91 | ```cpp |
| 80 | aclnnStatus aclnnGroupedDynamicMxQuantWithDualAxisGetWorkspaceSize( | 92 | aclnnStatus aclnnGroupedDynamicMxQuantWithDualAxisGetWorkspaceSize( |
| @@ -348,7 +360,6 @@ aclnnStatus aclnnGroupedDynamicMxQuantWithDualAxis( | |||
| 348 | - y1ScaleOut的shape由x决定,需要为[M,ceil(N/64),2];y2ScaleOut的shape由x和groupIndex共同决定,需要为[floor(M/64)+G,N,2],其中G为groupIndex元素个数。 | 360 | - y1ScaleOut的shape由x决定,需要为[M,ceil(N/64),2];y2ScaleOut的shape由x和groupIndex共同决定,需要为[floor(M/64)+G,N,2],其中G为groupIndex元素个数。 |
| 349 | - groupIndex采用cumsum模式,每个元素表示对应group的结束行索引;每个元素值需要大于0且非递减,最后一个元素需要等于M(即x.shape[0])。 | 361 | - groupIndex采用cumsum模式,每个元素表示对应group的结束行索引;每个元素值需要大于0且非递减,最后一个元素需要等于M(即x.shape[0])。 |
| 350 | 362 | ||
| 351 | - | ||
| 352 | ## 调用示例 | 363 | ## 调用示例 |
| 353 | 364 | ||
| 354 | 示例代码如下,仅供参考,具体编译和执行过程请参见[编译与运行样例](../../../docs/zh/context/compile_and_run_sample.md)。 | 365 | 示例代码如下,仅供参考,具体编译和执行过程请参见[编译与运行样例](../../../docs/zh/context/compile_and_run_sample.md)。 |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------- | :------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -19,7 +29,7 @@ | |||
| 19 | 29 | ||
| 20 | - 计算公式: | 30 | - 计算公式: |
| 21 | 31 | ||
| 22 | - $group\_list$ 沿 dim-0 将 $x$ 切分为 num_groups 组,$group\_list[g]$ 为前 $g+1$ 组在 dim-0 上的累计大小(单调递增,$group\_list[-1]=x.shape[0]$)。对每个group(g = 0, 1, ..., num_groups - 1): | 32 | + $group\_list$沿dim-0将$x$切分为num_groups组,$group\_list[g]$为前$g+1$组在dim-0上的累计大小(单调递增,$group\_list[-1]=x.shape[0]$)。对每个group(g = 0, 1, ..., num_groups - 1): |
| 23 | 33 | ||
| 24 | $$ | 34 | $$ |
| 25 | x\_g = x[group\_list[g-1] : group\_list[g], ...] | 35 | x\_g = x[group\_list[g-1] : group\_list[g], ...] |
| @@ -33,11 +43,11 @@ | |||
| 33 | amax[g] = \max(|x\_g|) | 43 | amax[g] = \max(|x\_g|) |
| 34 | $$ | 44 | $$ |
| 35 | 45 | ||
| 36 | - 其中,$x$ 表示输入张量,$x\_g$ 表示输入张量的第g组数据,g=0 时下界为0;$scale$ 表示量化缩放因子,$amax[g]$ 为输入张量对应group组绝对值的最大值,$\text{dst\_type}$指定输出类型,$\text{round\_mode}$指定舍入模式。 | 46 | + 其中,$x$表示输入张量,$x\_g$表示输入张量的第g组数据,g=0时下界为0;$scale$表示量化缩放因子,$amax[g]$为输入张量对应group组绝对值的最大值,$\text{dst\_type}$指定输出类型,$\text{round\_mode}$指定舍入模式。 |
| 37 | 47 | ||
| 38 | ## 函数原型 | 48 | ## 函数原型 |
| 39 | 49 | ||
| 40 | -每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用"aclnnGroupedQuantMaxGetWorkspaceSize"接口获取计算所需 workspace 大小以及包含了算子计算流程的执行器,再调用"aclnnGroupedQuantMax"接口执行计算。 | 50 | +每个算子分为[两段式接口](../../../docs/zh/context/two_phase_api.md),必须先调用“aclnnGroupedQuantMaxGetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnGroupedQuantMax”接口执行计算。 |
| 41 | 51 | ||
| 42 | ```cpp | 52 | ```cpp |
| 43 | aclnnStatus aclnnGroupedQuantMaxGetWorkspaceSize( | 53 | aclnnStatus aclnnGroupedQuantMaxGetWorkspaceSize( |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -265,7 +275,7 @@ aclnnStatus aclnnMxToBlockMxQuant( | |||
| 265 | 275 | ||
| 266 | - 确定性计算: | 276 | - 确定性计算: |
| 267 | - `aclnnMxToBlockMxQuant`默认确定性实现。 | 277 | - `aclnnMxToBlockMxQuant`默认确定性实现。 |
| 268 | -- x只支持2维或3维输入,且-2轴是64的倍数, -1轴是2的倍数,不支持非连续Tensor,不支持空Tensor。 | 278 | +- x只支持2维或3维输入,且-2轴是64的倍数,-1轴是2的倍数,不支持非连续Tensor,不支持空Tensor。 |
| 269 | - 关于x、mxscale、scale1、scale2的shape约束说明如下: | 279 | - 关于x、mxscale、scale1、scale2的shape约束说明如下: |
| 270 | - rank(mxscale) = rank(x) + 1。 | 280 | - rank(mxscale) = rank(x) + 1。 |
| 271 | - mxscale.shape[-2] = (Ceil(x.shape[-1], 32) + 2 - 1) / 2。 | 281 | - mxscale.shape[-2] = (Ceil(x.shape[-1], 32) + 2 - 1) / 2。 |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------- | :------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -155,18 +165,22 @@ aclnnStatus aclnnQuantize( | |||
| 155 | </tbody> | 165 | </tbody> |
| 156 | </table> | 166 | </table> |
| 157 | 167 | ||
| 168 | + <!-- npu="310p" id7 --> | ||
| 158 | - <term>Atlas 推理系列产品</term>: | 169 | - <term>Atlas 推理系列产品</term>: |
| 159 | - 数据类型: | 170 | - 数据类型: |
| 160 | - 入参`x`、`scales`不支持BFLOAT16、FLOAT32。 | 171 | - 入参`x`、`scales`不支持BFLOAT16、FLOAT32。 |
| 161 | - 入参`zeroPoints`不支持FLOAT32。且当数据类型为BFLOAT16时,`x`、`scales`数据类型均为BFLOAT16。 | 172 | - 入参`zeroPoints`不支持FLOAT32。且当数据类型为BFLOAT16时,`x`、`scales`数据类型均为BFLOAT16。 |
| 162 | - 出参`out`仅支持INT8、UINT8、INT32。 | 173 | - 出参`out`仅支持INT8、UINT8、INT32。 |
| 163 | - 入参`dtype`仅支持取值ACL_INT8、ACL_UINT8、ACL_INT32。 | 174 | - 入参`dtype`仅支持取值ACL_INT8、ACL_UINT8、ACL_INT32。 |
| 175 | + <!-- end id7 --> | ||
| 164 | 176 | ||
| 177 | + <!-- npu="A3,910b" id8 --> | ||
| 165 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: | 178 | - <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>: |
| 166 | - 数据类型: | 179 | - 数据类型: |
| 167 | - 入参`zeroPoints`不支持FLOAT32。且当数据类型为BFLOAT16时,`x`、`scales`数据类型均为BFLOAT16。 | 180 | - 入参`zeroPoints`不支持FLOAT32。且当数据类型为BFLOAT16时,`x`、`scales`数据类型均为BFLOAT16。 |
| 168 | - 出参`out`仅支持INT8、UINT8、INT32。 | 181 | - 出参`out`仅支持INT8、UINT8、INT32。 |
| 169 | - 入参`dtype`仅支持取值ACL_INT8、ACL_UINT8、ACL_INT32。 | 182 | - 入参`dtype`仅支持取值ACL_INT8、ACL_UINT8、ACL_INT32。 |
| 183 | + <!-- end id8 --> | ||
| 170 | 184 | ||
| 171 | - **返回值** | 185 | - **返回值** |
| 172 | 186 | ||
| @@ -4,18 +4,27 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | - | 15 | +<!-- end id3 --> |
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 16 | ## 功能说明 | 25 | ## 功能说明 |
| 17 | 26 | ||
| 18 | -- 接口功能:在SwiGlu激活函数后添加quant操作,实现输入x的SwiGluQuant计算 | 27 | +- 接口功能:在SwiGlu激活函数后添加quant操作,实现输入x的SwiGluQuant计算。 |
| 19 | - 算子支持范围:当前SwiGluQuant**仅支持MoE场景**,SwiGluQuant的输入x和group_index来自于GroupedMatMul算子和MoeInitRouting的输出,通过group_index入参实现MoE分组动态量化、静态per_tensor量化、静态per_channel量化功能。 | 28 | - 算子支持范围:当前SwiGluQuant**仅支持MoE场景**,SwiGluQuant的输入x和group_index来自于GroupedMatMul算子和MoeInitRouting的输出,通过group_index入参实现MoE分组动态量化、静态per_tensor量化、静态per_channel量化功能。 |
| 20 | - 动态量化计算公式: | 29 | - 动态量化计算公式: |
| 21 | 30 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- |:-------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -2,14 +2,24 @@ | |||
| 2 | 2 | ||
| 3 | ## 产品支持情况 | 3 | ## 产品支持情况 |
| 4 | 4 | ||
| 5 | -|产品 | 是否支持 | | 5 | +<!-- npu="950" id1 --> |
| 6 | -|:-------------------------|:----------:| | 6 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 7 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 7 | +<!-- end id1 --> |
| 8 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | x | | 8 | +<!-- npu="A3" id2 --> |
| 9 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | x | | 9 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 10 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 10 | +<!-- end id2 --> |
| 11 | -| <term>Atlas 推理系列产品</term> | × | | 11 | +<!-- npu="910b" id3 --> |
| 12 | -| <term>Atlas 训练系列产品</term> | × | | 12 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 13 | +<!-- end id3 --> | ||
| 14 | +<!-- npu="310b" id4 --> | ||
| 15 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 16 | +<!-- end id4 --> | ||
| 17 | +<!-- npu="310p" id5 --> | ||
| 18 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 19 | +<!-- end id5 --> | ||
| 20 | +<!-- npu="910" id6 --> | ||
| 21 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 22 | +<!-- end id6 --> | ||
| 13 | 23 | ||
| 14 | ## 功能说明 | 24 | ## 功能说明 |
| 15 | 25 | ||
| @@ -59,7 +69,7 @@ | |||
| 59 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ | 69 | P_i = cast\_to\_dst\_type(V_i/mxscale, round\_mode), \space i\space from\space 1\space to\space blocksize\\ |
| 60 | $$ | 70 | $$ |
| 61 | 71 | ||
| 62 | - - 量化后的 $P_{i}$ 按对应的 $V_{i}$ 的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 | 72 | + - 量化后的$P_{i}$按对应的$V_{i}$的位置组成输出yOut,mxscale按对应的axis维度上的分组组成输出mxscaleOut。 |
| 63 | 73 | ||
| 64 | - emax: 对应数据类型的最大正则数的指数位。 | 74 | - emax: 对应数据类型的最大正则数的指数位。 |
| 65 | 75 | ||
| @@ -72,7 +82,7 @@ | |||
| 72 | 82 | ||
| 73 | - 场景2,当scaleAlg为1时,只涉及FP8类型,DynamicMxQuant计算逻辑: | 83 | - 场景2,当scaleAlg为1时,只涉及FP8类型,DynamicMxQuant计算逻辑: |
| 74 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 | 84 | - 将长向量按块分,每块长度为k,对每块单独计算一个块缩放因子$S_{fp32}^b$,再把块内所有元素用同一个$S_{fp32}^b$映射到目标低精度类型FP8。如果最后一块不足k个元素,把缺失值视为0,按照完整块处理。 |
| 75 | - - 找到该块中数值的最大绝对值: | 85 | + - 找到该块中数值的最大绝对值: |
| 76 | $$ | 86 | $$ |
| 77 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) | 87 | Amax(D_{fp32}^b)=max(\{|d_{i}|\}_{i=1}^{k}) |
| 78 | $$ | 88 | $$ |
| @@ -436,12 +446,12 @@ aclnnStatus aclnnSwigluMxQuant( | |||
| 436 | - aclnnSwigluMxQuant默认确定性实现。 | 446 | - aclnnSwigluMxQuant默认确定性实现。 |
| 437 | 447 | ||
| 438 | - 输入x对应activateDim的维度需要是2的倍数,且x的维数必须大于1维。 | 448 | - 输入x对应activateDim的维度需要是2的倍数,且x的维数必须大于1维。 |
| 439 | -- activateDim为非last轴, swigluMode必须为0。 | 449 | +- activateDim为非last轴,swigluMode必须为0。 |
| 440 | - 当输出yOut的数据类型为FLOAT4_E2M1、FLOAT4_E1M2时,yOut的最后一维需要是2的倍数。 | 450 | - 当输出yOut的数据类型为FLOAT4_E2M1、FLOAT4_E1M2时,yOut的最后一维需要是2的倍数。 |
| 441 | - 当输出yOut的数据类型为FLOAT4_E2M1、FLOAT4_E1M2时,scaleAlg必须为0。 | 451 | - 当输出yOut的数据类型为FLOAT4_E2M1、FLOAT4_E1M2时,scaleAlg必须为0。 |
| 442 | - groupIndexOptional所有元素之和不能大于输入x除尾轴之外的剩余轴的乘积,groupIndexOptional的每个元素需要大于0。 | 452 | - groupIndexOptional所有元素之和不能大于输入x除尾轴之外的剩余轴的乘积,groupIndexOptional的每个元素需要大于0。 |
| 443 | - 输出yOut和mxscaleOut超出groupIndexOptional所有元素之和的部分未进行清理,该部分内存为垃圾数据。 | 453 | - 输出yOut和mxscaleOut超出groupIndexOptional所有元素之和的部分未进行清理,该部分内存为垃圾数据。 |
| 444 | -- 当activateDim为非last轴, 或者 axis为非last轴, groupIndexOptional存在时,x的输入必须为2维。 | 454 | +- 当activateDim为非last轴,或者axis为非last轴,groupIndexOptional存在时,x的输入必须为2维。 |
| 445 | - 当输出yOut的数据类型为FLOAT8_E4M3FN、FLOAT8_E5M2时,roundModeOptional必须为 rint。 | 455 | - 当输出yOut的数据类型为FLOAT8_E4M3FN、FLOAT8_E5M2时,roundModeOptional必须为 rint。 |
| 446 | 456 | ||
| 447 | ## 调用示例 | 457 | ## 调用示例 |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- | :------: | | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | × | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | × | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:不支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:不支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | × | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:不支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -|产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -|:-------------------------|:----------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -222,8 +232,12 @@ aclnnStatus aclnnTransQuantParamV2( | |||
| 222 | 232 | ||
| 223 | ## 约束说明 | 233 | ## 约束说明 |
| 224 | 234 | ||
| 235 | +<!-- npu="950,A3,910b,310p" id7 --> | ||
| 225 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>:该接口支持与matmul类算子(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md))配套使用。 | 236 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>:该接口支持与matmul类算子(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md))配套使用。 |
| 237 | +<!-- end id7 --> | ||
| 238 | +<!-- npu="A3,910b,310p" id8 --> | ||
| 226 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:该接口不支持与grouped matmul类算子(如aclnnGroupedMatmulV4)配套使用。 | 239 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:该接口不支持与grouped matmul类算子(如aclnnGroupedMatmulV4)配套使用。 |
| 240 | +<!-- end id8 --> | ||
| 227 | - 关于scale、offset、out的shape说明如下: | 241 | - 关于scale、offset、out的shape说明如下: |
| 228 | - 当无offset时,out shape与scale shape一致。 | 242 | - 当无offset时,out shape与scale shape一致。 |
| 229 | - 若out作为matmul类算子输入(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md)),shape支持1维(1,)、(n,)或2维(1, n),其中n与matmul计算中右矩阵(对应参数x2)的shape n一致。 | 243 | - 若out作为matmul类算子输入(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md)),shape支持1维(1,)、(n,)或2维(1, n),其中n与matmul计算中右矩阵(对应参数x2)的shape n一致。 |
| @@ -4,14 +4,24 @@ | |||
| 4 | 4 | ||
| 5 | ## 产品支持情况 | 5 | ## 产品支持情况 |
| 6 | 6 | ||
| 7 | -| 产品 | 是否支持 | | 7 | +<!-- npu="950" id1 --> |
| 8 | -| :----------------------------------------------------------- |:-------:| | 8 | +- <term>Ascend 950PR/Ascend 950DT</term>:支持 |
| 9 | -| <term>Ascend 950PR/Ascend 950DT</term> | √ | | 9 | +<!-- end id1 --> |
| 10 | -| <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term> | √ | | 10 | +<!-- npu="A3" id2 --> |
| 11 | -| <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term> | √ | | 11 | +- <term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:支持 |
| 12 | -| <term>Atlas 200I/500 A2 推理产品</term> | × | | 12 | +<!-- end id2 --> |
| 13 | -| <term>Atlas 推理系列产品</term> | √ | | 13 | +<!-- npu="910b" id3 --> |
| 14 | -| <term>Atlas 训练系列产品</term> | × | | 14 | +- <term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>:支持 |
| 15 | +<!-- end id3 --> | ||
| 16 | +<!-- npu="310b" id4 --> | ||
| 17 | +- <term>Atlas 200I/500 A2 推理产品</term>:不支持 | ||
| 18 | +<!-- end id4 --> | ||
| 19 | +<!-- npu="310p" id5 --> | ||
| 20 | +- <term>Atlas 推理系列产品</term>:支持 | ||
| 21 | +<!-- end id5 --> | ||
| 22 | +<!-- npu="910" id6 --> | ||
| 23 | +- <term>Atlas 训练系列产品</term>:不支持 | ||
| 24 | +<!-- end id6 --> | ||
| 15 | 25 | ||
| 16 | ## 功能说明 | 26 | ## 功能说明 |
| 17 | 27 | ||
| @@ -240,8 +250,12 @@ aclnnStatus aclnnTransQuantParamV3( | |||
| 240 | 250 | ||
| 241 | ## 约束说明 | 251 | ## 约束说明 |
| 242 | 252 | ||
| 253 | +<!-- npu="950,A3,910b,310p" id7 --> | ||
| 243 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>:该接口支持与matmul类算子(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md))配套使用。 | 254 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>、<term>Ascend 950PR/Ascend 950DT</term>:该接口支持与matmul类算子(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md))配套使用。 |
| 255 | +<!-- end id7 --> | ||
| 256 | +<!-- npu="A3,910b,310p" id8 --> | ||
| 244 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:该接口不支持与grouped matmul类算子(如aclnnGroupedMatmulV4)配套使用。 | 257 | - <term>Atlas 推理系列产品</term>、<term>Atlas A2 训练系列产品/Atlas A2 推理系列产品</term>、<term>Atlas A3 训练系列产品/Atlas A3 推理系列产品</term>:该接口不支持与grouped matmul类算子(如aclnnGroupedMatmulV4)配套使用。 |
| 258 | +<!-- end id8 --> | ||
| 245 | - 关于scale、offset、out的shape说明如下: | 259 | - 关于scale、offset、out的shape说明如下: |
| 246 | - 当无offset时,out shape与scale shape一致。 | 260 | - 当无offset时,out shape与scale shape一致。 |
| 247 | - 若out作为matmul类算子输入(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md)),shape支持1维(1,)、(n,)或2维(1, n),其中n与matmul计算中右矩阵(对应参数x2)的shape n一致。 | 261 | - 若out作为matmul类算子输入(如[aclnnQuantMatmulV4](../../../matmul/quant_batch_matmul_v3/docs/aclnnQuantMatmulV4.md)),shape支持1维(1,)、(n,)或2维(1, n),其中n与matmul计算中右矩阵(对应参数x2)的shape n一致。 |
🟡 Medium Priority
在
quant/dynamic_quant/docs/aclnnDynamicQuant.md约束说明部分,<!-- npu="910,310p" id10 -->的闭合标签<!-- end id10 -->被放置在了"确定性计算"内容之后(第274行),导致"确定性计算:aclnnDynamicQuant默认确定性实现"被纳入 910/310p 芯片专属范围。而在对比文件
aclnnDynamicQuantV2.md中,相同的<!-- npu="910,310p" id10 -->块正确地在"确定性计算"之前闭合(第340行),使确定性计算保持为通用说明。变更行为:当文档渲染系统根据芯片标签过滤内容时,非 910/310p 芯片的用户将看不到"确定性计算"这一通用说明。 失败模式:用户可能误以为该算子不支持确定性计算,或无法在文档中找到确定性计算的相关信息。 修复方向:将
<!-- end id10 -->移到"确定性计算"行之前,使其仅包裹芯片专属约束内容。