Automated Code Change

PiperOrigin-RevId: 791034770
This commit is contained in:
Ivo Ristovski List 2025-08-04 21:59:03 -07:00 committed by TensorFlower Gardener
parent 52605bea54
commit 3e006e2862
13 changed files with 42 additions and 32 deletions

View File

@ -2,6 +2,7 @@
# TensorFlow is a computational framework, primarily for use in machine
# learning applications.
load("@rules_cc//cc:cc_import.bzl", "cc_import")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "bool_setting")
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")

View File

@ -14,6 +14,8 @@ tf_library(
)
"""
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load(
"//tensorflow:tensorflow.bzl",
"if_android",
@ -313,7 +315,7 @@ def _tf_library(
# The cc_library rule packaging up the header and object file, and needed
# kernel implementations.
native.cc_library(
cc_library(
name = name,
srcs = [tfcompile_gen_object_files],
hdrs = [header_file],
@ -444,7 +446,7 @@ def _tf_library(
# --copt=-fvisibility=hidden
# --copt=-D_LIBCPP_TYPE_VIS=_LIBCPP_HIDDEN
# --copt=-D_LIBCPP_EXCEPTION_ABI=_LIBCPP_HIDDEN
native.cc_binary(
cc_binary(
name = benchmark_name,
srcs = [benchmark_file],
testonly = testonly,

View File

@ -1,6 +1,7 @@
"""BUILD extension for TF composition project."""
load("@local_xla//third_party/py/rules_pywrap:pywrap.default.bzl", "use_pywrap_rules")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//tensorflow:strict.default.bzl", "py_strict_binary", "py_strict_library")
load("//tensorflow:tensorflow.bzl", "tf_custom_op_library", "tf_gen_op_wrapper_py")
load("//tensorflow:tensorflow.default.bzl", "tf_custom_op_py_library")
@ -53,8 +54,7 @@ def gen_op_libraries(
tools = [":" + gen_op_lib_exec],
tags = tags,
)
native.cc_library(
cc_library(
name = name + "_cc",
testonly = test,
srcs = [":" + registered_op],
@ -126,7 +126,7 @@ def gen_op_libraries(
)
def gen_op_bindings(name):
native.cc_library(
cc_library(
name = name + "_ops_cc",
srcs = [name + "_ops.cc"],
deps = [

View File

@ -1,5 +1,6 @@
"""Definitions for rules to fuzz TensorFlow."""
load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("@rules_python//python:py_test.bzl", "py_test")
# TensorFlow fuzzing can be done in open source too, as it is in oss-fuzz.com
@ -38,7 +39,7 @@ def tf_cc_fuzz_test(
tags = tags + ["manual"]
# Now, redirect to cc_test
native.cc_test(
cc_test(
name = name,
deps = deps + [
"@com_google_fuzztest//fuzztest",

View File

@ -1,6 +1,7 @@
"""BUILD rules for generating flatbuffer files."""
load("@build_bazel_rules_android//android:rules.bzl", "android_library")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_java//java:defs.bzl", "java_library")
load("@rules_python//python:defs.bzl", "py_library")
@ -214,7 +215,7 @@ def flatbuffer_cc_library(
reflection_name = reflection_name,
reflection_visibility = visibility,
)
native.cc_library(
cc_library(
name = name,
hdrs = output_headers,
srcs = output_headers,

View File

@ -2,6 +2,7 @@
load("@com_github_grpc_grpc//bazel:generate_cc.bzl", "generate_cc")
load("@com_github_grpc_grpc//bazel:protobuf.bzl", "well_known_proto_libs")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
def cc_grpc_library(
name,
@ -93,8 +94,7 @@ def cc_grpc_library(
generate_mocks = generate_mocks,
**kwargs
)
native.cc_library(
cc_library(
name = name,
srcs = [":" + codegen_grpc_target],
hdrs = [":" + codegen_grpc_target],

View File

@ -1,5 +1,6 @@
# TODO(b/356020232): remove entire file and all usages after migration is done
load("@python_version_repo//:py_version.bzl", "USE_PYWRAP_RULES")
load("@rules_cc//cc:cc_import.bzl", "cc_import")
load(
"//third_party/py/rules_pywrap:pywrap.impl.bzl",
_pybind_extension = "pybind_extension",
@ -136,7 +137,7 @@ def pywrap_aware_cc_import(name, **kwargs):
if use_pywrap_rules():
pass
else:
native.cc_import(
cc_import(
name = name,
**kwargs
)

View File

@ -1,4 +1,7 @@
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_import.bzl", "cc_import")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_python//python:py_library.bzl", "py_library")
PywrapInfo = provider(
@ -280,8 +283,7 @@ def pywrap_library(
actual_common_deps = common_deps
if pywrap_index >= actual_pywrap_count:
actual_common_deps = common_deps + starlark_only_common_deps
native.cc_binary(
cc_binary(
name = shared_object_name,
srcs = [],
deps = [":%s" % pywrap_name] + actual_common_deps,
@ -383,8 +385,7 @@ def _construct_common_binary(
dependent_common_lib_package,
False,
) + _construct_linkopt_version_script(actual_version_script, False)
native.cc_binary(
cc_binary(
name = linux_binary_name,
deps = deps + ([actual_version_script] if actual_version_script else []),
linkstatic = True,
@ -398,8 +399,7 @@ def _construct_common_binary(
compatible_with = compatible_with,
local_defines = local_defines,
)
native.cc_binary(
cc_binary(
name = win_binary_name,
deps = deps,
linkstatic = True,
@ -423,8 +423,7 @@ def _construct_common_binary(
dependent_common_lib_package,
True,
) + _construct_linkopt_version_script(actual_version_script, True)
native.cc_binary(
cc_binary(
name = darwin_binary_name,
deps = deps + ([actual_version_script] if actual_version_script else []),
linkstatic = True,
@ -458,8 +457,7 @@ def _construct_common_binary(
)
import_name = "%s_import" % name
native.cc_import(
cc_import(
name = import_name,
shared_library = "%s" % name,
interface_library = select({
@ -471,7 +469,7 @@ def _construct_common_binary(
)
cc_lib_name = "%s_cc_library" % name
native.cc_library(
cc_library(
name = cc_lib_name,
deps = [":%s" % import_name],
testonly = testonly,
@ -887,7 +885,7 @@ def python_extension(
# If no wrapping is requested, this target will simply remain unused and
# never compiled
native.cc_library(
cc_library(
name = wrapped_cc_library_name,
deps = cc_library_deps,
srcs = srcs,
@ -905,7 +903,7 @@ def python_extension(
)
cc_library_name = "_%s_cc_library" % name
native.cc_library(
cc_library(
name = cc_library_name,
deps = _if_wrapped_py_init(
wrap_py_init,
@ -979,7 +977,7 @@ def _wrap_cc_select(name, dep_type, deps):
if type(deps) == _SELECT_TYPE:
wrapping_select_target = "_{}_{}".format(name, dep_type)
if dep_type == "deps":
native.cc_library(
cc_library(
name = wrapping_select_target,
deps = deps,
)
@ -1352,7 +1350,7 @@ def _construct_inverse_common_lib_filters(common_lib_filters):
new_common_lib_k = common_lib_v
if type(common_lib_v) == _LIST_TYPE or type(common_lib_v) == _SELECT_TYPE:
new_common_lib_k = "_%s_common_lib_filter" % common_lib_k.rsplit("/", 1)[-1]
native.cc_library(
cc_library(
name = new_common_lib_k,
deps = common_lib_v,
)

View File

@ -17,6 +17,7 @@
# NO_VISIBILITY_DECLARATION=.bzl file is intentionally exported to, e.g., JAX.
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load(
"//third_party/py/rules_pywrap:pywrap.impl.bzl",
"pybind_extension",
@ -45,7 +46,7 @@ def nanobind_pywrap_extension(
# We put the entire contents of the extension in a single cc_library, which will become part of
# the common pywrap library. All the contents of all extensions will end up in the common
# library.
native.cc_library(
cc_library(
name = lib_name,
srcs = srcs,
copts = copts,

View File

@ -582,6 +582,7 @@ bzl_library(
# This .bzl file is only used in OSS and references OSS paths. Therefore it cannot be parsed
# correctly by the parse test in g3.
# copybara:uncomment parse_tests = False,
# copybara:uncomment deps = ["@rules_cc//cc:core_rules"],
)
bzl_library(
@ -600,6 +601,7 @@ bzl_library(
# copybara:uncomment parse_tests = False,
deps = [
":build_config_root_bzl",
# copybara:uncomment "@rules_cc//cc:core_rules",
"//xla/tsl:tsl_bzl",
"@local_xla//third_party/py/rules_pywrap:pywrap_bzl",
],

View File

@ -13,6 +13,8 @@ load(
"if_tsl_link_protobuf",
)
load("@local_xla//xla/tsl/platform:build_config_root.bzl", "if_static")
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_test.bzl", _cc_test = "cc_test")
load("@rules_python//python:py_library.bzl", "py_library")
# IMPORTANT: Do not remove this load statement. We rely on that //xla/tsl doesn't exist in g3
@ -127,7 +129,7 @@ def pyx_library(
for src in pyx_srcs:
stem = src.split(".")[0]
shared_object_name = stem + ".so"
native.cc_binary(
cc_binary(
name = shared_object_name,
srcs = [stem + ".cpp"],
deps = cc_deps + ["@local_xla//third_party/python_runtime:headers"],
@ -471,8 +473,7 @@ def strict_cc_test(
clean_dep("@local_xla//xla/tsl:is_ci_build"): ["--gtest_fail_if_no_test_selected"],
"//conditions:default": [],
})
native.cc_test(
_cc_test(
name = name,
linkstatic = linkstatic,
args = args,

View File

@ -3,6 +3,8 @@
# This file is used in OSS only. It is not transformed by copybara. Therefore all paths in this
# file are OSS paths.
load("@rules_cc//cc:cc_library.bzl", _cc_library = "cc_library")
# IMPORTANT: Do not remove this load statement. We rely on that //xla/tsl doesn't exist in g3
# to prevent g3 .bzl files from loading this file.
load("//xla/tsl:package_groups.bzl", "DEFAULT_LOAD_VISIBILITY")
@ -36,5 +38,4 @@ def cc_library(name, deps = None, **kwargs):
if name != "empty":
deps = deps + ["@local_xla//xla/tsl:bazel_issue_21519"] # buildifier: disable=list-append
deps = deps + ["@local_tsl//:bazel_issue_21519"] # buildifier: disable=list-append
native.cc_library(name = name, deps = deps, **kwargs)
_cc_library(name = name, deps = deps, **kwargs)

View File

@ -5,6 +5,7 @@ load(
"@local_config_rocm//rocm:build_defs.bzl",
"if_rocm_is_configured",
)
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load(
"//xla/tsl:package_groups.bzl",
"DEFAULT_LOAD_VISIBILITY",
@ -66,7 +67,7 @@ _XLA_SHARED_OBJECT_SENSITIVE_DEPS = [
])
def xla_cc_binary(deps = [], copts = tsl_copts(), **kwargs):
native.cc_binary(deps = deps + _XLA_SHARED_OBJECT_SENSITIVE_DEPS, copts = copts, **kwargs)
cc_binary(deps = deps + _XLA_SHARED_OBJECT_SENSITIVE_DEPS, copts = copts, **kwargs)
def xla_cc_test(
name,