26
26
ctypes .CDLL ("libvulkan.so.1" )
27
27
28
28
29
+ from executorch .exir .program ._program import _to_edge_transform_and_lower
29
30
from executorch .extension .pybindings .portable_lib import ( # @manual
30
31
_load_for_executorch_from_buffer ,
31
32
)
@@ -100,6 +101,7 @@ def lower_module_and_test_output(
100
101
test_inputs = None ,
101
102
memory_layouts = None ,
102
103
first_output_only = False ,
104
+ not_decompose = False ,
103
105
):
104
106
"""
105
107
Helper testing function that takes a torch.nn.Module and lowers it to Vulkan with
@@ -119,16 +121,25 @@ def run_test(memory_layout):
119
121
program : ExportedProgram = export (
120
122
model , sample_inputs , dynamic_shapes = dynamic_shapes
121
123
)
122
- edge_program : EdgeProgramManager = to_edge (
123
- program , compile_config = self ._edge_compile_config
124
- )
125
-
126
- edge_program = edge_program .transform (
127
- [I64toI32 (self ._edge_compile_config ._skip_dim_order ), MeanToSumDiv ()]
128
- )
124
+ if not_decompose is False :
125
+ edge_program : EdgeProgramManager = to_edge (
126
+ program , compile_config = self ._edge_compile_config
127
+ )
129
128
130
- edge_program = edge_program .to_backend (VulkanPartitioner (compile_options ))
129
+ edge_program = edge_program .transform (
130
+ [
131
+ I64toI32 (self ._edge_compile_config ._skip_dim_order ),
132
+ MeanToSumDiv (),
133
+ ]
134
+ )
131
135
136
+ edge_program = edge_program .to_backend (
137
+ VulkanPartitioner (compile_options )
138
+ )
139
+ else :
140
+ edge_program = _to_edge_transform_and_lower (
141
+ program , partitioner = [VulkanPartitioner (compile_options )]
142
+ )
132
143
executorch_program = edge_program .to_executorch ()
133
144
134
145
self .assertEqual (
0 commit comments