Skip to content

Commit d4f65c9

Browse files
Yujie Huifacebook-github-bot
authored andcommitted
update Vulkan nn.module test to support not decomposition (#4054)
Summary: Pull Request resolved: #4054 In order to test the operators that are disabled to decompose, we need different APIs from excutorch to compile the model. We need to use `_to_edge_transform_and_lower()` by passing the Vulkan partitioner. If we use this API, we don't use the combination of `to_edge()` and `to_backend()`. https://www.internalfb.com/code/fbsource/[1176a06a4b48]/xplat/executorch/exir/program/_program.py?lines=862 Add a test option in `lower_module_and_test_output`. By default, it will call normal APIs, with `not_decompose` enabled, it will call `_to_edge_transform_and_lower()` instead. Reviewed By: jorgep31415 Differential Revision: D58907317
1 parent de4eb6c commit d4f65c9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

backends/vulkan/test/test_vulkan_delegate.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
ctypes.CDLL("libvulkan.so.1")
2727

2828

29+
from executorch.exir.program._program import _to_edge_transform_and_lower
2930
from executorch.extension.pybindings.portable_lib import ( # @manual
3031
_load_for_executorch_from_buffer,
3132
)
@@ -119,16 +120,15 @@ def run_test(memory_layout):
119120
program: ExportedProgram = export(
120121
model, sample_inputs, dynamic_shapes=dynamic_shapes
121122
)
122-
edge_program: EdgeProgramManager = to_edge(
123-
program, compile_config=self._edge_compile_config
124-
)
125123

126-
edge_program = edge_program.transform(
127-
[I64toI32(self._edge_compile_config._skip_dim_order), MeanToSumDiv()]
124+
edge_program = _to_edge_transform_and_lower(
125+
program,
126+
transform_passes=[
127+
I64toI32(self._edge_compile_config._skip_dim_order),
128+
MeanToSumDiv(),
129+
],
130+
partitioner=[VulkanPartitioner(compile_options)],
128131
)
129-
130-
edge_program = edge_program.to_backend(VulkanPartitioner(compile_options))
131-
132132
executorch_program = edge_program.to_executorch()
133133

134134
self.assertEqual(

0 commit comments

Comments
 (0)