Commit bc89f05
committed
Add transpose variants to XNNPACK shared-qparam op list
aten.transpose.int and its siblings (transpose_copy.int, t.default,
t_copy.default, swapaxes.default) were missing from _is_share_obs_or_fq_op
in xnnpack_quantizer_utils.py, even though the value-preserving sibling
permute/permute_copy was already present.
Without this fix, propagate_annotation does not attach a
SharedQuantizationSpec to transpose, so the input and output activations
can be observed independently and receive different (scale, zero_point).
After to_edge decomposes aten.transpose.int to aten.permute_copy.default,
XNNPACK lowers it to XNNStaticTranspose, which hard-requires identical
input/output quantization parameters for qint8/quint8 and rejects a
mismatch with xnn_status_invalid_parameter.
ARM (TOSA) and QNN quantizers already treat transpose as a shared-qparam
op; this aligns the XNNPACK quantizer with them.
Test: test_transpose_shared_qparams verifies that after prepare_pt2e the
transpose node's input and output share the same observer instance.1 parent d8d706a commit bc89f05
2 files changed
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1045 | 1045 | | |
1046 | 1046 | | |
1047 | 1047 | | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1048 | 1053 | | |
1049 | 1054 | | |
1050 | 1055 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
631 | 693 | | |
632 | 694 | | |
633 | 695 | | |
| |||
0 commit comments