diff --git a/kernels/aten/targets.bzl b/kernels/aten/targets.bzl index 2e007a16d7e..7d6d098793c 100644 --- a/kernels/aten/targets.bzl +++ b/kernels/aten/targets.bzl @@ -10,18 +10,12 @@ def define_common_targets(): runtime.export_file( name = "functions.yaml", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.export_file( name = "edge_dialect_aten_op.yaml", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) et_operator_library( @@ -33,10 +27,7 @@ def define_common_targets(): runtime.cxx_library( name = "operators_edge_dialect_aten", srcs = [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/kernels/aten/cpu:cpu", ], @@ -61,8 +52,5 @@ def define_common_targets(): custom_ops_yaml_target = "//executorch/kernels/aten:edge_dialect_aten_op.yaml", define_static_targets = True, custom_ops_requires_aot_registration = False, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/kernels/optimized/cpu/targets.bzl b/kernels/optimized/cpu/targets.bzl index b5fbff3021e..78bbecd9e2c 100644 --- a/kernels/optimized/cpu/targets.bzl +++ b/kernels/optimized/cpu/targets.bzl @@ -25,7 +25,7 @@ def define_common_targets(): name = "add_sub_impl", srcs = [], exported_headers = ["op_add_sub_impl.h"], - visibility = ["//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS",], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/kernels/portable/cpu/util:broadcast_indexes_range", @@ -39,7 +39,7 @@ def define_common_targets(): name = "fft_utils", srcs = [], exported_headers = ["fft_utils.h"], - visibility = ["//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS",], + visibility = ["PUBLIC"], exported_deps = [] if runtime.is_oss else ["fbsource//third-party/pocket_fft:pocketfft"], ) @@ -47,7 +47,7 @@ def define_common_targets(): name = "binary_ops", srcs = ["binary_ops.cpp"], exported_headers = ["binary_ops.h"], - visibility = ["//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS",], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core/exec_aten:lib", "//executorch/runtime/kernel:kernel_includes", @@ -68,7 +68,7 @@ def define_common_targets(): name = "moments_utils", srcs = [], exported_headers = ["moments_utils.h"], - visibility = ["//executorch/kernels/optimized/...", "@EXECUTORCH_CLIENTS",], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch", "//executorch/kernels/optimized:libvec", @@ -80,11 +80,11 @@ def define_common_targets(): runtime.filegroup( name = "optimized_source_files", srcs = native.glob(["*.cpp"]), - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.filegroup( name = "optimized_header_files", srcs = native.glob(["*.h"]), - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) diff --git a/kernels/optimized/lib_defs.bzl b/kernels/optimized/lib_defs.bzl index 7cb18009687..928fc44635d 100644 --- a/kernels/optimized/lib_defs.bzl +++ b/kernels/optimized/lib_defs.bzl @@ -127,10 +127,7 @@ def define_libs(is_fbcode=False): "vec/**/*.h", ]), header_namespace = "executorch/kernels/optimized", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch", ], @@ -157,10 +154,7 @@ def define_libs(is_fbcode=False): "utils/**/*.h", ]), header_namespace = "executorch/kernels/optimized", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ # Needed to access the ET_INLINE macro "//executorch/runtime/platform:compiler", @@ -222,10 +216,7 @@ def define_libs(is_fbcode=False): "DEFAULT": ["-Os"], }), header_namespace = "executorch/kernels/optimized", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], preprocessor_flags = get_preprocessor_flags(), fbobjc_exported_preprocessor_flags = [ "-DET_BUILD_WITH_BLAS", diff --git a/kernels/optimized/targets.bzl b/kernels/optimized/targets.bzl index c655cb149a3..7c4d6a5246a 100644 --- a/kernels/optimized/targets.bzl +++ b/kernels/optimized/targets.bzl @@ -13,19 +13,13 @@ def define_common_targets(is_fbcode=False): runtime.export_file( name = "optimized.yaml", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( name = "optimized_operators", srcs = [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/kernels/optimized/cpu:cpu_optimized", ], @@ -34,9 +28,7 @@ def define_common_targets(is_fbcode=False): et_operator_library( name = "optimized_oplist", ops_schema_yaml_target = ":optimized.yaml", - visibility = [ - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # Used mainly for operator testing. In practice, a generated lib specific @@ -50,8 +42,5 @@ def define_common_targets(is_fbcode=False): ], functions_yaml_target = ":optimized.yaml", define_static_targets = True, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/kernels/portable/cpu/pattern/targets.bzl b/kernels/portable/cpu/pattern/targets.bzl index 636c5d2127b..5df8fde3738 100644 --- a/kernels/portable/cpu/pattern/targets.bzl +++ b/kernels/portable/cpu/pattern/targets.bzl @@ -18,7 +18,7 @@ def define_common_targets(): "//executorch/kernels/portable/cpu/pattern:comparison_op", "//executorch/kernels/portable/cpu/pattern:logical_op" ], - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( diff --git a/kernels/portable/cpu/targets.bzl b/kernels/portable/cpu/targets.bzl index 83e8219402f..7df77570450 100644 --- a/kernels/portable/cpu/targets.bzl +++ b/kernels/portable/cpu/targets.bzl @@ -47,11 +47,7 @@ def define_common_targets(): ], srcs = [], exported_headers = ["vec_ops.h"], - visibility = [ - "//executorch/kernels/portable/...", - "//executorch/kernels/quantized/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # Only for use by targets in this directory. Defines constants like M_PI @@ -62,9 +58,7 @@ def define_common_targets(): exported_headers = [ "math_constants.h", ], - visibility = [ - "//executorch/kernels/portable/...", "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # Only for use by targets in this directory. @@ -72,13 +66,7 @@ def define_common_targets(): name = "scalar_utils", srcs = [], exported_headers = ["scalar_utils.h", "selective_build.h"], - visibility = [ - "//executorch/kernels/fb/...", - "//executorch/kernels/optimized/cpu/...", - "//executorch/kernels/portable/cpu/...", - "//executorch/kernels/portable/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], deps = [ "//executorch/runtime/core/exec_aten/util:scalar_type_util", ], @@ -91,11 +79,11 @@ def define_common_targets(): runtime.filegroup( name = "portable_source_files", srcs = native.glob(["*.cpp"]), - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.filegroup( name = "portable_header_files", srcs = native.glob(["*.h"]), - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) diff --git a/kernels/portable/cpu/util/targets.bzl b/kernels/portable/cpu/util/targets.bzl index 9c7f8d27111..1fd1e61ee8d 100644 --- a/kernels/portable/cpu/util/targets.bzl +++ b/kernels/portable/cpu/util/targets.bzl @@ -38,7 +38,7 @@ def define_common_targets(): "//executorch/kernels/portable/cpu/util:vectorized_math", "//executorch/kernels/portable/cpu/util:grid_sampler_2d_util", ], - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -88,7 +88,7 @@ def define_common_targets(): "//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string", "//executorch/runtime/core/exec_aten/util:tensor_util", ], - visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -101,7 +101,7 @@ def define_common_targets(): deps = [ "//executorch/runtime/kernel:kernel_includes", ], - visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -124,7 +124,7 @@ def define_common_targets(): deps = [ "//executorch/runtime/kernel:kernel_includes", ], - visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -139,7 +139,7 @@ def define_common_targets(): "//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string", "//executorch/runtime/kernel:kernel_includes", ], - visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/optimized/cpu/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -262,7 +262,7 @@ def define_common_targets(): "//executorch/runtime/core/exec_aten/util:tensor_util", ":broadcast_util", ], - visibility = ["//executorch/kernels/portable/cpu/...", "//executorch/kernels/quantized/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -308,7 +308,7 @@ def define_common_targets(): exported_deps = [ "//executorch/runtime/kernel:kernel_includes", ], - visibility = ["//executorch/kernels/portable/cpu/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -328,10 +328,7 @@ def define_common_targets(): "//executorch/runtime/core/exec_aten:lib", "//executorch/runtime/core/exec_aten/util:tensor_dimension_limit", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -369,12 +366,7 @@ def define_common_targets(): "//executorch/extension/threadpool:threadpool", ], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], - visibility = [ - "//executorch/extension/llm/custom_ops/...", - "//executorch/kernels/portable/cpu/...", - "//executorch/kernels/quantized/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( diff --git a/kernels/portable/targets.bzl b/kernels/portable/targets.bzl index 759e5c96ae8..2c6e0b5c35f 100644 --- a/kernels/portable/targets.bzl +++ b/kernels/portable/targets.bzl @@ -11,10 +11,7 @@ def define_common_targets(): runtime.cxx_library( name = "operators", srcs = [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/kernels/portable/cpu:cpu", ], @@ -24,10 +21,7 @@ def define_common_targets(): runtime.cxx_library( name = "operators_aten", srcs = [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/kernels/portable/cpu:cpu_aten", ], @@ -35,48 +29,33 @@ def define_common_targets(): runtime.export_file( name = "functions.yaml", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.export_file( name = "custom_ops.yaml", - visibility = [ - "//executorch/codegen/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) et_operator_library( name = "executorch_all_ops", include_all_operators = True, define_static_targets = True, - visibility = [ - "//executorch/codegen/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) et_operator_library( name = "executorch_aten_ops", ops_schema_yaml_target = "//executorch/kernels/portable:functions.yaml", define_static_targets = True, - visibility = [ - "//executorch/codegen/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) et_operator_library( name = "executorch_custom_ops", ops_schema_yaml_target = "//executorch/kernels/portable:custom_ops.yaml", define_static_targets = True, - visibility = [ - "//executorch/codegen/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) generated_lib_common_args = { @@ -84,10 +63,7 @@ def define_common_targets(): # size_test expects _static targets to be available for these libraries. "define_static_targets": True, "functions_yaml_target": "//executorch/kernels/portable:functions.yaml", - "visibility": [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + "visibility": ["PUBLIC"], } executorch_generated_lib( @@ -113,9 +89,6 @@ def define_common_targets(): ], custom_ops_yaml_target = "//executorch/kernels/portable:custom_ops.yaml", aten_mode = True, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], define_static_targets = True, ) diff --git a/kernels/portable/test/TARGETS b/kernels/portable/test/TARGETS index b659d6c093b..44c5697729e 100644 --- a/kernels/portable/test/TARGETS +++ b/kernels/portable/test/TARGETS @@ -13,10 +13,7 @@ runtime.cxx_library( srcs = [ "register_ops_aot_for_test.cpp", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], deps = [ "//executorch/extension/aten_util:aten_bridge", "//executorch/kernels/portable/cpu:op_grid_sampler_2d", diff --git a/kernels/prim_ops/targets.bzl b/kernels/prim_ops/targets.bzl index eea66c1afa7..1750eb5c34c 100644 --- a/kernels/prim_ops/targets.bzl +++ b/kernels/prim_ops/targets.bzl @@ -11,13 +11,13 @@ def define_common_targets(): runtime.filegroup( name = "prim_ops_sources", srcs = ["register_prim_ops.cpp"], - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) runtime.filegroup( name = "selective_build_prim_ops.h", srcs = ["selective_build_prim_ops.h"], - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], ) for aten_mode in get_aten_mode_options(): @@ -28,10 +28,7 @@ def define_common_targets(): srcs = ["et_copy_index.cpp"], # To allow for selective prim ops to depend on this library. # Used by selective_build.bzl - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_headers = ["et_copy_index.h"], deps = [ "//executorch/runtime/kernel:kernel_includes" + aten_suffix, @@ -48,10 +45,7 @@ def define_common_targets(): srcs = ["et_view.cpp"], # To allow for selective prim ops to depend on this library. # Used by selective_build.bzl - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_headers = ["et_view.h"], deps = [ "//executorch/runtime/kernel:kernel_includes" + aten_suffix, @@ -66,10 +60,7 @@ def define_common_targets(): runtime.cxx_library( name = "prim_ops_registry" + aten_suffix, srcs = ["register_prim_ops.cpp"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # @lint-ignore BUCKLINT link_whole, need this to register prim ops. link_whole = True, # prim ops are registered through a global table so the ctor needs to be allowed diff --git a/kernels/quantized/targets.bzl b/kernels/quantized/targets.bzl index 3448fd9c603..86fe81e2d58 100644 --- a/kernels/quantized/targets.bzl +++ b/kernels/quantized/targets.bzl @@ -4,9 +4,7 @@ load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", " def define_common_targets(): runtime.export_file( name = "quantized.yaml", - visibility = [ - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # Excluding embedding_byte ops because we choose to define them @@ -35,7 +33,7 @@ def define_common_targets(): exir_custom_ops_aot_lib( name = "custom_ops_generated_lib", yaml_target = ":quantized.yaml", - visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"], + visibility = ["PUBLIC"], kernels = [":quantized_operators_aten"], deps = [ ":quantized_ops_need_aot_registration", @@ -47,10 +45,7 @@ def define_common_targets(): exir_custom_ops_aot_lib( name = "aot_lib", yaml_target = ":quantized.yaml", - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], kernels = [":quantized_operators_aten"], deps = [ ":quantized_ops_need_aot_registration", @@ -61,10 +56,7 @@ def define_common_targets(): name = "all_quantized_ops", ops_schema_yaml_target = ":quantized.yaml", define_static_targets = True, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # On Windows we can only compile these two ops currently, so adding a @@ -87,10 +79,7 @@ def define_common_targets(): runtime.cxx_library( name = "quantized_operators" + aten_suffix, srcs = [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/kernels/quantized/cpu:quantized_cpu" + aten_suffix, ], @@ -110,10 +99,7 @@ def define_common_targets(): custom_ops_requires_aot_registration = False, aten_mode = aten_mode, support_exceptions = support_exceptions, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], define_static_targets = True, ) @@ -131,10 +117,7 @@ def define_common_targets(): ":q_dq_ops", ], support_exceptions = support_exceptions, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.python_library( @@ -143,8 +126,5 @@ def define_common_targets(): deps = [ "//caffe2:torch", ], - visibility = [ - "//executorch/kernels/quantized/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/kernels/quantized/test/TARGETS b/kernels/quantized/test/TARGETS index a820e3da3fa..16cf19a6bdd 100644 --- a/kernels/quantized/test/TARGETS +++ b/kernels/quantized/test/TARGETS @@ -25,10 +25,7 @@ runtime.cxx_library( srcs = [ "quantized_ops_aot_register.cpp", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], deps = [ "//executorch/extension/aten_util:aten_bridge", "//executorch/kernels/quantized/cpu:op_dequantize", diff --git a/kernels/test/custom_kernel_example/targets.bzl b/kernels/test/custom_kernel_example/targets.bzl index 767fabcbac8..8f038b5cda3 100644 --- a/kernels/test/custom_kernel_example/targets.bzl +++ b/kernels/test/custom_kernel_example/targets.bzl @@ -26,10 +26,7 @@ def define_common_targets(): runtime.cxx_library( name = "my_operators", srcs = [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = all_op_targets, ) diff --git a/kernels/test/targets.bzl b/kernels/test/targets.bzl index bc949e0dfdb..ad36c81c63e 100644 --- a/kernels/test/targets.bzl +++ b/kernels/test/targets.bzl @@ -24,10 +24,7 @@ def define_common_targets(): exported_headers=[ "TestUtil.h", ], - visibility = [ - "//executorch/kernels/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_kernel else [], exported_deps = [ "//executorch/runtime/core:core", @@ -53,10 +50,7 @@ def define_common_targets(): "ScalarOverflowTestMacros.h", "UnaryUfuncRealHBBF16ToFloatHBF16Test.h", ], - visibility = [ - "//executorch/kernels/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_kernel else [], exported_deps = [ ":supported_features_header", @@ -151,10 +145,7 @@ def define_common_targets(): runtime.filegroup( name = "test_srcs", srcs = TEST_SRCS, - visibility = [ - "//executorch/kernels/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.genrule( @@ -163,10 +154,7 @@ def define_common_targets(): cmd = "cp $(location :test_srcs)/* $OUT", outs = {f: [f] for f in TEST_SRCS}, default_outs = ["."], - visibility = [ - "//executorch/kernels/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) codegen_function_header_wrapper("executorch/kernels/aten", "aten") diff --git a/runtime/TARGETS b/runtime/TARGETS index 7448523f5ff..9f8f1b9783a 100644 --- a/runtime/TARGETS +++ b/runtime/TARGETS @@ -8,8 +8,5 @@ runtime.python_library( deps = [ "//executorch/extension/pybindings:portable_lib", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/backend/targets.bzl b/runtime/backend/targets.bzl index 1d1f95c6c97..606ae324e37 100644 --- a/runtime/backend/targets.bzl +++ b/runtime/backend/targets.bzl @@ -22,10 +22,7 @@ def define_common_targets(): "interface.h", ], preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:evalue" + aten_suffix, diff --git a/runtime/core/exec_aten/targets.bzl b/runtime/core/exec_aten/targets.bzl index 9114be639c0..df4a87ef033 100644 --- a/runtime/core/exec_aten/targets.bzl +++ b/runtime/core/exec_aten/targets.bzl @@ -15,10 +15,7 @@ def define_common_targets(): name = "lib" + aten_suffix, exported_headers = ["exec_aten.h"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = ["//executorch/runtime/core:tensor_shape_dynamism"] + ([] if aten_mode else ["//executorch/runtime/core/portable_type:portable_type"]), exported_external_deps = ["libtorch"] if aten_mode else [], ) diff --git a/runtime/core/exec_aten/testing_util/targets.bzl b/runtime/core/exec_aten/testing_util/targets.bzl index e5ebdc8788a..fa259b41f84 100644 --- a/runtime/core/exec_aten/testing_util/targets.bzl +++ b/runtime/core/exec_aten/testing_util/targets.bzl @@ -16,26 +16,7 @@ def define_common_targets(): "tensor_util.h", "tensor_factory.h", ], - visibility = [ - # Be strict with the visibility so that operator implementations - # under //executorch/kernels/... can't depend on this test-only - # target. It's ok to add any //executorch/*/test/... path to this - # list. - "//executorch/runtime/core/exec_aten/util/test/...", - "//executorch/runtime/core/exec_aten/testing_util/test/...", - "//executorch/runtime/core/portable_type/test/...", - "//executorch/kernels/prim_ops/test/...", - "//executorch/kernels/portable/test/...", - "//executorch/kernels/portable/cpu/util/test/...", - "//executorch/kernels/quantized/test/...", - "//executorch/kernels/optimized/test/...", - "//executorch/kernels/test/...", - "//executorch/kernels/fb/custom_ops/...", - "//executorch/runtime/core/test/...", - "//executorch/test/...", - "//executorch/extension/kernel_util/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], compiler_flags = ["-Wno-unneeded-internal-declaration"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], exported_deps = [ diff --git a/runtime/core/exec_aten/util/targets.bzl b/runtime/core/exec_aten/util/targets.bzl index 9ec2310250c..ffdfa4f1040 100644 --- a/runtime/core/exec_aten/util/targets.bzl +++ b/runtime/core/exec_aten/util/targets.bzl @@ -23,10 +23,7 @@ def define_common_targets(): exported_headers = [ "scalar_type_util.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = exported_preprocessor_flags_, exported_deps = exported_deps_, exported_external_deps = ["libtorch"] if aten_mode else [], @@ -42,10 +39,7 @@ def define_common_targets(): "//executorch/runtime/core:core", "//executorch/runtime/core/portable_type/c10/c10:c10", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], ) @@ -55,10 +49,7 @@ def define_common_targets(): exported_headers = [ "tensor_util.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [], exported_deps = [ ":tensor_dimension_limit", @@ -84,17 +75,11 @@ def define_common_targets(): "//executorch/runtime/core/exec_aten/util:tensor_dimension_limit", ], exported_headers = ["tensor_shape_to_c_string.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( name = "tensor_dimension_limit", exported_headers = ["tensor_dimension_limit.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/core/portable_type/c10/c10/targets.bzl b/runtime/core/portable_type/c10/c10/targets.bzl index 6b61f45d7d4..33a558085b7 100644 --- a/runtime/core/portable_type/c10/c10/targets.bzl +++ b/runtime/core/portable_type/c10/c10/targets.bzl @@ -61,11 +61,7 @@ def define_common_targets(): runtime.cxx_library( name = "aten_headers_for_executorch", srcs = [], - visibility = [ - "//executorch/kernels/optimized/...", - "//executorch/kernels/portable/cpu/util/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # select() on ovr_config//runtime:fbcode does not work # properly in all cases. I have seen # //xplat/executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch @@ -124,10 +120,7 @@ def define_common_targets(): "-DC10_USE_GLOG", "-DC10_USE_MINIMAL_GLOG", ]), - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core/portable_type/c10/torch/headeronly:torch_headeronly", ] + select({ @@ -142,8 +135,5 @@ def define_common_targets(): runtime.cxx_library( name = "c10", exported_deps = [":aten_headers_for_executorch"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/core/targets.bzl b/runtime/core/targets.bzl index e8240135a69..2c13cdbdae3 100644 --- a/runtime/core/targets.bzl +++ b/runtime/core/targets.bzl @@ -50,10 +50,7 @@ def define_common_targets(): "result.h", "span.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = get_core_flags(), exported_deps = [ "//executorch/runtime/core/portable_type/c10/c10:c10", @@ -82,10 +79,7 @@ def define_common_targets(): ":core", "//executorch/runtime/core/portable_type/c10/c10:c10", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) for aten_mode in get_aten_mode_options(): @@ -96,10 +90,7 @@ def define_common_targets(): "evalue.h", ], srcs = ["evalue.cpp"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ ":core", ":tag", @@ -114,10 +105,7 @@ def define_common_targets(): "event_tracer_hooks.h", "event_tracer_hooks_delegate.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_preprocessor_flags = get_event_tracer_flags() + get_sdk_flags(), exported_deps = [ "//executorch/runtime/platform:platform", @@ -130,10 +118,7 @@ def define_common_targets(): exported_headers = [ "named_data_map.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ ":tensor_layout" + aten_suffix, "//executorch/runtime/core/exec_aten:lib" + aten_suffix, diff --git a/runtime/core/testing_util/targets.bzl b/runtime/core/testing_util/targets.bzl index 40ced267915..dbab5977d67 100644 --- a/runtime/core/testing_util/targets.bzl +++ b/runtime/core/testing_util/targets.bzl @@ -15,10 +15,7 @@ def define_common_targets(): exported_headers = [ "error_matchers.h", ], - visibility = [ - "//executorch/runtime/core/testing_util/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_external_deps = [ "gmock", ], diff --git a/runtime/executor/targets.bzl b/runtime/executor/targets.bzl index 103ea299c34..28defd6ab11 100644 --- a/runtime/executor/targets.bzl +++ b/runtime/executor/targets.bzl @@ -37,10 +37,7 @@ def define_common_targets(): exported_deps = [ "//executorch/runtime/core:memory_allocator", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) @@ -55,10 +52,7 @@ def define_common_targets(): exported_headers = [ "pte_data_map.h", ], - visibility = [ - "//executorch/runtime/executor/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:named_data_map" + aten_suffix, @@ -86,10 +80,7 @@ def define_common_targets(): ":program_no_prim_ops" + aten_suffix, "//executorch/kernels/prim_ops:prim_ops_registry" + aten_suffix, ], - visibility = [ - "//executorch/runtime/executor/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) runtime.cxx_library( @@ -132,8 +123,5 @@ def define_common_targets(): "//executorch/schema:program", "//executorch/runtime/core/exec_aten/util:tensor_dimension_limit" ], - visibility = [ - "//executorch/runtime/executor/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/runtime/executor/test/targets.bzl b/runtime/executor/test/targets.bzl index 1174b01f42b..0fac69b6a48 100644 --- a/runtime/executor/test/targets.bzl +++ b/runtime/executor/test/targets.bzl @@ -81,11 +81,7 @@ def define_common_targets(is_fbcode = False): exported_headers = [ "managed_memory_manager.h", ], - visibility = [ - "//executorch/runtime/executor/test/...", - "//executorch/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], deps = [ "//executorch/runtime/core:memory_allocator", "//executorch/runtime/executor:memory_manager", diff --git a/runtime/kernel/targets.bzl b/runtime/kernel/targets.bzl index 92e30016f42..123dc1ac8da 100644 --- a/runtime/kernel/targets.bzl +++ b/runtime/kernel/targets.bzl @@ -28,10 +28,7 @@ def define_common_targets(): name = "operator_registry_MAX_NUM_KERNELS_TEST_ONLY", srcs = ["operator_registry.cpp"], exported_headers = ["operator_registry.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:evalue", @@ -60,10 +57,7 @@ def define_common_targets(): name = "operator_registry" + aten_suffix, srcs = ["operator_registry.cpp"], exported_headers = ["operator_registry.h"], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/core:evalue" + aten_suffix, @@ -76,12 +70,7 @@ def define_common_targets(): exported_headers = [ "kernel_runtime_context.h", ], - visibility = [ - "//executorch/kernels/...", - "//executorch/runtime/executor/...", - "//executorch/runtime/kernel/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ "//executorch/runtime/core:core", "//executorch/runtime/platform:platform", @@ -98,12 +87,7 @@ def define_common_targets(): exported_headers = [ "kernel_includes.h", ], - visibility = [ - "//executorch/runtime/kernel/...", - "//executorch/kernels/...", - "//executorch/kernels/prim_ops/...", # Prim kernels - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], exported_deps = [ ":kernel_runtime_context" + aten_suffix, "//executorch/runtime/core/exec_aten:lib" + aten_suffix, diff --git a/runtime/platform/targets.bzl b/runtime/platform/targets.bzl index 457deed531e..65d92b134d6 100644 --- a/runtime/platform/targets.bzl +++ b/runtime/platform/targets.bzl @@ -81,10 +81,7 @@ def define_common_targets(): ":compiler", ":platform_private", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # WARNING: using a deprecated API to avoid being built into a shared # library. In the case of dynamically loading so library we don't want # it to depend on other so libraries because that way we have to @@ -110,10 +107,7 @@ def define_common_targets(): "ovr_config//os:macos": ["-DET_USE_LIBDL"], }, ), - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) # Common compiler directives such as 'unlikely' or 'deprecated' @@ -122,8 +116,5 @@ def define_common_targets(): exported_headers = [ "compiler.h", ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], ) diff --git a/shim_et/xplat/executorch/build/runtime_wrapper.bzl b/shim_et/xplat/executorch/build/runtime_wrapper.bzl index 16a204aafc5..f03ddc6c76d 100644 --- a/shim_et/xplat/executorch/build/runtime_wrapper.bzl +++ b/shim_et/xplat/executorch/build/runtime_wrapper.bzl @@ -184,17 +184,7 @@ def _patch_kwargs_common(kwargs): """ env.remove_unsupported_kwargs(kwargs) - # Be careful about dependencies on executorch targets for now, so that we - # don't pick up unexpected clients while things are still in flux. - if not kwargs.pop("_is_external_target", False): - for target in kwargs.get("visibility", []): - if not (target == "PUBLIC" or target.startswith("//executorch") or target.startswith("//pytorch/tokenizers") or target.startswith("@")): - fail("Please manage all external visibility using the " + - "EXECUTORCH_CLIENTS list in " + - "//executorch/build/fb/clients.bzl. " + - "Found external visibility target \"{}\".".format(target)) - else: - kwargs.pop("_is_external_target", None) + kwargs.pop("_is_external_target", False) # Convert `[exported_]external_deps` entries into real deps if necessary. _resolve_external_deps(kwargs) diff --git a/shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl b/shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl index 345794151a4..bc43688b04e 100644 --- a/shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl +++ b/shim_et/xplat/executorch/kernels/optimized/op_registration_util.bzl @@ -92,13 +92,7 @@ def define_op_library(name, compiler_flags, deps): srcs = [ "{}.cpp".format(name), ], - visibility = [ - "//executorch/kernels/portable/test/...", - "//executorch/kernels/quantized/test/...", - "//executorch/kernels/optimized/test/...", - "//executorch/kernels/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], compiler_flags = [ # kernels often have helpers with no prototypes just disabling the warning here as the headers # are codegend and linked in later diff --git a/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl b/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl index 4fc3f9c63e7..e8692072362 100644 --- a/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl +++ b/shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl @@ -116,13 +116,7 @@ def define_op_library(name, deps, android_deps, aten_target, _allow_third_party_ srcs = [ "{}.cpp".format(name), ], - visibility = [ - "//executorch/kernels/portable/test/...", - "//executorch/kernels/quantized/...", - "//executorch/kernels/optimized/test/...", - "//executorch/kernels/test/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # kernels often have helpers with no prototypes just disabling the warning here as the headers # are codegend and linked in later compiler_flags = select({ diff --git a/shim_et/xplat/executorch/kernels/prim_ops/selective_build.bzl b/shim_et/xplat/executorch/kernels/prim_ops/selective_build.bzl index 73421f031ec..4d73e86dfb5 100644 --- a/shim_et/xplat/executorch/kernels/prim_ops/selective_build.bzl +++ b/shim_et/xplat/executorch/kernels/prim_ops/selective_build.bzl @@ -38,10 +38,7 @@ def prim_ops_registry_selective(name, selected_prim_ops_header_target, aten_suff "selective_build_prim_ops.h": ":" + genrule_dep_name + "[selective_build_prim_ops.h]", "selected_prim_ops.h": ":" + genrule_dep_name + "[selected_prim_ops.h]" }, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], + visibility = ["PUBLIC"], # @lint-ignore BUCKLINT link_whole, need this to register prim ops. link_whole = True, # prim ops are registered through a global table so the ctor needs to be allowed