1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 2load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib") 3load("@fbsource//xplat/executorch/kernels/portable:op_registration_util.bzl", "define_op_target", "op_target") 4 5MY_ATEN_COMPLIANT_OPS = ( 6 op_target( 7 name = "op_relu", 8 deps = [ 9 "//executorch/runtime/core/exec_aten/util:scalar_type_util", 10 "//executorch/runtime/core/exec_aten/util:tensor_util", 11 ], 12 ), 13) 14 15def define_common_targets(): 16 for op in MY_ATEN_COMPLIANT_OPS: 17 define_op_target(is_aten_op = True, **op) 18 19 all_op_targets = [":{}".format(op["name"]) for op in MY_ATEN_COMPLIANT_OPS] 20 21 runtime.export_file( 22 name = "my_functions.yaml", 23 visibility = ["//executorch/..."], 24 ) 25 26 runtime.cxx_library( 27 name = "my_operators", 28 srcs = [], 29 visibility = [ 30 "//executorch/...", 31 "@EXECUTORCH_CLIENTS", 32 ], 33 exported_deps = all_op_targets, 34 ) 35 36 et_operator_library( 37 name = "my_ops_list", 38 _is_external_target = True, 39 ops_schema_yaml_target = ":my_functions.yaml", 40 ) 41 42 executorch_generated_lib( 43 name = "generated_lib", 44 deps = [ 45 ":my_ops_list", 46 ":my_operators", 47 ], 48 functions_yaml_target = ":my_functions.yaml", 49 define_static_targets = True, 50 ) 51