1- load ("@fbsource//xplat/executorch/build:runtime_wrapper.bzl" , "runtime" )
1+ load ("@fbsource//xplat/executorch/build:runtime_wrapper.bzl" , "get_aten_mode_options" , " runtime" )
22load ("@fbsource//xplat/executorch/codegen:codegen.bzl" , "et_operator_library" , "executorch_generated_lib" )
33
44def define_common_targets ():
@@ -20,17 +20,18 @@ def define_common_targets():
2020 ],
2121 )
2222
23- runtime .cxx_library (
24- name = "operators_aten" ,
25- srcs = [],
26- visibility = [
27- "//executorch/..." ,
28- "@EXECUTORCH_CLIENTS" ,
29- ],
30- exported_deps = [
31- "//executorch/kernels/portable/cpu:cpu_aten" ,
32- ],
33- )
23+ if True in get_aten_mode_options ():
24+ runtime .cxx_library (
25+ name = "operators_aten" ,
26+ srcs = [],
27+ visibility = [
28+ "//executorch/..." ,
29+ "@EXECUTORCH_CLIENTS" ,
30+ ],
31+ exported_deps = [
32+ "//executorch/kernels/portable/cpu:cpu_aten" ,
33+ ],
34+ )
3435
3536 runtime .export_file (
3637 name = "functions.yaml" ,
@@ -79,9 +80,6 @@ def define_common_targets():
7980 )
8081
8182 generated_lib_common_args = {
82- "custom_ops_aten_kernel_deps" : [
83- "//executorch/kernels/portable:operators_aten" ,
84- ],
8583 "custom_ops_yaml_target" : "//executorch/kernels/portable:custom_ops.yaml" ,
8684 # size_test expects _static targets to be available for these libraries.
8785 "define_static_targets" : True ,
@@ -102,21 +100,22 @@ def define_common_targets():
102100 ** generated_lib_common_args
103101 )
104102
105- executorch_generated_lib (
106- name = "generated_lib_aten" ,
107- deps = [
108- ":executorch_aten_ops" ,
109- ":executorch_custom_ops" ,
110- "//executorch/kernels/portable:operators_aten" ,
111- ],
112- custom_ops_aten_kernel_deps = [
113- "//executorch/kernels/portable:operators_aten" ,
114- ],
115- custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml" ,
116- aten_mode = True ,
117- visibility = [
118- "//executorch/..." ,
119- "@EXECUTORCH_CLIENTS" ,
120- ],
121- define_static_targets = True ,
122- )
103+ if True in get_aten_mode_options ():
104+ executorch_generated_lib (
105+ name = "generated_lib_aten" ,
106+ deps = [
107+ ":executorch_aten_ops" ,
108+ ":executorch_custom_ops" ,
109+ "//executorch/kernels/portable:operators_aten" ,
110+ ],
111+ custom_ops_aten_kernel_deps = [
112+ "//executorch/kernels/portable:operators_aten" ,
113+ ],
114+ custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml" ,
115+ aten_mode = True ,
116+ visibility = [
117+ "//executorch/..." ,
118+ "@EXECUTORCH_CLIENTS" ,
119+ ],
120+ define_static_targets = True ,
121+ )
0 commit comments