提交 a463e69d 编写于 作者: J Jake Harmon 提交者: TensorFlower Gardener

Remove tensorflow.bzl from TSL, except for profiler

PiperOrigin-RevId: 481193247
上级 1b59fa8f
load("//tensorflow:tensorflow.default.bzl", "filegroup")
load("//tensorflow:tensorflow.bzl", "tf_cc_tests")
load(
"//tensorflow/tsl/platform:build_config.bzl",
"tsl_cc_test",
)
load(
"//tensorflow/tsl/platform:rules_cc.bzl",
"cc_library",
......@@ -196,7 +199,7 @@ filegroup(
],
)
tf_cc_tests(
tsl_cc_test(
name = "tsl_lib_gtl_tests",
srcs = [
"compactptrset_test.cc",
......
load("//tensorflow:tensorflow.default.bzl", "filegroup")
load(
"//tensorflow:tensorflow.bzl",
"//tensorflow/tsl:tsl.bzl",
"if_linux_x86_64",
"tf_cc_test",
"tf_copts",
)
load(
"//tensorflow/tsl/platform:build_config.bzl",
"tsl_cc_test",
)
load(
"//tensorflow/tsl/platform:rules_cc.bzl",
"cc_library",
......@@ -56,7 +59,7 @@ filegroup(
visibility = ["//tensorflow/core/lib/hash:__pkg__"],
)
tf_cc_test(
tsl_cc_test(
name = "crc32c_test",
size = "small",
srcs = ["crc32c_test.cc"],
......
......@@ -4,8 +4,8 @@ load(
"cc_library",
)
load(
"//tensorflow:tensorflow.bzl",
"tf_cc_test",
"//tensorflow/tsl/platform:build_config.bzl",
"tsl_cc_test",
)
package(
......@@ -55,7 +55,7 @@ filegroup(
],
)
tf_cc_test(
tsl_cc_test(
name = "histogram_test",
srcs = [
"histogram_test.cc",
......
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
load("//tensorflow/tsl/platform:build_config.bzl", "tsl_cc_test")
load("//tensorflow:tensorflow.default.bzl", "filegroup")
load(
"//tensorflow/tsl/platform:rules_cc.bzl",
......@@ -402,7 +402,7 @@ filegroup(
visibility = ["//tensorflow/core:__pkg__"],
)
tf_cc_test(
tsl_cc_test(
name = "buffered_inputstream_test",
size = "small",
srcs = ["buffered_inputstream_test.cc"],
......@@ -418,7 +418,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "cache_test",
size = "small",
srcs = ["cache_test.cc"],
......@@ -431,7 +431,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "inputbuffer_test",
size = "small",
srcs = ["inputbuffer_test.cc"],
......@@ -451,7 +451,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "inputstream_interface_test",
size = "small",
srcs = ["inputstream_interface_test.cc"],
......@@ -464,7 +464,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "random_inputstream_test",
size = "small",
srcs = ["random_inputstream_test.cc"],
......@@ -478,7 +478,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "record_reader_writer_test",
size = "small",
srcs = ["record_reader_writer_test.cc"],
......@@ -498,7 +498,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "recordio_test",
size = "small",
srcs = ["recordio_test.cc"],
......@@ -518,7 +518,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "table_test",
size = "small",
srcs = ["table_test.cc"],
......@@ -537,7 +537,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "zlib_buffers_test",
size = "small",
srcs = ["zlib_buffers_test.cc"],
......
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
load(
"//tensorflow/tsl/platform:build_config.bzl",
"tsl_cc_test",
)
# Snappy targets.
......@@ -76,7 +79,7 @@ cc_library(
alwayslink = True,
)
tf_cc_test(
tsl_cc_test(
name = "snappy_test",
size = "small",
srcs = ["snappy_test.cc"],
......
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
load(
"//tensorflow/tsl/platform:build_config.bzl",
"tsl_cc_test",
)
package(
default_visibility = [
......@@ -23,7 +26,7 @@ cc_library(
],
)
tf_cc_test(
tsl_cc_test(
name = "math_util_test",
size = "small",
srcs = [
......
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
load(
"//tensorflow/tsl/platform:build_config.bzl",
"tsl_cc_test",
)
load("//tensorflow:tensorflow.default.bzl", "filegroup", "get_compatible_with_portable")
load("//tensorflow/tsl/platform:rules_cc.bzl", "cc_library")
......@@ -169,7 +172,7 @@ filegroup(
],
)
tf_cc_test(
tsl_cc_test(
name = "distribution_sampler_test",
size = "small",
srcs = ["distribution_sampler_test.cc"],
......@@ -183,7 +186,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "philox_random_test",
size = "small",
srcs = ["philox_random_test.cc"],
......@@ -198,7 +201,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "random_distributions_test",
srcs = ["random_distributions_test.cc"],
tags = ["optonly"],
......@@ -214,7 +217,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "simple_philox_test",
size = "small",
srcs = ["simple_philox_test.cc"],
......@@ -227,7 +230,7 @@ tf_cc_test(
],
)
tf_cc_test(
tsl_cc_test(
name = "weighted_picker_test",
size = "medium",
srcs = ["weighted_picker_test.cc"],
......
......@@ -7,7 +7,7 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
load(
"//tensorflow:tensorflow.bzl",
"//tensorflow/tsl:tsl.bzl",
"tf_copts",
)
load(
......
# Tensorflow default + linux implementations of tensorflow/core/platform libraries.
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//tensorflow:tensorflow.default.bzl", "filegroup")
load("//tensorflow:tensorflow.bzl", "if_not_windows", "tf_copts")
load("//tensorflow/tsl:tsl.bzl", "if_not_windows", "tf_copts")
load("//tensorflow/tsl/platform:rules_cc.bzl", "cc_library")
package(
......
# Platform-specific build configurations.
load("@com_google_protobuf//:protobuf.bzl", "proto_gen")
load("//tensorflow:tensorflow.bzl", "clean_dep", "if_libtpu", "if_not_windows")
load("//tensorflow/tsl/platform:build_config_root.bzl", "if_static")
load("//tensorflow/tsl:tsl.bzl", "if_tsl_link_protobuf")
load(
"//tensorflow/tsl:tsl.bzl",
"clean_dep",
"if_libtpu",
"if_not_windows",
"if_tsl_link_protobuf",
)
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm")
load(
......
......@@ -2,7 +2,7 @@
# Platform-specific build configurations.
load("//tensorflow/tsl/platform:rules_cc.bzl", "cc_library")
load("//tensorflow:tensorflow.bzl", "tf_copts")
load("//tensorflow/tsl:tsl.bzl", "tf_copts")
# TODO(jakeharmon): Determine if this will fail in TSL's github
package(default_visibility = ["//tensorflow:internal"])
......
......@@ -7,8 +7,8 @@ load(
"cc_library",
)
load(
"//tensorflow:tensorflow.bzl",
"tf_copts", # @unused
"//tensorflow/tsl:tsl.bzl",
"tf_copts",
)
package(
......
......@@ -2,7 +2,7 @@ load("//tensorflow:tensorflow.default.bzl", "filegroup")
# Tensorflow windows-specific implementations of tensorflow/core/platform libraries.
load(
"//tensorflow:tensorflow.bzl",
"//tensorflow/tsl:tsl.bzl",
"tf_copts",
)
load(
......
load(
"//tensorflow:tensorflow.bzl",
"//tensorflow/tsl:tsl.bzl",
"if_google",
)
load(
......
......@@ -27,6 +27,7 @@ load(
"//third_party/compute_library:build_defs.bzl",
"if_enable_acl",
)
load("@bazel_skylib//lib:new_sets.bzl", "sets")
def clean_dep(target):
"""Returns string to 'target' in @org_tensorflow repository.
......@@ -213,3 +214,75 @@ def tf_openmp_copts():
# copybara:comment_end
"//conditions:default": [],
})
# Traverse the dependency graph along the "deps" attribute of the
# target and return a struct with one field called 'tf_collected_deps'.
# tf_collected_deps will be the union of the deps of the current target
# and the tf_collected_deps of the dependencies of this target.
def _collect_deps_aspect_impl(target, ctx): # buildifier: disable=unused-variable
direct, transitive = [], []
all_deps = []
if hasattr(ctx.rule.attr, "deps"):
all_deps += ctx.rule.attr.deps
if hasattr(ctx.rule.attr, "data"):
all_deps += ctx.rule.attr.data
if hasattr(ctx.rule.attr, "roots"):
all_deps += ctx.rule.attr.roots
for dep in all_deps:
direct.append(dep.label)
if hasattr(dep, "tf_collected_deps"):
transitive.append(dep.tf_collected_deps)
return struct(tf_collected_deps = depset(direct = direct, transitive = transitive))
collect_deps_aspect = aspect(
attr_aspects = ["deps", "data", "roots"],
implementation = _collect_deps_aspect_impl,
)
def _dep_label(dep):
label = dep.label
return label.package + ":" + label.name
# This rule checks that transitive dependencies don't depend on the targets
# listed in the 'disallowed_deps' attribute, but do depend on the targets listed
# in the 'required_deps' attribute. Dependencies considered are targets in the
# 'deps' attribute or the 'data' attribute.
def _check_deps_impl(ctx):
required_deps = ctx.attr.required_deps
disallowed_deps = ctx.attr.disallowed_deps
for input_dep in ctx.attr.deps:
if not hasattr(input_dep, "tf_collected_deps"):
continue
collected_deps = sets.make(input_dep.tf_collected_deps.to_list())
for disallowed_dep in disallowed_deps:
if sets.contains(collected_deps, disallowed_dep.label):
fail(
_dep_label(input_dep) + " cannot depend on " +
_dep_label(disallowed_dep),
)
for required_dep in required_deps:
if not sets.contains(collected_deps, required_dep.label):
fail(
_dep_label(input_dep) + " must depend on " +
_dep_label(required_dep),
)
return struct() # buildifier: disable=rule-impl-return
check_deps = rule(
_check_deps_impl,
attrs = {
"deps": attr.label_list(
aspects = [collect_deps_aspect],
mandatory = True,
allow_files = True,
),
"disallowed_deps": attr.label_list(
default = [],
allow_files = True,
),
"required_deps": attr.label_list(
default = [],
allow_files = True,
),
},
)
......@@ -9,7 +9,7 @@ load(
"cc_library",
)
load(
"//tensorflow:tensorflow.bzl",
"//tensorflow/tsl:tsl.bzl",
"check_deps",
"tf_copts",
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册