Skip to content

Commit 96f6e99

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 Reviewed By: jorgep31415 Differential Revision: D58907317
1 parent 1ba8946 commit 96f6e99

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

backends/vulkan/test/test_vulkan_delegate.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
2121
from executorch.backends.vulkan.vulkan_preprocess import VulkanBackend
2222

23-
from executorch.exir import EdgeCompileConfig, EdgeProgramManager, to_edge
23+
from executorch.exir import EdgeCompileConfig
2424
from torch.export import Dim, export, ExportedProgram
2525

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)