mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 00:19:58 +01:00
END_PUBLIC --- Commit9f81374c3authored by raymondxyang<zihao.yang@microsoft.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Add option for build more python tests in Cmake (#11853) * Ignore Windows built project * Fix deprecated methods in tf.contrib.python * Fix regex match for Windows build in contrib.keras * Fix Regex match for Windows build in session_bundle * * Fix deprecated methods * Fix regex match for Windows * Fix compatibility issue with Python 3.x * Add missing ops into Windows build for test * Enabled more testcases for Windows build * Clean code and fix typo * Add conditional cmake mode for enabling more unit testcase * Add Cmake mode for major Contrib packages * Add supplementary info in RAEDME for new cmake option * * Update tf_tests after testing with TF 1.3 * Clean code and resolve conflicts * Fix unsafe regex matches and format code * Update exclude list after testing with latest master branch * Fix missing module --- Commit98f0e1efeauthored by Yong Tang<yong.tang.github@outlook.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Dynamic ksize and strides with MaxPool (#11875) * Dynamic ksize with max_pool This fix tries to fix the issue raised in 4746 where ksize is static (attr) with max_pool. This fix changes ksize to input tensor so that it is dynamic now. This fix fixes 4746. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Add dynamic ksize to MaxPoolGrad and MaxPoolGradGrad Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Add test cases for max_pool_v2 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix GPU Jenkins issue. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Enable MaxPoolV2 in GPU Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Hide MaxPoolV2 and other fixes. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> --- Commit02d6bc185authored by Bairen Yi<byronyi@users.noreply.github.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: remove useless variable (#12212) --- Commited6b0d905authored by namrata-ibm<bhavenamrata@gmail.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Adding support for s390x in calculation of cpu_frequency (#12201) --- Commit627dfc9ddauthored by Taehoon Lee<taehoonlee@snu.ac.kr> Committed by Taehoon Lee<taehoonlee@snu.ac.kr>: Fix typos --- Commitc0f9b0a91authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: In fast-math mode emit a tanh that has a faster min/max. PiperOrigin-RevId: 164943597 --- Commit87605f3d6authored by Kay Zhu<kayzhu@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: [TF:XLA] Use HloEvaluator for ComputeConstant, remove the need of a dedicated compute constant backend. PiperOrigin-RevId: 164940970 --- Commit881de45c2authored by Taehoon Lee<me@taehoonlee.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Add bool type supports for GPU kernels (#11927) * Add bool type supports for GPU kernels * Add bool type test codes for GPU kernels --- Commiteeacdcdb1authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Add missing "CPU" suffix in registrations. PiperOrigin-RevId: 164939527 --- Commitde01be952authored by namrata-ibm<bhavenamrata@gmail.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Adding support for Big Endian in graph_constructor_test and wav_io (#12179) --- Commit26719d29fauthored by QingYing Chen<pkudysj@126.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Implement CRF decode (Viterbi decode) for tensor (#12056) * Implement CRF decoding for tensors * add test code for tensor version's CRF decoding * made modifications according to pylint * add some comments for crf decode * remove useless code * add comments at the top comment of crf module and add more comments in crf_test * capitalize first char of first word in comments * replace crf_decode test code with a deterministic example --- Commitf9a81ca2fauthored by Pete Warden<pete@petewarden.com> Committed by gunan<gunan@google.com>: Create CI build script for Raspberry Pi (#12190) * Create CI build script for Raspberry Pi * Moved location of Pi build script --- Commite2a163a90authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Merge code from PR #11940 with internal changes from cl/164796436, and update Python tests to also run on GPU. PiperOrigin-RevId: 164929133 --- Commit08bbfa187authored by Taehoon Lee<me@taehoonlee.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Fix typos (#12195) --- Commitab96f41fbauthored by Luke Iwanski<luke@codeplay.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: [OpenCL] Extends matmul_benchmark.py to cover SYCL (#11697) * [OpenCL] Extends matmul_benchmark.py to cover SYCL * Fixed typo * /gpu:0 -> /device:GPU:0 * Fixes control_flow_ops_py_test * /gpu: -> /device:GPU: * Fixes //tensorflow/python/profiler/internal:run_metadata_test * gpu: -> GPU: * Fixes tfprof_node * [OpenCL] Fixes device path to name with many colons (#123) The device path is constructed from a device name by replacing all colons with underscores. Some device names contain more than one colon, for example 'device:SYCL:0' which gives a path 'device_SYCL_0'. The previous code would not convert this back to the original device name, but rather to 'device:SYCL_0'. An alternative fix would be to convert all underscores to colons in the device name (i.e. remove the restriction inside `replace("_", ":", 1)`), however I'm not sure if there are any device names which contain underscores. * If no gpu device aviable fake one * gpu: -> device:GPU * Fixes profiler test * /gpu:x -> /device:GPU:x * Fixes debug_io_utils_test.cc test * Fixes device_name_utils_test.cc --- Commit35e7a3665authored by Yong Tang<yong.tang.github@outlook.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: Remove unneeded casting of int64 for reverse_sequence (#12192) This fix remove unneeded cast of int64 for reverse_sequence: ``` lengths = math_ops.to_int64(lengths) ``` as int32 has already been enabled for reverse_sequence. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> --- Commit9fba8c185authored by Anna R<annarev@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Add benchmark dashboard link to benchmarks doc. Also, I added a link and description for Benchmarks page to Community index page. PiperOrigin-RevId: 164924906 --- Commitbb6f32fa7authored by Mark Heffernan<meheff@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Make HloAliasAnalysis updatable after changes to the HLO graph. As part of this change make HloAliasAnalysis a thinner layer which basically only holds a map from HloValue to HloBuffer and vice versa. PiperOrigin-RevId: 164923041 --- Commit9103096c1authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by Thomas K?ppe<tkoeppe@google.com>: Merged commit includes the following changes: 164923041 by meheff: Make HloAliasAnalysis updatable after changes to the HLO graph. As part of this change make HloAliasAnalysis a thinner layer which basically only holds a map from HloValue to HloBuffer and vice versa. -- PiperOrigin-RevId: 164923041 --- Commit822603aedauthored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Merging sibling fusion instruction using multi_output_fusion PiperOrigin-RevId: 164920220 --- Commitc035aa2a8authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Go: Update generated wrapper functions for TensorFlow ops. PiperOrigin-RevId: 164917891 --- Commite1e81d9baauthored by Luke Iwanski<luke@codeplay.com> Committed by Rasmus Munk Larsen<rmlarsen@google.com>: [OpenCL] Fixes double memcpy bug (#151) (#12173) * [OpenCL] Fixes double memcpy bug (#151) As the debg CopyOp is called on a Tensor without type, we need to use the DataType enum to get type information, and use this to pass the type on to Eigen. This is a workaround Eigen's need to have a type when calling memcpy. If the Eigen memcpy can be provided without a type requirement, then the memcpy in sycl_util is unnecessary. * Acts on feedback from: #12173/files/32cb12a9001b672425867b5a3110fd98e737a20b#r132496277 --- Commitd9ca2d86dauthored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Internal change PiperOrigin-RevId: 164916465 --- Commitb8d13d218authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Remove more parts of DCASGD missed in the first pass. (47949b) PiperOrigin-RevId: 164914552 --- Commit73b3d52c7authored by Alexandre Passos<apassos@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: cmake fix PiperOrigin-RevId: 164911656 --- Commit2173b5b0aauthored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Allow TFE_TensorHandleCopyToDevice to have the same device as src and destination. It will reuse the same underlying buffer in those cases. PiperOrigin-RevId: 164909906 --- Commit13eb3b90eauthored by Alexandre Passos<apassos@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Experimental C and Python APIs to invoke TensorFlow kernels on concrete values. PiperOrigin-RevId: 164902588 --- Commit7dfabcc01authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Initialize ExecutionOptions in ComputeConstant to default values. PiperOrigin-RevId: 164894867 --- Commitc8897e9bcauthored by Benoit Steiner<bsteiner@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Static required time computation PiperOrigin-RevId: 164894645 --- Commit076158f9bauthored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Enable implicit->explicit conversion by default. PiperOrigin-RevId: 164890915 --- Commit58c4a4cb1authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Bugfix: number of input channels is not necessarily in the last dimension, after introduction of data_format param. PiperOrigin-RevId: 164889729 --- Commit8f9b1af8aauthored by Igor Saprykin<isaprykin@google.com> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Recover MonitoredSession when the Coordinator is requested to stop with one of the _PREEMPTION_ERRORS. When SyncReplicasOptimizer is used, a preemption in the Coordinator may result in two cases: Case 1) the session gets silently marked as complete Case 2) the session gets stuck This CL aims to solve and verify solutions for both of these problems. Fix 1 changes the should_stop logic. Fix 2 changes the CoordinatedSession.run() logic. SyncReplicasOptimizer runs a separate set of threads using a Coordinator instance. Those threads do FIFOQueue.enqueue; the main thread does a blocking FIFOQueue.dequeue. `sync_token_q` FIFOQueue is on parameter-servers. When one of the PS instances gets preempted, an AbortedError causes the Coordinator to stop via request_stop(ex). That by itself changes the state of MonitoredSession.should_stop() to True (Fix 1). Results of the blocking Dequeue operation are sent to the chief worker via Recv. What happens next depends on the amount of tokens in `sync_token_q`. If there are enough for the next call to Dequeue to return, then the low-level "tf session run() call" returns. The next iteration of the `while not MonitoredSession.should_stop()` loop decides that the training is complete (Case 1). If there are not enough tokens in `sync_token_q`, then the blocking Dequeue is going to keep waiting for them. This results in the graph execution getting stuck and the whole session getting garbage collected after 10 minutes (Case 2). We decided to fix that by re-creating a session after it gets garbage collected (Fix 2). An alternative was to try to cancel the pending Dequeue operation, but it's not clear that it is the right thing to do and it is also not easy. PiperOrigin-RevId: 164888390 --- Commit46e4de6e5authored by A. Unique TensorFlower<gardener@tensorflow.org> Committed by TensorFlower Gardener<gardener@tensorflow.org>: Undo loop fusion changes for now as they seem to be altering a few results. END_PUBLIC RELNOTES: n/a BEGIN_PUBLIC BEGIN_PUBLIC Automated g4 rollback of changelist 164825735 PiperOrigin-RevId: 165340331
252 lines
8.4 KiB
Python
252 lines
8.4 KiB
Python
"""Build rules for XLA testing."""
|
|
|
|
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_is_configured")
|
|
load("//tensorflow/compiler/xla/tests:plugin.bzl", "plugins")
|
|
|
|
all_backends = ["cpu", "cpu_parallel", "gpu"] + plugins.keys()
|
|
|
|
def filter_backends(backends):
|
|
"""Removes "gpu" from a backend list if CUDA is not enabled.
|
|
|
|
This allows us to simply hardcode lists including "gpu" here and in the
|
|
BUILD file, without causing failures when CUDA isn't enabled.'
|
|
|
|
Args:
|
|
backends: A list of backends to filter.
|
|
|
|
Returns:
|
|
The filtered list of backends.
|
|
"""
|
|
if cuda_is_configured():
|
|
return backends
|
|
else:
|
|
return [backend for backend in backends if backend != "gpu"]
|
|
|
|
|
|
def xla_test(name,
|
|
srcs,
|
|
deps,
|
|
xla_test_library_deps=[],
|
|
backends=[],
|
|
args=[],
|
|
tags=[],
|
|
copts=[],
|
|
data=[],
|
|
backend_tags={},
|
|
backend_args={},
|
|
**kwargs):
|
|
"""Generates cc_test targets for the given XLA backends.
|
|
|
|
This rule generates a cc_test target for one or more XLA backends and also
|
|
a platform-agnostic cc_library rule. The arguments are identical to cc_test
|
|
with two additions: 'backends' and 'backend_args'. 'backends' specifies the
|
|
backends to generate tests for ("cpu", "cpu_parallel", "gpu"), and
|
|
'backend_args'/'backend_tags' specifies backend-specific args parameters to
|
|
use when generating the cc_test.
|
|
|
|
The name of the cc_tests are the provided name argument with the backend name
|
|
appended, and the cc_library target name is the provided name argument with
|
|
"_lib" appended. For example, if name parameter is "foo_test", then the cpu
|
|
test target will be "foo_test_cpu" and the cc_library target is "foo_lib".
|
|
|
|
The cc_library target can be used to link with other plugins outside of
|
|
xla_test.
|
|
|
|
The build rule also defines a test suite ${name} which includes the tests for
|
|
each of the supported backends.
|
|
|
|
Each generated cc_test target has a tag indicating which backend the test is
|
|
for. This tag is of the form "xla_${BACKEND}" (eg, "xla_cpu"). These
|
|
tags can be used to gather tests for a particular backend into a test_suite.
|
|
|
|
Examples:
|
|
|
|
# Generates the targets: foo_test_cpu and foo_test_gpu.
|
|
xla_test(
|
|
name = "foo_test",
|
|
srcs = ["foo_test.cc"],
|
|
backends = ["cpu", "gpu"],
|
|
deps = [...],
|
|
)
|
|
|
|
# Generates the targets: bar_test_cpu and bar_test_gpu. bar_test_cpu
|
|
# includes the additional arg "--special_cpu_flag".
|
|
xla_test(
|
|
name = "bar_test",
|
|
srcs = ["bar_test.cc"],
|
|
backends = ["cpu", "gpu"],
|
|
backend_args = {"cpu": ["--special_cpu_flag"]}
|
|
deps = [...],
|
|
)
|
|
|
|
The build rule defines the preprocessor macro XLA_TEST_BACKEND_${BACKEND}
|
|
to the value 1 where ${BACKEND} is the uppercase name of the backend.
|
|
|
|
Args:
|
|
name: Name of the target.
|
|
srcs: Sources for the target.
|
|
deps: Dependencies of the target.
|
|
xla_test_library_deps: If set, the generated test targets will depend on the
|
|
respective cc_libraries generated by the xla_test_library rule.
|
|
backends: A list of backends to generate tests for. Supported
|
|
values: "cpu", "cpu_parallel", "gpu". If this list is empty, the test will
|
|
be generated for all supported backends.
|
|
args: Test arguments for the target.
|
|
tags: Tags for the target.
|
|
backend_args: A dict mapping backend name to list of additional args to
|
|
use for that target.
|
|
backend_tags: A dict mapping backend name to list of additional tags to
|
|
use for that target.
|
|
"""
|
|
test_names = []
|
|
if not backends:
|
|
backends = all_backends
|
|
|
|
native.cc_library(
|
|
name="%s_lib" % name,
|
|
srcs=srcs,
|
|
copts=copts,
|
|
testonly=True,
|
|
deps=deps + ["//tensorflow/compiler/xla/tests:test_macros_header"],
|
|
)
|
|
|
|
for backend in filter_backends(backends):
|
|
test_name = "%s_%s" % (name, backend)
|
|
this_backend_tags = ["xla_%s" % backend]
|
|
this_backend_copts = []
|
|
this_backend_args = backend_args.get(backend, [])
|
|
this_backend_data = []
|
|
if backend == "cpu":
|
|
backend_deps = ["//tensorflow/compiler/xla/service:cpu_plugin"]
|
|
backend_deps += ["//tensorflow/compiler/xla/tests:test_macros_cpu"]
|
|
elif backend == "cpu_parallel":
|
|
backend_deps = ["//tensorflow/compiler/xla/service:cpu_plugin"]
|
|
backend_deps += ["//tensorflow/compiler/xla/tests:test_macros_cpu"]
|
|
this_backend_args += ["--xla_backend_extra_options=\"xla_cpu_parallel\""]
|
|
elif backend == "gpu":
|
|
backend_deps = ["//tensorflow/compiler/xla/service:gpu_plugin"]
|
|
backend_deps += ["//tensorflow/compiler/xla/tests:test_macros_gpu"]
|
|
this_backend_tags += ["requires-gpu-sm35"]
|
|
elif backend in plugins:
|
|
backend_deps = plugins[backend]["deps"]
|
|
this_backend_copts += plugins[backend]["copts"]
|
|
this_backend_tags += plugins[backend]["tags"]
|
|
this_backend_args += plugins[backend]["args"]
|
|
this_backend_data += plugins[backend]["data"]
|
|
else:
|
|
fail("Unknown backend %s" % backend)
|
|
|
|
if xla_test_library_deps:
|
|
for lib_dep in xla_test_library_deps:
|
|
backend_deps += ["%s_%s" % (lib_dep, backend)]
|
|
|
|
native.cc_test(
|
|
name=test_name,
|
|
srcs=srcs,
|
|
tags=tags + backend_tags.get(backend, []) + this_backend_tags,
|
|
copts=copts + ["-DXLA_TEST_BACKEND_%s=1" % backend.upper()] +
|
|
this_backend_copts,
|
|
args=args + this_backend_args,
|
|
deps=deps + backend_deps,
|
|
data=data + this_backend_data,
|
|
**kwargs)
|
|
|
|
test_names.append(test_name)
|
|
|
|
native.test_suite(name=name, tests=test_names)
|
|
|
|
def xla_test_library(name,
|
|
srcs,
|
|
hdrs=[],
|
|
deps=[],
|
|
backends=[]):
|
|
"""Generates cc_library targets for the given XLA backends.
|
|
|
|
This rule forces the sources to be compiled for each backend so that the
|
|
backend specific macros could expand correctly. It's useful when test targets
|
|
in different directories referring to the same sources but test with different
|
|
arguments.
|
|
|
|
Examples:
|
|
|
|
# Generates the targets: foo_test_library_cpu and foo_test_gpu.
|
|
xla_test_library(
|
|
name = "foo_test_library",
|
|
srcs = ["foo_test.cc"],
|
|
backends = ["cpu", "gpu"],
|
|
deps = [...],
|
|
)
|
|
# Then use the xla_test rule to generate test targets:
|
|
xla_test(
|
|
name = "foo_test",
|
|
srcs = [],
|
|
backends = ["cpu", "gpu"],
|
|
deps = [...],
|
|
xla_test_library_deps = [":foo_test_library"],
|
|
)
|
|
|
|
Args:
|
|
name: Name of the target.
|
|
srcs: Sources for the target.
|
|
hdrs: Headers for the target.
|
|
deps: Dependencies of the target.
|
|
backends: A list of backends to generate libraries for.
|
|
Supported values: "cpu", "cpu_parallel", "gpu". If this list is empty, the
|
|
library will be generated for all supported backends.
|
|
"""
|
|
|
|
if not backends:
|
|
backends = all_backends
|
|
|
|
for backend in filter_backends(backends):
|
|
this_backend_copts = []
|
|
if backend in ["cpu", "cpu_parallel", "gpu"]:
|
|
backend_deps = ["//tensorflow/compiler/xla/tests:test_macros_%s" % backend]
|
|
elif backend in plugins:
|
|
backend_deps = plugins[backend]["deps"]
|
|
this_backend_copts += plugins[backend]["copts"]
|
|
else:
|
|
fail("Unknown backend %s" % backend)
|
|
|
|
native.cc_library(
|
|
name = "%s_%s" % (name, backend),
|
|
srcs = srcs,
|
|
testonly = True,
|
|
hdrs = hdrs,
|
|
copts = ["-DXLA_TEST_BACKEND_%s=1" % backend.upper()]
|
|
+ this_backend_copts,
|
|
deps = deps + backend_deps,
|
|
)
|
|
|
|
|
|
def generate_backend_suites(backends=[]):
|
|
if not backends:
|
|
backends = all_backends
|
|
for backend in filter_backends(backends):
|
|
native.test_suite(name="%s_tests" % backend,
|
|
tags = ["xla_%s" % backend])
|
|
|
|
|
|
def generate_backend_test_macros(backends=[]):
|
|
if not backends:
|
|
backends = all_backends
|
|
for backend in filter_backends(backends):
|
|
manifest = ""
|
|
if backend in plugins:
|
|
manifest = plugins[backend]["disabled_manifest"]
|
|
|
|
native.cc_library(
|
|
name="test_macros_%s" % backend,
|
|
testonly = True,
|
|
srcs = ["test_macros.cc"],
|
|
hdrs = ["test_macros.h"],
|
|
copts = [
|
|
"-DXLA_PLATFORM=\\\"%s\\\"" % backend.upper(),
|
|
"-DXLA_DISABLED_MANIFEST=\\\"%s\\\"" % manifest,
|
|
],
|
|
deps = [
|
|
"//tensorflow/compiler/xla:types",
|
|
"//tensorflow/core:lib",
|
|
"//tensorflow/core:test",
|
|
])
|