Skip to content

Commit 1325e0c

Browse files
committed
change to use to_edge_transform_and_lower
1 parent 9b360b1 commit 1325e0c

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

backends/aoti/runtime/aoti_backend.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ class AOTIBackend final : public ::executorch::runtime::BackendInterface {
352352
}
353353

354354
void destroy(DelegateHandle* handle_) const override {
355-
ET_LOG(Debug, "AOTIBackend handle %p destroy", handle_);
356355
AOTIDelegateHandle* handle = (AOTIDelegateHandle*)handle_;
357356

358357
// Delete the container BEFORE closing the shared library
@@ -364,11 +363,6 @@ class AOTIBackend final : public ::executorch::runtime::BackendInterface {
364363
Error,
365364
"AOTInductorModelContainerDelete failed with error code %d",
366365
delete_result);
367-
} else {
368-
ET_LOG(
369-
Debug,
370-
"AOTIBackend container_handle %p deleted",
371-
handle->container_handle);
372366
}
373367
}
374368

@@ -380,6 +374,7 @@ class AOTIBackend final : public ::executorch::runtime::BackendInterface {
380374
free(handle);
381375
cleanup_memory();
382376
cleanup_tensor_metadata();
377+
ET_LOG(Debug, "AOTIBackend handle %p destroy", handle_);
383378
}
384379
};
385380

export_aoti.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import torch
2323
from executorch.backends.aoti.aoti_partitioner import AotiPartitioner
24-
from executorch.exir import to_edge
24+
from executorch.exir import to_edge_transform_and_lower
2525
from torch import nn
2626
from torch.export import export
2727
from torchvision import models
@@ -135,13 +135,17 @@ def export_model(model, example_inputs, output_filename="aoti_model.pte"):
135135
aten_dialect = export(model, example_inputs)
136136

137137
# 2. to_edge: Make optimizations for Edge devices
138-
print("Step 2: Converting to Edge program...")
139-
edge_program = to_edge(aten_dialect)
140-
print(edge_program.exported_program().graph.print_tabular())
138+
# print("Step 2: Converting to Edge program...")
139+
# edge_program = to_edge(aten_dialect)
140+
# print(edge_program.exported_program().graph.print_tabular())
141141

142-
print("Step 3: Converting to backend...")
143-
edge_program = edge_program.to_backend(AotiPartitioner([]))
144-
print("To backend done.")
142+
# print("Step 3: Converting to backend...")
143+
# edge_program = edge_program.to_backend(AotiPartitioner([]))
144+
# print("To backend done.")
145+
146+
edge_program = to_edge_transform_and_lower(
147+
aten_dialect, partitioner=[AotiPartitioner([])]
148+
)
145149

146150
# 3. to_executorch: Convert the graph to an ExecuTorch program
147151
print("Step 4: Converting to ExecuTorch program...")

0 commit comments

Comments
 (0)