aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/tf2xla
diff options
context:
space:
mode:
authorGravatar Mark Heffernan <meheff@google.com>2018-09-12 13:19:18 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-12 13:23:12 -0700
commit5d1de24583aabeb2cb883ab197ae2b8d5446c565 (patch)
tree8e1227ad724f3da4413ce51ef4d39925b7ff226a /tensorflow/compiler/tf2xla
parent3fb474713b27552eba1943bb4172e54ad2dd13bc (diff)
Preserve unique ids when serializing/deserializing HLO protos.
Re-assigning unique IDs broke serialization of HloSchedule, and keeping IDs stable improves the fidelity of the proto serialization. This change requires that instructions in HLO module protos have valid, module-scope-unique ids so change the XLA builder to hand out module-scope-unique ids. Previously, instruction ids were only unique in the computation scope. PiperOrigin-RevId: 212692339
Diffstat (limited to 'tensorflow/compiler/tf2xla')
-rw-r--r--tensorflow/compiler/tf2xla/xla_compiler_test.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/tensorflow/compiler/tf2xla/xla_compiler_test.cc b/tensorflow/compiler/tf2xla/xla_compiler_test.cc
index 100b10cd83..72b17d04fc 100644
--- a/tensorflow/compiler/tf2xla/xla_compiler_test.cc
+++ b/tensorflow/compiler/tf2xla/xla_compiler_test.cc
@@ -604,10 +604,17 @@ TEST_F(XlaCompilerTest, DeterministicCompilation) {
auto instr1 = c1.instructions(j);
auto instr2 = c2.instructions(j);
instr1.clear_name();
+ instr1.clear_id();
+ instr1.clear_operand_ids();
instr2.clear_name();
- // The names of instructions were uniquified by the XlaBuilder, the rest
- // of the fields should be identical.
+ instr2.clear_id();
+ instr2.clear_operand_ids();
+ // The names of instructions were uniquified by the XlaBuilder and the
+ // unique ids may be different, the rest of the fields should be
+ // identical.
string str1, str2;
+ LOG(INFO) << "instr1 = " << instr1.DebugString();
+ LOG(INFO) << "instr2 = " << instr2.DebugString();
instr1.AppendPartialToString(&str1);
instr2.AppendPartialToString(&str2);
EXPECT_EQ(str1, str2);