aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-07-31 23:18:58 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-31 23:23:48 -0700
commit26ba623dccacfb2f913951e12089a8340e6a11ac (patch)
treebfa67abb9eb1d408bb1a4a52b8c7c5c3d470b00f /tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc
parent92279f8bfa6ce2124439aabfa6db84d722dc2b66 (diff)
Cleanup the sharding unique device API.
PiperOrigin-RevId: 206885051
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc b/tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc
index 48f676db85..b78bfa0cdf 100644
--- a/tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc
+++ b/tensorflow/compiler/xla/service/hlo_tfgraph_builder.cc
@@ -101,11 +101,11 @@ const string& HloTfGraphBuilder::GetNodeNameForInstruction(
}
};
string node_name;
- if (debug_options_.xla_hlo_tfgraph_device_scopes() &&
- instruction->has_sharding() &&
- instruction->sharding().HasUniqueDevice()) {
- node_name = StrCat(
- "dev", instruction->sharding().UniqueDevice().ConsumeValueOrDie());
+ if (debug_options_.xla_hlo_tfgraph_device_scopes()) {
+ auto device = instruction->sharding_unique_device();
+ if (device) {
+ node_name = StrCat("dev", *device);
+ }
}
// If an instruction is fused, put it in the subgraph of the fusion;
// otherwise, put it in the computation subgraph.
@@ -215,10 +215,10 @@ Status HloTfGraphBuilder::AddInstruction(const HloInstruction* instruction) {
NodeDef* node_def = graph_def_.add_node();
node_def->set_name(GetNodeNameForInstruction(instruction));
node_def->set_op(GetOpDefName(instruction));
- if (instruction->has_sharding() &&
- instruction->sharding().HasUniqueDevice()) {
- TF_ASSIGN_OR_RETURN(int64 device, instruction->sharding().UniqueDevice());
- node_def->set_device(GetDeviceName(device));
+
+ auto device = instruction->sharding_unique_device();
+ if (device) {
+ node_def->set_device(GetDeviceName(*device));
}
SetNodeAttrs(instruction, node_def);
if (instruction->opcode() == HloOpcode::kFusion) {