Skip to content

Commit 48d664c

Browse files
authored
[ET] promote to_edge_transform_and_lower to public API (#4790)
We wish to make to_edge_transform_and_lower a public API that is accessible through exir and no longer is preceeded with an "_" Co-authored-by: Max Ren <[email protected]> Pull Request resolved: #4766
1 parent 5950611 commit 48d664c

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

backends/vulkan/test/TARGETS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ python_unittest(
1818
"//executorch/backends/vulkan:vulkan_preprocess",
1919
"//executorch/backends/vulkan/partitioner:vulkan_partitioner",
2020
"//executorch/exir:lib",
21-
"//executorch/exir/program:program",
2221
"//executorch/extension/pybindings:portable_lib", # @manual
2322
"//executorch/extension/pytree:pylib",
2423
"//executorch/kernels/portable:custom_ops_generated_lib",

backends/vulkan/test/test_vulkan_delegate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
ctypes.CDLL("libvulkan.so.1")
2626

2727

28-
from executorch.exir.program._program import _to_edge_transform_and_lower
28+
from executorch.exir import to_edge_transform_and_lower
2929
from executorch.extension.pybindings.portable_lib import ( # @manual
3030
_load_for_executorch_from_buffer,
3131
)
@@ -120,7 +120,7 @@ def run_test(memory_layout):
120120
model, sample_inputs, dynamic_shapes=dynamic_shapes
121121
)
122122

123-
edge_program = _to_edge_transform_and_lower(
123+
edge_program = to_edge_transform_and_lower(
124124
program,
125125
transform_passes=[
126126
I64toI32(self._edge_compile_config._skip_dim_order),

backends/xnnpack/test/tester/tester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
ExecutorchBackendConfig,
2424
ExecutorchProgramManager,
2525
to_edge,
26+
to_edge_transform_and_lower,
2627
)
2728
from executorch.exir.backend.backend_api import validation_disabled
2829
from executorch.exir.backend.partitioner import Partitioner
2930
from executorch.exir.passes.sym_shape_eval_pass import ConstraintBasedSymShapeEvalPass
3031
from executorch.exir.print_program import pretty_print, print_program
31-
from executorch.exir.program._program import _to_edge_transform_and_lower
3232

3333
logger = logging.getLogger(__name__)
3434
logger.setLevel(logging.INFO)
@@ -300,7 +300,7 @@ def __init__(
300300

301301
def run(self, artifact: ExportedProgram, inputs=None) -> None:
302302
artifact_to_run = copy.deepcopy(artifact)
303-
self.edge_dialect_program = _to_edge_transform_and_lower(
303+
self.edge_dialect_program = to_edge_transform_and_lower(
304304
artifact_to_run,
305305
compile_config=self.edge_compile_conf,
306306
partitioner=self.partitioners,

examples/models/llava/export_llava.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
replace_sdpa_with_custom_op,
2626
)
2727
from executorch.examples.models.llava.model import LlavaModel
28-
from executorch.exir import EdgeCompileConfig
29-
from executorch.exir.program._program import _to_edge_transform_and_lower
28+
from executorch.exir import EdgeCompileConfig, to_edge_transform_and_lower
3029

3130
from executorch.extension.llm.export.builder import DType, LLMEdgeManager
3231
from executorch.extension.llm.tokenizer.tokenizer import Tokenizer
@@ -184,7 +183,7 @@ def export_all(llava_model: LlavaModel):
184183

185184
token_embedding_ep = export_token_embedding(llava, prompt_before_image)
186185

187-
lowered_and_edge = _to_edge_transform_and_lower(
186+
lowered_and_edge = to_edge_transform_and_lower(
188187
{
189188
"image_encoder": image_encoder_ep,
190189
"token_embedding": token_embedding_ep,

exir/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ExecutorchProgramManager,
2424
ExirExportedProgram,
2525
to_edge,
26+
to_edge_transform_and_lower,
2627
)
2728
from executorch.exir.serde.serialize import load, save
2829
from executorch.exir.tracer import ExirDynamoConfig
@@ -42,6 +43,7 @@
4243
"ExportGraphSignature",
4344
"_to_edge",
4445
"to_edge",
46+
"to_edge_transform_and_lower",
4547
"EdgeProgramManager",
4648
"ExecutorchProgramManager",
4749
"edge_to_executorch_passes",

exir/program/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
from executorch.exir.program._fake_program import get_fake_program
1010
from executorch.exir.program._program import (
1111
_to_edge,
12-
_to_edge_transform_and_lower,
1312
edge_to_executorch_passes,
1413
EdgeProgramManager,
1514
ExecutorchProgram,
1615
ExecutorchProgramManager,
1716
ExirExportedProgram,
1817
to_edge,
18+
to_edge_transform_and_lower,
1919
)
2020

2121
__all__ = [
2222
"ExirExportedProgram",
2323
"ExecutorchProgram",
2424
"_to_edge",
2525
"to_edge",
26-
"_to_edge_transform_and_lower",
26+
"to_edge_transform_and_lower",
2727
"edge_to_executorch_passes",
2828
"EdgeProgramManager",
2929
"ExecutorchProgramManager",

exir/program/_program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def _gen_edge_manager_for_partitioners(
926926
return edge_manager
927927

928928

929-
def _to_edge_transform_and_lower(
929+
def to_edge_transform_and_lower(
930930
programs: Union[ExportedProgram, Dict[str, ExportedProgram]],
931931
transform_passes: Optional[
932932
Union[Sequence[PassType], Dict[str, Sequence[PassType]]]

exir/program/test/test_program.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
from executorch.exir.pass_base import ExportPass
2323
from executorch.exir.passes import MemoryPlanningPass
2424
from executorch.exir.program._program import (
25-
_to_edge_transform_and_lower,
2625
EdgeProgramManager,
2726
ExecutorchProgramManager,
2827
to_edge,
28+
to_edge_transform_and_lower,
2929
)
3030
from executorch.exir.tracer import _default_decomposition_table
3131
from executorch.exir.verification.verifier import EXIREdgeDialectVerifier
@@ -587,7 +587,7 @@ def get_num_nondecomposed_ops(self, ep, partitioner):
587587

588588
def _test_model_with_non_decomp_partitioner(self, model: torch.nn.Module):
589589
# This is the pre-dispatch export that we will be switching to primarily
590-
# in the near future. The input to _to_edge_transform_and_lower needs to
590+
# in the near future. The input to to_edge_transform_and_lower needs to
591591
# be a graph generated by this pre dispatch export.
592592
ep = _export(model, model._get_random_inputs(), pre_dispatch=True)
593593
non_decomp_partitioner = NonDecompTestPartitioner()
@@ -597,7 +597,7 @@ def _test_model_with_non_decomp_partitioner(self, model: torch.nn.Module):
597597
)
598598

599599
# run to_edge_trasnform_and_lower
600-
edge = _to_edge_transform_and_lower(
600+
edge = to_edge_transform_and_lower(
601601
ep,
602602
compile_config=EdgeCompileConfig(),
603603
partitioner=[NonDecompTestPartitioner()],
@@ -652,7 +652,7 @@ def _get_random_inputs(cls):
652652

653653
model = TestLinear()
654654
ep = _export(model, model._get_random_inputs(), pre_dispatch=True)
655-
edge = _to_edge_transform_and_lower(
655+
edge = to_edge_transform_and_lower(
656656
ep,
657657
compile_config=EdgeCompileConfig(),
658658
partitioner=[NonDecompTestPartitioner()],

0 commit comments

Comments
 (0)