Skip to content

Commit 71ea7cb

Browse files
Gasoonjiafacebook-github-bot
authored andcommitted
make partition graph compilation based on xnnpack compile config (pytorch#2452)
Summary: Pull Request resolved: pytorch#2452 bypass-github-pytorch-ci-checks This diff makes graphs modules under xnnpack rely on xnnpack compile config, to make xnnpack compile config control edge compilation, and easier to control the flow. Reviewed By: cccclai Differential Revision: D54929119 fbshipit-source-id: c53872f450b8cfa24ca4c2108aa4e5445e194562
1 parent 04fbaae commit 71ea7cb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

backends/xnnpack/partition/graphs/bilinear_2d.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import executorch.exir as exir
1111
import torch
1212

13+
from executorch.backends.xnnpack.utils.configs import get_xnnpack_edge_compile_config
14+
1315

1416
@lru_cache(maxsize=None)
1517
def _get_bilinear_2d_graphs():
@@ -37,7 +39,9 @@ def forward(self, x):
3739
for config in capture_configs:
3840
edge = exir.capture(
3941
bilinear2d(align_corners), sample_inputs, config
40-
).to_edge()
42+
).to_edge(
43+
config=get_xnnpack_edge_compile_config(),
44+
)
4145
_bilinear2d_graphs[edge.exported_program.graph_module] = align_corners
4246
return _bilinear2d_graphs
4347

backends/xnnpack/partition/graphs/sdpa.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import List, Optional
99

1010
import torch
11+
from executorch.backends.xnnpack.utils.configs import get_xnnpack_edge_compile_config
1112
from executorch.exir import to_edge
1213
from torch import Tensor
1314
from torch.export import export
@@ -75,7 +76,8 @@ def forward(
7576
v,
7677
mask,
7778
),
78-
)
79+
),
80+
compile_config=get_xnnpack_edge_compile_config(),
7981
)
8082
gm = edge.exported_program().graph_module
8183
graphs.append(gm)

0 commit comments

Comments
 (0)