Small optimization for the calculation of element reuse.
We can break a loop early if we have already found an element reuse. PiperOrigin-RevId: 329466838 Change-Id: I5f3f4940a694755c2194a11d479be23e11741efb
This commit is contained in:
parent
ab772da384
commit
6293abccc7
@ -3370,6 +3370,11 @@ class HloInstruction::FusionReusesParamElements {
|
||||
// that.
|
||||
value_it = cache->find(&hlo);
|
||||
value_it->second = new_val;
|
||||
// Fold() minimizes the UseKind value. If it is already minimum, we can
|
||||
// break the loop early.
|
||||
if (new_val == UseKind::kReuse) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return value_it->second;
|
||||
|
Loading…
x
Reference in New Issue
Block a user