9 POSet queuedToRemovePo;
12 POSet finishedAlivePo;
38 queuedAliveMoves, finishedAliveMoves);
44 for (
int j = 0; j < outd; j++) {
53 if (!
ddg().hasNode(head)) {
55 queuedAliveMoves, finishedAliveMoves);
61 while (!queuedAlivePo.empty() || !queuedAliveMoves.empty()) {
62 if (!queuedAlivePo.empty()) {
63 checkAlivePO(queuedAlivePo, finishedAlivePo, queuedAliveMoves, finishedAliveMoves);
65 if (!queuedAliveMoves.empty()) {
66 checkAliveMove(queuedAliveMoves, finishedAliveMoves, queuedAlivePo, finishedAlivePo);
71 while (!queuedToRemovePo.empty() || !maybeRemovePo.empty() ||
72 !queuedToRemoveMove.empty() || !maybeRemoveMove.empty()) {
73 if (!queuedToRemovePo.empty()) {
75 queuedToRemoveMove, maybeRemoveMove);
80 if (!queuedToRemoveMove.empty()) {
82 queuedToRemovePo, maybeRemovePo);
87 if (!maybeRemovePo.empty()) {
88 checkMaybePos(maybeRemovePo, queuedToRemovePo, finishedAlivePo);
91 if (!maybeRemoveMove.empty()) {
92 checkMaybeMoves(maybeRemoveMove, queuedToRemoveMove, finishedAliveMoves);
99 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
100 std::cerr <<
"count of removed POs: " << count << std::endl;
110 for (
int i = 0; i < po->inputMoveCount(); i++) {
113 for (
int j = 0; j < ind; j++) {
120 queuedAliveMoves, finishedAliveMoves);
123 queuedAlivePo.erase(po);
124 finishedAlivePo.insert(po);
135 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
136 std::cerr <<
"alive PO: " << mn.
toString() << std::endl;
142 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
143 std::cerr <<
"alive PO: " << mn.
toString() << std::endl;
148 if (finishedAliveMoves.find(&mn) == finishedAliveMoves.end()) {
149 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
150 std::cerr <<
"alive MN: " << mn.
toString() << std::endl;
152 queuedAliveMoves.insert(&mn);
160 POSet& queuedAlivePo,
POSet& finishedAlivePo) {
161 MoveNode* mn = *queuedAliveMoves.begin();
163 for (
int j = 0; j < ind; j++) {
170 queuedAliveMoves, finishedAliveMoves);
172 queuedAliveMoves.erase(mn);
173 finishedAliveMoves.insert(mn);
181 POSet& queuedToRemovePo,
POSet& maybeRemovePo,
185 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
186 std::cerr <<
"Removing programoperation: " << po->toString()
189 for (
int i = 0; i < po->inputMoveCount(); i++) {
192 for (
int j = 0; j < ind; j++) {
202 if (queuedToRemovePo.find(tailOp) == queuedToRemovePo.end()) {
203 maybeRemovePo.insert(tailOp);
206 if (queuedToRemoveMove.find(&tail) == queuedToRemoveMove.end()) {
207 maybeRemoveMove.insert(&tail);
214 if (queuedToRemovePo.find(tailOp) == queuedToRemovePo.end()) {
215 maybeRemovePo.insert(tailOp);
223 for (
int i = 0; i < po->outputMoveCount(); i++) {
231 queuedToRemovePo.erase(queuedToRemovePo.begin());
237 POSet& queuedToRemovePo,
POSet& maybeRemovePo) {
238 MoveNode* mn = *queuedToRemoveMove.begin();
239 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
240 std::cerr <<
"\tRemoving move: " << mn->
toString()
244 for (
int j = 0; j < ind; j++) {
256 if (queuedToRemovePo.find(tailOp) == queuedToRemovePo.end()) {
257 maybeRemovePo.insert(tailOp);
260 if (queuedToRemoveMove.find(&tail) == queuedToRemoveMove.end()) {
261 maybeRemoveMove.insert(&tail);
268 if (queuedToRemovePo.find(tailOp) == queuedToRemovePo.end()) {
269 maybeRemovePo.insert(tailOp);
278 queuedToRemoveMove.erase(queuedToRemoveMove.begin());
283 if (alivePos.find(po) == alivePos.end()) {
284 queuedToRemove.insert(po);
286 maybeRemove.erase(maybeRemove.begin());
293 MoveNode* mn = *maybeRemove.begin();
294 if (aliveNodes.find(mn) == aliveNodes.end()) {
295 queuedToRemove.insert(mn);
297 maybeRemove.erase(mn);
303 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
304 std::cerr <<
"Restoring node: " << (*i).toString() << std::endl;