已合并
修复gemmV3在16in32out场景下精度问题 #5602
HKFLYE创建于 6月2日
修复gemmV3在16in32out场景下精度问题 #5602
已合并
共 9 个文件变更+10-646
| @@ -722,166 +722,6 @@ | |||
| 722 | } | 722 | } |
| 723 | ] | 723 | ] |
| 724 | }, | 724 | }, |
| 725 | - { | ||
| 726 | - "bin_filename": "BatchMatMulV3_ND_ND_ND_ND_FP16_FP16_FP32_FP32", | ||
| 727 | - "simplified_key": "diy,2/2/2/2/1/1/0/0", | ||
| 728 | - "inputs": [ | ||
| 729 | - { | ||
| 730 | - "name": "x1", | ||
| 731 | - "index": 0, | ||
| 732 | - "dtype": "float16", | ||
| 733 | - "format": "ND", | ||
| 734 | - "paramType": "required", | ||
| 735 | - "shape": [ | ||
| 736 | - -2 | ||
| 737 | - ] | ||
| 738 | - }, | ||
| 739 | - { | ||
| 740 | - "name": "x2", | ||
| 741 | - "index": 1, | ||
| 742 | - "dtype": "float16", | ||
| 743 | - "format": "ND", | ||
| 744 | - "paramType": "required", | ||
| 745 | - "shape": [ | ||
| 746 | - -2 | ||
| 747 | - ] | ||
| 748 | - }, | ||
| 749 | - { | ||
| 750 | - "name": "bias", | ||
| 751 | - "index": 2, | ||
| 752 | - "dtype": "float32", | ||
| 753 | - "format": "ND", | ||
| 754 | - "paramType": "optional", | ||
| 755 | - "shape": [ | ||
| 756 | - -2 | ||
| 757 | - ] | ||
| 758 | - }, | ||
| 759 | - { | ||
| 760 | - "name": "offset_w", | ||
| 761 | - "index": 3, | ||
| 762 | - "dtype": "int8", | ||
| 763 | - "format": "ND", | ||
| 764 | - "paramType": "optional", | ||
| 765 | - "shape": [ | ||
| 766 | - -2 | ||
| 767 | - ] | ||
| 768 | - } | ||
| 769 | - ], | ||
| 770 | - "outputs": [ | ||
| 771 | - { | ||
| 772 | - "name": "y", | ||
| 773 | - "index": 0, | ||
| 774 | - "dtype": "float32", | ||
| 775 | - "format": "ND", | ||
| 776 | - "paramType": "required", | ||
| 777 | - "shape": [ | ||
| 778 | - -2 | ||
| 779 | - ] | ||
| 780 | - } | ||
| 781 | - ], | ||
| 782 | - "attrs": [ | ||
| 783 | - { | ||
| 784 | - "name": "adj_x1", | ||
| 785 | - "dtype": "bool", | ||
| 786 | - "value": false | ||
| 787 | - }, | ||
| 788 | - { | ||
| 789 | - "name": "adj_x2", | ||
| 790 | - "dtype": "bool", | ||
| 791 | - "value": false | ||
| 792 | - }, | ||
| 793 | - { | ||
| 794 | - "name": "offset_x", | ||
| 795 | - "dtype": "int", | ||
| 796 | - "value": 0 | ||
| 797 | - }, | ||
| 798 | - { | ||
| 799 | - "name": "enable_hf32", | ||
| 800 | - "dtype": "bool", | ||
| 801 | - "value": false | ||
| 802 | - } | ||
| 803 | - ] | ||
| 804 | - }, | ||
| 805 | - { | ||
| 806 | - "bin_filename": "BatchMatMulV3_ND_ND_ND_ND_BF16_BF16_FP32_FP32", | ||
| 807 | - "simplified_key": "diy,2/2/2/2/27/27/0/0", | ||
| 808 | - "inputs": [ | ||
| 809 | - { | ||
| 810 | - "name": "x1", | ||
| 811 | - "index": 0, | ||
| 812 | - "dtype": "bfloat16", | ||
| 813 | - "format": "ND", | ||
| 814 | - "paramType": "required", | ||
| 815 | - "shape": [ | ||
| 816 | - -2 | ||
| 817 | - ] | ||
| 818 | - }, | ||
| 819 | - { | ||
| 820 | - "name": "x2", | ||
| 821 | - "index": 1, | ||
| 822 | - "dtype": "bfloat16", | ||
| 823 | - "format": "ND", | ||
| 824 | - "paramType": "required", | ||
| 825 | - "shape": [ | ||
| 826 | - -2 | ||
| 827 | - ] | ||
| 828 | - }, | ||
| 829 | - { | ||
| 830 | - "name": "bias", | ||
| 831 | - "index": 2, | ||
| 832 | - "dtype": "float32", | ||
| 833 | - "format": "ND", | ||
| 834 | - "paramType": "optional", | ||
| 835 | - "shape": [ | ||
| 836 | - -2 | ||
| 837 | - ] | ||
| 838 | - }, | ||
| 839 | - { | ||
| 840 | - "name": "offset_w", | ||
| 841 | - "index": 3, | ||
| 842 | - "dtype": "int8", | ||
| 843 | - "format": "ND", | ||
| 844 | - "paramType": "optional", | ||
| 845 | - "shape": [ | ||
| 846 | - -2 | ||
| 847 | - ] | ||
| 848 | - } | ||
| 849 | - ], | ||
| 850 | - "outputs": [ | ||
| 851 | - { | ||
| 852 | - "name": "y", | ||
| 853 | - "index": 0, | ||
| 854 | - "dtype": "float32", | ||
| 855 | - "format": "ND", | ||
| 856 | - "paramType": "required", | ||
| 857 | - "shape": [ | ||
| 858 | - -2 | ||
| 859 | - ] | ||
| 860 | - } | ||
| 861 | - ], | ||
| 862 | - "attrs": [ | ||
| 863 | - { | ||
| 864 | - "name": "adj_x1", | ||
| 865 | - "dtype": "bool", | ||
| 866 | - "value": false | ||
| 867 | - }, | ||
| 868 | - { | ||
| 869 | - "name": "adj_x2", | ||
| 870 | - "dtype": "bool", | ||
| 871 | - "value": false | ||
| 872 | - }, | ||
| 873 | - { | ||
| 874 | - "name": "offset_x", | ||
| 875 | - "dtype": "int", | ||
| 876 | - "value": 0 | ||
| 877 | - }, | ||
| 878 | - { | ||
| 879 | - "name": "enable_hf32", | ||
| 880 | - "dtype": "bool", | ||
| 881 | - "value": false | ||
| 882 | - } | ||
| 883 | - ] | ||
| 884 | - }, | ||
| 885 | { | 725 | { |
| 886 | "bin_filename": "BatchMatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", | 726 | "bin_filename": "BatchMatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", |
| 887 | "simplified_key": "diy,2/29/2/2/1/1/1/0", | 727 | "simplified_key": "diy,2/29/2/2/1/1/1/0", |
| @@ -722,166 +722,6 @@ | |||
| 722 | } | 722 | } |
| 723 | ] | 723 | ] |
| 724 | }, | 724 | }, |
| 725 | - { | ||
| 726 | - "bin_filename": "BatchMatMulV3_ND_ND_ND_ND_FP16_FP16_FP32_FP32", | ||
| 727 | - "simplified_key": "diy,2/2/2/2/1/1/0/0", | ||
| 728 | - "inputs": [ | ||
| 729 | - { | ||
| 730 | - "name": "x1", | ||
| 731 | - "index": 0, | ||
| 732 | - "dtype": "float16", | ||
| 733 | - "format": "ND", | ||
| 734 | - "paramType": "required", | ||
| 735 | - "shape": [ | ||
| 736 | - -2 | ||
| 737 | - ] | ||
| 738 | - }, | ||
| 739 | - { | ||
| 740 | - "name": "x2", | ||
| 741 | - "index": 1, | ||
| 742 | - "dtype": "float16", | ||
| 743 | - "format": "ND", | ||
| 744 | - "paramType": "required", | ||
| 745 | - "shape": [ | ||
| 746 | - -2 | ||
| 747 | - ] | ||
| 748 | - }, | ||
| 749 | - { | ||
| 750 | - "name": "bias", | ||
| 751 | - "index": 2, | ||
| 752 | - "dtype": "float32", | ||
| 753 | - "format": "ND", | ||
| 754 | - "paramType": "optional", | ||
| 755 | - "shape": [ | ||
| 756 | - -2 | ||
| 757 | - ] | ||
| 758 | - }, | ||
| 759 | - { | ||
| 760 | - "name": "offset_w", | ||
| 761 | - "index": 3, | ||
| 762 | - "dtype": "int8", | ||
| 763 | - "format": "ND", | ||
| 764 | - "paramType": "optional", | ||
| 765 | - "shape": [ | ||
| 766 | - -2 | ||
| 767 | - ] | ||
| 768 | - } | ||
| 769 | - ], | ||
| 770 | - "outputs": [ | ||
| 771 | - { | ||
| 772 | - "name": "y", | ||
| 773 | - "index": 0, | ||
| 774 | - "dtype": "float32", | ||
| 775 | - "format": "ND", | ||
| 776 | - "paramType": "required", | ||
| 777 | - "shape": [ | ||
| 778 | - -2 | ||
| 779 | - ] | ||
| 780 | - } | ||
| 781 | - ], | ||
| 782 | - "attrs": [ | ||
| 783 | - { | ||
| 784 | - "name": "adj_x1", | ||
| 785 | - "dtype": "bool", | ||
| 786 | - "value": false | ||
| 787 | - }, | ||
| 788 | - { | ||
| 789 | - "name": "adj_x2", | ||
| 790 | - "dtype": "bool", | ||
| 791 | - "value": false | ||
| 792 | - }, | ||
| 793 | - { | ||
| 794 | - "name": "offset_x", | ||
| 795 | - "dtype": "int", | ||
| 796 | - "value": 0 | ||
| 797 | - }, | ||
| 798 | - { | ||
| 799 | - "name": "enable_hf32", | ||
| 800 | - "dtype": "bool", | ||
| 801 | - "value": false | ||
| 802 | - } | ||
| 803 | - ] | ||
| 804 | - }, | ||
| 805 | - { | ||
| 806 | - "bin_filename": "BatchMatMulV3_ND_ND_ND_ND_BF16_BF16_FP32_FP32", | ||
| 807 | - "simplified_key": "diy,2/2/2/2/27/27/0/0", | ||
| 808 | - "inputs": [ | ||
| 809 | - { | ||
| 810 | - "name": "x1", | ||
| 811 | - "index": 0, | ||
| 812 | - "dtype": "bfloat16", | ||
| 813 | - "format": "ND", | ||
| 814 | - "paramType": "required", | ||
| 815 | - "shape": [ | ||
| 816 | - -2 | ||
| 817 | - ] | ||
| 818 | - }, | ||
| 819 | - { | ||
| 820 | - "name": "x2", | ||
| 821 | - "index": 1, | ||
| 822 | - "dtype": "bfloat16", | ||
| 823 | - "format": "ND", | ||
| 824 | - "paramType": "required", | ||
| 825 | - "shape": [ | ||
| 826 | - -2 | ||
| 827 | - ] | ||
| 828 | - }, | ||
| 829 | - { | ||
| 830 | - "name": "bias", | ||
| 831 | - "index": 2, | ||
| 832 | - "dtype": "float32", | ||
| 833 | - "format": "ND", | ||
| 834 | - "paramType": "optional", | ||
| 835 | - "shape": [ | ||
| 836 | - -2 | ||
| 837 | - ] | ||
| 838 | - }, | ||
| 839 | - { | ||
| 840 | - "name": "offset_w", | ||
| 841 | - "index": 3, | ||
| 842 | - "dtype": "int8", | ||
| 843 | - "format": "ND", | ||
| 844 | - "paramType": "optional", | ||
| 845 | - "shape": [ | ||
| 846 | - -2 | ||
| 847 | - ] | ||
| 848 | - } | ||
| 849 | - ], | ||
| 850 | - "outputs": [ | ||
| 851 | - { | ||
| 852 | - "name": "y", | ||
| 853 | - "index": 0, | ||
| 854 | - "dtype": "float32", | ||
| 855 | - "format": "ND", | ||
| 856 | - "paramType": "required", | ||
| 857 | - "shape": [ | ||
| 858 | - -2 | ||
| 859 | - ] | ||
| 860 | - } | ||
| 861 | - ], | ||
| 862 | - "attrs": [ | ||
| 863 | - { | ||
| 864 | - "name": "adj_x1", | ||
| 865 | - "dtype": "bool", | ||
| 866 | - "value": false | ||
| 867 | - }, | ||
| 868 | - { | ||
| 869 | - "name": "adj_x2", | ||
| 870 | - "dtype": "bool", | ||
| 871 | - "value": false | ||
| 872 | - }, | ||
| 873 | - { | ||
| 874 | - "name": "offset_x", | ||
| 875 | - "dtype": "int", | ||
| 876 | - "value": 0 | ||
| 877 | - }, | ||
| 878 | - { | ||
| 879 | - "name": "enable_hf32", | ||
| 880 | - "dtype": "bool", | ||
| 881 | - "value": false | ||
| 882 | - } | ||
| 883 | - ] | ||
| 884 | - }, | ||
| 885 | { | 725 | { |
| 886 | "bin_filename": "BatchMatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", | 726 | "bin_filename": "BatchMatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", |
| 887 | "simplified_key": "diy,2/29/2/2/1/1/1/0", | 727 | "simplified_key": "diy,2/29/2/2/1/1/1/0", |
| @@ -275,7 +275,8 @@ public: | |||
| 275 | bool needBroadcast = CheckAddmmTensorShapeNeedBroadcast(matA, matB, bias); | 275 | bool needBroadcast = CheckAddmmTensorShapeNeedBroadcast(matA, matB, bias); |
| 276 | // A2/A3上对于 16in32out,且不需要broadcast场景 直接走gemmV3 | 276 | // A2/A3上对于 16in32out,且不需要broadcast场景 直接走gemmV3 |
| 277 | if (CheckGemmV3WithAlphaBeta(bias, matA, matB, cubeMathType) || (enable16In32Out && !needBroadcast)) { | 277 | if (CheckGemmV3WithAlphaBeta(bias, matA, matB, cubeMathType) || (enable16In32Out && !needBroadcast)) { |
| 278 | - const aclTensor* bmmOut = ExecGemmV3WithAlphaBetaOp(bias, matA, matB, alpha, beta, executor); | 278 | + const aclTensor* bmmOut = ExecGemmV3WithAlphaBetaOp(bias, matA, matB, |
| 279 | + alpha, beta, executor, enable16In32Out); | ||
| 279 | CHECK_RET(bmmOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 280 | CHECK_RET(bmmOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 280 | convOut = bmmOut; | 281 | convOut = bmmOut; |
| 281 | return ACLNN_SUCCESS; | 282 | return ACLNN_SUCCESS; |
| @@ -405,7 +405,7 @@ const aclTensor* GetBatchMatmulOp( | |||
| 405 | enable16In32Out, executor); | 405 | enable16In32Out, executor); |
| 406 | } | 406 | } |
| 407 | OP_LOGI("Hit batch_mat_mul_v3 scenario."); | 407 | OP_LOGI("Hit batch_mat_mul_v3 scenario."); |
| 408 | - if (enable16In32Out) { | 408 | + if (enable16In32Out || enable2201Baddbmm16In32Out) { |
| 409 | OP_LOGI("Hit batch_mat_mul_v3 fp16/bf16 in - fp32 out scenario."); | 409 | OP_LOGI("Hit batch_mat_mul_v3 fp16/bf16 in - fp32 out scenario."); |
| 410 | bmmOpOut = l0op::BatchMatMulV3NdFp16Bf162Fp32( | 410 | bmmOpOut = l0op::BatchMatMulV3NdFp16Bf162Fp32( |
| 411 | selfTransdata, mat2Transdata, bias, nullptr, adjX1, adjX2, offsetX, matmulOpInfo.enableHf32, executor); | 411 | selfTransdata, mat2Transdata, bias, nullptr, adjX1, adjX2, offsetX, matmulOpInfo.enableHf32, executor); |
| @@ -479,6 +479,11 @@ static const aclTensor* GetMatMulOp( | |||
| 479 | bool supportNdNz = mmOpInfo.support_info.self_format == ge::FORMAT_ND && | 479 | bool supportNdNz = mmOpInfo.support_info.self_format == ge::FORMAT_ND && |
| 480 | mmOpInfo.support_info.mat2_format == ge::FORMAT_FRACTAL_NZ; | 480 | mmOpInfo.support_info.mat2_format == ge::FORMAT_FRACTAL_NZ; |
| 481 | bool addmm16In32Out = enable16In32Out && (bias != nullptr || supportNdNz); | 481 | bool addmm16In32Out = enable16In32Out && (bias != nullptr || supportNdNz); |
| 482 | + bool isFp32Out = mmOpInfo.support_info.output_dtype == DataType::DT_FLOAT; | ||
| 483 | + bool bothMatFp16Bf16 = (mmOpInfo.support_info.self_dtype == DataType::DT_FLOAT16 && | ||
| 484 | + mmOpInfo.support_info.mat2_dtype == DataType::DT_FLOAT16) || | ||
| 485 | + (mmOpInfo.support_info.self_dtype == DataType::DT_BF16 && | ||
| 486 | + mmOpInfo.support_info.mat2_dtype == DataType::DT_BF16); | ||
| 482 | if (CheckMatmulV3Support(x1, x2, bias, mmOpInfo, transposeX1, transposeX2, opImplModeEnum) || | 487 | if (CheckMatmulV3Support(x1, x2, bias, mmOpInfo, transposeX1, transposeX2, opImplModeEnum) || |
| 483 | (CheckMMV3NzNzNdSupport(mmOpInfo) && CheckSupportInfoFormatNzNzNd(mmOpInfo)) || addmm16In32Out) { | 488 | (CheckMMV3NzNzNdSupport(mmOpInfo) && CheckSupportInfoFormatNzNzNd(mmOpInfo)) || addmm16In32Out) { |
| 484 | OP_LOGI("Hit matmul_v3 scenario."); | 489 | OP_LOGI("Hit matmul_v3 scenario."); |
| @@ -520,7 +525,7 @@ static const aclTensor* GetMatMulOp( | |||
| 520 | const aclTensor* mmOut = | 525 | const aclTensor* mmOut = |
| 521 | l0op::MatMulV3Nd(x1, x2, bias, transposeX1, transposeX2, offsetX, opImplModeEnum, executor); | 526 | l0op::MatMulV3Nd(x1, x2, bias, transposeX1, transposeX2, offsetX, opImplModeEnum, executor); |
| 522 | return mmOut; | 527 | return mmOut; |
| 523 | - } else if (enable16In32Out && bias == nullptr) { | 528 | + } else if ((enable16In32Out || (isFp32Out && bothMatFp16Bf16)) && bias == nullptr) { |
唐 | |||
| 524 | // This is Split K Mode; Check if MatMul using Nd in Nd Out | 529 | // This is Split K Mode; Check if MatMul using Nd in Nd Out |
| 525 | OP_LOGI("hit matmulv2 fp16/bp16 in fp32 out case."); | 530 | OP_LOGI("hit matmulv2 fp16/bp16 in fp32 out case."); |
| 526 | const aclTensor* mmOut = | 531 | const aclTensor* mmOut = |
| @@ -636,7 +636,6 @@ GemmV3BaseKernel<swizzleDirect, transA, transB, InDtype, BiasDtype, OutDtype, Ac | |||
| 636 | WaitFlag<HardEvent::MTE2_V>(EVENT_ID0); | 636 | WaitFlag<HardEvent::MTE2_V>(EVENT_ID0); |
| 637 | for (uint32_t i = 0; i < count; ++i) { | 637 | for (uint32_t i = 0; i < count; ++i) { |
| 638 | if constexpr (!std::is_same_v<BiasDtype, AccumDtype>) { | 638 | if constexpr (!std::is_same_v<BiasDtype, AccumDtype>) { |
| 639 | - AscendC::printf("need cast ubc dtype.\n"); | ||
| 640 | AscendC::Cast<AccumDtype, BiasDtype, false>(ubSum_[i * VEC_ITER_NUMEL], // dst | 639 | AscendC::Cast<AccumDtype, BiasDtype, false>(ubSum_[i * VEC_ITER_NUMEL], // dst |
| 641 | ubC_[i * VEC_ITER_NUMEL], // src | 640 | ubC_[i * VEC_ITER_NUMEL], // src |
| 642 | AscendC::RoundMode::CAST_NONE, // mode | 641 | AscendC::RoundMode::CAST_NONE, // mode |
| @@ -679,7 +678,6 @@ GemmV3BaseKernel<swizzleDirect, transA, transB, InDtype, BiasDtype, OutDtype, Ac | |||
| 679 | AscendC::UnaryRepeatParams(1, 1, 8, 8)); | 678 | AscendC::UnaryRepeatParams(1, 1, 8, 8)); |
| 680 | AscendC::PipeBarrier<PIPE_V>(); | 679 | AscendC::PipeBarrier<PIPE_V>(); |
| 681 | if constexpr (!std::is_same_v<OutDtype, AccumDtype>) { | 680 | if constexpr (!std::is_same_v<OutDtype, AccumDtype>) { |
| 682 | - AscendC::printf("need cast uby dtype.\n"); | ||
| 683 | AscendC::Cast<OutDtype, AccumDtype, false>(ubY_[i * VEC_ITER_NUMEL], // dst | 681 | AscendC::Cast<OutDtype, AccumDtype, false>(ubY_[i * VEC_ITER_NUMEL], // dst |
| 684 | ubSum_[i * VEC_ITER_NUMEL], // src | 682 | ubSum_[i * VEC_ITER_NUMEL], // src |
| 685 | AscendC::RoundMode::CAST_RINT, // mode | 683 | AscendC::RoundMode::CAST_RINT, // mode |
| @@ -1762,166 +1762,6 @@ | |||
| 1762 | } | 1762 | } |
| 1763 | ] | 1763 | ] |
| 1764 | }, | 1764 | }, |
| 1765 | - { | ||
| 1766 | - "bin_filename": "MatMulV3_ND_NZ_ND_ND_FP16_FP16_FP32_FP32", | ||
| 1767 | - "simplified_key": "diy,2/29/2/2/1/1/0/0", | ||
| 1768 | - "inputs": [ | ||
| 1769 | - { | ||
| 1770 | - "name": "x1", | ||
| 1771 | - "index": 0, | ||
| 1772 | - "dtype": "float16", | ||
| 1773 | - "format": "ND", | ||
| 1774 | - "paramType": "required", | ||
| 1775 | - "shape": [ | ||
| 1776 | - -2 | ||
| 1777 | - ] | ||
| 1778 | - }, | ||
| 1779 | - { | ||
| 1780 | - "name": "x2", | ||
| 1781 | - "index": 1, | ||
| 1782 | - "dtype": "float16", | ||
| 1783 | - "format": "FRACTAL_NZ", | ||
| 1784 | - "paramType": "required", | ||
| 1785 | - "shape": [ | ||
| 1786 | - -2 | ||
| 1787 | - ] | ||
| 1788 | - }, | ||
| 1789 | - { | ||
| 1790 | - "name": "bias", | ||
| 1791 | - "index": 2, | ||
| 1792 | - "dtype": "float32", | ||
| 1793 | - "format": "ND", | ||
| 1794 | - "paramType": "optional", | ||
| 1795 | - "shape": [ | ||
| 1796 | - -2 | ||
| 1797 | - ] | ||
| 1798 | - }, | ||
| 1799 | - { | ||
| 1800 | - "name": "offset_w", | ||
| 1801 | - "index": 3, | ||
| 1802 | - "dtype": "int8", | ||
| 1803 | - "format": "ND", | ||
| 1804 | - "paramType": "optional", | ||
| 1805 | - "shape": [ | ||
| 1806 | - -2 | ||
| 1807 | - ] | ||
| 1808 | - } | ||
| 1809 | - ], | ||
| 1810 | - "outputs": [ | ||
| 1811 | - { | ||
| 1812 | - "name": "y", | ||
| 1813 | - "index": 0, | ||
| 1814 | - "dtype": "float32", | ||
| 1815 | - "format": "ND", | ||
| 1816 | - "paramType": "required", | ||
| 1817 | - "shape": [ | ||
| 1818 | - -2 | ||
| 1819 | - ] | ||
| 1820 | - } | ||
| 1821 | - ], | ||
| 1822 | - "attrs": [ | ||
| 1823 | - { | ||
| 1824 | - "name": "transpose_x1", | ||
| 1825 | - "dtype": "bool", | ||
| 1826 | - "value": false | ||
| 1827 | - }, | ||
| 1828 | - { | ||
| 1829 | - "name": "transpose_x2", | ||
| 1830 | - "dtype": "bool", | ||
| 1831 | - "value": false | ||
| 1832 | - }, | ||
| 1833 | - { | ||
| 1834 | - "name": "offset_x", | ||
| 1835 | - "dtype": "int", | ||
| 1836 | - "value": 0 | ||
| 1837 | - }, | ||
| 1838 | - { | ||
| 1839 | - "name": "opImplMode", | ||
| 1840 | - "dtype": "int", | ||
| 1841 | - "value": 1 | ||
| 1842 | - } | ||
| 1843 | - ] | ||
| 1844 | - }, | ||
| 1845 | - { | ||
| 1846 | - "bin_filename": "MatMulV3_ND_NZ_ND_ND_BF16_BF16_FP32_FP32", | ||
| 1847 | - "simplified_key": "diy,2/29/2/2/27/27/0/0", | ||
| 1848 | - "inputs": [ | ||
| 1849 | - { | ||
| 1850 | - "name": "x1", | ||
| 1851 | - "index": 0, | ||
| 1852 | - "dtype": "bfloat16", | ||
| 1853 | - "format": "ND", | ||
| 1854 | - "paramType": "required", | ||
| 1855 | - "shape": [ | ||
| 1856 | - -2 | ||
| 1857 | - ] | ||
| 1858 | - }, | ||
| 1859 | - { | ||
| 1860 | - "name": "x2", | ||
| 1861 | - "index": 1, | ||
| 1862 | - "dtype": "bfloat16", | ||
| 1863 | - "format": "FRACTAL_NZ", | ||
| 1864 | - "paramType": "required", | ||
| 1865 | - "shape": [ | ||
| 1866 | - -2 | ||
| 1867 | - ] | ||
| 1868 | - }, | ||
| 1869 | - { | ||
| 1870 | - "name": "bias", | ||
| 1871 | - "index": 2, | ||
| 1872 | - "dtype": "float32", | ||
| 1873 | - "format": "ND", | ||
| 1874 | - "paramType": "optional", | ||
| 1875 | - "shape": [ | ||
| 1876 | - -2 | ||
| 1877 | - ] | ||
| 1878 | - }, | ||
| 1879 | - { | ||
| 1880 | - "name": "offset_w", | ||
| 1881 | - "index": 3, | ||
| 1882 | - "dtype": "int8", | ||
| 1883 | - "format": "ND", | ||
| 1884 | - "paramType": "optional", | ||
| 1885 | - "shape": [ | ||
| 1886 | - -2 | ||
| 1887 | - ] | ||
| 1888 | - } | ||
| 1889 | - ], | ||
| 1890 | - "outputs": [ | ||
| 1891 | - { | ||
| 1892 | - "name": "y", | ||
| 1893 | - "index": 0, | ||
| 1894 | - "dtype": "float32", | ||
| 1895 | - "format": "ND", | ||
| 1896 | - "paramType": "required", | ||
| 1897 | - "shape": [ | ||
| 1898 | - -2 | ||
| 1899 | - ] | ||
| 1900 | - } | ||
| 1901 | - ], | ||
| 1902 | - "attrs": [ | ||
| 1903 | - { | ||
| 1904 | - "name": "transpose_x1", | ||
| 1905 | - "dtype": "bool", | ||
| 1906 | - "value": false | ||
| 1907 | - }, | ||
| 1908 | - { | ||
| 1909 | - "name": "transpose_x2", | ||
| 1910 | - "dtype": "bool", | ||
| 1911 | - "value": false | ||
| 1912 | - }, | ||
| 1913 | - { | ||
| 1914 | - "name": "offset_x", | ||
| 1915 | - "dtype": "int", | ||
| 1916 | - "value": 0 | ||
| 1917 | - }, | ||
| 1918 | - { | ||
| 1919 | - "name": "opImplMode", | ||
| 1920 | - "dtype": "int", | ||
| 1921 | - "value": 1 | ||
| 1922 | - } | ||
| 1923 | - ] | ||
| 1924 | - }, | ||
| 1925 | { | 1765 | { |
| 1926 | "bin_filename": "MatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", | 1766 | "bin_filename": "MatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", |
| 1927 | "simplified_key": "diy,2/29/2/2/1/1/1/0", | 1767 | "simplified_key": "diy,2/29/2/2/1/1/1/0", |
| @@ -1762,166 +1762,6 @@ | |||
| 1762 | } | 1762 | } |
| 1763 | ] | 1763 | ] |
| 1764 | }, | 1764 | }, |
| 1765 | - { | ||
| 1766 | - "bin_filename": "MatMulV3_ND_NZ_ND_ND_FP16_FP16_FP32_FP32", | ||
| 1767 | - "simplified_key": "diy,2/29/2/2/1/1/0/0", | ||
| 1768 | - "inputs": [ | ||
| 1769 | - { | ||
| 1770 | - "name": "x1", | ||
| 1771 | - "index": 0, | ||
| 1772 | - "dtype": "float16", | ||
| 1773 | - "format": "ND", | ||
| 1774 | - "paramType": "required", | ||
| 1775 | - "shape": [ | ||
| 1776 | - -2 | ||
| 1777 | - ] | ||
| 1778 | - }, | ||
| 1779 | - { | ||
| 1780 | - "name": "x2", | ||
| 1781 | - "index": 1, | ||
| 1782 | - "dtype": "float16", | ||
| 1783 | - "format": "FRACTAL_NZ", | ||
| 1784 | - "paramType": "required", | ||
| 1785 | - "shape": [ | ||
| 1786 | - -2 | ||
| 1787 | - ] | ||
| 1788 | - }, | ||
| 1789 | - { | ||
| 1790 | - "name": "bias", | ||
| 1791 | - "index": 2, | ||
| 1792 | - "dtype": "float32", | ||
| 1793 | - "format": "ND", | ||
| 1794 | - "paramType": "optional", | ||
| 1795 | - "shape": [ | ||
| 1796 | - -2 | ||
| 1797 | - ] | ||
| 1798 | - }, | ||
| 1799 | - { | ||
| 1800 | - "name": "offset_w", | ||
| 1801 | - "index": 3, | ||
| 1802 | - "dtype": "int8", | ||
| 1803 | - "format": "ND", | ||
| 1804 | - "paramType": "optional", | ||
| 1805 | - "shape": [ | ||
| 1806 | - -2 | ||
| 1807 | - ] | ||
| 1808 | - } | ||
| 1809 | - ], | ||
| 1810 | - "outputs": [ | ||
| 1811 | - { | ||
| 1812 | - "name": "y", | ||
| 1813 | - "index": 0, | ||
| 1814 | - "dtype": "float32", | ||
| 1815 | - "format": "ND", | ||
| 1816 | - "paramType": "required", | ||
| 1817 | - "shape": [ | ||
| 1818 | - -2 | ||
| 1819 | - ] | ||
| 1820 | - } | ||
| 1821 | - ], | ||
| 1822 | - "attrs": [ | ||
| 1823 | - { | ||
| 1824 | - "name": "transpose_x1", | ||
| 1825 | - "dtype": "bool", | ||
| 1826 | - "value": false | ||
| 1827 | - }, | ||
| 1828 | - { | ||
| 1829 | - "name": "transpose_x2", | ||
| 1830 | - "dtype": "bool", | ||
| 1831 | - "value": false | ||
| 1832 | - }, | ||
| 1833 | - { | ||
| 1834 | - "name": "offset_x", | ||
| 1835 | - "dtype": "int", | ||
| 1836 | - "value": 0 | ||
| 1837 | - }, | ||
| 1838 | - { | ||
| 1839 | - "name": "opImplMode", | ||
| 1840 | - "dtype": "int", | ||
| 1841 | - "value": 1 | ||
| 1842 | - } | ||
| 1843 | - ] | ||
| 1844 | - }, | ||
| 1845 | - { | ||
| 1846 | - "bin_filename": "MatMulV3_ND_NZ_ND_ND_BF16_BF16_FP32_FP32", | ||
| 1847 | - "simplified_key": "diy,2/29/2/2/27/27/0/0", | ||
| 1848 | - "inputs": [ | ||
| 1849 | - { | ||
| 1850 | - "name": "x1", | ||
| 1851 | - "index": 0, | ||
| 1852 | - "dtype": "bfloat16", | ||
| 1853 | - "format": "ND", | ||
| 1854 | - "paramType": "required", | ||
| 1855 | - "shape": [ | ||
| 1856 | - -2 | ||
| 1857 | - ] | ||
| 1858 | - }, | ||
| 1859 | - { | ||
| 1860 | - "name": "x2", | ||
| 1861 | - "index": 1, | ||
| 1862 | - "dtype": "bfloat16", | ||
| 1863 | - "format": "FRACTAL_NZ", | ||
| 1864 | - "paramType": "required", | ||
| 1865 | - "shape": [ | ||
| 1866 | - -2 | ||
| 1867 | - ] | ||
| 1868 | - }, | ||
| 1869 | - { | ||
| 1870 | - "name": "bias", | ||
| 1871 | - "index": 2, | ||
| 1872 | - "dtype": "float32", | ||
| 1873 | - "format": "ND", | ||
| 1874 | - "paramType": "optional", | ||
| 1875 | - "shape": [ | ||
| 1876 | - -2 | ||
| 1877 | - ] | ||
| 1878 | - }, | ||
| 1879 | - { | ||
| 1880 | - "name": "offset_w", | ||
| 1881 | - "index": 3, | ||
| 1882 | - "dtype": "int8", | ||
| 1883 | - "format": "ND", | ||
| 1884 | - "paramType": "optional", | ||
| 1885 | - "shape": [ | ||
| 1886 | - -2 | ||
| 1887 | - ] | ||
| 1888 | - } | ||
| 1889 | - ], | ||
| 1890 | - "outputs": [ | ||
| 1891 | - { | ||
| 1892 | - "name": "y", | ||
| 1893 | - "index": 0, | ||
| 1894 | - "dtype": "float32", | ||
| 1895 | - "format": "ND", | ||
| 1896 | - "paramType": "required", | ||
| 1897 | - "shape": [ | ||
| 1898 | - -2 | ||
| 1899 | - ] | ||
| 1900 | - } | ||
| 1901 | - ], | ||
| 1902 | - "attrs": [ | ||
| 1903 | - { | ||
| 1904 | - "name": "transpose_x1", | ||
| 1905 | - "dtype": "bool", | ||
| 1906 | - "value": false | ||
| 1907 | - }, | ||
| 1908 | - { | ||
| 1909 | - "name": "transpose_x2", | ||
| 1910 | - "dtype": "bool", | ||
| 1911 | - "value": false | ||
| 1912 | - }, | ||
| 1913 | - { | ||
| 1914 | - "name": "offset_x", | ||
| 1915 | - "dtype": "int", | ||
| 1916 | - "value": 0 | ||
| 1917 | - }, | ||
| 1918 | - { | ||
| 1919 | - "name": "opImplMode", | ||
| 1920 | - "dtype": "int", | ||
| 1921 | - "value": 1 | ||
| 1922 | - } | ||
| 1923 | - ] | ||
| 1924 | - }, | ||
| 1925 | { | 1765 | { |
| 1926 | "bin_filename": "MatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", | 1766 | "bin_filename": "MatMulV3_ND_NZ_ND_ND_FP16_FP16_FP16_FP32", |
| 1927 | "simplified_key": "diy,2/29/2/2/1/1/1/0", | 1767 | "simplified_key": "diy,2/29/2/2/1/1/1/0", |
| @@ -508,7 +508,7 @@ public: | |||
| 508 | // A2/A3上对于 16in32out,且不需要broadcast场景 直接走gemmV3 | 508 | // A2/A3上对于 16in32out,且不需要broadcast场景 直接走gemmV3 |
| 509 | if ((CheckGemmV3WithAlphaBeta(bias, matA, matB, cubeMathType) || | 509 | if ((CheckGemmV3WithAlphaBeta(bias, matA, matB, cubeMathType) || |
| 510 | (enable16In32Out && !needBroadcast)) && isSupportNpuArch) { | 510 | (enable16In32Out && !needBroadcast)) && isSupportNpuArch) { |
| 511 | - auto outGemmV3 = ExecGemmV3WithAlphaBetaOp(bias, matA, matB, alpha, beta, executor); | 511 | + auto outGemmV3 = ExecGemmV3WithAlphaBetaOp(bias, matA, matB, alpha, beta, executor, enable16In32Out); |
| 512 | CHECK_RET(outGemmV3 != nullptr, ACLNN_ERR_INNER_NULLPTR); | 512 | CHECK_RET(outGemmV3 != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 513 | convOut = outGemmV3; | 513 | convOut = outGemmV3; |
| 514 | return ACLNN_SUCCESS; | 514 | return ACLNN_SUCCESS; |
这个应该是1980的分支,基本都不维护的,你确定应该在这里写吗