mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
fix(ocl): track buffer pool count per device
Track amount of created buffer pools per device. Do not allocate extra pools if limit is reached. New contexts will have pooling disabled if limit is reached on device. Related-To: NEO-13461 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b6fc2b5861
commit
e61d04a881
@@ -181,7 +181,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
void initializeRayTracing(uint32_t maxBvhLevels);
|
||||
void allocateRTDispatchGlobals(uint32_t maxBvhLevels);
|
||||
|
||||
uint64_t getGlobalMemorySize(uint32_t deviceBitfield) const;
|
||||
MOCKABLE_VIRTUAL uint64_t getGlobalMemorySize(uint32_t deviceBitfield) const;
|
||||
const std::vector<SubDevice *> &getSubDevices() const { return subdevices; }
|
||||
bool getUuid(std::array<uint8_t, ProductHelper::uuidSize> &uuid);
|
||||
void generateUuid(std::array<uint8_t, ProductHelper::uuidSize> &uuid);
|
||||
@@ -237,6 +237,23 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
return microsecondResolution;
|
||||
}
|
||||
|
||||
void updateMaxPoolCount(uint32_t maxPoolCount) {
|
||||
maxBufferPoolCount = maxPoolCount;
|
||||
}
|
||||
|
||||
bool requestPoolCreate(uint32_t count) {
|
||||
if (maxBufferPoolCount >= count + bufferPoolCount.fetch_add(count)) {
|
||||
return true;
|
||||
} else {
|
||||
bufferPoolCount -= count;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void recordPoolsFreed(uint32_t size) {
|
||||
bufferPoolCount -= size;
|
||||
}
|
||||
|
||||
protected:
|
||||
Device() = delete;
|
||||
Device(ExecutionEnvironment *executionEnvironment, const uint32_t rootDeviceIndex);
|
||||
@@ -314,8 +331,10 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
std::unique_ptr<UsmMemAllocPoolsManager> deviceUsmMemAllocPoolsManager;
|
||||
|
||||
size_t allocationsSavedForReuseSize = 0u;
|
||||
uint32_t microsecondResolution = 1000u;
|
||||
std::atomic_uint32_t bufferPoolCount = 0u;
|
||||
uint32_t maxBufferPoolCount = 0u;
|
||||
mutable std::mutex allocationsReuseMtx;
|
||||
uint32_t microsecondResolution = 1000u;
|
||||
|
||||
struct {
|
||||
bool isValid = false;
|
||||
|
||||
Reference in New Issue
Block a user