mirror of
				https://github.com/intel/intel-graphics-compiler.git
				synced 2025-10-30 08:18:26 +08:00 
			
		
		
		
	IGA: code cleanup for DpasMacroBuilder (NFC)
Removed unused code.
This commit is contained in:
		| @ -583,15 +583,14 @@ size_t DepSetBuilder::DpasMacroBuilder::getNumberOfSuppresionGroups( | ||||
| } | ||||
|  | ||||
| size_t DepSetBuilder::DpasMacroBuilder::formSrcSuppressionBlock( | ||||
|     InstListIterator startIt, uint32_t srcIdx) { | ||||
|     InstListIterator startIt) { | ||||
|   // get the candidate block | ||||
|   BitSet<> allDstBits(m_dsBuilder.getGRF_LEN()); | ||||
|   BitSet<> allSrcBits(m_dsBuilder.getGRF_LEN()); | ||||
|   BitSet<> allDstNoLastBits(m_dsBuilder.getGRF_LEN()); | ||||
|   BitSet<> allSrcNoLastBits(m_dsBuilder.getGRF_LEN()); | ||||
|  | ||||
|   SuppressBlock bptr( | ||||
|       getNumberOfSuppresionGroups(srcIdx), srcIdx == 1 ? 8 : 4); | ||||
|   SuppressBlock bptr; | ||||
|  | ||||
|   size_t numSuppressed = 0; | ||||
|   InstListIterator it = startIt; | ||||
| @ -599,9 +598,6 @@ size_t DepSetBuilder::DpasMacroBuilder::formSrcSuppressionBlock( | ||||
|  | ||||
|   // find until the last instruction that can be suppressed | ||||
|   while (it != m_instList.end()) { | ||||
|     if (!srcIsSuppressCandidate(**it, srcIdx)) | ||||
|       break; | ||||
|  | ||||
|     SrcRegRangeType src_range, src_extra_range; | ||||
|     DstRegRangeType dst_range; | ||||
|     m_inps.getDpasSrcDependency(**it, src_range, src_extra_range, m_model); | ||||
| @ -610,11 +606,6 @@ size_t DepSetBuilder::DpasMacroBuilder::formSrcSuppressionBlock( | ||||
|                        GetDpasSystolicDepth((*it)->getDpasFc()) == 8)) | ||||
|       break; | ||||
|  | ||||
|     Operand &srcOp = (*it)->getSource(srcIdx); | ||||
|     // TODO: to simplify the implementation, stop looking if the src is null | ||||
|     if (srcOp.getDirRegName() != RegName::GRF_R) | ||||
|       break; | ||||
|  | ||||
|     bool skipSetLastBits = false; | ||||
|     if (hasProducerConsumerDep(dst_range, src_range, allDstBits)) { | ||||
|         break; | ||||
| @ -643,28 +634,11 @@ size_t DepSetBuilder::DpasMacroBuilder::formSrcSuppressionBlock( | ||||
|                                  bptr.allDstRange); | ||||
|  | ||||
|     // return the total instructions found can be in the macro | ||||
|     return bptr.size() + numSuppressed; | ||||
|     return numSuppressed; | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| bool DepSetBuilder::DpasMacroBuilder::srcIsSuppressCandidate( | ||||
|     const Instruction &inst, uint32_t srcIdx) const { | ||||
|   // src1 always can be the candidate since all dpas depth must be the same | ||||
|   // within the same macro | ||||
|   if (srcIdx == 1) | ||||
|     return true; | ||||
|   if (srcIdx == 2) { | ||||
|     // DP dpas must have rep count 4 | ||||
|     if (inst.isDF()) | ||||
|       return GetDpasRepeatCount(inst.getDpasFc()) == 4; | ||||
|  | ||||
|     // allow only rep count 8 for non-DP dpase | ||||
|     return GetDpasRepeatCount(inst.getDpasFc()) == 8; | ||||
|   } | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| bool DepSetBuilder::DpasMacroBuilder::hasProducerConsumerDep( | ||||
|     const DstRegRangeType &dst_range, const SrcRegRangeType &src_range, | ||||
|     const BitSet<> &target_dst_bits) const { | ||||
| @ -714,9 +688,7 @@ Instruction &DepSetBuilder::DpasMacroBuilder::formMacro(size_t &dpasCnt) { | ||||
|   } | ||||
|  | ||||
|  | ||||
|  | ||||
|   dpasCnt = std::max(dpasCnt, formSrcSuppressionBlock(m_firstDpasIt, 1)); | ||||
|   dpasCnt = std::max(dpasCnt, formSrcSuppressionBlock(m_firstDpasIt, 2)); | ||||
|   dpasCnt = std::max(dpasCnt, formSrcSuppressionBlock(m_firstDpasIt)); | ||||
|  | ||||
|   if (dpasCnt == 1) { | ||||
|     updateRegFootprintsToDepSets(src_range, src_extra_range, dst_range); | ||||
|  | ||||
| @ -533,15 +533,6 @@ private: | ||||
|   private: | ||||
|     struct SuppressBlock { | ||||
|     public: | ||||
|       // Maximum number of groups allowed. This dpeneds on platform and the src | ||||
|       // index | ||||
|       const size_t maxNumGroup; | ||||
|       const size_t groupSize; | ||||
|  | ||||
|       // Groups in this block: each group is represented by the first register | ||||
|       // of the group | ||||
|       std::vector<uint16_t> groups; | ||||
|  | ||||
|       // Keep tarck of the src and dst register footprints of all instructions | ||||
|       // those are in this suppressBlcok. This will be used to set to DepSet | ||||
|       // when the block is decided to be added into the macro, for avoiding | ||||
| @ -550,41 +541,7 @@ private: | ||||
|       RegRangeListType allDstRange; | ||||
|  | ||||
|     public: | ||||
|       SuppressBlock(size_t maxNumGroup, size_t groupSize) | ||||
|           : maxNumGroup(maxNumGroup), groupSize(groupSize) {} | ||||
|  | ||||
|       bool isFull() const { return groups.size() >= maxNumGroup; } | ||||
|  | ||||
|       bool contains(uint16_t startRegNum) const { | ||||
|         return std::find(groups.begin(), groups.end(), startRegNum) != | ||||
|                groups.end(); | ||||
|       } | ||||
|  | ||||
|       // check if the given register range has partially overlapped with existed | ||||
|       // ones return true when there is partially overlapped retur false if | ||||
|       // there is completely overlapped or no overlapped | ||||
|       bool partialOverlapped(uint16_t startRegNum) const { | ||||
|         if (contains(startRegNum)) | ||||
|           return false; | ||||
|         for (auto &group : groups) { | ||||
|           // number of registers in a group must be all the same across the | ||||
|           // groups in the same block | ||||
|           uint16_t diff = | ||||
|               startRegNum > group ? startRegNum - group : group - startRegNum; | ||||
|           if (diff < groupSize) | ||||
|             return true; | ||||
|         } | ||||
|         return false; | ||||
|       } | ||||
|  | ||||
|       size_t size() const { return groups.size(); } | ||||
|  | ||||
|       // add the registers into this blcok, | ||||
|       void addRegs(uint16_t startRegNum) { | ||||
|         assert(!isFull()); | ||||
|         assert(!contains(startRegNum)); | ||||
|         groups.push_back(startRegNum); | ||||
|       } | ||||
|       SuppressBlock() {} | ||||
|  | ||||
|       void addRegRanges(SrcRegRangeType &srcRange, | ||||
|                         SrcRegRangeType &extraSrcRange, | ||||
| @ -598,14 +555,12 @@ private: | ||||
|     }; // SuppressionBlock | ||||
|  | ||||
|     // get the max number of suppression groups according to srcIdx and platform | ||||
|     [[maybe_unused]] | ||||
|     size_t getNumberOfSuppresionGroups(uint32_t srcIdx) const; | ||||
|  | ||||
|     // check from startIt, find the number of consecutive dpas those can be | ||||
|     // grouped in a macro due to srcIdx suppression. Return number of | ||||
|     // instructions found | ||||
|     size_t formSrcSuppressionBlock(InstListIterator startIt, uint32_t srcIdx); | ||||
|  | ||||
|     bool srcIsSuppressCandidate(const Instruction &inst, uint32_t srcIdx) const; | ||||
|     // grouped in a macro. Return number of instructions found | ||||
|     size_t formSrcSuppressionBlock(InstListIterator startIt); | ||||
|  | ||||
|   private: | ||||
|     const DepSetBuilder &m_dsBuilder; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Diana Chen
					Diana Chen