Skip to content

Commit 4ca434e

Browse files
committed
[qualcomm] Update draw_graph goldens for permutes inserted by LayoutTransform
D123733351 (pytorch#21932) moved the `QCOM_AXIS_ORDER` pop from `QnnBackend._build_op_wrappers` into `LayoutTransform`. `test_qnn_backend_draw_graph` calls `transform_for_preprocess_pipeline` directly, so it previously never cleared the stale to-edge tags and `LayoutTransform` inserted no permutes. Its goldens captured that graph, which real lowering never produces. The test now sees the same graph as `preprocess`: an NCHW->NHWC `permute_copy` feeding both convs, the graph input at its original `[1, 32, 28, 28]` shape, and (quantized only) an NHWC->NCHW `permute_copy` before the output dequantize. Update both goldens to match. Authored with Claude Code. Differential Revision: [D123874998](https://our.internmc.facebook.com/intern/diff/D123874998/) ghstack-source-id: 443606972 Pull-Request: pytorch#23528
1 parent 3576c02 commit 4ca434e

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

‎backends/qualcomm/tests/test_qnn_delegate.py‎

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7618,12 +7618,20 @@ def test_qnn_backend_draw_graph(self):
76187618
<TR><TD BGCOLOR="white">dims: [1, 28, 28, 32]</TD></TR>
76197619
<TR><TD BGCOLOR="white">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_UNDEFINED</TD></TR>
76207620
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
7621+
"aten_permute_copy_default@0" [label=<
7622+
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
7623+
<TR><TD BGCOLOR="white">name: aten_permute_copy_default@0</TD></TR>
7624+
<TR><TD BGCOLOR="white">data_type: Qnn_DataType_t.QNN_DATATYPE_FLOAT_32</TD></TR>
7625+
<TR><TD BGCOLOR="white">tensor_type: Qnn_TensorType_t.QNN_TENSOR_TYPE_NATIVE</TD></TR>
7626+
<TR><TD BGCOLOR="white">dims: [1, 28, 28, 32]</TD></TR>
7627+
<TR><TD BGCOLOR="white">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_UNDEFINED</TD></TR>
7628+
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
76217629
"input_0_x@0" [label=<
76227630
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
76237631
<TR><TD BGCOLOR="lightgreen">name: input_0_x@0</TD></TR>
76247632
<TR><TD BGCOLOR="lightgreen">data_type: Qnn_DataType_t.QNN_DATATYPE_FLOAT_32</TD></TR>
76257633
<TR><TD BGCOLOR="lightgreen">tensor_type: Qnn_TensorType_t.QNN_TENSOR_TYPE_APP_WRITE</TD></TR>
7626-
<TR><TD BGCOLOR="lightgreen">dims: [1, 28, 28, 32]</TD></TR>
7634+
<TR><TD BGCOLOR="lightgreen">dims: [1, 32, 28, 28]</TD></TR>
76277635
<TR><TD BGCOLOR="lightgreen">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_UNDEFINED</TD></TR>
76287636
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
76297637
"p_conv2_weight@0" [label=<
@@ -7658,12 +7666,13 @@ def test_qnn_backend_draw_graph(self):
76587666
<TR><TD BGCOLOR="lightpink">dims: [32]</TD></TR>
76597667
<TR><TD BGCOLOR="lightpink">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_UNDEFINED</TD></TR>
76607668
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
7661-
"input_0_x@0" -> "aten_convolution_default@0"
7669+
"input_0_x@0" -> "aten_permute_copy_default@0"
7670+
"aten_permute_copy_default@0" -> "aten_convolution_default@0"
76627671
"p_conv1_weight@0" -> "aten_convolution_default@0"
76637672
"p_conv1_bias@0" -> "aten_convolution_default@0"
76647673
"aten_convolution_default@0" -> "aten_relu_default@0"
76657674
"aten_convolution_default_1@0" -> "aten_relu_default_1@0"
7666-
"input_0_x@0" -> "aten_convolution_default_1@0"
7675+
"aten_permute_copy_default@0" -> "aten_convolution_default_1@0"
76677676
"p_conv2_weight@0" -> "aten_convolution_default_1@0"
76687677
"p_conv2_bias@0" -> "aten_convolution_default_1@0"
76697678
"aten_relu_default@0" -> "output_aten_add_tensor@0"
@@ -8751,6 +8760,22 @@ def test_qnn_backend_draw_graph(self):
87518760
<TR><TD BGCOLOR="white">dims: [1, 32, 28, 28]</TD></TR>
87528761
<TR><TD BGCOLOR="white">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_SCALE_OFFSET</TD></TR>
87538762
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
8763+
"aten_permute_copy_default@0" [label=<
8764+
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
8765+
<TR><TD BGCOLOR="white">name: aten_permute_copy_default@0</TD></TR>
8766+
<TR><TD BGCOLOR="white">data_type: Qnn_DataType_t.QNN_DATATYPE_UFIXED_POINT_8</TD></TR>
8767+
<TR><TD BGCOLOR="white">tensor_type: Qnn_TensorType_t.QNN_TENSOR_TYPE_NATIVE</TD></TR>
8768+
<TR><TD BGCOLOR="white">dims: [1, 28, 28, 32]</TD></TR>
8769+
<TR><TD BGCOLOR="white">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_SCALE_OFFSET</TD></TR>
8770+
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
8771+
"aten_permute_copy_default_1@0" [label=<
8772+
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
8773+
<TR><TD BGCOLOR="white">name: aten_permute_copy_default_1@0</TD></TR>
8774+
<TR><TD BGCOLOR="white">data_type: Qnn_DataType_t.QNN_DATATYPE_UFIXED_POINT_8</TD></TR>
8775+
<TR><TD BGCOLOR="white">tensor_type: Qnn_TensorType_t.QNN_TENSOR_TYPE_NATIVE</TD></TR>
8776+
<TR><TD BGCOLOR="white">dims: [1, 32, 28, 28]</TD></TR>
8777+
<TR><TD BGCOLOR="white">quantization_encoding: Qnn_QuantizationEncoding_t.QNN_QUANTIZATION_ENCODING_SCALE_OFFSET</TD></TR>
8778+
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
87548779
"b__frozen_param0@0" [label=<
87558780
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
87568781
<TR><TD BGCOLOR="lightpink">name: b__frozen_param0@0</TD></TR>
@@ -8801,16 +8826,18 @@ def test_qnn_backend_draw_graph(self):
88018826
</TABLE>> color=black fillcolor=transparent shape=box style=rounded]
88028827
"aten_relu_default@0" -> "aten_add_tensor@0"
88038828
"aten_convolution_default@0" -> "aten_relu_default@0"
8804-
"quantized_decomposed_quantize_per_tensor_default@0" -> "aten_convolution_default@0"
8829+
"aten_permute_copy_default@0" -> "aten_convolution_default@0"
8830+
"quantized_decomposed_quantize_per_tensor_default@0" -> "aten_permute_copy_default@0"
88058831
"input_0_x@0" -> "quantized_decomposed_quantize_per_tensor_default@0"
88068832
"b__frozen_param0@0" -> "aten_convolution_default@0"
88078833
"b__frozen_param1@0" -> "aten_convolution_default@0"
88088834
"aten_relu_default_1@0" -> "aten_add_tensor@0"
88098835
"aten_convolution_default_1@0" -> "aten_relu_default_1@0"
8810-
"quantized_decomposed_quantize_per_tensor_default@0" -> "aten_convolution_default_1@0"
8836+
"aten_permute_copy_default@0" -> "aten_convolution_default_1@0"
88118837
"b__frozen_param2@0" -> "aten_convolution_default_1@0"
88128838
"b__frozen_param3@0" -> "aten_convolution_default_1@0"
8813-
"aten_add_tensor@0" -> "output_quantized_decomposed_dequantize_per_tensor_default@0"
8839+
"aten_add_tensor@0" -> "aten_permute_copy_default_1@0"
8840+
"aten_permute_copy_default_1@0" -> "output_quantized_decomposed_dequantize_per_tensor_default@0"
88148841
}
88158842
"""
88168843
module = DrawGraphModel() # noqa: F405

0 commit comments

Comments
 (0)