@@ -240,13 +240,6 @@ G4_BB* FlowGraph::createNewBB(bool insertInFG)
240240 if (insertInFG)
241241 numBBId++;
242242
243- if (builder->getOptions ()->getTarget () == VISA_3D)
244- {
245- // all 3D bbs are considered to be in SIMD CF since the dispatch mask may
246- // have some channels off.
247- bb->setInSimdFlow (true );
248- }
249-
250243 BBAllocList.push_back (bb);
251244 return bb;
252245}
@@ -905,7 +898,7 @@ void FlowGraph::constructFlowGraph(INST_LIST& instlist)
905898
906899 if (hasSIMDCF && pKernel->getIntKernelAttribute (Attributes::ATTR_Target) == VISA_CM)
907900 {
908- markSimdBlocks (labelMap, funcInfoHashTable);
901+ processSCF (labelMap, funcInfoHashTable);
909902 addSIMDEdges ();
910903 }
911904
@@ -2595,19 +2588,17 @@ G4_BB* FlowGraph::findLabelBB(
25952588
25962589
25972590/*
2598- * Mark blocks that are nested in SIMD control flow.
2599- * Only structured CF is handled here, SIMD BBs due to goto/join
2600- * are marked in processGoto()
2591+ * This function sets the JIP for Structured CF (SCF) instructions, Unstructured
2592+ * Control Flow (UCF) instructions (goto) are handled in processGoto().
26012593*
2602- * This function also sets the JIP of the endif to its enclosing endif/while, if it exists
26032594* Note: we currently do not consider goto/join when adding the JIP for endif,
26042595* since structure analysis should not allow goto into/out of if-endif. This means
26052596* we only need to set the the JIP of the endif to its immediately enclosing endif/while
26062597*
26072598* The simd control flow blocks must be well-structured
26082599*
26092600*/
2610- void FlowGraph::markSimdBlocks (std::map<std::string, G4_BB*>& labelMap, FuncInfoHashTable &FuncInfoMap)
2601+ void FlowGraph::processSCF (std::map<std::string, G4_BB*>& labelMap, FuncInfoHashTable &FuncInfoMap)
26112602{
26122603 std::stack<StructuredCF*> ifAndLoops;
26132604 std::vector<StructuredCF*> structuredSimdCF;
@@ -2659,11 +2650,6 @@ void FlowGraph::markSimdBlocks(std::map<std::string, G4_BB*>& labelMap, FuncInfo
26592650 }
26602651 }
26612652
2662- if (ifAndLoops.size () > 0 )
2663- {
2664- bb->setInSimdFlow (true );
2665- }
2666-
26672653 if (bb->size () > 0 )
26682654 {
26692655 G4_INST* lastInst = bb->back ();
@@ -2698,45 +2684,6 @@ void FlowGraph::markSimdBlocks(std::map<std::string, G4_BB*>& labelMap, FuncInfo
26982684 setJIPForEndif (cf->mEndInst , cf->enclosingCF ->mEndInst , cf->enclosingCF ->mEndBB );
26992685 }
27002686 }
2701-
2702- // Visit the call graph, and mark simd blocks in subroutines.
2703- std::set<FuncInfo*> Visited;
2704- std::queue<FuncInfo*> Funcs;
2705-
2706- // Starting with kernel.
2707- Funcs.push (kernelInfo);
2708-
2709- // Now process all subroutines called in a simd-cf block.
2710- while (!Funcs.empty ())
2711- {
2712- FuncInfo* CallerInfo = Funcs.front ();
2713- Funcs.pop ();
2714-
2715- // Skip if this is already visited.
2716- if (!Visited.insert (CallerInfo).second )
2717- continue ;
2718-
2719- for (auto BB : CallerInfo->getBBList ())
2720- {
2721- if (BB->isInSimdFlow () && BB->isEndWithCall ())
2722- {
2723- G4_INST *CI = BB->back ();
2724- if (CI->getSrc (0 )->isLabel ())
2725- {
2726- G4_Label* Callee = CI->getSrc (0 )->asLabel ();
2727- G4_BB* CalleeEntryBB = labelMap[Callee->getLabel ()];
2728- FuncInfo* CalleeInfo = CalleeEntryBB->getFuncInfo ();
2729- Funcs.push (CalleeInfo);
2730-
2731- // Mark all blocks in this subroutine.
2732- for (auto BB1 : CalleeInfo->getBBList ())
2733- {
2734- BB1->setInSimdFlow (true );
2735- }
2736- }
2737- }
2738- }
2739- }
27402687}
27412688
27422689// markDivergentBBs()
@@ -2770,7 +2717,6 @@ void FlowGraph::markDivergentBBs()
27702717 for (auto IT = BBs.begin (), IE = BBs.end (); IT != IE; ++IT)
27712718 {
27722719 G4_BB* BB = *IT;
2773- BB->setInSimdFlow (true );
27742720 BB->setDivergent (true );
27752721 }
27762722 return ;
@@ -3012,9 +2958,6 @@ void FlowGraph::markDivergentBBs()
30122958 G4_BB* BB = *IT;
30132959
30142960 BB->setDivergent (true );
3015- // set InSIMDFlow as well, will merge two gradually
3016- BB->setInSimdFlow (true );
3017-
30182961 if (BB->size () == 0 )
30192962 {
30202963 // sanity check
@@ -3147,8 +3090,6 @@ void FlowGraph::markDivergentBBs()
31473090 // normal scan of BB
31483091 if (isPriorToLastJoin (BB)) {
31493092 BB->setDivergent (true );
3150- // set InSIMDFlow as well, will merge these two fields gradually
3151- BB->setInSimdFlow (true );
31523093 }
31533094 // Temporary for debugging, toBeDelete!
31543095 // if (pKernel->getIntKernelAttribute(Attributes::ATTR_Target) == VISA_CM)
@@ -3452,13 +3393,6 @@ void FlowGraph::processGoto(bool HasSIMDCF)
34523393 }
34533394 }
34543395
3455- // at this point if there are active join blocks, we are in SIMD control flow
3456- // FIXME: This is over pessimistic for kernels with actual simd cf.
3457- if (HasSIMDCF && !activeJoinBlocks.empty ())
3458- {
3459- bb->setInSimdFlow (true );
3460- }
3461-
34623396 G4_INST* lastInst = bb->back ();
34633397 if (lastInst->opcode () == G4_goto && !lastInst->asCFInst ()->isBackward ())
34643398 {
0 commit comments