Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch 201392512 #20156

Merged
merged 200 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
655c52b
Minor python change to remove doing unnecessary work in resource vari…
Jun 15, 2018
c9a2034
[TF:XLA] Validate the control flow structure in encapsulate_subgraphs…
tensorflower-gardener Jun 15, 2018
fa6e9f3
Increase gru_test test size
pavithrasv Jun 15, 2018
6f7c83c
[TF:XLA] Update comment on xla_compiler.h to match the code.
hawkinsp Jun 15, 2018
32e85d4
Fix a bug in dependency optimizer: Repeated inputs would not get conv…
tensorflower-gardener Jun 15, 2018
d63d663
Disable long running tests in fastbuild mode.
gunan Jun 15, 2018
1ca4b6f
Fix: DepthwiseConv2D fails when bias is enabled
pavithrasv Jun 15, 2018
b62d76d
[XLA] Switch PostOrder accessors to use std::vector instead of std::l…
d0k Jun 15, 2018
45d7a04
Add test of TOKEN primitive type which uses conditionals.
meheffernan Jun 15, 2018
8ba25e3
[XLA] Don't implement kCrossReplicaSum case in HloInstruction::Identi…
tensorflower-gardener Jun 15, 2018
a7fcc5d
contrib.timeseries: sets the predictions dict in EstimatorSpec for ev…
yk5 Jun 15, 2018
916c0aa
Refactor loader.load function into a class that splits the graph load…
k-w-w Jun 15, 2018
f9b832d
[TF2XLA] Remove the last unncessary host-to-device memcpy, and remove…
kayzhu Jun 15, 2018
a601d9a
Support model parallelism in PER_HOST_V2 input pipeline.
toponado-zz Jun 15, 2018
1ba31da
Add DeviceSet to SingleMachine, so we can use the OptimizeGraph() too…
aaroey Jun 15, 2018
03e3310
Broad refactoring (part 2): Introduce a module dedicated to AutoGraph…
Jun 15, 2018
64a81c5
Reuse duplicated reference ops in optimized_ops.h
tensorflower-gardener Jun 15, 2018
d09b1eb
Fix segfault in ConstantFolding::MaterializeShapes when the first inp…
tensorflower-gardener Jun 15, 2018
d07d47d
Provides a more fine-grained option for each thread to control
tensorflower-gardener Jun 15, 2018
c783b56
Add some extra DebugString() functions to shape_inference. Currently …
hawkinsp Jun 15, 2018
79f52c1
Set shapes and types to queue ops, if not set by enqueue ops.
tensorflower-gardener Jun 15, 2018
1645a0a
Typo fixes.
dimvar Jun 15, 2018
817c39b
Fix None grads bug when calling a keras Sequential twice on same inpu…
lxuechen Jun 15, 2018
c295688
Quiet the doc generator.
MarkDaoust Jun 15, 2018
d3ae8e7
Add bazel android repo to workspace
tensorflower-gardener Jun 15, 2018
7991f01
Fix typo in tf.lite Python interpreter comment.
rryan Jun 15, 2018
33f8f7e
Automated g4 rollback of changelist 200750664
kayzhu Jun 15, 2018
94b3db6
Move cond_v2 to core (non-public) and add toggle to use cond_v2 by de…
skye Jun 15, 2018
5e9a39d
Reflow comments; NFC
Jun 15, 2018
b8861af
Automatic cast layer inputs to the layer's dtype.
reedwm Jun 15, 2018
1d74a69
Enable fetching shapes from the C API by default.
skye Jun 15, 2018
44a854b
Some fixes to testInferenceInputType
tensorflower-gardener Jun 15, 2018
97eaebf
Split GradientBoostedDecisionTreeModel.train() to three steps.
tensorflower-gardener Jun 15, 2018
0e85bc7
Integrate ClusterResolvers with Keras TPU support
saeta Jun 15, 2018
ed3adf6
Fixes Eager mode of dynamic_rnn for RNNCells with unbalanced output
tensorflower-gardener Jun 15, 2018
96100f9
Faster TopoQueue in graph_properties.
yacoder Jun 15, 2018
4d8a66c
[py_func]: Fix #20021
asimshankar Jun 15, 2018
e3f7e70
Allow Tensor-valued keyword arguments for tfe.defun.
akshayka Jun 15, 2018
23bdaed
[XLA] Implement ConjugateTransposeOp
majnemer Jun 15, 2018
d1daba6
Expose Quantization params for outputs in JNI interpreter
tensorflower-gardener Jun 15, 2018
f6148d7
Add tf.contrib.checkpoint.CheckpointableBase for isinstance checks.
allenlavoie Jun 16, 2018
edf1516
Automated g4 rollback of changelist 200790145
tensorflower-gardener Jun 16, 2018
03178bc
[tf.data] Concurrency improvements to `map_and_batch`.
jsimsa Jun 16, 2018
1aac0a3
Remove bad assert in control_flow_ops.py.
skye Jun 16, 2018
1aebd98
TFE: Correctly set shapes of defun outputs
iganichev Jun 16, 2018
68af404
Automated g4 rollback of changelist 200747752
k-w-w Jun 16, 2018
e2755e0
Don't check for duplicates in FetchOutputs and FeedInputs when creati…
tensorflower-gardener Jun 16, 2018
6679e79
[tf.data] Internal refactor of the parallel version of `tf.data.Datas…
jsimsa Jun 16, 2018
6a9ea7b
[XLA:GPU] Allow different element types in multi-output fusion root t…
thomasjoerg Jun 16, 2018
6a86de5
Disable random_ops_test on windows.
gunan Jun 16, 2018
df4ff78
Automated g4 rollback of changelist 200623983
gunan Jun 16, 2018
990e1f2
TFLite Custom op for object detection postprocessing.
tensorflower-gardener Jun 16, 2018
1c697bc
Teach gather-reshape folding to work with degenerate dims
Jun 16, 2018
5764747
Optimize max/min reductions over monotonic functions
tensorflower-gardener Jun 16, 2018
e03446a
clean up
Jun 16, 2018
17d3bff
[XLA] Propagate StatusOr through SWIG interface.
cdleary Jun 16, 2018
5cb77a7
Convert ImportTensorFlow method from switch to table based.
tensorflower-gardener Jun 17, 2018
8f25577
Implement reduce_sum
tensorflower-gardener Jun 17, 2018
ba322e9
Fix minor bug in handling of IndicatorColumn in BoostedTreesClassifier.
tensorflower-gardener Jun 17, 2018
066a24e
Add support for direct buffer access from TF Lite Python API.
aselle Jun 17, 2018
2c4535c
Disable flaky random_ops_test
gunan Jun 18, 2018
6c4d248
Enable bfloat propagation for bitcast HLO
tensorflower-gardener Jun 18, 2018
8722fe2
Support BF16 propagation through domain instructions
tensorflower-gardener Jun 18, 2018
95f3a84
Use --output_user_root to specify a short output base for Windows bui…
tensorflower-gardener Jun 18, 2018
32ca2bd
[XLA:GPU] Don't run layout assignment (or any HLO passes) in multiout…
d0k Jun 18, 2018
1b52f91
Rename object detection custom op filenames to be consistent with ear…
tensorflower-gardener Jun 18, 2018
147eb9d
[XLA] Change calls to LiteralTestUtil::Equal to pass in the expected …
d0k Jun 18, 2018
e006d39
[tf.data] Cleanup of tf.contrib.data python tests.
jsimsa Jun 18, 2018
3db3e50
Add missing strip_prefix to workspace.
tensorflower-gardener Jun 18, 2018
8ecf506
[TF:XLA] Add a XlaSort operator that directly wraps the Sort HLO.
hawkinsp Jun 18, 2018
e80732c
Merge changes from github.
Jun 18, 2018
4b87c3b
Don't add to the global losses collection from tf.losses.* when execu…
allenlavoie Jun 18, 2018
a1ed9bb
Go: Update generated wrapper functions for TensorFlow ops.
tensorflower-gardener Jun 18, 2018
fc03fbf
Include the name of the resource in error messages about cross-device…
hawkinsp Jun 18, 2018
148b438
Automated g4 rollback of changelist 201011811
Jun 18, 2018
82dfc69
Go: Update generated wrapper functions for TensorFlow ops.
tensorflower-gardener Jun 18, 2018
34c45c2
[XLA] Simplify, add additional testing for TruncatedNormal
majnemer Jun 18, 2018
07359dd
fix ReadTensor not reading the full contents of reader
tensorflower-gardener Jun 18, 2018
75b9974
Have TensorFlow use latest version of nsync.
tensorflower-gardener Jun 18, 2018
3d3196f
Disable large tests in fastbuild mode.
gunan Jun 18, 2018
ab251a0
Enables `If` operator lowering in cond_v2 when XLA is disabled. Lower…
tensorflower-gardener Jun 18, 2018
1d118e7
[XLA:GPU] Un-unimplement gather emission
d0k Jun 18, 2018
b0a1fb8
Migrate to android skylark rules
tensorflower-gardener Jun 18, 2018
586d2d5
Broad refactoring (part 3): reorganize the code so that the dependenc…
Jun 18, 2018
3550ef8
Convert CheckInputsSize to return a Status instead of CHECK-failing, …
tensorflower-gardener Jun 18, 2018
3fa0009
Replace distribution_util.assert_close with tf.assert_near.
tensorflower-gardener Jun 18, 2018
24e9804
This is an initial submission of GGT to tensorflow contrib.
tensorflower-gardener Jun 18, 2018
c26ba8f
Support rsqrt for graphdef export.
tensorflower-gardener Jun 18, 2018
209662b
Fix bug in RemoveIdempotent optimizer stage.
tensorflower-gardener Jun 18, 2018
205fe2d
Fix input_batch_size for PER_HOST_V2 when model parallelism is enabled.
toponado-zz Jun 18, 2018
ae377d4
Enable the natural layouts of the entry computation to flow into the …
tensorflower-gardener Jun 18, 2018
23feb3b
Make sure CRS is fully deserializable from an HLO TXT and Proto POV.
tensorflower-gardener Jun 18, 2018
c4f0f9a
Java: Release 1.9.0-rc1
asimshankar Jun 18, 2018
d22fa07
Default to compiling functions running on TPU.
iganichev Jun 18, 2018
3029a93
Extract tf_record_test.py from reader_ops_test.py
tensorflower-gardener Jun 18, 2018
f91b5b0
Internal change.
tensorflower-gardener Jun 18, 2018
3edb609
Improving local run behavior in estimator.train_and_evaluate.
ispirmustafa Jun 19, 2018
ca24a3e
Add an iOS benchmarking app.
shashishekhar Jun 19, 2018
c70b8e7
The pretrained text embedding models in tf.hub expect a string input.…
tensorflower-gardener Jun 19, 2018
aecd8fe
Make learning decay functions return functions that return the
lxuechen Jun 19, 2018
3c0c74e
Make NNAPI delegation support more ops.
tensorflower-gardener Jun 19, 2018
eeeb666
Split out opcodes with window as subclasses from HloInstruction (kCon…
tensorflower-gardener Jun 19, 2018
91d98f5
Migration to python 3 for estimator.predict.
tensorflower-gardener Jun 19, 2018
27acbe0
Reduce Grappler overhead by skipping optimizers when the graph is tiny.
tensorflower-gardener Jun 19, 2018
3423d28
Add missing numpy header dependency to pywrap_tfe_lib
gunan Jun 19, 2018
36bf4a4
[TF:XLA] Implement TopKV2 for bfloat16 types by packing into a float32
hawkinsp Jun 19, 2018
98a8298
HloInstruction::CreateFromProto should not crash on CHECK, instead ne…
tensorflower-gardener Jun 19, 2018
183ea7a
Automated g4 rollback of changelist 201089859
lxuechen Jun 19, 2018
e8d37d9
Split out HloHostComputeInstruction, HloPadInstruction and HloDynamic…
tensorflower-gardener Jun 19, 2018
60b78d6
Load NCCL lib on-demand to facilitate default NCCL version upgrade to 2
smit-hinsu Jun 19, 2018
6070ae0
Merge changes from github.
Jun 19, 2018
a36636e
Update ops-related pbtxt files.
tensorflower-gardener Jun 19, 2018
a79d083
Go: Update generated wrapper functions for TensorFlow ops.
tensorflower-gardener Jun 19, 2018
c9b142c
Automated g4 rollback of changelist 200988382
gunan Jun 19, 2018
70d7638
Update downloadable clang to r334100.
ilya-biryukov Jun 19, 2018
d091290
Mark Gather as fusile.
akuegel Jun 19, 2018
a89726d
Derivative of tf.igamma(a, x) and tf.igammac(a, x) with respect to a.
tensorflower-gardener Jun 19, 2018
27ad1f3
Update ops-related pbtxt files.
tensorflower-gardener Jun 19, 2018
fc6ff59
Go: Update generated wrapper functions for TensorFlow ops.
tensorflower-gardener Jun 19, 2018
707ac11
Update a few documentation for layer-input-casting feature.
protoget Jun 19, 2018
bae4a27
Internal change
tensorflower-gardener Jun 19, 2018
1e3caf5
Disable test on windows.
Jun 19, 2018
124fadc
Performance microtweaks: Pass by reference rather than by value; pre-…
tensorflower-gardener Jun 19, 2018
2f7c783
[tf.data] Fix a performance-related finding from clang-tidy.
mrry Jun 19, 2018
316fee4
Update TFLite "minimal" example
tensorflower-gardener Jun 19, 2018
a14de34
Automated g4 rollback of changelist 201069367
Jun 19, 2018
c532c3f
[TF:XLA] Add a global mutex around XlaCompileOnDemandOp's call to Exe…
hawkinsp Jun 19, 2018
5fc2bdd
Implement TFLite sqrt/rsqrt unary operators
tensorflower-gardener Jun 19, 2018
7f44992
Refresh allocations in the presence of dynamic tensors
tensorflower-gardener Jun 19, 2018
f1a0807
Apply runtime shapes to pooling and activation kernels.
tensorflower-gardener Jun 19, 2018
ccaf2ca
Use --output_user_root to specify a short output base for Windows bui…
tensorflower-gardener Jun 19, 2018
c740b34
Allow setting server def on the eager context, and add the eager serv…
Jun 19, 2018
afd1c2c
Automated g4 rollback of changelist 201190626
tensorflower-gardener Jun 19, 2018
bed3fcd
Adding reference to the following classes:
tensorflower-gardener Jun 19, 2018
d2385b2
Automated g4 rollback of changelist 200783477
reedwm Jun 19, 2018
a1043d4
Correctly compute real and side outputs when constructing backprop fu…
akshayka Jun 19, 2018
f7372b8
Internal Change.
Jun 19, 2018
a8e7bc8
Reconcile enum types.
tensorflower-gardener Jun 19, 2018
8170ca0
[TF:XLA] Bump open source llvm revision to r335024
Jun 19, 2018
f75a7e2
Rollback of changelist 200200356. We might want to support GPUs on Ma…
tensorflower-gardener Jun 19, 2018
ebe34a1
fix a bug about converting Log1p - we are checking the x tensor (not …
tensorflower-gardener Jun 19, 2018
8f19772
Rollback documentation that I forgot to rollback last time.
reedwm Jun 19, 2018
5fab6df
Support Variable Tensor API in LSTM Full kernel.
miaout17 Jun 19, 2018
878e667
Changing test size to "medium" to prevent test timeouts.
jsimsa Jun 19, 2018
ca22666
Moving SharedEmbeddingColumns state management back to graph collecti…
rohan100jain Jun 19, 2018
f9af1e1
Disable caching_device for mirrored variables.
tensorflower-gardener Jun 19, 2018
765f6d5
Automated g4 rollback of changelist 201101839
lxuechen Jun 19, 2018
92a55c7
Refactor the impl of Shard() so that the caller can use a Runner.
tensorflower-gardener Jun 19, 2018
445f167
Create hyper parameter tensors in optimizer v2 outside any control fl…
guptapriya Jun 19, 2018
27c27c5
Improve filter for cuBLAS bug.
tensorflower-gardener Jun 19, 2018
48832ef
Automated g4 rollback of changelist 201194552
tensorflower-gardener Jun 19, 2018
10091aa
Rename llvm.BUILD to llvm.autogenerated.BUILD
Jun 19, 2018
bbba4e0
Allow default TF/XLA op registration with specific backend overrides.
Jun 19, 2018
3f46969
Automated g4 rollback of changelist 200777514
kayzhu Jun 19, 2018
94c6e1b
ConfigureGcsHooks: Fixed a couple of typos.
tensorflower-gardener Jun 19, 2018
aec5a01
[TF:XLA] Prevent overflow in hlo_scheduling, when compiling AutoML mo…
dimvar Jun 19, 2018
5bc928f
Add an advanced activation layer for ReLU
tanzhenyu Jun 19, 2018
a455319
Automated g4 rollback of changelist 201217989
tensorflower-gardener Jun 19, 2018
5d93b99
Derivative of tf.random_gamma with respect to the alpha parameter.
tensorflower-gardener Jun 19, 2018
e1a7a2d
Add scripts to write to tfrecords, read from tfrecords and training.
lxuechen Jun 19, 2018
da861da
Refactor loader.load function into a class that splits the graph load…
k-w-w Jun 20, 2018
8410313
Update ops-related pbtxt files.
tensorflower-gardener Jun 20, 2018
1f48db2
Fixing a bug in linear_model where the name for the model is always s…
rohan100jain Jun 20, 2018
b10bf00
Add interface in Compiler for computing the default backend configura…
broune Jun 20, 2018
eb7005d
Go: Update generated wrapper functions for TensorFlow ops.
tensorflower-gardener Jun 20, 2018
9751540
[TF:XLA] Fix for HLO instruction post-order DFS and multioutput fusion.
tensorflower-gardener Jun 20, 2018
c04396e
Implement new API for TPUStrategy to run multiple steps, and move mos…
guptapriya Jun 20, 2018
9ab04ad
Remove the ambiguity of device/host computation layouts within the Hl…
tensorflower-gardener Jun 20, 2018
081f30a
[TF2XLA] Optimize TruncatedNormalOp
majnemer Jun 20, 2018
b8f0b73
Internal change
tensorflower-gardener Jun 20, 2018
7c754a6
Get started landing page.
lamberta Jun 20, 2018
4283949
Allow the use of 32 bit integer type for loop index and tensor elemen…
bixia1 Jun 20, 2018
89e0ce6
Improvements in the documentation of tf.random_gamma, tf.random_poiss…
tensorflower-gardener Jun 20, 2018
18fd25c
[TF:XLA] Bump open source llvm revision to r335074
akuegel Jun 20, 2018
352461a
Simplify ConvertLiteralToIrConstant()
akuegel Jun 20, 2018
55e70e5
Make common_runtime/eager libraries compile for Android, by eliding t…
tensorflower-gardener Jun 20, 2018
a056771
Support list of integers in custom op attributes.
tensorflower-gardener Jun 20, 2018
2ff8bbd
Support defun-ing instance methods.
akshayka Jun 20, 2018
62c3e35
Fix eager path in get_started leftnav
lamberta Jun 20, 2018
e370e54
Fix a bug that would leave orphaned arrays in the graph.
tensorflower-gardener Jun 20, 2018
af3455a
[tf.data] Properly export `tf.contrib.data.choose_from_datasets()`
mrry Jun 20, 2018
2b08053
[eager]: Support string attributes where the value contains `\0`.
asimshankar Jun 20, 2018
60f965a
s/tf.contrib.eager.GradientTape/tf.GradientTape/
asimshankar Jun 20, 2018
856adff
Hide py3 names we don't need to document.
MarkDaoust Jun 20, 2018
88625ad
16-bit quantized add support in TFLite interpreter
tensorflower-gardener Jun 20, 2018
2b45f14
Allow TowerLocalVars to be updated with the same value across all tow…
Jun 20, 2018
faba438
[TF:XLA] Change hlo_domain_test to use HloVerifiedTestBase.
dimvar Jun 20, 2018
3bfd3ae
Update protobuf dependency of TF to 3.6.
gunan Jun 20, 2018
6c08402
[tf.data] Properly export `tf.contrib.data.group_by_reducer()`
jsimsa Jun 20, 2018
e51df59
Boilerplate for an ANF transformer. This is not currently related to …
Jun 20, 2018
4efefb9
Implement TFLite Shape operator
jdduke Jun 20, 2018
c40ed1d
Fix a bug: the conversion of pure Conv to DepthwiseConv did not
tensorflower-gardener Jun 20, 2018
1f7d5c3
Make evaluate() work on anything that has a numpy() method in eager t…
tensorflower-gardener Jun 20, 2018
5988a74
SymbolicGradient for some resource variables.
alextp Jun 20, 2018
5d773dd
Fix gradle build for TFLite Android example.
shashishekhar Jun 20, 2018
4fdb7cc
Split GradientBoostedDecisionTreeModel.train() to three steps.
tensorflower-gardener Jun 20, 2018
8f1f0a8
Merge commit for internal changes
mingxingtan Jun 20, 2018
345d484
Fix minor merging issue.
mingxingtan Jun 20, 2018
2330079
Fix an XLA merging error.
mingxingtan Jun 21, 2018
f5ce4d8
Disable decorators_test for pip.
yifeif Jun 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions tensorflow/c/eager/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ tf_cuda_library(
"//tensorflow/core/distributed_runtime/eager:eager_client",
"//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
"//tensorflow/core/distributed_runtime/rpc:grpc_channel",
"//tensorflow/core/distributed_runtime/rpc/eager:eager_grpc_server_lib",
"//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
"//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache",
"//tensorflow/core/distributed_runtime/rpc:grpc_worker_service",
Expand Down Expand Up @@ -93,10 +92,10 @@ tf_cuda_library(
"//tensorflow/core/distributed_runtime/eager:eager_client",
"//tensorflow/core/distributed_runtime/eager:remote_tensor_handle",
"//tensorflow/core/distributed_runtime/rpc:grpc_channel",
"//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
"//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache",
"//tensorflow/core/distributed_runtime/rpc:grpc_worker_service",
"//tensorflow/core/distributed_runtime/rpc:rpc_rendezvous_mgr",
"//tensorflow/core/distributed_runtime/rpc/eager:eager_grpc_server_lib",
"//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
],
)
Expand Down Expand Up @@ -139,7 +138,7 @@ tf_cuda_cc_test(
"//tensorflow/core:protos_all_cc",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"//tensorflow/core/distributed_runtime/rpc/eager:eager_grpc_server_lib",
"//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
],
)

Expand Down
86 changes: 59 additions & 27 deletions tensorflow/c/eager/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ limitations under the License.
#include "tensorflow/core/common_runtime/eager/execute.h"
#include "tensorflow/core/common_runtime/function.h"
#include "tensorflow/core/common_runtime/rendezvous_mgr.h"
#include "tensorflow/core/distributed_runtime/rpc/eager/eager_grpc_server_lib.h"
#include "tensorflow/core/distributed_runtime/rpc/eager/grpc_eager_client.h"
#include "tensorflow/core/distributed_runtime/rpc/grpc_channel.h"
#include "tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h"
#include "tensorflow/core/distributed_runtime/server_lib.h"
#include "tensorflow/core/distributed_runtime/worker_env.h"
#include "tensorflow/core/framework/node_def_util.h"
#include "tensorflow/core/framework/rendezvous.h"
#include "tensorflow/core/framework/tensor_shape.pb.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/lib/core/refcount.h"
#include "tensorflow/core/lib/core/stringpiece.h"
#include "tensorflow/core/lib/gtl/cleanup.h"
#include "tensorflow/core/lib/gtl/flatmap.h"
#include "tensorflow/core/lib/gtl/map_util.h"
Expand Down Expand Up @@ -147,46 +148,66 @@ tensorflow::Status CreateRemoteContexts(

tensorflow::Status NewRemoteAwareTFE_Context(const TFE_ContextOptions* opts,
TFE_Context** ctx) {
// We don't use the TF_RETURN_IF_ERROR macro directly since that destroys the
// server object (which currently CHECK-fails) and we miss the error, instead,
// we log the error, and then return to allow the user to see the error
// message.
#define LOG_AND_RETURN_IF_ERROR(...) \
do { \
const ::tensorflow::Status _status = (__VA_ARGS__); \
LOG(ERROR) << _status.error_message(); \
if (TF_PREDICT_FALSE(!_status.ok())) return _status; \
} while (0)

string worker_name = tensorflow::strings::StrCat(
"/job:", opts->server_def.job_name(),
"/replica:0/task:", opts->server_def.task_index());
std::unique_ptr<tensorflow::eager::EagerGrpcServer> server;
TF_RETURN_IF_ERROR(
tensorflow::eager::EagerGrpcServer::Create(opts->server_def, &server));

TF_RETURN_IF_ERROR(server->Start());
std::unique_ptr<tensorflow::ServerInterface> server;
LOG_AND_RETURN_IF_ERROR(tensorflow::NewServer(opts->server_def, &server));

tensorflow::GrpcServer* grpc_server =
dynamic_cast<tensorflow::GrpcServer*>(server.get());
if (grpc_server == nullptr) {
LOG_AND_RETURN_IF_ERROR(tensorflow::errors::Internal(
"Currently, TFE_NewContext only supports tensorflow::GrpcServer."));
}

LOG_AND_RETURN_IF_ERROR(grpc_server->Start());

std::vector<string> remote_workers;
server->master_env()->worker_cache->ListWorkers(&remote_workers);
grpc_server->master_env()->worker_cache->ListWorkers(&remote_workers);
remote_workers.erase(
std::remove(remote_workers.begin(), remote_workers.end(), worker_name),
remote_workers.end());

std::unique_ptr<tensorflow::DeviceMgr> remote_device_mgr;
TF_RETURN_IF_ERROR(GetAllRemoteDevices(
remote_workers, server->master_env()->worker_cache, &remote_device_mgr));
LOG_AND_RETURN_IF_ERROR(GetAllRemoteDevices(
remote_workers, grpc_server->master_env()->worker_cache,
&remote_device_mgr));

std::shared_ptr<tensorflow::GrpcChannelCache> channel_cache =
server->channel_cache();
grpc_server->channel_cache();
std::unique_ptr<tensorflow::eager::EagerClientCache> remote_eager_workers(
tensorflow::eager::NewGrpcEagerClientCache(channel_cache));

// Initialize remote eager workers.
tensorflow::gtl::FlatMap<string, tensorflow::uint64> remote_contexts;
TF_RETURN_IF_ERROR(CreateRemoteContexts(remote_workers,
remote_eager_workers.get(),
opts->async, &remote_contexts));
LOG_AND_RETURN_IF_ERROR(CreateRemoteContexts(remote_workers,
remote_eager_workers.get(),
opts->async, &remote_contexts));

tensorflow::RemoteRendezvous* r =
server->worker_env()->rendezvous_mgr->Find(0);
grpc_server->worker_env()->rendezvous_mgr->Find(0);

auto* device_mgr = server->worker_env()->device_mgr;
auto* device_mgr = grpc_server->worker_env()->device_mgr;
*ctx = new TFE_Context(opts->session_options.options, opts->policy,
opts->async, device_mgr, r, std::move(server),
std::move(remote_eager_workers),
std::move(remote_device_mgr), remote_contexts);

return tensorflow::Status::OK();
#undef LOG_AND_RETURN_IF_ERROR
}
} // namespace

Expand Down Expand Up @@ -421,8 +442,11 @@ TF_AttrType TFE_OpNameGetAttrType(TFE_Context* ctx,
return ret;
}

void TFE_OpSetAttrString(TFE_Op* op, const char* attr_name, const char* value) {
op->operation.MutableAttrs()->Set(attr_name, value);
void TFE_OpSetAttrString(TFE_Op* op, const char* attr_name, const void* value,
size_t length) {
op->operation.MutableAttrs()->Set(
attr_name,
tensorflow::StringPiece(static_cast<const char*>(value), length));
}

void TFE_OpSetAttrInt(TFE_Op* op, const char* attr_name, int64_t value) {
Expand Down Expand Up @@ -473,16 +497,22 @@ void TFE_OpSetAttrFunction(TFE_Op* op, const char* attr_name,
op->operation.MutableAttrs()->Set(attr_name, attr_value);
}

#define TFE_OP_SET_ATTR_LIST(fn, type) \
void fn(TFE_Op* op, const char* attr_name, const type* values, \
int num_values) { \
op->operation.MutableAttrs()->Set( \
attr_name, \
tensorflow::gtl::ArraySlice<const type>(values, num_values)); \
void TFE_OpSetAttrStringList(TFE_Op* op, const char* attr_name,
const void* const* values, const size_t* lengths,
int num_values) {
std::vector<tensorflow::StringPiece> v(num_values);
for (int i = 0; i < num_values; ++i) {
v[i] = tensorflow::StringPiece(static_cast<const char*>(values[i]),
lengths[i]);
}
TFE_OP_SET_ATTR_LIST(TFE_OpSetAttrStringList, char*)
TFE_OP_SET_ATTR_LIST(TFE_OpSetAttrFloatList, float)
#undef TFE_OP_SET_ATTR_LIST
op->operation.MutableAttrs()->Set(attr_name, v);
}

void TFE_OpSetAttrFloatList(TFE_Op* op, const char* attr_name,
const float* values, int num_values) {
op->operation.MutableAttrs()->Set(
attr_name, tensorflow::gtl::ArraySlice<const float>(values, num_values));
}

void TFE_OpSetAttrIntList(TFE_Op* op, const char* attr_name,
const int64_t* values, int num_values) {
Expand Down Expand Up @@ -655,9 +685,11 @@ void SetOpAttrValueScalar(TFE_Context* ctx, TFE_Op* op,
const tensorflow::AttrValue& default_value,
const char* attr_name, TF_Status* status) {
switch (default_value.value_case()) {
case tensorflow::AttrValue::kS:
TFE_OpSetAttrString(op, attr_name, default_value.s().data());
case tensorflow::AttrValue::kS: {
const string& v = default_value.s();
TFE_OpSetAttrString(op, attr_name, v.data(), v.size());
break;
}
case tensorflow::AttrValue::kI:
TFE_OpSetAttrInt(op, attr_name, static_cast<int64_t>(default_value.i()));
break;
Expand Down
6 changes: 4 additions & 2 deletions tensorflow/c/eager/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ TF_CAPI_EXPORT extern TF_AttrType TFE_OpNameGetAttrType(

TF_CAPI_EXPORT extern void TFE_OpSetAttrString(TFE_Op* op,
const char* attr_name,
const char* value);
const void* value,
size_t length);
TF_CAPI_EXPORT extern void TFE_OpSetAttrInt(TFE_Op* op, const char* attr_name,
int64_t value);
TF_CAPI_EXPORT extern void TFE_OpSetAttrFloat(TFE_Op* op, const char* attr_name,
Expand All @@ -305,7 +306,8 @@ TF_CAPI_EXPORT extern void TFE_OpSetAttrFunction(TFE_Op* op,

TF_CAPI_EXPORT extern void TFE_OpSetAttrStringList(TFE_Op* op,
const char* attr_name,
const char** value,
const void* const* values,
const size_t* lengths,
int num_values);
TF_CAPI_EXPORT extern void TFE_OpSetAttrIntList(TFE_Op* op,
const char* attr_name,
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/c/eager/c_api_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ limitations under the License.
#include "tensorflow/core/common_runtime/rendezvous_mgr.h"
#include "tensorflow/core/distributed_runtime/eager/eager_client.h"
#include "tensorflow/core/distributed_runtime/remote_device.h"
#include "tensorflow/core/distributed_runtime/rpc/eager/eager_grpc_server_lib.h"
#include "tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h"
#include "tensorflow/core/distributed_runtime/rpc/grpc_worker_cache.h"
#include "tensorflow/core/distributed_runtime/rpc/grpc_worker_service.h"
#include "tensorflow/core/distributed_runtime/rpc/rpc_rendezvous_mgr.h"
Expand Down Expand Up @@ -78,7 +78,7 @@ struct TFE_Context {
TFE_ContextDevicePlacementPolicy default_policy, bool async,
tensorflow::DeviceMgr* local_device_mgr,
tensorflow::Rendezvous* rendezvous,
std::unique_ptr<tensorflow::GrpcServer> server,
std::unique_ptr<tensorflow::ServerInterface> server,
std::unique_ptr<tensorflow::eager::EagerClientCache> remote_eager_workers,
std::unique_ptr<tensorflow::DeviceMgr> remote_device_mgr,
const tensorflow::gtl::FlatMap<tensorflow::string, tensorflow::uint64>&
Expand Down
22 changes: 11 additions & 11 deletions tensorflow/c/eager/c_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.

#include <string.h>
#include "tensorflow/c/eager/c_api_test_util.h"
#include "tensorflow/core/distributed_runtime/rpc/eager/eager_grpc_server_lib.h"
#include "tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h"
#include "tensorflow/core/framework/function.pb.h"
#include "tensorflow/core/lib/strings/strcat.h"
#include "tensorflow/core/platform/logging.h"
Expand Down Expand Up @@ -132,10 +132,10 @@ void TestRemoteExecute(bool async) {

server_def.set_task_index(1);

std::unique_ptr<tensorflow::eager::EagerGrpcServer> worker_server;
ASSERT_TRUE(
tensorflow::eager::EagerGrpcServer::Create(server_def, &worker_server)
.ok());
std::unique_ptr<tensorflow::GrpcServer> worker_server;
ASSERT_TRUE(tensorflow::GrpcServer::Create(
server_def, tensorflow::Env::Default(), &worker_server)
.ok());
ASSERT_TRUE(worker_server->Start().ok());

TF_Status* status = TF_NewStatus();
Expand Down Expand Up @@ -215,10 +215,10 @@ void TestRemoteExecuteSilentCopies(bool async) {

server_def.set_task_index(1);

std::unique_ptr<tensorflow::eager::EagerGrpcServer> worker_server;
ASSERT_TRUE(
tensorflow::eager::EagerGrpcServer::Create(server_def, &worker_server)
.ok());
std::unique_ptr<tensorflow::GrpcServer> worker_server;
ASSERT_TRUE(tensorflow::GrpcServer::Create(
server_def, tensorflow::Env::Default(), &worker_server)
.ok());
ASSERT_TRUE(worker_server->Start().ok());

TF_Status* status = TF_NewStatus();
Expand Down Expand Up @@ -1162,8 +1162,8 @@ TFE_TensorHandle* CreateVariable(TFE_Context* ctx, float value,
if (TF_GetCode(status) != TF_OK) return nullptr;
TFE_OpSetAttrType(op, "dtype", TF_FLOAT);
TFE_OpSetAttrShape(op, "shape", {}, 0, status);
TFE_OpSetAttrString(op, "container", "");
TFE_OpSetAttrString(op, "shared_name", "");
TFE_OpSetAttrString(op, "container", "", 0);
TFE_OpSetAttrString(op, "shared_name", "", 0);
if (TF_GetCode(status) != TF_OK) return nullptr;
TFE_TensorHandle* var_handle = nullptr;
int num_retvals = 1;
Expand Down
1 change: 1 addition & 0 deletions tensorflow/compiler/jit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ cc_library(
"//tensorflow/compiler/jit/ops:parallel_check_op",
"//tensorflow/compiler/jit/ops:xla_ops",
"//tensorflow/compiler/tf2xla:dump_graph",
"//tensorflow/compiler/tf2xla:validate_control_flow",
"//tensorflow/compiler/tf2xla:xla_compiler",
"//tensorflow/compiler/xla:status_macros",
"//tensorflow/core:core_cpu",
Expand Down
22 changes: 21 additions & 1 deletion tensorflow/compiler/jit/create_xla_launch_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,28 @@ class SinglePassSearch {

Status CompilationRequested(const FunctionLibraryRuntime& flr,
const NodeDef& node_def) {
const FunctionDef* function_def =
flr.GetFunctionLibraryDefinition()->Find(node_def.name());
if (function_def == nullptr) {
// The node def is not calling a function. Individual ops can be
// run directly using on-demand mode, no need to create XlaLaunch
// kernel for them.
// TODO(b/110359382): Make custom kernel creation return a bool instead of
// status.
// We don't set error messages here to avoid unnecessary string copy.
// Similarly below.
return Status(error::INVALID_ARGUMENT, "");
}

// If kXlaCompileAttr is set on the node_def, use its value.
const auto& it = node_def.attr().find(kXlaCompileAttr);
if (it != node_def.attr().end()) {
return it->second.b() ? Status::OK() : Status(error::INVALID_ARGUMENT, "");
}

// kXlaCompileAttr is not set on node_def, check if it is set on
// FunctionDef.
bool xla_compile = false;
// Check if op is marked _XlaCompile=true.
Status status = flr.GetFunctionLibraryDefinition()->GetAttr(
node_def, kXlaCompileAttr, &xla_compile);
if (!status.ok() || !xla_compile) {
Expand Down
16 changes: 12 additions & 4 deletions tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ limitations under the License.
#include "tensorflow/compiler/jit/shape_inference_helpers.h"
#include "tensorflow/compiler/tf2xla/const_analysis.h"
#include "tensorflow/compiler/tf2xla/dump_graph.h"
#include "tensorflow/compiler/tf2xla/validate_control_flow.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/core/common_runtime/function.h"
#include "tensorflow/core/common_runtime/optimization_registry.h"
Expand Down Expand Up @@ -1504,6 +1505,11 @@ Status Encapsulator::SplitIntoSubgraphs() {
for (auto& entry : subgraphs_) {
Subgraph& subgraph = entry.second;
FixupSourceAndSinkEdges(subgraph.GetGraph());
// Verify that the graph has well-formed control flow structure to be
// functionalized.
std::vector<ControlFlowInfo> dummy;
TF_RETURN_IF_ERROR(
BuildAndValidateControlFlowInfo(subgraph.GetGraph(), &dummy));
}

return s;
Expand Down Expand Up @@ -2519,10 +2525,12 @@ Status EncapsulateSubgraphsPass::Run(
return Status::OK();
};

TF_RETURN_IF_ERROR(EncapsulateSubgraphsInFunctions(
kXlaClusterAttr, kXlaOutsideCompilationAttr, **options.graph,
rewrite_subgraph,
/*reuse_existing_functions=*/false, &graph_out, library));
TF_RETURN_WITH_CONTEXT_IF_ERROR(
EncapsulateSubgraphsInFunctions(
kXlaClusterAttr, kXlaOutsideCompilationAttr, **options.graph,
rewrite_subgraph, /*reuse_existing_functions=*/false, &graph_out,
library),
"EncapsulateSubgraphsPass failed");

if (VLOG_IS_ON(1)) {
dump_graph::DumpGraphToFile("after_encapsulate_subgraphs", *graph_out,
Expand Down
14 changes: 12 additions & 2 deletions tensorflow/compiler/jit/xla_compile_on_demand_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,24 @@ Status XlaCompileOnDemandOp::Run(OpKernelContext* ctx,
ctx->op_device_context() ? ctx->op_device_context()->stream() : nullptr;
TF_RET_CHECK(stream);

VLOG(2) << "Executing computation.";
VLOG(2) << "Executing computation: " << name();
for (const xla::ShapedBuffer* arg : launch_context.arguments()) {
VLOG(2) << name() << ": " << *arg;
}
xla::ExecutableRunOptions run_options;
run_options.set_stream(stream);
run_options.set_allocator(client->backend().memory_allocator());
run_options.set_intra_op_thread_pool(&ctx->eigen_cpu_device());
run_options.set_rng_seed(ctx->step_id());

auto run_result = executable->Run(launch_context.arguments(), run_options);
xla::StatusOr<xla::ScopedShapedBuffer> run_result;
{
// TODO(b/110383871): fix concurrency problems and remove this mutex.
static mutex* mu = new mutex;
mutex_lock lock(*mu);

run_result = executable->Run(launch_context.arguments(), run_options);
}
TF_RETURN_IF_ERROR(run_result.status());

launch_context.PopulateOutputs(ctx, result, run_result.ConsumeValueOrDie());
Expand Down
8 changes: 4 additions & 4 deletions tensorflow/compiler/jit/xla_device_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Status XlaTransferManager::TransferLiteralToDevice(
XlaTensor::FromTensor(device_tensor)->shaped_buffer();
VLOG(1) << "Transfer to device as literal: " << literal.ToString() << " "
<< shaped_buffer.ToString();
return transfer_manager_->TransferLiteralToDevice(stream_->parent(), literal,
return transfer_manager_->TransferLiteralToDevice(stream_, literal,
shaped_buffer);
}

Expand All @@ -83,9 +83,9 @@ Status XlaTransferManager::TransferLiteralFromDevice(
const xla::ShapedBuffer& shaped_buffer =
XlaTensor::FromTensor(&device_tensor)->shaped_buffer();

TF_ASSIGN_OR_RETURN(std::unique_ptr<xla::Literal> literal,
transfer_manager_->TransferLiteralFromDevice(
stream_->parent(), shaped_buffer));
TF_ASSIGN_OR_RETURN(
std::unique_ptr<xla::Literal> literal,
transfer_manager_->TransferLiteralFromDevice(stream_, shaped_buffer));
VLOG(1) << "Transfer from device as literal: " << literal->ToString() << " "
<< shaped_buffer.ToString();
Tensor tensor;
Expand Down