Skip to content

Commit 26527ef

Browse files
digantdesaifacebook-github-bot
authored andcommitted
Partitioner new op guideline (#284)
Summary: Pull Request resolved: #284 as title Reviewed By: mcr229 Differential Revision: D49161165 fbshipit-source-id: 6542bde35eed95c692dc3d91146b6a4ce86742ba
1 parent 7692b51 commit 26527ef

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

backends/xnnpack/partition/configs.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,28 @@
77
import torch
88
from executorch.exir.dialects._ops import ops as exir_ops
99

10-
###
11-
### Module based partitioners
12-
###
10+
"""
11+
** How to incorporate a new op into the XNNPACK Partitioner? **
12+
13+
[1] When the new edge op being added is direct descendent of a core-aten op,
14+
and is also supported* by XNNPACK, prefer partitioning it via SUPPORTED_OPS
15+
mechanism e.g. torch.add
16+
17+
[2] When the new op being added is not a core-aten op,
18+
19+
[2.1] If the original torch op is supported* by XNNPACK, prefer partitioning it
20+
via SUPPORTED_MODULES. This will require "recomposing" the op before lowering
21+
it to XNNPACK e.g. torch.nn.Linear. Make sure to include all variants of the
22+
modules in the SUPPORTED_MODULES list.
23+
24+
[2.2] If the original torch op is not supported by XNNPACK, then it is assumed
25+
that out of all the decomposed core-aten ops, SUPPORTED_OPS will be lowered to
26+
XNNPACK.
27+
28+
* - Supported fully or partially. The partial support does not mean only few
29+
ops from the decomposition but means only some variants of the op "modes"
30+
possible with the arg combinations.
31+
"""
1332

1433
SUPPORTED_OPS = [
1534
exir_ops.edge.aten.div.Tensor,

0 commit comments

Comments
 (0)