已合并
删除aclnnfqmm接口中transpose属性&aclnnfqmm 适配A4W4 weightnz #1893
rueenov11创建于 2月12日
删除aclnnfqmm接口中transpose属性&aclnnfqmm 适配A4W4 weightnz #1893
已合并
共 12 个文件变更+59-117
| @@ -64,8 +64,6 @@ aclnnStatus aclnnFusedQuantMatmulGetWorkspaceSize( | |||
| 64 | const aclTensor *biasOptional, | 64 | const aclTensor *biasOptional, |
| 65 | const aclTensor *x3Optional, | 65 | const aclTensor *x3Optional, |
| 66 | const char *fusedOpType, | 66 | const char *fusedOpType, |
| 67 | - bool transposeX1, | ||
| 68 | - bool transposeX2, | ||
| 69 | int64_t groupSizeOptional, | 67 | int64_t groupSizeOptional, |
| 70 | aclTensor *out, | 68 | aclTensor *out, |
| 71 | uint64_t *workspaceSize, | 69 | uint64_t *workspaceSize, |
| @@ -117,7 +115,7 @@ aclnnStatus aclnnFusedQuantMatmul( | |||
| 117 | <td>INT4、INT8、INT32</td> | 115 | <td>INT4、INT8、INT32</td> |
| 118 | <td>ND</td> | 116 | <td>ND</td> |
| 119 | <td>2-6</td> | 117 | <td>2-6</td> |
| 120 | - <td>×</td> | 118 | + <td>√</td> |
| 121 | </tr> | 119 | </tr> |
| 122 | <tr> | 120 | <tr> |
| 123 | <td>x2</td> | 121 | <td>x2</td> |
| @@ -132,7 +130,7 @@ aclnnStatus aclnnFusedQuantMatmul( | |||
| 132 | <td>INT4、INT8、INT32</td> | 130 | <td>INT4、INT8、INT32</td> |
| 133 | <td>ND</td> | 131 | <td>ND</td> |
| 134 | <td>2-6</td> | 132 | <td>2-6</td> |
| 135 | - <td>x</td> | 133 | + <td>√</td> |
| 136 | </tr> | 134 | </tr> |
| 137 | <tr> | 135 | <tr> |
| 138 | <td>x1Scale</td> | 136 | <td>x1Scale</td> |
| @@ -224,26 +222,6 @@ aclnnStatus aclnnFusedQuantMatmul( | |||
| 224 | <td>-</td> | 222 | <td>-</td> |
| 225 | <td>-</td> | 223 | <td>-</td> |
| 226 | </tr> | 224 | </tr> |
| 227 | - <tr> | ||
| 228 | - <td>transposeX1</td> | ||
| 229 | - <td>输入</td> | ||
| 230 | - <td>表示x1的输入shape是否包含transpose。</td> | ||
| 231 | - <td>-</td> | ||
| 232 | - <td>BOOL</td> | ||
| 233 | - <td>-</td> | ||
| 234 | - <td>-</td> | ||
| 235 | - <td>-</td> | ||
| 236 | - </tr> | ||
| 237 | - <tr> | ||
| 238 | - <td>transposeX2</td> | ||
| 239 | - <td>输入</td> | ||
| 240 | - <td>表示x2的输入shape是否包含transpose。</td> | ||
| 241 | - <td>-</td> | ||
| 242 | - <td>BOOL</td> | ||
| 243 | - <td>-</td> | ||
| 244 | - <td>-</td> | ||
| 245 | - <td>-</td> | ||
| 246 | - </tr> | ||
| 247 | <tr> | 225 | <tr> |
| 248 | <td>groupSizeOptional</td> | 226 | <td>groupSizeOptional</td> |
| 249 | <td>输入</td> | 227 | <td>输入</td> |
| @@ -388,19 +366,14 @@ aclnnStatus aclnnFusedQuantMatmul( | |||
| 388 | - x1数据类型支持INT8、INT32、INT4。 | 366 | - x1数据类型支持INT8、INT32、INT4。 |
| 389 | - 当数据类型为INT32、INT4时,为INT4量化场景: | 367 | - 当数据类型为INT32、INT4时,为INT4量化场景: |
| 390 | - 当前仅支持ND输入。 | 368 | - 当前仅支持ND输入。 |
| 391 | - - 只支持transposeX1为false情况。 | 369 | + - 当前只支持不转置输入。 |
| 392 | - 要求x1内轴为偶数。 | 370 | - 要求x1内轴为偶数。 |
| 393 | - 当数据类型为INT32时,每个INT32数据存放8个INT4数据,对应维度表示:(batch,m,k // 8),要求k为8的倍数。 | 371 | - 当数据类型为INT32时,每个INT32数据存放8个INT4数据,对应维度表示:(batch,m,k // 8),要求k为8的倍数。 |
| 394 | - - 在transposeX1为false情况下,形状为(batch, m, k),batch轴支持0~4维。 | ||
| 395 | - x2数据类型支持INT8、INT32、INT4。 | 372 | - x2数据类型支持INT8、INT32、INT4。 |
| 396 | - 当数据类型为INT32、INT4时,为INT4量化场景: | 373 | - 当数据类型为INT32、INT4时,为INT4量化场景: |
| 397 | - 该接口仅支持2维ND格式。 | 374 | - 该接口仅支持2维ND格式。 |
| 398 | - 要求x2内轴为偶数。 | 375 | - 要求x2内轴为偶数。 |
| 399 | - 数据类型为INT32时,每个INT32数据存放8个INT4数据: | 376 | - 数据类型为INT32时,每个INT32数据存放8个INT4数据: |
| 400 | - - transposeX2为true时维度为:(n,k // 8),要求k为8的倍数。 | ||
| 401 | - - transposeX2为false时维度为:(k,n // 8),要求n为8的倍数。 | ||
| 402 | - - transposeX2为false情况下各个维度表示:(batch,k,n),batch轴支持0~4维,其中k与x1的shape中的k一致。 | ||
| 403 | - - transposeX2为true情况下各个维度表示:(batch,n,k),batch轴支持0~4维,其中k与x1的shape中的k一致。 | ||
| 404 | - 可使用aclnnConvertWeightToINT4Pack接口完成x2从INT32(1个int32在0~3bit位存储1个int4)到INT32(1个int32存储8个int4)或INT4(1个int4表示1个int4)的数据格式转换,具体参见[aclnnConvertWeightToINT4Pack接口](../../convert_weight_to_int4_pack/docs/aclnnConvertWeightToINT4Pack.md)。 | 377 | - 可使用aclnnConvertWeightToINT4Pack接口完成x2从INT32(1个int32在0~3bit位存储1个int4)到INT32(1个int32存储8个int4)或INT4(1个int4表示1个int4)的数据格式转换,具体参见[aclnnConvertWeightToINT4Pack接口](../../convert_weight_to_int4_pack/docs/aclnnConvertWeightToINT4Pack.md)。 |
| 405 | - x1Scale约束如下: | 378 | - x1Scale约束如下: |
| 406 | - shape支持1维,形状为(m,),数据类型支持FLOAT32。 | 379 | - shape支持1维,形状为(m,),数据类型支持FLOAT32。 |
| @@ -409,9 +382,6 @@ aclnnStatus aclnnFusedQuantMatmul( | |||
| 409 | - biasOptional的约束如下: | 382 | - biasOptional的约束如下: |
| 410 | - shape支持1、3维,INT4量化场景下只支持biasOptional为1维,shape为(n),3维时biasOptional shape为(batch, 1, n)。 | 383 | - shape支持1、3维,INT4量化场景下只支持biasOptional为1维,shape为(n),3维时biasOptional shape为(batch, 1, n)。 |
| 411 | - 数据类型支持int32、float32、bfloat16或float16。 | 384 | - 数据类型支持int32、float32、bfloat16或float16。 |
| 412 | - - transposeX1:x1和x2为INT32、INT4时,transposeX1仅支持false,各个维度表示:(m, k)。 | ||
| 413 | - - transposeX2的约束如下: | ||
| 414 | - - ND格式下,为false时维度为:(batch,k,n),为true时维度为:(batch,n,k),batch可不存在,其中k与x1的shape中的k一致。 | ||
| 415 | - out的约束如下: | 385 | - out的约束如下: |
| 416 | - shape支持2~6维,(batch,m,n)。数据类型支持FLOAT16、BFLOAT16。 | 386 | - shape支持2~6维,(batch,m,n)。数据类型支持FLOAT16、BFLOAT16。 |
| 417 | 387 | ||
| @@ -557,8 +527,6 @@ x1为INT8,x2为INT8,x1Scale为FLOAT32,x2Scale为FLOAT32。 | |||
| 557 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); | 527 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); |
| 558 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); | 528 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); |
| 559 | CHECK_RET(ret == ACL_SUCCESS, return ret); | 529 | CHECK_RET(ret == ACL_SUCCESS, return ret); |
| 560 | - bool transposeX1 = false; | ||
| 561 | - bool transposeX2 = false; | ||
| 562 | int64_t groupSize = 0; | 530 | int64_t groupSize = 0; |
| 563 | const char fusedOpType[] = "gelu_tanh"; | 531 | const char fusedOpType[] = "gelu_tanh"; |
| 564 | 532 | ||
| @@ -567,7 +535,7 @@ x1为INT8,x2为INT8,x1Scale为FLOAT32,x2Scale为FLOAT32。 | |||
| 567 | aclOpExecutor* executor = nullptr; | 535 | aclOpExecutor* executor = nullptr; |
| 568 | 536 | ||
| 569 | ret = aclnnFusedQuantMatmulGetWorkspaceSize( | 537 | ret = aclnnFusedQuantMatmulGetWorkspaceSize( |
| 570 | - x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, transposeX1, transposeX2, groupSize, out, | 538 | + x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, groupSize, out, |
| 571 | &workspaceSize, &executor); | 539 | &workspaceSize, &executor); |
| 572 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulGetWorkspaceSize failed. ERROR: %d\n", ret); return ret); | 540 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulGetWorkspaceSize failed. ERROR: %d\n", ret); return ret); |
| 573 | // 根据第一段接口计算出的workspaceSize申请device内存 | 541 | // 根据第一段接口计算出的workspaceSize申请device内存 |
| @@ -64,8 +64,6 @@ aclnnStatus aclnnFusedQuantMatmulWeightNzGetWorkspaceSize( | |||
| 64 | const aclTensor *biasOptional, | 64 | const aclTensor *biasOptional, |
| 65 | const aclTensor *x3Optional, | 65 | const aclTensor *x3Optional, |
| 66 | const char *fusedOpType, | 66 | const char *fusedOpType, |
| 67 | - bool transposeX1, | ||
| 68 | - bool transposeX2, | ||
| 69 | int64_t groupSizeOptional, | 67 | int64_t groupSizeOptional, |
| 70 | aclTensor *out, | 68 | aclTensor *out, |
| 71 | uint64_t *workspaceSize, | 69 | uint64_t *workspaceSize, |
| @@ -117,7 +115,7 @@ aclnnStatus aclnnFusedQuantMatmulWeightNz( | |||
| 117 | <td>INT4、INT8、INT32</td> | 115 | <td>INT4、INT8、INT32</td> |
| 118 | <td>ND</td> | 116 | <td>ND</td> |
| 119 | <td>2-6</td> | 117 | <td>2-6</td> |
| 120 | - <td>×</td> | 118 | + <td>√</td> |
| 121 | </tr> | 119 | </tr> |
| 122 | <tr> | 120 | <tr> |
| 123 | <td>x2</td> | 121 | <td>x2</td> |
| @@ -132,7 +130,7 @@ aclnnStatus aclnnFusedQuantMatmulWeightNz( | |||
| 132 | <td>INT4、INT8、INT32</td> | 130 | <td>INT4、INT8、INT32</td> |
| 133 | <td>NZ</td> | 131 | <td>NZ</td> |
| 134 | <td>2-6</td> | 132 | <td>2-6</td> |
| 135 | - <td>x</td> | 133 | + <td>√</td> |
| 136 | </tr> | 134 | </tr> |
| 137 | <tr> | 135 | <tr> |
| 138 | <td>x1Scale</td> | 136 | <td>x1Scale</td> |
| @@ -224,26 +222,6 @@ aclnnStatus aclnnFusedQuantMatmulWeightNz( | |||
| 224 | <td>-</td> | 222 | <td>-</td> |
| 225 | <td>-</td> | 223 | <td>-</td> |
| 226 | </tr> | 224 | </tr> |
| 227 | - <tr> | ||
| 228 | - <td>transposeX1</td> | ||
| 229 | - <td>输入</td> | ||
| 230 | - <td>表示x1的输入shape是否包含transpose。</td> | ||
| 231 | - <td>-</td> | ||
| 232 | - <td>BOOL</td> | ||
| 233 | - <td>-</td> | ||
| 234 | - <td>-</td> | ||
| 235 | - <td>-</td> | ||
| 236 | - </tr> | ||
| 237 | - <tr> | ||
| 238 | - <td>transposeX2</td> | ||
| 239 | - <td>输入</td> | ||
| 240 | - <td>表示x2的输入shape是否包含transpose。</td> | ||
| 241 | - <td>-</td> | ||
| 242 | - <td>BOOL</td> | ||
| 243 | - <td>-</td> | ||
| 244 | - <td>-</td> | ||
| 245 | - <td>-</td> | ||
| 246 | - </tr> | ||
| 247 | <tr> | 225 | <tr> |
| 248 | <td>groupSizeOptional</td> | 226 | <td>groupSizeOptional</td> |
| 249 | <td>输入</td> | 227 | <td>输入</td> |
| @@ -389,21 +367,16 @@ aclnnStatus aclnnFusedQuantMatmulWeightNz( | |||
| 389 | - x1数据类型支持INT8、INT32、INT4。 | 367 | - x1数据类型支持INT8、INT32、INT4。 |
| 390 | - 当数据类型为INT32、INT4时,为INT4量化场景: | 368 | - 当数据类型为INT32、INT4时,为INT4量化场景: |
| 391 | - 当前仅支持ND输入。 | 369 | - 当前仅支持ND输入。 |
| 392 | - - 只支持transposeX1为false情况。 | 370 | + - 当前只支持不转置输入。 |
| 393 | - 要求x1内轴为偶数。 | 371 | - 要求x1内轴为偶数。 |
| 394 | - 当数据类型为INT32时,每个INT32数据存放8个INT4数据,对应维度表示:(batch,m,k // 8),要求k为8的倍数。 | 372 | - 当数据类型为INT32时,每个INT32数据存放8个INT4数据,对应维度表示:(batch,m,k // 8),要求k为8的倍数。 |
| 395 | - - 在transposeX1为false情况下,形状为(batch, m, k),batch轴支持0~4维。 | ||
| 396 | - x2数据类型支持INT8、INT32、INT4。 | 373 | - x2数据类型支持INT8、INT32、INT4。 |
| 397 | - 该接口仅支持x2为NZ格式,此时x2是NZ格式时,k、n不能为1。 | 374 | - 该接口仅支持x2为NZ格式,此时x2是NZ格式时,k、n不能为1。 |
| 398 | - - 数据类型为INT32时,每个INT32数据存放8个INT4数据: | 375 | + - 数据类型为INT32时,每个INT32数据存放8个INT4数据。 |
| 399 | - - transposeX2为true时维度为:(n,k // 8),要求k为8的倍数。 | ||
| 400 | - - transposeX2为false时维度为:(k,n // 8),要求n为8的倍数。 | ||
| 401 | - - transposeX2为false情况下各个维度表示:(batch,k,n),batch轴支持0~4维,其中k与x1的shape中的k一致。 | ||
| 402 | - - transposeX2为true情况下各个维度表示:(batch,n,k),batch轴支持0~4维,其中k与x1的shape中的k一致。 | ||
| 403 | - 可使用aclnnConvertWeightToINT4Pack接口完成x2从INT32(1个int32在0~3bit位存储1个int4)到INT32(1个int32存储8个int4)或INT4(1个int4表示1个int4)的数据格式转换,具体参见[aclnnConvertWeightToINT4Pack接口](../../convert_weight_to_int4_pack/docs/aclnnConvertWeightToINT4Pack.md)。 | 376 | - 可使用aclnnConvertWeightToINT4Pack接口完成x2从INT32(1个int32在0~3bit位存储1个int4)到INT32(1个int32存储8个int4)或INT4(1个int4表示1个int4)的数据格式转换,具体参见[aclnnConvertWeightToINT4Pack接口](../../convert_weight_to_int4_pack/docs/aclnnConvertWeightToINT4Pack.md)。 |
| 404 | - AI处理器亲和数据排布格式下,shape支持4~8维。 | 377 | - AI处理器亲和数据排布格式下,shape支持4~8维。 |
| 405 | - - transposeX2为true时维度为:(batch,k1,n1,n0,k0),batch可不存在,其中k0 = 32, n0 = 16, x1 shape中的k和x2 shape中的k1需要满足以下关系:ceil(k / 32) = k1。 | 378 | + - 转置时维度为:(batch,k1,n1,n0,k0),batch可不存在,其中k0 = 32, n0 = 16, x1 shape中的k和x2 shape中的k1需要满足以下关系:ceil(k / 32) = k1。 |
| 406 | - - transposeX2为false时维度为:(batch,n1,k1,k0,n0),batch可不存在,其中k0 = 16,n0 = 32,x1 shape中的k和x2 shape中的k1需要满足以下关系:ceil(k / 16) = k1。 | 379 | + - 不转置时维度为:(batch,n1,k1,k0,n0),batch可不存在,其中k0 = 16,n0 = 32,x1 shape中的k和x2 shape中的k1需要满足以下关系:ceil(k / 16) = k1。 |
| 407 | - 可使用aclnnCalculateMatmulWeightSizeV2接口以及aclnnTransMatmulWeight接口完成输入Format从ND到AI处理器亲和数据排布格式的转换。 | 380 | - 可使用aclnnCalculateMatmulWeightSizeV2接口以及aclnnTransMatmulWeight接口完成输入Format从ND到AI处理器亲和数据排布格式的转换。 |
| 408 | - x1Scale约束如下: | 381 | - x1Scale约束如下: |
| 409 | - shape支持1维,形状为(m,),数据类型支持FLOAT32。 | 382 | - shape支持1维,形状为(m,),数据类型支持FLOAT32。 |
| @@ -412,11 +385,6 @@ aclnnStatus aclnnFusedQuantMatmulWeightNz( | |||
| 412 | - biasOptional的约束如下: | 385 | - biasOptional的约束如下: |
| 413 | - shape支持1、3维,INT4量化场景下只支持biasOptional为1维,shape为(n),3维时biasOptional shape为(batch, 1, n)。 | 386 | - shape支持1、3维,INT4量化场景下只支持biasOptional为1维,shape为(n),3维时biasOptional shape为(batch, 1, n)。 |
| 414 | - 数据类型支持int32、float32、bfloat16或float16。 | 387 | - 数据类型支持int32、float32、bfloat16或float16。 |
| 415 | - - transposeX1:x1和x2为INT32、INT4时,transposeX1仅支持false,各个维度表示:(m, k)。 | ||
| 416 | - - transposeX2的约束如下: | ||
| 417 | - - AI处理器亲和数据排布格式下: | ||
| 418 | - - 为true时维度为:(batch,k1,n1,n0,k0),batch可不存在,其中k0 = 32,n0 = 16,x1 shape中的k和x2 shape中的k1需要满足以下关系:ceil(k / 32) = k1。 | ||
| 419 | - - 为false时维度为:(batch,n1,k1,k0,n0),batch可不存在,其中k0 = 16,n0 = 32,x1 shape中的k和x2 shape中的k1需要满足以下关系:ceil(k / 16) = k1。 | ||
| 420 | - out的约束如下: | 388 | - out的约束如下: |
| 421 | - shape支持2~6维,(batch,m,n)。数据类型支持FLOAT16、BFLOAT16。 | 389 | - shape支持2~6维,(batch,m,n)。数据类型支持FLOAT16、BFLOAT16。 |
| 422 | 390 | ||
| @@ -597,8 +565,6 @@ x1为INT8,x2为INT8,x1Scale为FLOAT32,x2Scale为FLOAT32。 | |||
| 597 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); | 565 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); |
| 598 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); | 566 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); |
| 599 | CHECK_RET(ret == ACL_SUCCESS, return ret); | 567 | CHECK_RET(ret == ACL_SUCCESS, return ret); |
| 600 | - bool transposeX1 = false; | ||
| 601 | - bool transposeX2 = false; | ||
| 602 | int64_t groupSize = 0; | 568 | int64_t groupSize = 0; |
| 603 | const char fusedOpType[] = "gelu_tanh"; | 569 | const char fusedOpType[] = "gelu_tanh"; |
| 604 | 570 | ||
| @@ -625,7 +591,7 @@ x1为INT8,x2为INT8,x1Scale为FLOAT32,x2Scale为FLOAT32。 | |||
| 625 | // 调用aclnnFusedQuantMatmulWeightNz第一段接口 | 591 | // 调用aclnnFusedQuantMatmulWeightNz第一段接口 |
| 626 | workspaceSize = 0; | 592 | workspaceSize = 0; |
| 627 | ret = aclnnFusedQuantMatmulWeightNzGetWorkspaceSize( | 593 | ret = aclnnFusedQuantMatmulWeightNzGetWorkspaceSize( |
| 628 | - x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, transposeX1, transposeX2, groupSize, out, | 594 | + x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, groupSize, out, |
| 629 | &workspaceSize, &executor); | 595 | &workspaceSize, &executor); |
| 630 | 596 | ||
| 631 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulWeightNzGetWorkspaceSize failed. ERROR: %d\n", ret); | 597 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulWeightNzGetWorkspaceSize failed. ERROR: %d\n", ret); |
| @@ -142,8 +142,6 @@ int aclnnFusedQuantMatmulTest(int32_t deviceId, aclrtStream& stream) | |||
| 142 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); | 142 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); |
| 143 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); | 143 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); |
| 144 | CHECK_RET(ret == ACL_SUCCESS, return ret); | 144 | CHECK_RET(ret == ACL_SUCCESS, return ret); |
| 145 | - bool transposeX1 = false; | ||
| 146 | - bool transposeX2 = false; | ||
| 147 | int64_t groupSize = 0; | 145 | int64_t groupSize = 0; |
| 148 | const char fusedOpType[] = "gelu_tanh"; | 146 | const char fusedOpType[] = "gelu_tanh"; |
| 149 | 147 | ||
| @@ -152,7 +150,7 @@ int aclnnFusedQuantMatmulTest(int32_t deviceId, aclrtStream& stream) | |||
| 152 | aclOpExecutor* executor = nullptr; | 150 | aclOpExecutor* executor = nullptr; |
| 153 | 151 | ||
| 154 | ret = aclnnFusedQuantMatmulGetWorkspaceSize( | 152 | ret = aclnnFusedQuantMatmulGetWorkspaceSize( |
| 155 | - x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, transposeX1, transposeX2, groupSize, out, | 153 | + x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, groupSize, out, |
| 156 | &workspaceSize, &executor); | 154 | &workspaceSize, &executor); |
| 157 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulGetWorkspaceSize failed. ERROR: %d\n", ret); return ret); | 155 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulGetWorkspaceSize failed. ERROR: %d\n", ret); return ret); |
| 158 | // 根据第一段接口计算出的workspaceSize申请device内存 | 156 | // 根据第一段接口计算出的workspaceSize申请device内存 |
| @@ -177,8 +177,6 @@ int aclnnFusedQuantMatmulWeightNzTest(int32_t deviceId, aclrtStream& stream) | |||
| 177 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); | 177 | std::unique_ptr<aclTensor, aclnnStatus (*)(const aclTensor*)> outTensorPtr(out, aclDestroyTensor); |
| 178 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); | 178 | std::unique_ptr<void, aclError (*)(void*)> outDeviceAddrPtr(outDeviceAddr, aclrtFree); |
| 179 | CHECK_RET(ret == ACL_SUCCESS, return ret); | 179 | CHECK_RET(ret == ACL_SUCCESS, return ret); |
| 180 | - bool transposeX1 = false; | ||
| 181 | - bool transposeX2 = false; | ||
| 182 | int64_t groupSize = 0; | 180 | int64_t groupSize = 0; |
| 183 | const char fusedOpType[] = "gelu_tanh"; | 181 | const char fusedOpType[] = "gelu_tanh"; |
| 184 | 182 | ||
| @@ -205,7 +203,7 @@ int aclnnFusedQuantMatmulWeightNzTest(int32_t deviceId, aclrtStream& stream) | |||
| 205 | // 调用aclnnFusedQuantMatmulWeightNz第一段接口 | 203 | // 调用aclnnFusedQuantMatmulWeightNz第一段接口 |
| 206 | workspaceSize = 0; | 204 | workspaceSize = 0; |
| 207 | ret = aclnnFusedQuantMatmulWeightNzGetWorkspaceSize( | 205 | ret = aclnnFusedQuantMatmulWeightNzGetWorkspaceSize( |
| 208 | - x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, transposeX1, transposeX2, groupSize, out, | 206 | + x1, x2, x1Scale, x2Scale, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, fusedOpType, groupSize, out, |
| 209 | &workspaceSize, &executor); | 207 | &workspaceSize, &executor); |
| 210 | 208 | ||
| 211 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulWeightNzGetWorkspaceSize failed. ERROR: %d\n", ret); | 209 | CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclnnFusedQuantMatmulWeightNzGetWorkspaceSize failed. ERROR: %d\n", ret); |
| @@ -34,8 +34,6 @@ extern "C" { | |||
| 34 | * @param [in] biasOptional: 偏置,数据类型支持:int32, bfloat16, float16, float32。 | 34 | * @param [in] biasOptional: 偏置,数据类型支持:int32, bfloat16, float16, float32。 |
| 35 | * @param [in] x3Optional: 后融合矩阵,当前接口暂不支持该参数。 | 35 | * @param [in] x3Optional: 后融合矩阵,当前接口暂不支持该参数。 |
| 36 | * @param [in] fusedOpType: 融合类型,支持:"gelu_tanh", "gelu_erf"。 | 36 | * @param [in] fusedOpType: 融合类型,支持:"gelu_tanh", "gelu_erf"。 |
| 37 | - * @param [in] transposeX1: x1矩阵是否转置。 | ||
| 38 | - * @param [in] transposeX2: x2矩阵是否转置。 | ||
| 39 | * @param [in] groupSizeOptional: 量化参数,数据类型支持:int64。 | 37 | * @param [in] groupSizeOptional: 量化参数,数据类型支持:int64。 |
| 40 | * @param [out] out: 计算结果,数据类型:float16, bfloat16。 | 38 | * @param [out] out: 计算结果,数据类型:float16, bfloat16。 |
| 41 | * @param [out] workspaceSize: 返回需要在npu device侧申请的workspace大小。 | 39 | * @param [out] workspaceSize: 返回需要在npu device侧申请的workspace大小。 |
| @@ -47,8 +45,7 @@ ACLNN_API aclnnStatus aclnnFusedQuantMatmulGetWorkspaceSize(const aclTensor *x1, | |||
| 47 | const aclTensor *yScaleOptional, const aclTensor *x1OffsetOptional, | 45 | const aclTensor *yScaleOptional, const aclTensor *x1OffsetOptional, |
| 48 | const aclTensor *x2OffsetOptional, const aclTensor *yOffsetOptional, | 46 | const aclTensor *x2OffsetOptional, const aclTensor *yOffsetOptional, |
| 49 | const aclTensor *biasOptional, const aclTensor *x3Optional, | 47 | const aclTensor *biasOptional, const aclTensor *x3Optional, |
| 50 | - const char *fusedOpType, bool transposeX1, | 48 | + const char *fusedOpType, int64_t groupSizeOptional, |
| 51 | - bool transposeX2, int64_t groupSizeOptional, | ||
| 52 | aclTensor *out, uint64_t *workspaceSize, | 49 | aclTensor *out, uint64_t *workspaceSize, |
| 53 | aclOpExecutor **executor); | 50 | aclOpExecutor **executor); |
| 54 | 51 | ||
| @@ -34,8 +34,6 @@ extern "C" { | |||
| 34 | * @param [in] biasOptional: 偏置,数据类型支持:int32, bfloat16, float16, float32。 | 34 | * @param [in] biasOptional: 偏置,数据类型支持:int32, bfloat16, float16, float32。 |
| 35 | * @param [in] x3Optional: 后融合矩阵,当前接口暂不支持该参数。 | 35 | * @param [in] x3Optional: 后融合矩阵,当前接口暂不支持该参数。 |
| 36 | * @param [in] fusedOpType: 融合类型,支持:"gelu_tanh", "gelu_erf"。 | 36 | * @param [in] fusedOpType: 融合类型,支持:"gelu_tanh", "gelu_erf"。 |
| 37 | - * @param [in] transposeX1: x1矩阵是否转置。 | ||
| 38 | - * @param [in] transposeX2: x2矩阵是否转置。 | ||
| 39 | * @param [in] groupSizeOptional: 量化参数,数据类型支持:int64。 | 37 | * @param [in] groupSizeOptional: 量化参数,数据类型支持:int64。 |
| 40 | * @param [out] out: 计算结果,数据类型:float16, bfloat16。 | 38 | * @param [out] out: 计算结果,数据类型:float16, bfloat16。 |
| 41 | * @param [out] workspaceSize: 返回需要在npu device侧申请的workspace大小。 | 39 | * @param [out] workspaceSize: 返回需要在npu device侧申请的workspace大小。 |
| @@ -47,8 +45,7 @@ ACLNN_API aclnnStatus aclnnFusedQuantMatmulWeightNzGetWorkspaceSize(const aclTen | |||
| 47 | const aclTensor *yScaleOptional, const aclTensor *x1OffsetOptional, | 45 | const aclTensor *yScaleOptional, const aclTensor *x1OffsetOptional, |
| 48 | const aclTensor *x2OffsetOptional, const aclTensor *yOffsetOptional, | 46 | const aclTensor *x2OffsetOptional, const aclTensor *yOffsetOptional, |
| 49 | const aclTensor *biasOptional, const aclTensor *x3Optional, | 47 | const aclTensor *biasOptional, const aclTensor *x3Optional, |
| 50 | - const char *fusedOpType, bool transposeX1, | 48 | + const char *fusedOpType, int64_t groupSizeOptional, |
| 51 | - bool transposeX2, int64_t groupSizeOptional, | ||
| 52 | aclTensor *out, uint64_t *workspaceSize, | 49 | aclTensor *out, uint64_t *workspaceSize, |
| 53 | aclOpExecutor **executor); | 50 | aclOpExecutor **executor); |
| 54 | 51 | ||