xref: /aosp_15_r20/external/executorch/exir/tests/TARGETS (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
2load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
3load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
4
5oncall("executorch")
6
7python_library(
8    name = "lib",
9    srcs = [
10        "common.py",
11    ],
12    deps = [
13        "//caffe2:torch",
14        "//executorch/exir:schema",
15    ],
16)
17
18python_library(
19    name = "models",
20    srcs = [
21        "models.py",
22    ],
23    deps = [
24        "//caffe2:torch",
25        "//executorch/exir:lib",
26        "//executorch/exir:lowered_backend_module",
27    ],
28)
29
30python_library(
31    name = "control_flow_models",
32    srcs = [
33        "control_flow_models.py",
34    ],
35    deps = [
36        "//caffe2:torch",
37    ],
38)
39
40python_library(
41    name = "dynamic_shape_models",
42    srcs = [
43        "dynamic_shape_models.py",
44    ],
45    deps = [
46        "//caffe2:torch",
47    ],
48)
49
50python_library(
51    name = "transformer",
52    srcs = [
53        "transformer.py",
54    ],
55    deps = [
56        "//caffe2:torch",
57    ],
58)
59
60python_library(
61    name = "asr_joiner",
62    srcs = [
63        "asr_joiner.py",
64    ],
65    deps = [
66        "//caffe2:torch",
67    ],
68)
69
70python_unittest(
71    name = "tracer",
72    srcs = [
73        "test_tracer.py",
74    ],
75    # Static listing does not support tests generated in runtime.
76    supports_static_listing = False,
77    deps = [
78        "fbsource//third-party/pypi/parameterized:parameterized",
79        ":lib",
80        ":models",
81        "//caffe2:torch",
82        "//caffe2/functorch:functorch_src",
83        "//executorch/exir:lib",
84        "//executorch/exir:tracer",
85        "//executorch/exir/dialects:lib",
86    ],
87)
88
89python_unittest(
90    name = "serde",
91    srcs = [
92        "test_serde.py",
93    ],
94    deps = [
95        "//caffe2:torch",
96        "//executorch/exir:lib",
97        "//executorch/exir/backend:backend_api",
98        "//executorch/exir/backend/test:backend_with_compiler_demo",
99        "//executorch/exir/backend/test:op_partitioner_demo",
100        "//executorch/exir/serde:serialize",
101    ],
102)
103
104python_unittest(
105    name = "joint_graph",
106    srcs = [
107        "test_joint_graph.py",
108    ],
109    deps = [
110        "//caffe2:torch",
111        "//executorch/exir:lib",
112        "//executorch/extension/pybindings:portable_lib",
113    ],
114)
115
116python_unittest(
117    name = "error",
118    srcs = [
119        "test_error.py",
120    ],
121    deps = [
122        "//executorch/exir:error",
123    ],
124)
125
126python_unittest(
127    name = "tensor",
128    srcs = [
129        "test_tensor.py",
130    ],
131    deps = [
132        "//caffe2:torch",
133        "//executorch/exir:schema",
134        "//executorch/exir:tensor",
135    ],
136)
137
138cpp_library(
139    name = "test_lib",
140    srcs = [
141        "test_lib.cpp",
142    ],
143    supports_python_dlopen = True,
144    deps = [
145        "//caffe2:ATen-cpu",
146        "//caffe2:torch-cpp-cpu",  # @manual
147    ],
148)
149
150python_unittest(
151    name = "op_convert",
152    srcs = [
153        "test_op_convert.py",
154    ],
155    preload_deps = [
156        "//executorch/kernels/portable:custom_ops_generated_lib",
157        ":test_lib",  # @manual
158    ],
159    deps = [
160        "//caffe2:torch",
161        "//executorch/exir/operator:convert",
162    ],
163)
164
165python_unittest(
166    name = "memory_planning",
167    srcs = [
168        "test_memory_planning.py",
169    ],
170    preload_deps = [
171        "//executorch/kernels/portable:custom_ops_generated_lib",
172    ],
173    # Static listing does not support tests generated with parameterized
174    supports_static_listing = False,
175    deps = [
176        "fbsource//third-party/pypi/parameterized:parameterized",
177        "//caffe2:torch",
178        "//executorch/exir:lib",
179        "//executorch/exir:memory_planning",
180        "//executorch/exir:pass_base",
181        "//executorch/exir:pass_manager",
182        "//executorch/exir/passes:lib",
183        "//executorch/exir/passes:sym_shape_eval_pass",
184    ],
185)
186
187python_unittest(
188    name = "passes",
189    srcs = [
190        "test_passes.py",
191    ],
192    preload_deps = [":test_lib"],
193    deps = [
194        ":control_flow_models",
195        ":lib",
196        ":models",
197        "//caffe2:torch",
198        "//caffe2/functorch:functorch_src",
199        "//executorch/exir:graph_module",
200        "//executorch/exir:lib",
201        "//executorch/exir:memory",
202        "//executorch/exir:memory_planning",
203        "//executorch/exir:pass_base",
204        "//executorch/exir:schema",
205        "//executorch/exir:tensor",
206        "//executorch/exir/dialects:lib",
207        "//executorch/exir/dialects/edge:lib",
208        "//executorch/exir/emit:lib",
209        "//executorch/exir/passes:constant_prop_pass",
210        "//executorch/exir/passes:debug_handle_generator_pass",
211        "//executorch/exir/passes:insert_write_back_for_buffers_pass",
212        "//executorch/exir/passes:lib",
213        "//executorch/exir/passes:memory_format_ops_pass",
214        "//executorch/exir/passes:normalize_view_copy_base_pass",
215        "//executorch/exir/passes:remove_graph_asserts_pass",
216        "//executorch/exir/passes:remove_mixed_type_operators",
217        "//executorch/exir/passes:replace_edge_with_backend_pass",
218        "//executorch/exir/passes:replace_view_copy_with_view_pass",
219        "//executorch/exir/passes:scalar_to_tensor_pass",
220        "//executorch/exir/passes:spec_prop_pass",
221        "//executorch/exir/passes:sym_to_tensor_pass",
222        "//executorch/exir/program:program",
223        "//executorch/extension/pybindings:portable_lib",  # @manual
224    ],
225)
226
227python_unittest(
228    name = "pass_infra",
229    srcs = [
230        "test_pass_infra.py",
231    ],
232    deps = [
233        "//caffe2:torch",
234        "//executorch/exir:lib",
235        "//executorch/exir:pass_manager",
236        "//executorch/exir/passes:lib",
237        "//executorch/exir/passes:pass_registry",
238    ],
239)
240
241python_unittest(
242    name = "common",
243    srcs = [
244        "test_common.py",
245    ],
246    deps = [
247        "//caffe2:torch",
248        "//executorch/exir:common",
249        "//executorch/exir:print_program",
250    ],
251)
252
253python_unittest(
254    name = "verification",
255    srcs = [
256        "test_verification.py",
257    ],
258    deps = [
259        "//caffe2:torch",
260        "//executorch/exir:lib",
261        "//executorch/exir:schema",
262        "//executorch/exir/passes:const_prop_pass",
263        "//executorch/exir/verification:interpreter",
264        "//executorch/exir/verification:verifier",
265    ],
266)
267
268python_unittest(
269    name = "delegate",
270    srcs = [
271        "test_delegate.py",
272    ],
273    deps = [
274        ":lib",
275        ":models",
276        "//caffe2:torch",
277        "//executorch/exir:lib",
278        "//executorch/exir:lowered_backend_module",
279        "//executorch/exir:schema",
280        "//executorch/exir/dialects:lib",
281    ],
282)
283
284python_unittest(
285    name = "quant_fusion_pass",
286    srcs = [
287        "test_quant_fusion_pass.py",
288    ],
289    preload_deps = [
290        "//executorch/kernels/quantized:custom_ops_generated_lib",
291    ],
292    deps = [
293        ":lib",
294        "//caffe2:torch",
295        "//executorch/exir:lib",
296        "//executorch/exir/passes:quant_fusion_pass",
297    ],
298)
299
300python_unittest(
301    name = "quantization",
302    srcs = [
303        "test_quantization.py",
304    ],
305    preload_deps = [
306        "//executorch/kernels/quantized:custom_ops_generated_lib",
307    ],
308    deps = [
309        "fbsource//third-party/pypi/expecttest:expecttest",  # @manual
310        "//caffe2:torch",
311        "//executorch/exir:lib",
312        "//executorch/exir/passes:quant_fusion_pass",
313        "//executorch/exir/passes:spec_prop_pass",
314        "//pytorch/vision:torchvision",
315    ],
316)
317
318python_unittest(
319    name = "capture",
320    srcs = [
321        "test_capture.py",
322    ],
323    # Static listing does not support tests generated in runtime.
324    supports_static_listing = False,
325    deps = [
326        "fbsource//third-party/pypi/parameterized:parameterized",
327        ":models",
328        "//caffe2:torch",
329        "//executorch/exir:lib",
330    ],
331)
332
333python_unittest(
334    name = "dynamic_shape_propagation",
335    srcs = [
336        "test_dynamic_shape_propagation.py",
337    ],
338    deps = [
339        ":models",
340        "//caffe2:torch",
341        "//executorch/exir:lib",
342        "//executorch/exir/passes:lib",
343    ],
344)
345
346python_unittest(
347    name = "arg_validator",
348    srcs = [
349        "test_arg_validator.py",
350    ],
351    deps = [
352        "//caffe2:torch",
353        "//executorch/exir:lib",
354        "//executorch/exir/dialects:lib",
355        "//executorch/exir/dialects/edge:lib",
356        "//executorch/exir/verification:verifier",
357    ],
358)
359
360python_unittest(
361    name = "dim_order_utils",
362    srcs = [
363        "test_dim_order_utils.py",
364    ],
365    deps = [
366        "//caffe2:torch",
367        "//executorch/exir:dim_order_utils",
368    ],
369)
370
371python_unittest(
372    name = "test_memory_format_ops_pass_aten",
373    srcs = [
374        "test_memory_format_ops_pass_aten.py",
375    ],
376    deps = [
377        ":test_memory_format_ops_pass_utils",
378        "//caffe2:torch",
379        "//executorch/extension/pybindings:aten_lib",  # @manual
380        "//pytorch/vision:torchvision",  # @manual
381    ],
382)
383
384python_unittest(
385    name = "test_memory_format_ops_pass",
386    srcs = [
387        "test_memory_format_ops_pass.py",
388    ],
389    deps = [
390        ":test_memory_format_ops_pass_utils",
391        "//caffe2:torch",
392        "//executorch/exir:dim_order_utils",
393        "//executorch/exir:lib",
394        "//executorch/exir:pass_base",
395        "//executorch/exir/dialects:lib",
396        "//executorch/exir/dialects/edge:lib",
397        "//executorch/extension/pybindings:portable_lib",  # @manual
398        "//pytorch/vision:torchvision",  # @manual
399    ],
400)
401
402python_library(
403    name = "test_memory_format_ops_pass_utils",
404    srcs = [
405        "test_memory_format_ops_pass_utils.py",
406    ],
407    deps = [
408        "//caffe2:torch",
409        "//executorch/backends/xnnpack/partition:xnnpack_partitioner",
410        "//executorch/exir:dim_order_utils",
411        "//executorch/exir:lib",
412        "//executorch/exir/capture:config",
413    ],
414)
415
416python_unittest(
417    name = "print_program",
418    srcs = [
419        "test_print_program.py",
420    ],
421    deps = [
422        "//caffe2:torch",
423        "//executorch/exir:lib",
424        "//executorch/exir:print_program",
425    ],
426)
427
428python_unittest(
429    name = "test_remove_view_copy",
430    srcs = [
431        "test_remove_view_copy.py",
432    ],
433    deps = [
434        "//caffe2:torch",
435        "//executorch/exir:lib",
436        "//executorch/exir:memory",
437        "//executorch/exir/capture:config",
438        "//executorch/exir/passes:lib",
439    ],
440)
441
442python_unittest(
443    name = "warnings",
444    srcs = [
445        "test_warnings.py",
446    ],
447    deps = [
448        "//executorch/exir:_warnings",
449    ],
450)
451
452python_unittest(
453    name = "quantize_io_pass",
454    srcs = [
455        "test_quantize_io_pass.py",
456    ],
457    deps = [
458        "//caffe2:torch",
459        "//executorch/exir:lib",
460        "//executorch/exir/passes:quantize_io_pass",
461    ],
462)
463