|
29 | 29 | from executorch.exir.capture._config import ExecutorchBackendConfig |
30 | 30 | from executorch.exir.delegate import executorch_call_delegate |
31 | 31 | from executorch.exir.dialects._ops import ops as exir_ops |
| 32 | +from executorch.exir.passes.memory_planning_pass import MemoryPlanningPass |
32 | 33 | from executorch.exir.passes.propagate_device_pass import ( |
33 | 34 | _get_target_device_from_compile_specs, |
34 | 35 | _parse_device_spec_value, |
| 36 | + PropagateDeviceConfig, |
35 | 37 | TARGET_DEVICE_COMPILE_SPEC_KEY, |
36 | 38 | ) |
37 | 39 | from executorch.exir.schema import DeviceType |
@@ -766,8 +768,12 @@ def forward(self, a, b): |
766 | 768 | inputs = (torch.randn(2, 2), torch.randn(2, 2)) |
767 | 769 | et_config = ExecutorchBackendConfig( |
768 | 770 | emit_stacktrace=False, |
769 | | - skip_h2d_for_method_inputs=True, |
770 | | - enable_non_cpu_memory_planning=True, |
| 771 | + propagate_device_config=PropagateDeviceConfig( |
| 772 | + skip_h2d_for_method_inputs=True |
| 773 | + ), |
| 774 | + memory_planning_pass=MemoryPlanningPass( |
| 775 | + enable_non_cpu_memory_planning=True |
| 776 | + ), |
771 | 777 | ) |
772 | 778 |
|
773 | 779 | for pipeline, program, gm in self._get_executorch_program( |
@@ -822,8 +828,12 @@ def forward(self, a, b): |
822 | 828 | inputs = (torch.randn(2, 2), torch.randn(2, 2)) |
823 | 829 | et_config = ExecutorchBackendConfig( |
824 | 830 | emit_stacktrace=False, |
825 | | - skip_d2h_for_method_outputs=True, |
826 | | - enable_non_cpu_memory_planning=True, |
| 831 | + propagate_device_config=PropagateDeviceConfig( |
| 832 | + skip_d2h_for_method_outputs=True |
| 833 | + ), |
| 834 | + memory_planning_pass=MemoryPlanningPass( |
| 835 | + enable_non_cpu_memory_planning=True |
| 836 | + ), |
827 | 837 | ) |
828 | 838 |
|
829 | 839 | for pipeline, program, gm in self._get_executorch_program( |
@@ -876,9 +886,13 @@ def forward(self, a, b): |
876 | 886 | inputs = (torch.randn(2, 2), torch.randn(2, 2)) |
877 | 887 | et_config = ExecutorchBackendConfig( |
878 | 888 | emit_stacktrace=False, |
879 | | - skip_h2d_for_method_inputs=True, |
880 | | - skip_d2h_for_method_outputs=True, |
881 | | - enable_non_cpu_memory_planning=True, |
| 889 | + propagate_device_config=PropagateDeviceConfig( |
| 890 | + skip_h2d_for_method_inputs=True, |
| 891 | + skip_d2h_for_method_outputs=True, |
| 892 | + ), |
| 893 | + memory_planning_pass=MemoryPlanningPass( |
| 894 | + enable_non_cpu_memory_planning=True |
| 895 | + ), |
882 | 896 | ) |
883 | 897 |
|
884 | 898 | for pipeline, program, gm in self._get_executorch_program( |
@@ -952,8 +966,12 @@ def forward(self, a, b): |
952 | 966 | inputs = (torch.randn(2, 2), torch.randn(2, 2)) |
953 | 967 | et_config = ExecutorchBackendConfig( |
954 | 968 | emit_stacktrace=False, |
955 | | - skip_h2d_for_method_inputs=True, |
956 | | - enable_non_cpu_memory_planning=True, |
| 969 | + propagate_device_config=PropagateDeviceConfig( |
| 970 | + skip_h2d_for_method_inputs=True |
| 971 | + ), |
| 972 | + memory_planning_pass=MemoryPlanningPass( |
| 973 | + enable_non_cpu_memory_planning=True |
| 974 | + ), |
957 | 975 | ) |
958 | 976 |
|
959 | 977 | for pipeline, program, gm in self._get_executorch_program( |
|
0 commit comments