aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_computation.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-03-20 16:13:58 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-20 16:17:13 -0700
commit49ee96a60bea1b595cff3cb550cfc8d2ade5ed8b (patch)
treeaa71f2881ff280bb608ee9d0ec9ee05fc7c1a93c /tensorflow/compiler/xla/service/hlo_computation.h
parent0bd851b38810540034069d92a2f76a026429bced (diff)
[XLA] Use IDs instead of names to represent the edges of HLO graph in hlo.proto.
PiperOrigin-RevId: 189831057
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_computation.h')
-rw-r--r--tensorflow/compiler/xla/service/hlo_computation.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_computation.h b/tensorflow/compiler/xla/service/hlo_computation.h
index 630d3675de..9d3f6e9a2c 100644
--- a/tensorflow/compiler/xla/service/hlo_computation.h
+++ b/tensorflow/compiler/xla/service/hlo_computation.h
@@ -160,12 +160,12 @@ class HloComputation {
// module: the module which will contain the computation. The newly created
// computation is *not* added to the module, however.
// proto: the proto to convert from.
- // computation_map: a map from computation name to HloComputation*. This map
+ // computation_map: a map from computation id to HloComputation*. This map
// must contain all computations which the newly constructed computation
// calls.
static StatusOr<std::unique_ptr<HloComputation>> CreateFromProto(
HloModule* module, const HloComputationProto& proto,
- const tensorflow::gtl::FlatMap<string, HloComputation*>& computation_map);
+ const tensorflow::gtl::FlatMap<int64, HloComputation*>& computation_map);
// Gets the instructions in this computation.
//
@@ -334,6 +334,15 @@ class HloComputation {
fusion_instruction_ = fusion_instruction;
}
+ // The id of this computation should be unique within the module.
+ void SetUniqueId(int64 id) {
+ CHECK_EQ(unique_id_, -1);
+ CHECK_GE(id, 0);
+ unique_id_ = id;
+ }
+
+ int64 unique_id() const { return unique_id_; }
+
private:
explicit HloComputation(
const string& name, int parameter_count,
@@ -344,10 +353,6 @@ class HloComputation {
HloInstruction* AddInstructionInternal(
std::unique_ptr<HloInstruction> instruction);
- // Helper for setting the parent of instructions that are added to this
- // computation.
- void Reparent(HloInstruction* instruction);
-
// Fuses HLOs in instructions_to_fuse into fusion_instruction.
//
// Pre-condition: fusion_instruction's opcode is kFusion.
@@ -365,6 +370,7 @@ class HloComputation {
std::vector<HloInstruction*> CollectUnreachableRoots() const;
string name_;
+ int64 unique_id_;
HloInstruction* root_instruction_;
// If this computation is a fusion computation, this field points to the