HLO hash function considers all instructions in the order returned by MakeComputationSortedByContent to ignore the difference from naming.
PiperOrigin-RevId: 297893716 Change-Id: I57c109c87f9168c372081c5b17598e8f6e0536ad
This commit is contained in:
parent
b12869642a
commit
956b1ec099
|
@ -717,7 +717,10 @@ HloComputation* HloModule::GetComputationWithName(absl::string_view name) {
|
|||
|
||||
uint64 HloModule::Hash() const {
|
||||
uint64 result = entry_computation_layout().Hash();
|
||||
for (auto* computation : MakeComputationPostOrder()) {
|
||||
// Use MakeComputationSortedByContent() instead of MakeComputationPostOrder()
|
||||
// because naming may affect the order of MakeComputationPostOrder() but not
|
||||
// MakeComputationSortedByContent().
|
||||
for (auto* computation : MakeComputationSortedByContent()) {
|
||||
for (auto* instruction : computation->MakeInstructionPostOrder()) {
|
||||
result = tensorflow::Hash64Combine(result, instruction->Hash());
|
||||
}
|
||||
|
|
|
@ -196,6 +196,10 @@ class HloModule {
|
|||
// computation B, then A will appear after B in the sort.
|
||||
std::vector<HloComputation*> MakeComputationPostOrder() const;
|
||||
|
||||
// Same as MakeComputationPostOrder() but sorting the computations by their
|
||||
// contents.
|
||||
std::vector<HloComputation*> MakeComputationSortedByContent() const;
|
||||
|
||||
// Gets the computations in this module which aren't for fusion nodes.
|
||||
//
|
||||
// Postcondition: All computations in the returned list have
|
||||
|
@ -346,10 +350,6 @@ class HloModule {
|
|||
std::unique_ptr<HloComputation> computation, bool is_entry,
|
||||
bool uniquify_identifiers);
|
||||
|
||||
// Same as MakeComputationPostOrder() but sorting the computations by their
|
||||
// contents.
|
||||
std::vector<HloComputation*> MakeComputationSortedByContent() const;
|
||||
|
||||
string name_;
|
||||
HloModuleConfig config_;
|
||||
HloComputation* entry_computation_ = nullptr;
|
||||
|
|
Loading…
Reference in New Issue