Skip to content

Commit 7028a71

Browse files
Gasoonjiafacebook-github-bot
authored andcommitted
skip dim order for now to avoid delegation issue (#3982)
Summary: Pull Request resolved: #3982 some delegate authors claim can not found dim order when partition. Temporary disable dim order as default for unblock others. Reviewed By: digantdesai, larryliu0820 Differential Revision: D58593014 fbshipit-source-id: 3cfbe170d57fb187d43eeb29bf63f59e9acc574b
1 parent 99284c7 commit 7028a71

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

backends/vulkan/test/test_vulkan_delegate.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
import ctypes
810
import unittest
911
from typing import Tuple
@@ -117,7 +119,9 @@ def run_test(memory_layout):
117119
program: ExportedProgram = export(
118120
model, sample_inputs, dynamic_shapes=dynamic_shapes
119121
)
120-
edge_program: EdgeProgramManager = to_edge(program)
122+
edge_program: EdgeProgramManager = to_edge(
123+
program, compile_config=self._edge_compile_config
124+
)
121125

122126
edge_program = edge_program.transform([I64toI32(), MeanToSumDiv()])
123127

exir/capture/_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
from dataclasses import dataclass, field
810
from typing import Dict, List, Optional, Union
911

@@ -38,7 +40,8 @@ class EdgeCompileConfig:
3840
_use_edge_ops: bool = True
3941
_skip_type_promotion: bool = False
4042
# TODO(gasoonjia): remove this
41-
_skip_dim_order: bool = False
43+
# TODO(T192537614): reenanle dim order as default
44+
_skip_dim_order: bool = True
4245

4346

4447
@compatibility(is_backward_compatible=False)

exir/emit/test/test_emit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7-
# pye-strict
7+
# pyre-unsafe
88

99
import typing
1010
import unittest
@@ -866,7 +866,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
866866
# Success if you use dim_order
867867
to_edge(
868868
export(model, inputs),
869-
compile_config=exir.EdgeCompileConfig(_check_ir_validity=False),
869+
compile_config=exir.EdgeCompileConfig(
870+
_check_ir_validity=False, _skip_dim_order=False
871+
),
870872
).to_executorch()
871873

872874
def test_emit_multiple_entry_points(self) -> None:

exir/tests/test_memory_format_ops_pass_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
import unittest
810
from dataclasses import dataclass
911
from typing import Any, Tuple
1012

1113
import torch
1214
from executorch.exir import to_edge
15+
from executorch.exir.capture._config import EdgeCompileConfig
1316

1417
from executorch.exir.dim_order_utils import (
1518
is_channel_last_dim_order,
@@ -70,7 +73,7 @@ def memory_format_test_runner(
7073
edge_op_str
7174
).run(before.graph_module.code)
7275

73-
epm = to_edge(before)
76+
epm = to_edge(before, compile_config=EdgeCompileConfig(_skip_dim_order=False))
7477

7578
# check op strings
7679
FileCheck().check_not(aten_op_str).check_count(

exir/tests/test_passes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,10 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
11341134

11351135
add = Add()
11361136

1137-
edge = to_edge(export(add, (torch.ones(1),)))
1137+
edge = to_edge(
1138+
export(add, (torch.ones(1),)),
1139+
compile_config=EdgeCompileConfig(_skip_dim_order=False),
1140+
)
11381141
edge = edge.transform([ScalarToTensorPass(), RemoveMixedTypeOperators()])
11391142
exported_program = lift_constant_tensor_pass(edge.exported_program())
11401143

exir/verification/test/test_verifier.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# pyre-unsafe
8+
79
import unittest
810
from contextlib import contextmanager
11+
from typing import Any
912

1013
import torch
1114
from executorch.exir import EdgeCompileConfig, to_edge
@@ -20,7 +23,7 @@
2023

2124
class TestEdgeDialectVerifier(unittest.TestCase):
2225
@contextmanager
23-
def assertNotRaises(self, exc_type):
26+
def assertNotRaises(self, exc_type: Any) -> Any:
2427
try:
2528
yield None
2629
except exc_type:
@@ -81,8 +84,9 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
8184

8285
export_model = export(m, example_input)
8386

84-
# In default we use dim order.
85-
compile_config_without_edge_op = EdgeCompileConfig(_use_edge_ops=False)
87+
compile_config_without_edge_op = EdgeCompileConfig(
88+
_use_edge_ops=False, _skip_dim_order=False
89+
)
8690

8791
edge_manager = to_edge(
8892
export_model, compile_config=compile_config_without_edge_op
@@ -128,8 +132,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
128132

129133
export_model = export(m, example_input)
130134

131-
# In default we use dim order.
132-
compile_config_with_dim_order = EdgeCompileConfig()
135+
compile_config_with_dim_order = EdgeCompileConfig(_skip_dim_order=False)
133136
compile_config_with_stride = EdgeCompileConfig(_skip_dim_order=True)
134137

135138
dim_order_edge_model = to_edge(

0 commit comments

Comments
 (0)