Skip to content

Commit 7e6b2b1

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Move opinput api.py argtype.py and dtypes.py to edge dialect (#249)
Summary: Pull Request resolved: #249 Move argument, dtype constraints runner logic from `kernels/test/fb/opinput` to `exir/dialects/edge/*`. Also did a restructure of `exir/dialects/edge`: ``` fbcode/executorch/exir/dialects/edge/ ├── arg # Edge op argument model and types │ ├── model.py │ ├── TARGETS │ └── type.py ├── BUCK ├── dtype # Edge supported dtype and logic to extract dtype constraints from core ATen ops. │ ├── runner.py │ ├── supported.py │ └── TARGETS ├── edge.yaml ├── op # Torch operator getter and other useful APIs │ ├── api.py │ └── TARGETS ├── _ops.py ├── spec # Edge dialect spec generator │ ├── gen.py │ ├── TARGETS │ └── utils.py ├── TARGETS └── test ├── BUCK ├── TARGETS ├── test_edge_ops.py └── test_edge_yaml.py ``` Notice that currently the moved code is not being used by edge dialect spec generator. Next diffs will handle that. Reviewed By: manuelcandales Differential Revision: D49065273 fbshipit-source-id: d807d8ff58c39695fe4a85ebfd3ea801e073d3a8
1 parent 094d00e commit 7e6b2b1

File tree

16 files changed

+798
-91
lines changed

16 files changed

+798
-91
lines changed

exir/dialects/edge/TARGETS

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,8 @@
11
load("@fbcode_macros//build_defs:export_files.bzl", "export_file")
2-
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
32
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
43

54
oncall("executorch")
65

7-
python_library(
8-
name = "yaml_generator_lib",
9-
srcs = [
10-
"yaml_generator.py",
11-
],
12-
deps = [
13-
"fbsource//third-party/pypi/expecttest:expecttest", # @manual
14-
"fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml",
15-
":support_dtypes",
16-
":utils",
17-
"//caffe2:torch",
18-
"//pye/lib:eager_model_base",
19-
],
20-
)
21-
22-
python_binary(
23-
name = "yaml_generator",
24-
srcs = [
25-
"yaml_generator.py",
26-
],
27-
main_module = "executorch.exir.dialects.edge.yaml_generator",
28-
deps = [
29-
"fbsource//third-party/pypi/expecttest:expecttest", # @manual
30-
"fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml",
31-
":support_dtypes",
32-
":utils",
33-
"//caffe2:torch",
34-
"//pye/lib:eager_model_base",
35-
],
36-
)
37-
386
python_library(
397
name = "lib",
408
srcs = [
@@ -46,36 +14,16 @@ python_library(
4614
deps = [
4715
"fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml",
4816
"fbsource//third-party/pypi/setuptools:setuptools",
49-
":support_dtypes",
50-
":utils",
5117
"//caffe2:torch",
5218
"//caffe2/torchgen:torchgen",
19+
"//executorch/exir/dialects/edge/dtype:lib",
20+
"//executorch/exir/dialects/edge/spec:lib",
5321
"//executorch/exir/operator:convert",
5422
],
5523
)
5624

57-
python_library(
58-
name = "support_dtypes",
59-
srcs = [
60-
"support_dtypes.py",
61-
],
62-
deps = [
63-
"//caffe2:torch",
64-
],
65-
)
66-
6725
export_file(
6826
name = "edge_yaml",
6927
src = "edge.yaml",
7028
visibility = ["//executorch/..."],
7129
)
72-
73-
python_library(
74-
name = "utils",
75-
srcs = [
76-
"utils.py",
77-
],
78-
deps = [
79-
"//caffe2:torch",
80-
],
81-
)

exir/dialects/edge/_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
import torch
1414

15-
from executorch.exir.dialects.edge.support_dtypes import regular_tensor_str_to_dtypes
16-
from executorch.exir.dialects.edge.utils import (
15+
from executorch.exir.dialects.edge.dtype.supported import regular_tensor_str_to_dtypes
16+
from executorch.exir.dialects.edge.spec.utils import (
1717
get_tensor_variable_names,
1818
get_torch_op_overload,
1919
)

exir/dialects/edge/arg/TARGETS

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
3+
oncall("ai_infra_mobile_platform")
4+
5+
python_library(
6+
name = "lib",
7+
srcs = [
8+
"model.py",
9+
"type.py",
10+
],
11+
deps = [
12+
"//caffe2:torch",
13+
],
14+
)

0 commit comments

Comments
 (0)