1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 2 3def define_common_targets(): 4 """Defines targets that should be shared between fbcode and xplat. 5 The directory containing this targets.bzl file should also contain both 6 TARGETS and BUCK files that call this function. 7 """ 8 9 runtime.python_library( 10 name = "lib", 11 srcs = [ 12 "__init__.py", 13 ], 14 visibility = [ 15 "//executorch/backends/...", 16 ], 17 deps = [ 18 ":addmm_mm_to_linear", 19 ], 20 ) 21 22 runtime.python_library( 23 name = "addmm_mm_to_linear", 24 srcs = ["addmm_mm_to_linear.py"], 25 visibility = [ 26 "//executorch/backends/...", 27 ], 28 deps = [ 29 "//caffe2:torch", 30 "//executorch/exir:pass_base", 31 "//executorch/exir:sym_util", 32 "//executorch/exir/dialects:lib", 33 ], 34 ) 35 36 runtime.python_library( 37 name = "decompose_sdpa", 38 srcs = ["decompose_sdpa.py"], 39 visibility = [ 40 "//executorch/backends/...", 41 "@EXECUTORCH_CLIENTS", 42 ], 43 deps = [ 44 "//caffe2:torch", 45 "//executorch/exir:pass_base", 46 ], 47 ) 48 49 runtime.python_library( 50 name = "fuse_batch_norm_with_conv", 51 srcs = ["fuse_batch_norm_with_conv.py"], 52 visibility = [ 53 "//executorch/backends/...", 54 ], 55 deps = [ 56 ":utils", 57 "//caffe2:torch", 58 "//executorch/exir:pass_base", 59 "//executorch/exir:sym_util", 60 "//executorch/exir/dialects:lib", 61 ], 62 ) 63 64 runtime.python_library( 65 name = "fuse_conv_with_clamp", 66 srcs = ["fuse_conv_with_clamp.py"], 67 visibility = [ 68 "//executorch/backends/...", 69 ], 70 deps = [ 71 ":utils", 72 "//caffe2:torch", 73 "//executorch/backends/vulkan:custom_ops_lib", 74 "//executorch/exir:pass_base", 75 "//executorch/exir:sym_util", 76 "//executorch/exir/dialects:lib", 77 ], 78 ) 79 80 runtime.python_library( 81 name = "fuse_dequant_linear", 82 srcs = ["fuse_dequant_linear.py"], 83 visibility = [ 84 "//executorch/backends/...", 85 ], 86 deps = [ 87 ":utils", 88 "//caffe2:torch", 89 "//executorch/exir:pass_base", 90 "//executorch/exir:sym_util", 91 "//executorch/exir/dialects:lib", 92 ], 93 ) 94 95 runtime.python_library( 96 name = "view_copy_to_squeeze_unsqueeze", 97 srcs = ["view_copy_to_squeeze_unsqueeze.py"], 98 visibility = [ 99 "//executorch/backends/...", 100 ], 101 deps = [ 102 ":utils", 103 "//caffe2:torch", 104 "//executorch/exir:pass_base", 105 "//executorch/exir/dialects:lib", 106 ], 107 ) 108 109 runtime.python_library( 110 name = "fuse_view_copy", 111 srcs = ["fuse_view_copy.py"], 112 visibility = [ 113 "//executorch/backends/...", 114 ], 115 deps = [ 116 "//caffe2:torch", 117 "//executorch/exir:pass_base", 118 "//executorch/exir/dialects:lib", 119 ], 120 ) 121 122 runtime.python_library( 123 name = "remove_clone_ops", 124 srcs = ["remove_clone_ops.py"], 125 visibility = [ 126 "//executorch/backends/...", 127 ], 128 deps = [ 129 "//caffe2:torch", 130 "//executorch/exir:pass_base", 131 "//executorch/exir/dialects:lib", 132 ], 133 ) 134 135 runtime.python_library( 136 name = "mean_to_sum_div", 137 srcs = ["mean_to_sum_div.py"], 138 visibility = [ 139 "//executorch/backends/...", 140 ], 141 deps = [ 142 "//caffe2:torch", 143 "//executorch/exir:pass_base", 144 "//executorch/exir:sym_util", 145 "//executorch/exir/dialects:lib", 146 ], 147 ) 148 149 runtime.python_library( 150 name = "utils", 151 srcs = ["utils.py"], 152 deps = [ 153 "//caffe2:torch", 154 "//executorch/exir:lib", 155 "//executorch/exir:pass_manager", 156 "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", 157 "//executorch/exir/dialects:lib", 158 "//pytorch/ao:torchao", # @manual 159 ], 160 ) 161 162 runtime.python_library( 163 name = "duplicate_dynamic_quant_chain", 164 srcs = ["duplicate_dynamic_quant_chain.py"], 165 visibility = [ 166 "//executorch/backends/...", 167 "//executorch/examples/...", 168 "//executorch/extension/llm/...", 169 "@EXECUTORCH_CLIENTS", 170 ], 171 deps = [ 172 "//caffe2:torch", 173 ], 174 ) 175 176 runtime.python_library( 177 name = "convert_dtype_pass", 178 srcs = [ 179 "convert_dtype_pass.py", 180 ], 181 visibility = [ 182 "//executorch/backends/...", 183 ], 184 deps = [ 185 "//caffe2:torch", 186 "//executorch/exir:pass_base", 187 ], 188 ) 189 190 runtime.python_test( 191 name = "test_duplicate_dynamic_quant_chain", 192 srcs = [ 193 "test/test_duplicate_dynamic_quant_chain.py", 194 ], 195 deps = [ 196 "fbsource//third-party/pypi/expecttest:expecttest", # @manual 197 ":duplicate_dynamic_quant_chain", 198 "//caffe2:torch", 199 "//executorch/exir:lib", 200 ], 201 ) 202