Skip to content

Commit 2d23960

Browse files
author
Dandelion Mané
authored
Merge pull request tensorflow#8216 from dandelionmane/branch_149567254
Branch 149567254
2 parents 221c28d + 169a096 commit 2d23960

File tree

131 files changed

+13955
-6689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+13955
-6689
lines changed

BUILD

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +0,0 @@
1-
# Description:
2-
# TensorFlow is an open source software library for numerical computation using
3-
# data flow graphs.
4-
5-
package(
6-
default_visibility = [
7-
"//tensorflow:internal",
8-
"//tensorflow_models:__subpackages__",
9-
],
10-
)
11-
12-
licenses(["notice"]) # Apache 2.0
13-
14-
exports_files(["LICENSE"])
15-
16-
load(
17-
"//tensorflow:tensorflow.bzl",
18-
"cc_header_only_library",
19-
)
20-
21-
cc_header_only_library(
22-
name = "protobuf_headers",
23-
includes = ["external/protobuf/src"],
24-
visibility = ["//visibility:public"],
25-
deps = [
26-
"@protobuf//:protobuf",
27-
],
28-
)

tensorflow/BUILD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ filegroup(
221221
"//tensorflow/core/debug:all_files",
222222
"//tensorflow/core/distributed_runtime:all_files",
223223
"//tensorflow/core/distributed_runtime/rpc:all_files",
224+
"//tensorflow/core/grappler:all_files",
225+
"//tensorflow/core/grappler/clusters:all_files",
226+
"//tensorflow/core/grappler/costs:all_files",
227+
"//tensorflow/core/grappler/inputs:all_files",
228+
"//tensorflow/core/grappler/optimizers:all_files",
224229
"//tensorflow/core/kernels:all_files",
225230
"//tensorflow/core/kernels/cloud:all_files",
226231
"//tensorflow/core/kernels/hexagon:all_files",

tensorflow/compiler/jit/kernels/xla_local_launch_op.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ namespace gpu = perftools::gputools;
3939
namespace tensorflow {
4040

4141
// Adapter class that wraps a Tensorflow allocator as an XLA allocator.
42+
// Assumes that the Tensorflow allocator permits asynchronous deallocation:
43+
// see comment on `AllowsAsynchronousDeallocation()`.
4244
class XlaAllocator : public xla::DeviceMemoryAllocator {
4345
public:
4446
XlaAllocator(const perftools::gputools::Platform* platform,
@@ -54,6 +56,15 @@ class XlaAllocator : public xla::DeviceMemoryAllocator {
5456
Status MakeTensorFromBuffer(gpu::DeviceMemoryBase buffer, DataType dtype,
5557
const TensorShape& shape, Tensor* tensor) const;
5658

59+
// The Tensorflow BFC allocator used on GPU allows host-side deallocation
60+
// before GPU execution takes place. Tensorflow uses the ordering of the main
61+
// compute stream to enforce a happens-before relationship between a memory
62+
// allocation and code that reuses the same memory. If Tensorflow adds
63+
// support for multiple GPU streams or allocators with different ordering
64+
// requirements, this code may need to change.
65+
// (This attribute has no effect on CPU.)
66+
bool AllowsAsynchronousDeallocation() const override { return true; }
67+
5768
private:
5869
OpKernelContext* const op_context_;
5970

tensorflow/compiler/jit/kernels/xla_local_launch_op.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ namespace tensorflow {
3131
// Once all inputs are present, and their shapes are known, the op can
3232
// use a 'XlaCompilationCache' to compile and execute code which is specific
3333
// to the shapes of input Tensors.
34-
// XlaLocalLaunchOp uses xla::LocalClient::ExecuteLocally and passes
35-
// arguments into/out of XLA in device memory.
34+
// XlaLocalLaunchOp uses xla::LocalClient::Compile() and
35+
// xla::LocalExecutable::Run(), and passes arguments into/out of XLA in device
36+
// memory.
3637
class XlaLocalLaunchOp : public OpKernel {
3738
public:
3839
explicit XlaLocalLaunchOp(OpKernelConstruction* ctx);

tensorflow/compiler/tests/BUILD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,21 @@ tf_xla_py_test(
195195
],
196196
)
197197

198+
tf_xla_py_test(
199+
name = "pooling_ops_3d_test",
200+
size = "medium",
201+
srcs = ["pooling_ops_3d_test.py"],
202+
shard_count = 10,
203+
deps = [
204+
":xla_test",
205+
"//tensorflow/python:array_ops",
206+
"//tensorflow/python:framework_for_generated_wrappers",
207+
"//tensorflow/python:nn_ops",
208+
"//tensorflow/python:nn_ops_gen",
209+
"//tensorflow/python:platform_test",
210+
],
211+
)
212+
198213
tf_xla_py_test(
199214
name = "random_ops_test",
200215
size = "small",
@@ -224,6 +239,17 @@ tf_xla_py_test(
224239
],
225240
)
226241

242+
tf_xla_py_test(
243+
name = "reverse_ops_test",
244+
size = "small",
245+
srcs = ["reverse_ops_test.py"],
246+
deps = [
247+
":xla_test",
248+
"//tensorflow/python:array_ops",
249+
"//tensorflow/python:framework_for_generated_wrappers",
250+
],
251+
)
252+
227253
tf_xla_py_test(
228254
name = "ternary_ops_test",
229255
size = "small",

0 commit comments

Comments
 (0)