diff --git a/tensorflow/compiler/xla/service/hlo_value.h b/tensorflow/compiler/xla/service/hlo_value.h index a1150ae299d..a721aabef76 100644 --- a/tensorflow/compiler/xla/service/hlo_value.h +++ b/tensorflow/compiler/xla/service/hlo_value.h @@ -57,6 +57,11 @@ struct HloPosition { (instruction->unique_id() == other.instruction->unique_id() && index < other.index); } + + template + friend H AbslHashValue(H h, const HloPosition& pos) { + return H::combine(std::move(h), pos.instruction->Hash(), pos.index); + } }; std::ostream& operator<<(std::ostream& out, const HloPosition& position); @@ -81,6 +86,12 @@ struct HloUse { } bool operator!=(const HloUse& other) const { return !(*this == other); } + + template + friend H AbslHashValue(H h, const HloUse& use) { + return H::combine(std::move(h), use.instruction, use.operand_index, + use.operand_number); + } }; std::ostream& operator<<(std::ostream& out, const HloUse& use); @@ -240,7 +251,8 @@ std::ostream& operator<<(std::ostream& out, const HloValueSet& hlo_value); // hold multiple HloValueSets. class InstructionValueSet : public ShapeTree { public: - InstructionValueSet(const Shape& shape) : ShapeTree(shape) {} + explicit InstructionValueSet(const Shape& shape) + : ShapeTree(shape) {} // Sets this value set to the union of the given value sets. Returns whether // this value set changed.