Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/source/compiler-custom-compiler-passes.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,12 @@ We also provide a combined helper function:
Args:
* `graph_module (fx.GraphModule)`: Module that we want to partition
* `patterns (List[torch.fx.Graph])`: A list of patterns in the form of
torch.fx.Graph. These graphs can be obtained through the `graph` field from a
GraphModule obtained by exir.capture (recommended) or symbolic tracing (which
might not result in an accurate edge dialect graph), or by manual crafting a
graph module.
torch.fx.Graph. For edge-dialect matching, use
`to_edge(torch.export.export(module, args)).exported_program().graph`, with
`to_edge` imported from `executorch.exir`, as in the
[XNNPACK bilinear_2d patterns](https://github.com/pytorch/executorch/blob/main/backends/xnnpack/partition/graphs/bilinear_2d.py).
Plain `torch.export.export` produces ATen-dialect targets, which will not match
edge-dialect nodes.
* `op_support (OperatorSupportBase)`: A OperatorSupportBase that can be created
in the following ways:
* Subclassing it directly and implementing `is_node_supported()`
Expand Down
15 changes: 1 addition & 14 deletions exir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@

from typing import Any

from executorch.exir.capture import (
_capture_legacy_do_not_use,
CallSpec,
capture,
CaptureConfig,
EdgeCompileConfig,
ExecutorchBackendConfig,
)
from executorch.exir.capture import EdgeCompileConfig, ExecutorchBackendConfig
from executorch.exir.emit import emit_program, EmitterOutput
from executorch.exir.program import (
_to_edge,
Expand All @@ -26,17 +19,13 @@
to_edge_transform_and_lower,
)
from executorch.exir.serde.serialize import load, save
from executorch.exir.tracer import ExirDynamoConfig
from torch.export import ExportedProgram, ExportGraphSignature

Value = Any

__all__ = [
"emit_program",
"EmitterOutput",
"capture",
"_capture_legacy_do_not_use",
"CallSpec",
"ExportedProgram",
"ExirExportedProgram",
"ExecutorchProgram",
Expand All @@ -47,11 +36,9 @@
"EdgeProgramManager",
"ExecutorchProgramManager",
"edge_to_executorch_passes",
"CaptureConfig",
"EdgeCompileConfig",
"ExecutorchBackendConfig",
"Value",
"ExirDynamoConfig",
"load",
"save",
]
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ def generate_pattern_op_partitions(
Args:
graph_module: Module that we want to partition
patterns: A list of patterns in the form of torch.fx.Graph. These graphs
can be obtained through the `graph` field from a GraphModule obtained by
exir.capture (recommended) or symbolic tracing (which might not result
in an accurate edge dialect graph), or by manual crafting a graph
module.
should use edge-dialect targets to match an edge-dialect graph_module.
Use to_edge(torch.export.export(module, args)).exported_program().graph
(with to_edge from executorch.exir), as in the XNNPACK bilinear_2d
patterns. Plain torch.export produces ATen-dialect targets, which
will not match edge-dialect nodes.
partitions_list: A list of node lists whose nodes are intended to be tagged
along with the nodes detected by the pattern matcher.
op_support: A OperatorSupportBase that can be created in the following ways:
Expand Down
18 changes: 0 additions & 18 deletions exir/capture/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,10 @@ fbcode_target(_kind = runtime.python_library,
"__init__.py",
],
deps = [
":capture",
":config",
],
)

fbcode_target(_kind = runtime.python_library,
name = "capture",
srcs = [
"_capture.py",
],
deps = [
":config",
"//caffe2:torch",
"//executorch/exir:error",
"//executorch/exir:tracer",
"//executorch/exir/program:lib",
"//executorch/exir/program:program",
"//executorch/exir/verification:verifier",
],
)

fbcode_target(_kind = runtime.python_library,
name = "config",
srcs = [
Expand All @@ -45,7 +28,6 @@ fbcode_target(_kind = runtime.python_library,
"//caffe2:torch",
"//executorch/exir:dynamic_shape",
"//executorch/exir:pass_manager",
"//executorch/exir:tracer",
"//executorch/exir/passes:lib",
"//executorch/exir/passes:propagate_device_config",
"//executorch/exir/passes:sym_shape_eval_pass",
Expand Down
16 changes: 1 addition & 15 deletions exir/capture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,9 @@

# pyre-strict

from executorch.exir.capture._capture import (
_capture_legacy_do_not_use,
CallSpec,
capture,
)

from executorch.exir.capture._config import (
CaptureConfig,
EdgeCompileConfig,
ExecutorchBackendConfig,
)
from executorch.exir.capture._config import EdgeCompileConfig, ExecutorchBackendConfig

__all__ = [
"CallSpec",
"capture",
"_capture_legacy_do_not_use",
"CaptureConfig",
"EdgeCompileConfig",
"ExecutorchBackendConfig",
]
Loading
Loading