Skip to content

Commit

Permalink
Formatting BUILD and bzl files.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 234543907
  • Loading branch information
tensorflower-gardener committed Feb 19, 2019
1 parent 6f7a0a8 commit a0b0a50
Show file tree
Hide file tree
Showing 26 changed files with 2,173 additions and 2,117 deletions.
17 changes: 8 additions & 9 deletions tensorflow/compiler/tests/plugin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
# git update-index --assume-unchanged tensorflow/compiler/tests/plugin.bzl

plugins = {
#"example": {
# "device":"XLA_MY_DEVICE",
# "types":"DT_FLOAT,DT_HALF,DT_INT32",
# "tags":[],
# "args":["--disabled_manifest=tensorflow/compiler/plugin/example/disabled_manifest.txt"],
# "data":["//tensorflow/compiler/plugin/example:disabled_manifest.txt"],
# "deps":[],
#},
#"example": {
# "device":"XLA_MY_DEVICE",
# "types":"DT_FLOAT,DT_HALF,DT_INT32",
# "tags":[],
# "args":["--disabled_manifest=tensorflow/compiler/plugin/example/disabled_manifest.txt"],
# "data":["//tensorflow/compiler/plugin/example:disabled_manifest.txt"],
# "deps":[],
#},
}

17 changes: 8 additions & 9 deletions tensorflow/compiler/xla/service/cpu/build_defs.bzl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""build_defs for service/cpu."""


def runtime_copts():
"""Returns copts used for CPU runtime libraries."""
return (["-DEIGEN_AVOID_STL_ARRAY"] + select({
"//tensorflow:android_arm": ["-mfpu=neon"],
"//conditions:default": []
}) + select({
"//tensorflow:android": ["-O2"],
"//conditions:default": []
}))
"""Returns copts used for CPU runtime libraries."""
return (["-DEIGEN_AVOID_STL_ARRAY"] + select({
"//tensorflow:android_arm": ["-mfpu=neon"],
"//conditions:default": [],
}) + select({
"//tensorflow:android": ["-O2"],
"//conditions:default": [],
}))
1 change: 0 additions & 1 deletion tensorflow/compiler/xla/tests/plugin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@
# }

plugins = {}

71 changes: 34 additions & 37 deletions tensorflow/core/platform/default/platform.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,52 @@ CUDNN_VERSION = ""
PLATFORM = ""

def cuda_sdk_version():
return CUDA_VERSION
return CUDA_VERSION

def cudnn_sdk_version():
return CUDNN_VERSION
return CUDNN_VERSION

def cuda_library_path(name, version = cuda_sdk_version()):
if PLATFORM == "Darwin":
if not version:
return "lib/lib{}.dylib".format(name)
if PLATFORM == "Darwin":
if not version:
return "lib/lib{}.dylib".format(name)
else:
return "lib/lib{}.{}.dylib".format(name, version)
elif not version:
return "lib64/lib{}.so".format(name)
else:
return "lib/lib{}.{}.dylib".format(name, version)
else:
if not version:
return "lib64/lib{}.so".format(name)
else:
return "lib64/lib{}.so.{}".format(name, version)
return "lib64/lib{}.so.{}".format(name, version)

def cuda_static_library_path(name):
if PLATFORM == "Darwin":
return "lib/lib{}_static.a".format(name)
else:
return "lib64/lib{}_static.a".format(name)
if PLATFORM == "Darwin":
return "lib/lib{}_static.a".format(name)
else:
return "lib64/lib{}_static.a".format(name)

def cudnn_library_path(version = cudnn_sdk_version()):
if PLATFORM == "Darwin":
if not version:
return "lib/libcudnn.dylib"
else:
return "lib/libcudnn.{}.dylib".format(version)
else:
if not version:
return "lib64/libcudnn.so"
if PLATFORM == "Darwin":
if not version:
return "lib/libcudnn.dylib"
else:
return "lib/libcudnn.{}.dylib".format(version)
elif not version:
return "lib64/libcudnn.so"
else:
return "lib64/libcudnn.so.{}".format(version)
return "lib64/libcudnn.so.{}".format(version)

def cupti_library_path(version = cuda_sdk_version()):
if PLATFORM == "Darwin":
if not version:
return "extras/CUPTI/lib/libcupti.dylib"
if PLATFORM == "Darwin":
if not version:
return "extras/CUPTI/lib/libcupti.dylib"
else:
return "extras/CUPTI/lib/libcupti.{}.dylib".format(version)
elif not version:
return "extras/CUPTI/lib64/libcupti.so"
else:
return "extras/CUPTI/lib/libcupti.{}.dylib".format(version)
else:
if not version:
return "extras/CUPTI/lib64/libcupti.so"
else:
return "extras/CUPTI/lib64/libcupti.so.{}".format(version)
return "extras/CUPTI/lib64/libcupti.so.{}".format(version)

def readlink_command():
if PLATFORM == "Darwin":
return "greadlink"
else:
return "readlink"
if PLATFORM == "Darwin":
return "greadlink"
else:
return "readlink"
2 changes: 1 addition & 1 deletion tensorflow/java/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ XLINT_OPTS = [
"-Xlint:-processing",
"-Xlint:-serial",
"-Xlint:-try",
"-Xlint:-classfile", # see b/32750402, go/javac-warnings#classfile
"-Xlint:-classfile", # see b/32750402, go/javac-warnings#classfile
]

# The bazel errorprone plugin currently only enables default errorChecks
Expand Down
80 changes: 41 additions & 39 deletions tensorflow/java/src/gen/gen_ops.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,48 @@ load(
# and then archive those source files into
# ops/gen_sources.srcjar
#
def tf_java_op_gen_srcjar(name,
gen_tool,
base_package,
api_def_srcs=[],
out_dir="ops/",
out_src_dir="src/main/java/",
visibility=["//tensorflow/java:__pkg__"]):
def tf_java_op_gen_srcjar(
name,
gen_tool,
base_package,
api_def_srcs = [],
out_dir = "ops/",
out_src_dir = "src/main/java/",
visibility = ["//tensorflow/java:__pkg__"]):
gen_cmds = ["rm -rf $(@D)"] # Always start from fresh when generating source files
srcs = api_def_srcs[:]

gen_cmds = ["rm -rf $(@D)"] # Always start from fresh when generating source files
srcs = api_def_srcs[:]
if not api_def_srcs:
api_def_args_str = ","
else:
api_def_args = []
for api_def_src in api_def_srcs:
# Add directory of the first ApiDef source to args.
# We are assuming all ApiDefs in a single api_def_src are in the
# same directory.
api_def_args.append(
"$$(dirname $$(echo $(locations " + api_def_src +
") | cut -d\" \" -f1))",
)
api_def_args_str = ",".join(api_def_args)

if not api_def_srcs:
api_def_args_str = ","
else:
api_def_args = []
for api_def_src in api_def_srcs:
# Add directory of the first ApiDef source to args.
# We are assuming all ApiDefs in a single api_def_src are in the
# same directory.
api_def_args.append(
"$$(dirname $$(echo $(locations " + api_def_src +
") | cut -d\" \" -f1))")
api_def_args_str = ",".join(api_def_args)
gen_cmds += ["$(location " + gen_tool + ")" +
" --output_dir=$(@D)/" + out_src_dir +
" --base_package=" + base_package +
" --api_dirs=" + api_def_args_str]

gen_cmds += ["$(location " + gen_tool + ")" +
" --output_dir=$(@D)/" + out_src_dir +
" --base_package=" + base_package +
" --api_dirs=" + api_def_args_str]
# Generate a source archive containing generated code for these ops.
gen_srcjar = out_dir + name + ".srcjar"
gen_cmds += ["$(location @local_jdk//:jar) cMf $(location :" + gen_srcjar + ") -C $(@D) src"]

# Generate a source archive containing generated code for these ops.
gen_srcjar = out_dir + name + ".srcjar"
gen_cmds += ["$(location @local_jdk//:jar) cMf $(location :" + gen_srcjar + ") -C $(@D) src"]

native.genrule(
name=name,
srcs=srcs,
outs=[gen_srcjar],
tools=[
"@local_jdk//:jar",
"@local_jdk//:jdk",
gen_tool
] + tf_binary_additional_srcs(),
cmd=" && ".join(gen_cmds))
native.genrule(
name = name,
srcs = srcs,
outs = [gen_srcjar],
tools = [
"@local_jdk//:jar",
"@local_jdk//:jdk",
gen_tool,
] + tf_binary_additional_srcs(),
cmd = " && ".join(gen_cmds),
)
42 changes: 23 additions & 19 deletions tensorflow/python/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ load("//tensorflow:tensorflow.bzl", "tf_gen_op_wrapper_py")
# consumers of the tf_gen_op_wrapper_py rule would be simplified if we don't
# hard code the ops/ directory.

def tf_gen_op_wrapper_private_py(name, out=None, deps=[],
require_shape_functions=True,
visibility=[]):
if not name.endswith("_gen"):
fail("name must end in _gen")
if not visibility:
visibility = ["//visibility:private"]
bare_op_name = name[:-4] # Strip off the _gen
tf_gen_op_wrapper_py(name=bare_op_name,
out=out,
visibility=visibility,
deps=deps,
require_shape_functions=require_shape_functions,
generated_target_name=name,
api_def_srcs = [
"//tensorflow/core/api_def:base_api_def",
"//tensorflow/core/api_def:python_api_def",
],
)
def tf_gen_op_wrapper_private_py(
name,
out = None,
deps = [],
require_shape_functions = True,
visibility = []):
if not name.endswith("_gen"):
fail("name must end in _gen")
if not visibility:
visibility = ["//visibility:private"]
bare_op_name = name[:-4] # Strip off the _gen
tf_gen_op_wrapper_py(
name = bare_op_name,
out = out,
visibility = visibility,
deps = deps,
require_shape_functions = require_shape_functions,
generated_target_name = name,
api_def_srcs = [
"//tensorflow/core/api_def:base_api_def",
"//tensorflow/core/api_def:python_api_def",
],
)
2 changes: 1 addition & 1 deletion tensorflow/stream_executor/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def tf_additional_cudnn_plugin_deps():
# Returns whether any GPU backend is configuered.
def if_gpu_is_configured(x):
if cuda_is_configured() or rocm_is_configured():
return x
return x
return []
7 changes: 4 additions & 3 deletions tensorflow/tensorflow.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ load(
"//third_party/ngraph:build_defs.bzl",
"if_ngraph",
)

def register_extension_info(**kwargs):
pass

Expand Down Expand Up @@ -1463,7 +1464,7 @@ def cc_header_only_library(name, deps = [], includes = [], extra_deps = [], **kw

def tf_custom_op_library_additional_deps():
return [
"@protobuf_archive//:protobuf_headers",
"@protobuf_archive//:protobuf_headers",
clean_dep("//third_party/eigen3"),
clean_dep("//tensorflow/core:framework_headers_lib"),
] + if_windows(["//tensorflow/python:pywrap_tensorflow_import_lib"])
Expand All @@ -1473,8 +1474,8 @@ def tf_custom_op_library_additional_deps():
# exporting symbols from _pywrap_tensorflow.dll on Windows.
def tf_custom_op_library_additional_deps_impl():
return [
"@protobuf_archive//:protobuf",
"@nsync//:nsync_cpp",
"@protobuf_archive//:protobuf",
"@nsync//:nsync_cpp",
# for //third_party/eigen3
clean_dep("//third_party/eigen3"),
# for //tensorflow/core:framework_headers_lib
Expand Down
Loading

0 comments on commit a0b0a50

Please sign in to comment.