已合并
修复FQMM算子kernel config配置错误 #5172
rueenov11创建于 5月23日
修复FQMM算子kernel config配置错误 #5172
已合并
rueenov11创建于 5月23日
共 6 个文件变更+826-119
@@ -2,7 +2,7 @@
2 "op_type": "FusedQuantMatMul",2 "op_type": "FusedQuantMatMul",
3 "op_list": [3 "op_list": [
4 {4 {
5- "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_bf16",5+ "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp32_fp32_bf16",
6 "inputs": [6 "inputs": [
7 {7 {
8 "name": "x1",8 "name": "x1",
@@ -42,7 +42,7 @@
42 "index": 3,42 "index": 3,
43 "dtype": "float32",43 "dtype": "float32",
44 "format": "ND",44 "format": "ND",
45- "paramType": "optional",45+ "paramType": "required",
46 "shape": [46 "shape": [
47 -247 -2
48 ],48 ],
@@ -53,7 +53,7 @@
53 "index": 4,53 "index": 4,
54 "dtype": "float32",54 "dtype": "float32",
55 "format": "ND",55 "format": "ND",
56- "paramType": "optional",56+ "paramType": "required",
57 "shape": [57 "shape": [
58 -258 -2
59 ],59 ],
@@ -173,7 +173,7 @@
173 ]173 ]
174 },174 },
175 {175 {
176- "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp16",176+ "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp32_bf16_bf16",
177 "inputs": [177 "inputs": [
178 {178 {
179 "name": "x1",179 "name": "x1",
@@ -213,18 +213,189 @@
213 "index": 3,213 "index": 3,
214 "dtype": "float32",214 "dtype": "float32",
215 "format": "ND",215 "format": "ND",
216+ "paramType": "required",
217+ "shape": [
218+ -2
219+ ],
220+ "format_match_mode": "FormatDefault"
221+ },
222+ {
223+ "name": "x2_scale",
224+ "index": 4,
225+ "dtype": "bfloat16",
226+ "format": "ND",
227+ "paramType": "required",
228+ "shape": [
229+ -2
230+ ],
231+ "format_match_mode": "FormatDefault"
232+ },
233+ {
234+ "name": "y_scale",
235+ "index": 5,
236+ "dtype": "uint64",
237+ "format": "ND",
216 "paramType": "optional",238 "paramType": "optional",
217 "shape": [239 "shape": [
218 -2240 -2
219 ],241 ],
220 "format_match_mode": "FormatDefault"242 "format_match_mode": "FormatDefault"
221 },243 },
244+ {
245+ "name": "x1_offset",
246+ "index": 6,
247+ "dtype": "bfloat16",
248+ "format": "ND",
249+ "paramType": "optional",
250+ "shape": [
251+ -2
252+ ],
253+ "format_match_mode": "FormatDefault"
254+ },
255+ {
256+ "name": "x2_offset",
257+ "index": 7,
258+ "dtype": "bfloat16",
259+ "format": "ND",
260+ "paramType": "optional",
261+ "shape": [
262+ -2
263+ ],
264+ "format_match_mode": "FormatDefault"
265+ },
266+ {
267+ "name": "y_offset",
268+ "index": 8,
269+ "dtype": "float32",
270+ "format": "ND",
271+ "paramType": "optional",
272+ "shape": [
273+ -2
274+ ],
275+ "format_match_mode": "FormatDefault"
276+ },
277+ {
278+ "name": "x2_table",
279+ "index": 9,
280+ "dtype": "int8",
281+ "format": "ND",
282+ "paramType": "optional",
283+ "shape": [
284+ -2
285+ ],
286+ "format_match_mode": "FormatDefault"
287+ },
288+ {
289+ "name": "x3",
290+ "index": 10,
291+ "dtype": "float32",
292+ "format": "ND",
293+ "paramType": "optional",
294+ "shape": [
295+ -2
296+ ],
297+ "format_match_mode": "FormatDefault"
298+ }
299+ ],
300+ "outputs": [
301+ {
302+ "name": "y",
303+ "index": 0,
304+ "dtype": "bfloat16",
305+ "format": "ND",
306+ "paramType": "required",
307+ "shape": [
308+ -2
309+ ],
310+ "format_match_mode": "FormatDefault"
311+ }
312+ ],
313+ "attrs": [
314+ {
315+ "name": "dtype",
316+ "dtype": "int",
317+ "value": -1
318+ },
319+ {
320+ "name": "compute_type",
321+ "dtype": "int",
322+ "value": -1
323+ },
324+ {
325+ "name": "transpose_x1",
326+ "dtype": "bool",
327+ "value": false
328+ },
329+ {
330+ "name": "transpose_x2",
331+ "dtype": "bool",
332+ "value": true
333+ },
334+ {
335+ "name": "group_size",
336+ "dtype": "int",
337+ "value": 128
338+ },
339+ {
340+ "name": "fused_op_type",
341+ "dtype": "string",
342+ "value": ""
343+ }
344+ ]
345+ },
346+ {
347+ "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp32_fp32_fp16",
348+ "inputs": [
349+ {
350+ "name": "x1",
351+ "index": 0,
352+ "dtype": "int8",
353+ "format": "ND",
354+ "paramType": "required",
355+ "shape": [
356+ -2
357+ ],
358+ "format_match_mode": "FormatDefault"
359+ },
360+ {
361+ "name": "x2",
362+ "index": 1,
363+ "dtype": "int8",
364+ "format": "ND",
365+ "paramType": "required",
366+ "shape": [
367+ -2
368+ ],
369+ "format_match_mode": "FormatDefault"
370+ },
371+ {
372+ "name": "bias",
373+ "index": 2,
374+ "dtype": "float32",
375+ "format": "ND",
376+ "paramType": "optional",
377+ "shape": [
378+ -2
379+ ],
380+ "format_match_mode": "FormatDefault"
381+ },
382+ {
383+ "name": "x1_scale",
384+ "index": 3,
385+ "dtype": "float32",
386+ "format": "ND",
387+ "paramType": "required",
388+ "shape": [
389+ -2
390+ ],
391+ "format_match_mode": "FormatDefault"
392+ },
222 {393 {
223 "name": "x2_scale",394 "name": "x2_scale",
224 "index": 4,395 "index": 4,
225 "dtype": "float32",396 "dtype": "float32",
226 "format": "ND",397 "format": "ND",
227- "paramType": "optional",398+ "paramType": "required",
228 "shape": [399 "shape": [
229 -2400 -2
230 ],401 ],
@@ -344,7 +515,7 @@
344 ]515 ]
345 },516 },
346 {517 {
347- "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_bf16",518+ "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp32_fp32_bf16",
348 "inputs": [519 "inputs": [
349 {520 {
350 "name": "x1",521 "name": "x1",
@@ -384,7 +555,7 @@
384 "index": 3,555 "index": 3,
385 "dtype": "float32",556 "dtype": "float32",
386 "format": "ND",557 "format": "ND",
387- "paramType": "optional",558+ "paramType": "required",
388 "shape": [559 "shape": [
389 -2560 -2
390 ],561 ],
@@ -395,7 +566,7 @@
395 "index": 4,566 "index": 4,
396 "dtype": "float32",567 "dtype": "float32",
397 "format": "ND",568 "format": "ND",
398- "paramType": "optional",569+ "paramType": "required",
399 "shape": [570 "shape": [
400 -2571 -2
401 ],572 ],
@@ -515,7 +686,7 @@
515 ]686 ]
516 },687 },
517 {688 {
518- "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp16",689+ "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp32_bf16_bf16",
519 "inputs": [690 "inputs": [
520 {691 {
521 "name": "x1",692 "name": "x1",
@@ -555,18 +726,189 @@
555 "index": 3,726 "index": 3,
556 "dtype": "float32",727 "dtype": "float32",
557 "format": "ND",728 "format": "ND",
729+ "paramType": "required",
730+ "shape": [
731+ -2
732+ ],
733+ "format_match_mode": "FormatDefault"
734+ },
735+ {
736+ "name": "x2_scale",
737+ "index": 4,
738+ "dtype": "bfloat16",
739+ "format": "ND",
740+ "paramType": "required",
741+ "shape": [
742+ -2
743+ ],
744+ "format_match_mode": "FormatDefault"
745+ },
746+ {
747+ "name": "y_scale",
748+ "index": 5,
749+ "dtype": "uint64",
750+ "format": "ND",
558 "paramType": "optional",751 "paramType": "optional",
559 "shape": [752 "shape": [
560 -2753 -2
561 ],754 ],
562 "format_match_mode": "FormatDefault"755 "format_match_mode": "FormatDefault"
563 },756 },
757+ {
758+ "name": "x1_offset",
759+ "index": 6,
760+ "dtype": "bfloat16",
761+ "format": "ND",
762+ "paramType": "optional",
763+ "shape": [
764+ -2
765+ ],
766+ "format_match_mode": "FormatDefault"
767+ },
768+ {
769+ "name": "x2_offset",
770+ "index": 7,
771+ "dtype": "bfloat16",
772+ "format": "ND",
773+ "paramType": "optional",
774+ "shape": [
775+ -2
776+ ],
777+ "format_match_mode": "FormatDefault"
778+ },
779+ {
780+ "name": "y_offset",
781+ "index": 8,
782+ "dtype": "float32",
783+ "format": "ND",
784+ "paramType": "optional",
785+ "shape": [
786+ -2
787+ ],
788+ "format_match_mode": "FormatDefault"
789+ },
790+ {
791+ "name": "x2_table",
792+ "index": 9,
793+ "dtype": "int8",
794+ "format": "ND",
795+ "paramType": "optional",
796+ "shape": [
797+ -2
798+ ],
799+ "format_match_mode": "FormatDefault"
800+ },
801+ {
802+ "name": "x3",
803+ "index": 10,
804+ "dtype": "float32",
805+ "format": "ND",
806+ "paramType": "optional",
807+ "shape": [
808+ -2
809+ ],
810+ "format_match_mode": "FormatDefault"
811+ }
812+ ],
813+ "outputs": [
814+ {
815+ "name": "y",
816+ "index": 0,
817+ "dtype": "bfloat16",
818+ "format": "ND",
819+ "paramType": "required",
820+ "shape": [
821+ -2
822+ ],
823+ "format_match_mode": "FormatDefault"
824+ }
825+ ],
826+ "attrs": [
827+ {
828+ "name": "dtype",
829+ "dtype": "int",
830+ "value": -1
831+ },
832+ {
833+ "name": "compute_type",
834+ "dtype": "int",
835+ "value": -1
836+ },
837+ {
838+ "name": "transpose_x1",
839+ "dtype": "bool",
840+ "value": false
841+ },
842+ {
843+ "name": "transpose_x2",
844+ "dtype": "bool",
845+ "value": false
846+ },
847+ {
848+ "name": "group_size",
849+ "dtype": "int",
850+ "value": -1
851+ },
852+ {
853+ "name": "fused_op_type",
854+ "dtype": "string",
855+ "value": ""
856+ }
857+ ]
858+ },
859+ {
860+ "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp32_fp32_fp16",
861+ "inputs": [
862+ {
863+ "name": "x1",
864+ "index": 0,
865+ "dtype": "int4",
866+ "format": "ND",
867+ "paramType": "required",
868+ "shape": [
869+ -2
870+ ],
871+ "format_match_mode": "FormatDefault"
872+ },
873+ {
874+ "name": "x2",
875+ "index": 1,
876+ "dtype": "int4",
877+ "format": "ND",
878+ "paramType": "required",
879+ "shape": [
880+ -2
881+ ],
882+ "format_match_mode": "FormatDefault"
883+ },
884+ {
885+ "name": "bias",
886+ "index": 2,
887+ "dtype": "bfloat16",
888+ "format": "ND",
889+ "paramType": "optional",
890+ "shape": [
891+ -2
892+ ],
893+ "format_match_mode": "FormatDefault"
894+ },
895+ {
896+ "name": "x1_scale",
897+ "index": 3,
898+ "dtype": "float32",
899+ "format": "ND",
900+ "paramType": "required",
901+ "shape": [
902+ -2
903+ ],
904+ "format_match_mode": "FormatDefault"
905+ },
564 {906 {
565 "name": "x2_scale",907 "name": "x2_scale",
566 "index": 4,908 "index": 4,
567 "dtype": "float32",909 "dtype": "float32",
568 "format": "ND",910 "format": "ND",
569- "paramType": "optional",911+ "paramType": "required",
570 "shape": [912 "shape": [
571 -2913 -2
572 ],914 ],
@@ -686,5 +1028,4 @@
686 ]1028 ]
687 }1029 }
688 ]1030 ]
689-}1031+}
690- 
@@ -2,7 +2,7 @@
2 "op_type": "FusedQuantMatMul",2 "op_type": "FusedQuantMatMul",
3 "op_list": [3 "op_list": [
4 {4 {
5- "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_bf16",5+ "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp32_fp32_bf16",
6 "inputs": [6 "inputs": [
7 {7 {
8 "name": "x1",8 "name": "x1",
@@ -42,7 +42,7 @@
42 "index": 3,42 "index": 3,
43 "dtype": "float32",43 "dtype": "float32",
44 "format": "ND",44 "format": "ND",
45- "paramType": "optional",45+ "paramType": "required",
46 "shape": [46 "shape": [
47 -247 -2
48 ],48 ],
@@ -53,7 +53,7 @@
53 "index": 4,53 "index": 4,
54 "dtype": "float32",54 "dtype": "float32",
55 "format": "ND",55 "format": "ND",
56- "paramType": "optional",56+ "paramType": "required",
57 "shape": [57 "shape": [
58 -258 -2
59 ],59 ],
@@ -173,7 +173,7 @@
173 ]173 ]
174 },174 },
175 {175 {
176- "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp16",176+ "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp32_bf16_bf16",
177 "inputs": [177 "inputs": [
178 {178 {
179 "name": "x1",179 "name": "x1",
@@ -213,18 +213,189 @@
213 "index": 3,213 "index": 3,
214 "dtype": "float32",214 "dtype": "float32",
215 "format": "ND",215 "format": "ND",
216+ "paramType": "required",
217+ "shape": [
218+ -2
219+ ],
220+ "format_match_mode": "FormatDefault"
221+ },
222+ {
223+ "name": "x2_scale",
224+ "index": 4,
225+ "dtype": "bfloat16",
226+ "format": "ND",
227+ "paramType": "required",
228+ "shape": [
229+ -2
230+ ],
231+ "format_match_mode": "FormatDefault"
232+ },
233+ {
234+ "name": "y_scale",
235+ "index": 5,
236+ "dtype": "uint64",
237+ "format": "ND",
216 "paramType": "optional",238 "paramType": "optional",
217 "shape": [239 "shape": [
218 -2240 -2
219 ],241 ],
220 "format_match_mode": "FormatDefault"242 "format_match_mode": "FormatDefault"
221 },243 },
244+ {
245+ "name": "x1_offset",
246+ "index": 6,
247+ "dtype": "bfloat16",
248+ "format": "ND",
249+ "paramType": "optional",
250+ "shape": [
251+ -2
252+ ],
253+ "format_match_mode": "FormatDefault"
254+ },
255+ {
256+ "name": "x2_offset",
257+ "index": 7,
258+ "dtype": "bfloat16",
259+ "format": "ND",
260+ "paramType": "optional",
261+ "shape": [
262+ -2
263+ ],
264+ "format_match_mode": "FormatDefault"
265+ },
266+ {
267+ "name": "y_offset",
268+ "index": 8,
269+ "dtype": "float32",
270+ "format": "ND",
271+ "paramType": "optional",
272+ "shape": [
273+ -2
274+ ],
275+ "format_match_mode": "FormatDefault"
276+ },
277+ {
278+ "name": "x2_table",
279+ "index": 9,
280+ "dtype": "int8",
281+ "format": "ND",
282+ "paramType": "optional",
283+ "shape": [
284+ -2
285+ ],
286+ "format_match_mode": "FormatDefault"
287+ },
288+ {
289+ "name": "x3",
290+ "index": 10,
291+ "dtype": "float32",
292+ "format": "ND",
293+ "paramType": "optional",
294+ "shape": [
295+ -2
296+ ],
297+ "format_match_mode": "FormatDefault"
298+ }
299+ ],
300+ "outputs": [
301+ {
302+ "name": "y",
303+ "index": 0,
304+ "dtype": "bfloat16",
305+ "format": "ND",
306+ "paramType": "required",
307+ "shape": [
308+ -2
309+ ],
310+ "format_match_mode": "FormatDefault"
311+ }
312+ ],
313+ "attrs": [
314+ {
315+ "name": "dtype",
316+ "dtype": "int",
317+ "value": -1
318+ },
319+ {
320+ "name": "compute_type",
321+ "dtype": "int",
322+ "value": -1
323+ },
324+ {
325+ "name": "transpose_x1",
326+ "dtype": "bool",
327+ "value": false
328+ },
329+ {
330+ "name": "transpose_x2",
331+ "dtype": "bool",
332+ "value": true
333+ },
334+ {
335+ "name": "group_size",
336+ "dtype": "int",
337+ "value": 128
338+ },
339+ {
340+ "name": "fused_op_type",
341+ "dtype": "string",
342+ "value": ""
343+ }
344+ ]
345+ },
346+ {
347+ "bin_filename": "FusedQuantMatMul_ND_ND_int8_int8_fp32_fp32_fp16",
348+ "inputs": [
349+ {
350+ "name": "x1",
351+ "index": 0,
352+ "dtype": "int8",
353+ "format": "ND",
354+ "paramType": "required",
355+ "shape": [
356+ -2
357+ ],
358+ "format_match_mode": "FormatDefault"
359+ },
360+ {
361+ "name": "x2",
362+ "index": 1,
363+ "dtype": "int8",
364+ "format": "ND",
365+ "paramType": "required",
366+ "shape": [
367+ -2
368+ ],
369+ "format_match_mode": "FormatDefault"
370+ },
371+ {
372+ "name": "bias",
373+ "index": 2,
374+ "dtype": "float32",
375+ "format": "ND",
376+ "paramType": "optional",
377+ "shape": [
378+ -2
379+ ],
380+ "format_match_mode": "FormatDefault"
381+ },
382+ {
383+ "name": "x1_scale",
384+ "index": 3,
385+ "dtype": "float32",
386+ "format": "ND",
387+ "paramType": "required",
388+ "shape": [
389+ -2
390+ ],
391+ "format_match_mode": "FormatDefault"
392+ },
222 {393 {
223 "name": "x2_scale",394 "name": "x2_scale",
224 "index": 4,395 "index": 4,
225 "dtype": "float32",396 "dtype": "float32",
226 "format": "ND",397 "format": "ND",
227- "paramType": "optional",398+ "paramType": "required",
228 "shape": [399 "shape": [
229 -2400 -2
230 ],401 ],
@@ -344,7 +515,7 @@
344 ]515 ]
345 },516 },
346 {517 {
347- "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_bf16",518+ "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp32_fp32_bf16",
348 "inputs": [519 "inputs": [
349 {520 {
350 "name": "x1",521 "name": "x1",
@@ -384,7 +555,7 @@
384 "index": 3,555 "index": 3,
385 "dtype": "float32",556 "dtype": "float32",
386 "format": "ND",557 "format": "ND",
387- "paramType": "optional",558+ "paramType": "required",
388 "shape": [559 "shape": [
389 -2560 -2
390 ],561 ],
@@ -395,7 +566,7 @@
395 "index": 4,566 "index": 4,
396 "dtype": "float32",567 "dtype": "float32",
397 "format": "ND",568 "format": "ND",
398- "paramType": "optional",569+ "paramType": "required",
399 "shape": [570 "shape": [
400 -2571 -2
401 ],572 ],
@@ -515,7 +686,7 @@
515 ]686 ]
516 },687 },
517 {688 {
518- "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp16",689+ "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp32_bf16_bf16",
519 "inputs": [690 "inputs": [
520 {691 {
521 "name": "x1",692 "name": "x1",
@@ -555,18 +726,189 @@
555 "index": 3,726 "index": 3,
556 "dtype": "float32",727 "dtype": "float32",
557 "format": "ND",728 "format": "ND",
729+ "paramType": "required",
730+ "shape": [
731+ -2
732+ ],
733+ "format_match_mode": "FormatDefault"
734+ },
735+ {
736+ "name": "x2_scale",
737+ "index": 4,
738+ "dtype": "bfloat16",
739+ "format": "ND",
740+ "paramType": "required",
741+ "shape": [
742+ -2
743+ ],
744+ "format_match_mode": "FormatDefault"
745+ },
746+ {
747+ "name": "y_scale",
748+ "index": 5,
749+ "dtype": "uint64",
750+ "format": "ND",
558 "paramType": "optional",751 "paramType": "optional",
559 "shape": [752 "shape": [
560 -2753 -2
561 ],754 ],
562 "format_match_mode": "FormatDefault"755 "format_match_mode": "FormatDefault"
563 },756 },
757+ {
758+ "name": "x1_offset",
759+ "index": 6,
760+ "dtype": "bfloat16",
761+ "format": "ND",
762+ "paramType": "optional",
763+ "shape": [
764+ -2
765+ ],
766+ "format_match_mode": "FormatDefault"
767+ },
768+ {
769+ "name": "x2_offset",
770+ "index": 7,
771+ "dtype": "bfloat16",
772+ "format": "ND",
773+ "paramType": "optional",
774+ "shape": [
775+ -2
776+ ],
777+ "format_match_mode": "FormatDefault"
778+ },
779+ {
780+ "name": "y_offset",
781+ "index": 8,
782+ "dtype": "float32",
783+ "format": "ND",
784+ "paramType": "optional",
785+ "shape": [
786+ -2
787+ ],
788+ "format_match_mode": "FormatDefault"
789+ },
790+ {
791+ "name": "x2_table",
792+ "index": 9,
793+ "dtype": "int8",
794+ "format": "ND",
795+ "paramType": "optional",
796+ "shape": [
797+ -2
798+ ],
799+ "format_match_mode": "FormatDefault"
800+ },
801+ {
802+ "name": "x3",
803+ "index": 10,
804+ "dtype": "float32",
805+ "format": "ND",
806+ "paramType": "optional",
807+ "shape": [
808+ -2
809+ ],
810+ "format_match_mode": "FormatDefault"
811+ }
812+ ],
813+ "outputs": [
814+ {
815+ "name": "y",
816+ "index": 0,
817+ "dtype": "bfloat16",
818+ "format": "ND",
819+ "paramType": "required",
820+ "shape": [
821+ -2
822+ ],
823+ "format_match_mode": "FormatDefault"
824+ }
825+ ],
826+ "attrs": [
827+ {
828+ "name": "dtype",
829+ "dtype": "int",
830+ "value": -1
831+ },
832+ {
833+ "name": "compute_type",
834+ "dtype": "int",
835+ "value": -1
836+ },
837+ {
838+ "name": "transpose_x1",
839+ "dtype": "bool",
840+ "value": false
841+ },
842+ {
843+ "name": "transpose_x2",
844+ "dtype": "bool",
845+ "value": false
846+ },
847+ {
848+ "name": "group_size",
849+ "dtype": "int",
850+ "value": -1
851+ },
852+ {
853+ "name": "fused_op_type",
854+ "dtype": "string",
855+ "value": ""
856+ }
857+ ]
858+ },
859+ {
860+ "bin_filename": "FusedQuantMatMul_ND_ND_int4_int4_fp32_fp32_fp16",
861+ "inputs": [
862+ {
863+ "name": "x1",
864+ "index": 0,
865+ "dtype": "int4",
866+ "format": "ND",
867+ "paramType": "required",
868+ "shape": [
869+ -2
870+ ],
871+ "format_match_mode": "FormatDefault"
872+ },
873+ {
874+ "name": "x2",
875+ "index": 1,
876+ "dtype": "int4",
877+ "format": "ND",
878+ "paramType": "required",
879+ "shape": [
880+ -2
881+ ],
882+ "format_match_mode": "FormatDefault"
883+ },
884+ {
885+ "name": "bias",
886+ "index": 2,
887+ "dtype": "bfloat16",
888+ "format": "ND",
889+ "paramType": "optional",
890+ "shape": [
891+ -2
892+ ],
893+ "format_match_mode": "FormatDefault"
894+ },
895+ {
896+ "name": "x1_scale",
897+ "index": 3,
898+ "dtype": "float32",
899+ "format": "ND",
900+ "paramType": "required",
901+ "shape": [
902+ -2
903+ ],
904+ "format_match_mode": "FormatDefault"
905+ },
564 {906 {
565 "name": "x2_scale",907 "name": "x2_scale",
566 "index": 4,908 "index": 4,
567 "dtype": "float32",909 "dtype": "float32",
568 "format": "ND",910 "format": "ND",
569- "paramType": "optional",911+ "paramType": "required",
570 "shape": [912 "shape": [
571 -2913 -2
572 ],914 ],
@@ -686,5 +1028,4 @@
686 ]1028 ]
687 }1029 }
688 ]1030 ]
689-}1031+}
690- 
此文件变更行数或变更字符数较多,你可以直接 查看源码
@@ -11,12 +11,12 @@
11 # ----------------------------------------------------------------------------11 # ----------------------------------------------------------------------------
12 12 
13import torch13import torch
14-import torch_npu
15import ctypes14import ctypes
16import logging15import logging
17import numpy as np16import numpy as np
18import random17import random
19from torch.nn.functional import gelu as torch_gelu18from torch.nn.functional import gelu as torch_gelu
19+import copy
20 20 
21from atk.common.log import Logger21from atk.common.log import Logger
22from atk.configs.dataset_config import InputDataset22from atk.configs.dataset_config import InputDataset
@@ -26,7 +26,7 @@ from atk.tasks.api_execute.base_api import BaseApi
26from atk.tasks.dataset.base_dataset import OpsDataset26from atk.tasks.dataset.base_dataset import OpsDataset
27from atk.tasks.api_execute.aclnn_base_api import AclnnBaseApi27from atk.tasks.api_execute.aclnn_base_api import AclnnBaseApi
28from atk.tasks.backends.lib_interface.acl_wrapper import TensorPtr28from atk.tasks.backends.lib_interface.acl_wrapper import TensorPtr
29-from atk.tasks.backends.lib_interface.acl_wrapper import AclFormat, Int64, AclTensorList, AclIntArray, AclTensor29+from atk.tasks.backends.lib_interface.acl_wrapper import AclFormat, Int64, AclTensorList, AclIntArray, AclTensor, nnopbase
30 30 
31logging = Logger().get_logger()31logging = Logger().get_logger()
32 32 
@@ -54,22 +54,20 @@ class AclnnFusedQuantMatmul(BaseApi):
54 value_max = 127 if self.x1.dtype == torch.int8 else 754 value_max = 127 if self.x1.dtype == torch.int8 else 7
55 55 
56 if self.device == "cpu":56 if self.device == "cpu":
57- if self.bias is None:57+ if self.bias == None:
58 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 0: bias - 无")58 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 0: bias - 无")
59- # out = x1 @ x2 ∗ x2scale * x1scale59+ out = torch.matmul(self.x1.to(torch.int32), self.x2.to(torch.int32)).to(torch.float32) * self.x2scale.to(torch.float32)
60- out = torch.matmul(self.x1, self.x2).to(torch.float32) * self.x2scale.to(torch.float32)
61 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)60 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)
62 61 
63 elif self.bias.dtype == torch.int32:62 elif self.bias.dtype == torch.int32:
64 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 1: bias - INT32")63 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 1: bias - INT32")
65- # out = (x1 @ x2 + bias) ∗ x2scale * x1scale64+ out = (torch.matmul(self.x1.to(torch.int32), self.x2.to(torch.int32)) + self.bias).to(torch.float32) * self.x2scale.to(torch.float32)
66- out = (torch.matmul(self.x1, self.x2) + self.bias).to(torch.float32) * self.x2scale.to(torch.float32)
67 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)65 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)
66+ logging.info(f"用例 id: {self.task_result.case_config.id} | after matmul x1scale")
68 67 
69 elif self.bias.dtype in [torch.bfloat16, torch.float16, torch.float32]:68 elif self.bias.dtype in [torch.bfloat16, torch.float16, torch.float32]:
70 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 2: bias - BFLOAT16/FLOAT16/FLOAT32")69 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 2: bias - BFLOAT16/FLOAT16/FLOAT32")
71- # out = x1 @ x2 ∗ x2scale * x1scale + bias70+ out = torch.matmul(self.x1.to(torch.int32), self.x2.to(torch.int32))
72- out = torch.matmul(self.x1, self.x2)
73 out = out.to(torch.float32) * self.x2scale.to(torch.float32)71 out = out.to(torch.float32) * self.x2scale.to(torch.float32)
74 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)72 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)
75 out = out.to(torch.float32) + self.bias.to(torch.float32)73 out = out.to(torch.float32) + self.bias.to(torch.float32)
@@ -77,15 +75,17 @@ class AclnnFusedQuantMatmul(BaseApi):
77 else:75 else:
78 logging.error("输入 dtype 组合无效.")76 logging.error("输入 dtype 组合无效.")
79 raise ValueError77 raise ValueError
80- 78+
79+ logging.info(f"用例 id: {self.task_result.case_config.id} | before gelu")
81 # gelu计算80 # gelu计算
82 if self.fusedoptype == "gelu_erf":81 if self.fusedoptype == "gelu_erf":
83 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_erf")82 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_erf")
84- out = torch_gelu(out, approximate='none') # erf83+ out = torch_gelu(out, approximate='none') #erf
85 elif self.fusedoptype == "gelu_tanh":84 elif self.fusedoptype == "gelu_tanh":
86 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_tanh")85 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_tanh")
87- out = torch_gelu(out, approximate='tanh') # tanh86+ out = torch_gelu(out, approximate='tanh') #tanh
88- 87+ logging.info(f"用例 id: {self.task_result.case_config.id} | after gelutanh")
88+
89 return out.to(self.out_dtype)89 return out.to(self.out_dtype)
90 90 
91 if self.device == "npu":91 if self.device == "npu":
@@ -119,34 +119,36 @@ class AclnnFusedQuantMatmul(BaseApi):
119 119
120 self.out_dtype = input_data.kwargs['out'].dtype120 self.out_dtype = input_data.kwargs['out'].dtype
121 121 
122- 
123@register("execute_aclnn_fused_quantmatmul")122@register("execute_aclnn_fused_quantmatmul")
124class PyAclnnFusedQuantMatmul(AclnnBaseApi):123class PyAclnnFusedQuantMatmul(AclnnBaseApi):
125 def init_by_input_data(self, input_data: InputDataset): 124 def init_by_input_data(self, input_data: InputDataset):
126 input_args = [] # 算子的入参列表125 input_args = [] # 算子的入参列表
127 output_packages = [] # 算子的出参数据包列表126 output_packages = [] # 算子的出参数据包列表
128- 127+ import torch_npu
129- transpose_x1 = input_data.kwargs.pop("transposeX1")128+ # 处理int32pack
130- transpose_x2 = input_data.kwargs.pop("transposeX2")
131- input_data.kwargs.pop("isNz")
132- input_data.kwargs.pop("out")
133- 
134- if transpose_x1:
135- input_data.kwargs['x1'] = input_data.kwargs['x1'].transpose(-2, -1)
136- 
137 x1 = input_data.kwargs['x1']129 x1 = input_data.kwargs['x1']
138 if x1.dtype == torch.int32:130 if x1.dtype == torch.int32:
139- x1_npu = torch_npu.npu_convert_weight_to_int4pack(x1.contiguous().npu())131+ x1_npu = torch_npu.npu_convert_weight_to_int4pack(x1.npu())
140 input_data.kwargs['x1'] = x1_npu132 input_data.kwargs['x1'] = x1_npu
141 133 
142 x2 = input_data.kwargs['x2']134 x2 = input_data.kwargs['x2']
143 if x2.dtype == torch.int32:135 if x2.dtype == torch.int32:
144- x2_npu = torch_npu.npu_convert_weight_to_int4pack(x2.contiguous().npu())136+ x2_npu = torch_npu.npu_convert_weight_to_int4pack(x2.npu())
145- if transpose_x2:
146- x2_npu = x2_npu.transpose(-2, -1)
147 input_data.kwargs['x2'] = x2_npu137 input_data.kwargs['x2'] = x2_npu
148- elif transpose_x2:138+ 
149- input_data.kwargs['x2'] = x2.transpose(-2, -1)139+ # 记录原始 storage shape, 兼容非连续 Tensor
140+ self.ori_input_data = copy.deepcopy(input_data)
141+ 
142+ # 当用例要求为非连续 Tensor 时, 转置为非连续
143+ if input_data.kwargs['transposeX1'] == 1:
144+ input_data.kwargs['x1'] = input_data.kwargs['x1'].transpose(-1, -2)
145+ if input_data.kwargs['transposeX2'] == 1:
146+ input_data.kwargs['x2'] = input_data.kwargs['x2'].transpose(-1, -2)
147+ 
148+ input_data.kwargs.pop("isNz")
149+ input_data.kwargs.pop("out")
150+ input_data.kwargs.pop("transposeX1")
151+ input_data.kwargs.pop("transposeX2")
150 152 
151 for i, arg in enumerate(input_data.args):153 for i, arg in enumerate(input_data.args):
152 data = self.backend.convert_input_data(arg, index=i)154 data = self.backend.convert_input_data(arg, index=i)
@@ -168,8 +170,32 @@ class PyAclnnFusedQuantMatmul(AclnnBaseApi):
168 if len(input_data.kwargs['bias'].shape) == 0:170 if len(input_data.kwargs['bias'].shape) == 0:
169 input_args[8] = TensorPtr()171 input_args[8] = TensorPtr()
170 172
171- input_args[9] = TensorPtr()173+ input_args[9] = TensorPtr() #x3
172 input_args[11] = ctypes.c_long(0) # groupSize174 input_args[11] = ctypes.c_long(0) # groupSize
173 175
174 input_args.extend(output_packages)176 input_args.extend(output_packages)
175 return input_args, output_packages177 return input_args, output_packages
178+
179+ def get_storage_shape(self, input_data: InputDataset, index=None, name=None):
180+ if name is not None:
181+ # 处理非连续 Tensor 数据 storage shape
182+ return self.ori_input_data.kwargs[name].shape
183+ else:
184+ return None
185+ 
186+ def get_cpp_func_signature_type(self):
187+ return ("aclnnStatus aclnnFusedQuantMatmulGetWorkspaceSize(const aclTensor *x1, \
188+ const aclTensor *x2, \
189+ const aclTensor *x1Scale, \
190+ const aclTensor *x2Scale, \
191+ const aclTensor *yScale, \
192+ const aclTensor *x1Offset, \
193+ const aclTensor *x2Offset, \
194+ const aclTensor *yOffset, \
195+ const aclTensor *bias, \
196+ const aclTensor *x3, \
197+ const char *fusedOpType, \
198+ int64_t groupSize, \
199+ const aclTensor *out, \
200+ uint64_t *workspaceSize, \
201+ aclOpExecutor **executor)")
@@ -11,12 +11,12 @@
11 # ----------------------------------------------------------------------------11 # ----------------------------------------------------------------------------
12 12 
13import torch13import torch
14-import torch_npu
15import ctypes14import ctypes
16import logging15import logging
17import numpy as np16import numpy as np
18import random17import random
19from torch.nn.functional import gelu as torch_gelu18from torch.nn.functional import gelu as torch_gelu
19+import copy
20 20 
21from atk.common.log import Logger21from atk.common.log import Logger
22from atk.configs.dataset_config import InputDataset22from atk.configs.dataset_config import InputDataset
@@ -30,31 +30,10 @@ from atk.tasks.backends.lib_interface.acl_wrapper import AclFormat, Int64, AclTe
30 30 
31logging = Logger().get_logger()31logging = Logger().get_logger()
32 32 
33- 33+@register("execute_fused_quantmatmul")
34-def _is_transpose_last_two_dims(tensor):34+class AclnnFusedQuantMatmul(BaseApi):
35- if tensor.dim() < 2 or tensor.dim() > 6:
36- return False
37- 
38- dim1 = tensor.dim() - 1
39- dim2 = tensor.dim() - 2
40- shape = tensor.shape
41- strides = tensor.stride()
42- if strides[dim2] != 1 or strides[dim1] != shape[dim2]:
43- return False
44- 
45- tmp_nx_d = shape[dim1] * shape[dim2]
46- for batch_dim in range(tensor.dim() - 3, -1, -1):
47- if strides[batch_dim] != tmp_nx_d:
48- return False
49- tmp_nx_d *= shape[batch_dim]
50- 
51- return not (shape[dim1] == 1 and shape[dim2] == 1)
52- 
53- 
54-@register("execute_fused_quantmatmul_weightnz")
55-class AclnnFusedQuantMatmulWeightNz(BaseApi):
56 def __init__(self, task_result: TaskResult):35 def __init__(self, task_result: TaskResult):
57- super(AclnnFusedQuantMatmulWeightNz, self).__init__(task_result)36+ super(AclnnFusedQuantMatmul, self).__init__(task_result)
58 self.x1 = None37 self.x1 = None
59 self.x2 = None38 self.x2 = None
60 self.x1scale = None39 self.x1scale = None
@@ -74,22 +53,19 @@ class AclnnFusedQuantMatmulWeightNz(BaseApi):
74 value_max = 127 if self.x1.dtype == torch.int8 else 753 value_max = 127 if self.x1.dtype == torch.int8 else 7
75 54 
76 if self.device == "cpu":55 if self.device == "cpu":
77- if self.bias is None:56+ if self.bias == None:
78 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 0: bias - 无")57 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 0: bias - 无")
79- # out = x1 @ x2 ∗ x2scale * x1scale58+ out = torch.matmul(self.x1.to(torch.int32), self.x2.to(torch.int32)).to(torch.float32) * self.x2scale.to(torch.float32)
80- out = torch.matmul(self.x1, self.x2).to(torch.float32) * self.x2scale.to(torch.float32)
81 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)59 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)
82 60 
83 elif self.bias.dtype == torch.int32:61 elif self.bias.dtype == torch.int32:
84 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 1: bias - INT32")62 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 1: bias - INT32")
85- # out = (x1 @ x2 + bias) ∗ x2scale * x1scale63+ out = (torch.matmul(self.x1.to(torch.int32), self.x2.to(torch.int32)) + self.bias).to(torch.float32) * self.x2scale.to(torch.float32)
86- out = (torch.matmul(self.x1, self.x2) + self.bias).to(torch.float32) * self.x2scale.to(torch.float32)
87 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)64 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)
88 65 
89 elif self.bias.dtype in [torch.bfloat16, torch.float16, torch.float32]:66 elif self.bias.dtype in [torch.bfloat16, torch.float16, torch.float32]:
90 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 2: bias - BFLOAT16/FLOAT16/FLOAT32")67 logging.info(f"用例 id: {self.task_result.case_config.id} | 场景 2: bias - BFLOAT16/FLOAT16/FLOAT32")
91- # out = x1 @ x2 ∗ x2scale * x1scale + bias68+ out = torch.matmul(self.x1.to(torch.int32), self.x2.to(torch.int32))
92- out = torch.matmul(self.x1, self.x2)
93 out = out.to(torch.float32) * self.x2scale.to(torch.float32)69 out = out.to(torch.float32) * self.x2scale.to(torch.float32)
94 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)70 out = out.to(torch.float32) * self.x1scale.unsqueeze(-1).to(torch.float32)
95 out = out.to(torch.float32) + self.bias.to(torch.float32)71 out = out.to(torch.float32) + self.bias.to(torch.float32)
@@ -101,10 +77,10 @@ class AclnnFusedQuantMatmulWeightNz(BaseApi):
101 # gelu计算77 # gelu计算
102 if self.fusedoptype == "gelu_erf":78 if self.fusedoptype == "gelu_erf":
103 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_erf")79 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_erf")
104- out = torch_gelu(out.to(torch.float32), approximate='none') # erf80+ out = torch_gelu(out.to(torch.float32), approximate='none') #erf
105 elif self.fusedoptype == "gelu_tanh":81 elif self.fusedoptype == "gelu_tanh":
106 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_tanh")82 logging.info(f"用例 id: {self.task_result.case_config.id} | 后处理 gelu_tanh")
107- out = torch_gelu(out.to(torch.float32), approximate='tanh') # tanh83+ out = torch_gelu(out.to(torch.float32), approximate='tanh') #tanh
108 84 
109 return out.to(self.out_dtype)85 return out.to(self.out_dtype)
110 86 
@@ -140,34 +116,36 @@ class AclnnFusedQuantMatmulWeightNz(BaseApi):
140 116
141 self.out_dtype = input_data.kwargs['out'].dtype117 self.out_dtype = input_data.kwargs['out'].dtype
142 118 
143- 119+@register("execute_aclnn_fused_quantmatmul")
144-@register("execute_aclnn_fused_quantmatmul_weightnz")120+class PyAclnnFusedQuantMatmul(AclnnBaseApi):
145-class PyAclnnFusedQuantMatmulWeightNz(AclnnBaseApi):
146 def init_by_input_data(self, input_data: InputDataset): 121 def init_by_input_data(self, input_data: InputDataset):
147 input_args = [] # 算子的入参列表122 input_args = [] # 算子的入参列表
148 output_packages = [] # 算子的出参数据包列表123 output_packages = [] # 算子的出参数据包列表
149- 124+ import torch_npu
150- transpose_x1 = input_data.kwargs.pop("transposeX1")
151- transpose_x2 = input_data.kwargs.pop("transposeX2")
152- self.is_nz = input_data.kwargs.pop("isNz")
153- input_data.kwargs.pop("out")
154- 
155- if transpose_x1:
156- input_data.kwargs['x1'] = input_data.kwargs['x1'].transpose(-2, -1)
157- 
158 x1 = input_data.kwargs['x1']125 x1 = input_data.kwargs['x1']
159 if x1.dtype == torch.int32:126 if x1.dtype == torch.int32:
160- x1_npu = torch_npu.npu_convert_weight_to_int4pack(x1.contiguous().npu())127+ x1_npu = torch_npu.npu_convert_weight_to_int4pack(x1.npu())
161 input_data.kwargs['x1'] = x1_npu128 input_data.kwargs['x1'] = x1_npu
162 129 
163 x2 = input_data.kwargs['x2']130 x2 = input_data.kwargs['x2']
164 if x2.dtype == torch.int32:131 if x2.dtype == torch.int32:
165- x2_npu = torch_npu.npu_convert_weight_to_int4pack(x2.contiguous().npu())132+ x2_npu = torch_npu.npu_convert_weight_to_int4pack(x2.npu())
166- if transpose_x2:
167- x2_npu = x2_npu.transpose(-2, -1)
168 input_data.kwargs['x2'] = x2_npu133 input_data.kwargs['x2'] = x2_npu
169- elif transpose_x2:134+
170- input_data.kwargs['x2'] = x2.transpose(-2, -1)135+ # 记录原始 storage shape, 兼容非连续 Tensor
136+ self.ori_input_data = copy.deepcopy(input_data)
137+
138+ # 当用例要求为非连续 Tensor 时, 转置为非连续
139+ if input_data.kwargs['transposeX1'] == 1:
140+ input_data.kwargs['x1'] = input_data.kwargs['x1'].transpose(-1, -2)
141+ if input_data.kwargs['transposeX2'] == 1:
142+ input_data.kwargs['x2'] = input_data.kwargs['x2'].transpose(-1, -2)
143+ 
144+ self.is_nz = input_data.kwargs['isNz']
145+ input_data.kwargs.pop("isNz")
146+ input_data.kwargs.pop("out")
147+ input_data.kwargs.pop("transposeX1")
148+ input_data.kwargs.pop("transposeX2")
171 149 
172 for i, arg in enumerate(input_data.args):150 for i, arg in enumerate(input_data.args):
173 data = self.backend.convert_input_data(arg, index=i)151 data = self.backend.convert_input_data(arg, index=i)
@@ -197,19 +175,23 @@ class PyAclnnFusedQuantMatmulWeightNz(AclnnBaseApi):
197 175
198 def get_storage_shape(self, input_data: InputDataset, index=None, name=None):176 def get_storage_shape(self, input_data: InputDataset, index=None, name=None):
199 if name == "x2":177 if name == "x2":
200- b = input_data.kwargs['x1'].shape[:-2]178+ mat2NdShape = self.ori_input_data.kwargs[name].shape
201- x2 = input_data.kwargs['x2']
202- k, n = x2.shape[-2:]
203- transpose_x2 = _is_transpose_last_two_dims(x2)
204- nz_k0_value_trans = 64 if x2.dtype == torch.int32 else 32
205 179 
206- mat2_nd_shape = torch.Size([*b, (k + nz_k0_value_trans - 1) // nz_k0_value_trans,180+ b = self.ori_input_data.kwargs['x1'].shape[:-2]
207- (n + 16 - 1) // 16, 16, nz_k0_value_trans]) if transpose_x2 else \181+ if self.ori_input_data.kwargs['transposeX2']:
208- torch.Size([*b, (n + nz_k0_value_trans - 1) // nz_k0_value_trans,182+ n, k = self.ori_input_data.kwargs['x2'].shape[-2:]
209- (k + 16 - 1) // 16, 16, nz_k0_value_trans])183+ else:
210- return mat2_nd_shape184+ k, n = self.ori_input_data.kwargs['x2'].shape[-2:]
185+ # 此处无需对齐,已经在 init_by_input_data 中修改过 input_data.kwargs['x2'] 的维度
186+ if self.ori_input_data.kwargs['x1'].dtype == torch.int8:
187+ mat2NzShape = torch.Size([*b, (k + 32 - 1)//32, (n + 16 - 1)//16, 16, 32]) if self.ori_input_data.kwargs['transposeX2'] else \
188+ torch.Size([*b, (n + 32 - 1)//32, (k + 16 - 1)//16, 16, 32])
189+ elif self.ori_input_data.kwargs['x1'].dtype == torch.int32:
190+ mat2NzShape = torch.Size([*b, (k + 64 - 1)//64, (n + 16 - 1)//16, 16, 64]) if self.ori_input_data.kwargs['transposeX2'] else \
191+ torch.Size([*b, (n + 64 - 1)//64, (k + 16 - 1)//16, 16, 64])
192+ return mat2NzShape
211 elif name is not None:193 elif name is not None:
212- return input_data.kwargs[name].shape194+ return self.ori_input_data.kwargs[name].shape
213 195 
214 def get_storage_format(self, input_data: InputDataset, index=None, name=None):196 def get_storage_format(self, input_data: InputDataset, index=None, name=None):
215 """197 """
@@ -223,3 +205,20 @@ class PyAclnnFusedQuantMatmulWeightNz(AclnnBaseApi):
223 return AclFormat.ACL_FORMAT_FRACTAL_NZ205 return AclFormat.ACL_FORMAT_FRACTAL_NZ
224 else:206 else:
225 return AclFormat.ACL_FORMAT_ND207 return AclFormat.ACL_FORMAT_ND
208+
209+ def get_cpp_func_signature_type(self):
210+ return ("aclnnStatus aclnnFusedQuantMatmulWeightNzGetWorkspaceSize(const aclTensor *x1, \
211+ const aclTensor *x2, \
212+ const aclTensor *x1Scale, \
213+ const aclTensor *x2Scale, \
214+ const aclTensor *yScale, \
215+ const aclTensor *x1Offset, \
216+ const aclTensor *x2Offset, \
217+ const aclTensor *yOffset, \
218+ const aclTensor *bias, \
219+ const aclTensor *x3, \
220+ const char *fusedOpType, \
221+ int64_t groupSize, \
222+ const aclTensor *out, \
223+ uint64_t *workspaceSize, \
224+ aclOpExecutor **executor)")