|
| 1 | +load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native") |
| 2 | +load(":compute_api_tests.bzl", "define_compute_api_test_targets") |
| 3 | +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") |
| 4 | +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") |
| 5 | + |
| 6 | +def define_common_targets(is_fbcode = False): |
| 7 | + """Combined fbcode + xplat targets for backends/vulkan/test.""" |
| 8 | + if is_fbcode: |
| 9 | + python_unittest( |
| 10 | + name = "test_vulkan_delegate", |
| 11 | + srcs = [ |
| 12 | + "test_vulkan_delegate.py", |
| 13 | + ], |
| 14 | + preload_deps = [ |
| 15 | + "fbsource//third-party/swiftshader/lib/linux-x64:libvk_swiftshader_fbcode", |
| 16 | + "//executorch/backends/vulkan:vulkan_backend_lib", |
| 17 | + "//executorch/kernels/portable:custom_ops_generated_lib", |
| 18 | + ], |
| 19 | + deps = [ |
| 20 | + ":test_utils", |
| 21 | + "//caffe2:torch", |
| 22 | + "//executorch/backends/transforms:convert_dtype_pass", |
| 23 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 24 | + "//executorch/backends/vulkan/partitioner:vulkan_partitioner", |
| 25 | + "//executorch/exir:lib", |
| 26 | + "//executorch/extension/pybindings:portable_lib", # @manual |
| 27 | + "//executorch/extension/pytree:pylib", |
| 28 | + "//executorch/kernels/portable:custom_ops_generated_lib", |
| 29 | + ], |
| 30 | + ) |
| 31 | + |
| 32 | + python_unittest( |
| 33 | + name = "test_vulkan_passes", |
| 34 | + srcs = [ |
| 35 | + "test_vulkan_passes.py", |
| 36 | + ], |
| 37 | + deps = [ |
| 38 | + "//caffe2:torch", |
| 39 | + "//executorch/backends/vulkan/_passes:vulkan_passes", |
| 40 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 41 | + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", |
| 42 | + "//pytorch/ao:torchao", # @manual |
| 43 | + ] |
| 44 | + ) |
| 45 | + |
| 46 | + python_unittest( |
| 47 | + name = "test_vulkan_delegate_header", |
| 48 | + srcs = [ |
| 49 | + "test_vulkan_delegate_header.py", |
| 50 | + ], |
| 51 | + deps = [ |
| 52 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 53 | + ], |
| 54 | + ) |
| 55 | + |
| 56 | + python_unittest( |
| 57 | + name = "test_vulkan_compile_options", |
| 58 | + srcs = [ |
| 59 | + "test_vulkan_compile_options.py", |
| 60 | + ], |
| 61 | + deps = [ |
| 62 | + "//caffe2:torch", |
| 63 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 64 | + "//executorch/backends/vulkan/partitioner:vulkan_partitioner", |
| 65 | + "//executorch/exir/_serialize:lib", |
| 66 | + "//executorch/exir:lib", |
| 67 | + ], |
| 68 | + ) |
| 69 | + |
| 70 | + python_unittest( |
| 71 | + name = "test_serialization", |
| 72 | + srcs = [ |
| 73 | + "test_serialization.py", |
| 74 | + ], |
| 75 | + deps = [ |
| 76 | + "//caffe2:torch", |
| 77 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 78 | + ], |
| 79 | + ) |
| 80 | + |
| 81 | + python_unittest( |
| 82 | + name = "test_vulkan_tensor_repr", |
| 83 | + srcs = [ |
| 84 | + "test_vulkan_tensor_repr.py", |
| 85 | + ], |
| 86 | + deps = [ |
| 87 | + "//caffe2:torch", |
| 88 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 89 | + ], |
| 90 | + ) |
| 91 | + |
| 92 | + runtime.python_library( |
| 93 | + name = "tester", |
| 94 | + srcs = ["tester.py"], |
| 95 | + deps = [ |
| 96 | + "//executorch/backends/vulkan/partitioner:vulkan_partitioner", |
| 97 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 98 | + ] |
| 99 | + ) |
| 100 | + |
| 101 | + runtime.python_library( |
| 102 | + name = "test_utils", |
| 103 | + srcs = [ |
| 104 | + "utils.py", |
| 105 | + ], |
| 106 | + deps = [ |
| 107 | + "//caffe2:torch", |
| 108 | + "//executorch/backends/vulkan:vulkan_preprocess", |
| 109 | + "//executorch/backends/vulkan/partitioner:vulkan_partitioner", |
| 110 | + "//executorch/backends/xnnpack:xnnpack_preprocess", |
| 111 | + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", |
| 112 | + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", |
| 113 | + "//executorch/devtools:lib", |
| 114 | + "//executorch/devtools/bundled_program/serialize:lib", |
| 115 | + "//executorch/exir:lib", |
| 116 | + "//executorch/extension/pybindings:portable_lib", # @manual |
| 117 | + "//executorch/extension/pytree:pylib", |
| 118 | + ], |
| 119 | + ) |
| 120 | + else: |
| 121 | + fb_native.filegroup( |
| 122 | + name = "test_shaders", |
| 123 | + srcs = glob([ |
| 124 | + "glsl/*", |
| 125 | + ]), |
| 126 | + visibility = [ |
| 127 | + "PUBLIC", |
| 128 | + ], |
| 129 | + ) |
| 130 | + |
| 131 | + define_compute_api_test_targets() |
0 commit comments