mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix oscillation in coalesceInsertedDataDependencies (#20833)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/20833 Att. The algorithm is still "horrendously inefficient". But since we are sunsetting Nomnigraph, I just did the minimal fix here. Reviewed By: tracelogfb Differential Revision: D15463880 fbshipit-source-id: 413a1280a92c1923ba49031177816a2d5f888575
This commit is contained in:
committed by
Facebook Github Bot
parent
2d96876d88
commit
48bf7b9be8
@ -75,6 +75,11 @@ class BasicBlock {
|
||||
std::find(std::begin(instructions_), std::end(instructions_), instr1);
|
||||
auto it2 =
|
||||
std::find(std::begin(instructions_), std::end(instructions_), instr2);
|
||||
auto pos1b = std::distance(instructions_.begin(), it1);
|
||||
auto pos2b = std::distance(instructions_.begin(), it2);
|
||||
if (pos1b <= pos2b) {
|
||||
return;
|
||||
}
|
||||
instructions_.erase(it1);
|
||||
instructions_.insert(it2, instr1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user