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));
73 ResourceSizeMask = (1ULL << Desc.NumUnits) - 1;
76 AvailableSlots = BufferSize == -1 ? 0U : static_cast<unsigned>(BufferSize);
112 : Resources(SM.getNumProcResourceKinds() - 1),
113 Strategies(SM.getNumProcResourceKinds() - 1),
114 Resource2Groups(SM.getNumProcResourceKinds() - 1, 0),
116 ResIndex2ProcResID(SM.getNumProcResourceKinds() - 1, 0),
145 Mask -= GroupMaskIdx;
148 uint64_t Unit = Mask & (-Mask);
171 return Resources[getResourceStateIndex(ResourceID)]->getNumUnits();
176 // Second, is the specific sub-resource ID.
181 assert(RS.isReady() && "No available units to select!");
188 uint64_t SubResourceID = Strategies[Index]->select(RS.getReadyMask());
195 // Mark the sub-resource referenced by RR as used.
199 // Remember to update the resource strategy for non-group resources with
200 // multiple units.
202 Strategies[RSID]->used(RR.second);
204 // If there are still available units in RR.first,
215 unsigned GroupIndex = getResourceStateIndex(Users & (-Users));
218 Strategies[GroupIndex]->used(RR.first);
220 Users &= Users - 1;
237 unsigned GroupIndex = getResourceStateIndex(Users & (-Users));
240 Users &= Users - 1;
255 uint64_t CurrentBuffer = ConsumedBuffers & (-ConsumedBuffers);
264 // We do this to simulate an in-order dispatch/issue of instructions.
273 uint64_t CurrentBuffer = ConsumedBuffers & (-ConsumedBuffers);
297 NumAvailableUnits -= NumUnits;
328 unsigned NumUnits = llvm::popcount(Resources[Index]->getReadyMask());
333 if (!it->second) {
334 BusyResourceMask |= it->first;
338 it->second--;
339 if (!it->second)
340 ConsumedResourceMask |= it->first;
377 BR.second--;