Lines Matching +full:sub +full:- +full:units

1 //===--------------------- ResourceManager.cpp ------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// The classes here represent processor resource units and their management
13 //===----------------------------------------------------------------------===//
23 #define DEBUG_TYPE "llvm-mca"
30 NextInSequenceMask &= (CandidateMask | (CandidateMask - 1)); in selectImpl()
73 ResourceSizeMask = (1ULL << Desc.NumUnits) - 1; in ResourceState()
76 AvailableSlots = BufferSize == -1 ? 0U : static_cast<unsigned>(BufferSize); in ResourceState()
112 : Resources(SM.getNumProcResourceKinds() - 1), in ResourceManager()
113 Strategies(SM.getNumProcResourceKinds() - 1), in ResourceManager()
114 Resource2Groups(SM.getNumProcResourceKinds() - 1, 0), in ResourceManager()
116 ResIndex2ProcResID(SM.getNumProcResourceKinds() - 1, 0), in ResourceManager()
145 Mask -= GroupMaskIdx; in ResourceManager()
148 uint64_t Unit = Mask & (-Mask); in ResourceManager()
171 return Resources[getResourceStateIndex(ResourceID)]->getNumUnits(); in getNumUnits()
176 // Second, is the specific sub-resource ID.
181 assert(RS.isReady() && "No available units to select!"); in selectPipe()
188 uint64_t SubResourceID = Strategies[Index]->select(RS.getReadyMask()); in selectPipe()
195 // Mark the sub-resource referenced by RR as used. in use()
199 // Remember to update the resource strategy for non-group resources with in use()
200 // multiple units. in use()
202 Strategies[RSID]->used(RR.second); in use()
204 // If there are still available units in RR.first, in use()
215 unsigned GroupIndex = getResourceStateIndex(Users & (-Users)); in use()
218 Strategies[GroupIndex]->used(RR.first); in use()
220 Users &= Users - 1; in use()
237 unsigned GroupIndex = getResourceStateIndex(Users & (-Users)); in release()
240 Users &= Users - 1; in release()
255 uint64_t CurrentBuffer = ConsumedBuffers & (-ConsumedBuffers); in reserveBuffers()
264 // We do this to simulate an in-order dispatch/issue of instructions. in reserveBuffers()
273 uint64_t CurrentBuffer = ConsumedBuffers & (-ConsumedBuffers); in releaseBuffers()
297 NumAvailableUnits -= NumUnits; in checkAvailability()
328 unsigned NumUnits = llvm::popcount(Resources[Index]->getReadyMask()); in checkAvailability()
333 if (!it->second) { in checkAvailability()
334 BusyResourceMask |= it->first; in checkAvailability()
338 it->second--; in checkAvailability()
339 if (!it->second) in checkAvailability()
340 ConsumedResourceMask |= it->first; in checkAvailability()
377 BR.second--; in cycleEvent()