@@ -2602,7 +2602,11 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
26022602 // Append the scheduled node to the end of the schedule.
26032603 schedule->scheduledNodes .push_back (scheduled);
26042604 lastScheduled = scheduled;
2605-
2605+ if (scheduled->getInstructions ()->front ()->isDpas ()) {
2606+ schedule->preDPASNodeVec .push_back (scheduled);
2607+ } else {
2608+ schedule->preDPASNodeVec .clear ();
2609+ }
26062610 if (getOptions ()->getOption (vISA_SendQueueSched) &&
26072611 scheduled->getInstructions ()->front ()->isSend ()) {
26082612 // Set the cycle at which this node is scheduled.
@@ -2674,7 +2678,7 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
26742678 return (!readyList.empty () || !preReadyQueue.empty ()) && lastScheduled &&
26752679 kernel->fg .builder ->hasDPAS () &&
26762680 getOptions ()->getOption (vISA_scheduleforDPASMacro) &&
2677- (lastScheduled-> getInstructions ()-> front ()-> isDpas () );
2681+ schedule-> preDPASNodeVec . size ( );
26782682 };
26792683
26802684 // Check if depends on just scheduled previous DPAS intruction
@@ -2712,26 +2716,14 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
27122716 if (!inst->isDpas ())
27132717 return nullptr ;
27142718
2715- // Collect the dpas which are just scheduled, stop when meet a none-dpas
2716- // instruction.
2717- std::vector<Node *> preDPASNodeVec;
2718- for (int i = schedule->scheduledNodes .size () - 1 ; i >= 0 ; i--) {
2719- Node *scheduledNode = schedule->scheduledNodes [i];
2720- G4_INST *scheduledInst = scheduledNode->getInstructions ()->front ();
2721- // Dpas only
2722- if (!scheduledInst->isDpas ())
2723- break ;
2724- preDPASNodeVec.push_back (scheduledNode);
2725- }
2726-
27272719 Node *macroCandidate = nullptr ;
27282720 bool hasDep = false ;
27292721 // Check if current scheduled is the macro candidate
27302722 G4_INST *scheduledInst = scheduled->getInstructions ()->front ();
27312723 if ((scheduled->getInstructions ()->size () == 1 ) &&
27322724 scheduledInst->isDpas () &&
27332725 inst->asDpasInst ()->checksMacroTypes (*scheduledInst->asDpasInst ())) {
2734- hasDep = hasDepOnPreDpas (scheduled, preDPASNodeVec);
2726+ hasDep = hasDepOnPreDpas (scheduled, schedule-> preDPASNodeVec );
27352727 if (!hasDep && hasDpasReadSuppression (inst, scheduledInst)) {
27362728 return scheduled; // It's good candidate already, don't return nullptr
27372729 // which may be changed by other heuritics
@@ -2765,7 +2757,7 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
27652757 // Not candidate, push back to original queue
27662758 if ((node->getInstructions ()->size () != 1 ) || !nodeInst->isDpas () ||
27672759 !inst->asDpasInst ()->checksMacroTypes (*nodeInst->asDpasInst ()) ||
2768- hasDepOnPreDpas (node, preDPASNodeVec)) {
2760+ hasDepOnPreDpas (node, schedule-> preDPASNodeVec )) {
27692761 addBackReadyList (i, readyListSize, node);
27702762 i++;
27712763 continue ;
@@ -2796,8 +2788,7 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
27962788 }
27972789
27982790 // No read suppresion candidate, and reschedule happened
2799- if (!hasSuppressoinCandidate && macroCandidate &&
2800- macroCandidate != scheduled) {
2791+ if (!hasSuppressoinCandidate && macroCandidate) {
28012792 reScheduled = macroCandidate;
28022793 }
28032794
@@ -2807,7 +2798,7 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
28072798 }
28082799
28092800 // If rescheduled, push the scheduled to readyList
2810- if (reScheduled) {
2801+ if (reScheduled && reScheduled != scheduled ) {
28112802 readyList.push (scheduled);
28122803 }
28132804
@@ -3129,6 +3120,11 @@ uint32_t DDD::listSchedule(G4_BB_Schedule *schedule) {
31293120 // Scheduling for DPAS instructions
31303121 if (!heuCandidate && scheduleForDpas ()) {
31313122 heuCandidate = applyDpasHeuristic (scheduled, lastScheduled);
3123+ if (heuCandidate) {
3124+ schedule->preDPASNodeVec .push_back (heuCandidate);
3125+ } else {
3126+ schedule->preDPASNodeVec .clear ();
3127+ }
31323128 }
31333129
31343130 if (!heuCandidate && scheduleForSuppression ()) {
0 commit comments