Skip to content

Commit 9ede813

Browse files
mcr229facebook-github-bot
authored andcommitted
Fix XNNPACK Example for MV3 (#147)
Summary: Pull Request resolved: #147 xnnpack requires dequant nodes to be duplicated such that len(dq.users) == 1. We run this pass on our internal XNNPACK tests From Jerry: This will be a config that is used within the XNNPACKQuantizer. This will be added later, for the sake of enabling this in the example, we add the duplicatedequantnodepass to our edge compile config Additionally, graph_validation is failing for MV3, so we have to disable_validation for now. cccclai is looking into it Reviewed By: digantdesai Differential Revision: D48703639 fbshipit-source-id: 4521243d120b401da47d048a10e1363b444b2cbb
1 parent ec4d4e8 commit 9ede813

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/backend/xnnpack_examples.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
XnnpackQuantizedPartitioner2,
1616
)
1717
from executorch.exir.backend.backend_api import to_backend
18+
from executorch.exir.backend.canonical_partitioners.duplicate_dequant_node_pass import (
19+
DuplicateDequantNodePass,
20+
)
1821

1922
from ..models import MODEL_NAME_TO_MODEL
2023
from ..quantization.utils import quantize
@@ -78,7 +81,13 @@
7881
# It will eventually be changed to a lifted graph, in which _unlift=False,
7982
edge = exir.capture(
8083
model, example_inputs, exir.CaptureConfig(enable_aot=True, _unlift=True)
81-
).to_edge(exir.EdgeCompileConfig(_check_ir_validity=False))
84+
).to_edge(
85+
exir.EdgeCompileConfig(
86+
# TODO(T162080278): Duplicated Dequant nodes will be in quantizer spec
87+
_check_ir_validity=False,
88+
passes=[DuplicateDequantNodePass()],
89+
)
90+
)
8291
logging.info(f"Exported graph:\n{edge.exported_program.graph}")
8392

8493
edge.exported_program = to_backend(edge.exported_program, partitioner)

0 commit comments

Comments
 (0)