mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
Do not reuse mem obj's allocation
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
69269b9aed
commit
4ac6e09117
@@ -14,9 +14,7 @@
|
||||
namespace NEO {
|
||||
|
||||
InternalAllocationStorage::InternalAllocationStorage(CommandStreamReceiver &commandStreamReceiver)
|
||||
: commandStreamReceiver(commandStreamReceiver),
|
||||
temporaryAllocations(TEMPORARY_ALLOCATION),
|
||||
allocationsForReuse(REUSABLE_ALLOCATION){};
|
||||
: commandStreamReceiver(commandStreamReceiver){};
|
||||
|
||||
void InternalAllocationStorage::storeAllocation(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage) {
|
||||
uint32_t taskCount = gfxAllocation->getTaskCount(commandStreamReceiver.getOsContext().getContextId());
|
||||
@@ -34,13 +32,17 @@ void InternalAllocationStorage::storeAllocationWithTaskCount(std::unique_ptr<Gra
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto &allocationsList = (allocationUsage == TEMPORARY_ALLOCATION) ? temporaryAllocations : allocationsForReuse;
|
||||
auto &allocationsList = allocationLists[allocationUsage];
|
||||
gfxAllocation->updateTaskCount(taskCount, commandStreamReceiver.getOsContext().getContextId());
|
||||
allocationsList.pushTailOne(*gfxAllocation.release());
|
||||
}
|
||||
|
||||
void InternalAllocationStorage::cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage) {
|
||||
freeAllocationsList(waitTaskCount, (allocationUsage == TEMPORARY_ALLOCATION) ? temporaryAllocations : allocationsForReuse);
|
||||
freeAllocationsList(waitTaskCount, allocationLists[allocationUsage]);
|
||||
|
||||
if (allocationUsage == TEMPORARY_ALLOCATION) {
|
||||
freeAllocationsList(waitTaskCount, allocationLists[DEFERRED_DEALLOCATION]);
|
||||
}
|
||||
}
|
||||
|
||||
void InternalAllocationStorage::freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList) {
|
||||
@@ -66,12 +68,12 @@ void InternalAllocationStorage::freeAllocationsList(uint32_t waitTaskCount, Allo
|
||||
}
|
||||
|
||||
std::unique_ptr<GraphicsAllocation> InternalAllocationStorage::obtainReusableAllocation(size_t requiredSize, AllocationType allocationType) {
|
||||
auto allocation = allocationsForReuse.detachAllocation(requiredSize, nullptr, &commandStreamReceiver, allocationType);
|
||||
auto allocation = allocationLists[REUSABLE_ALLOCATION].detachAllocation(requiredSize, nullptr, &commandStreamReceiver, allocationType);
|
||||
return allocation;
|
||||
}
|
||||
|
||||
std::unique_ptr<GraphicsAllocation> InternalAllocationStorage::obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, AllocationType allocationType) {
|
||||
auto allocation = temporaryAllocations.detachAllocation(requiredSize, requiredPtr, &commandStreamReceiver, allocationType);
|
||||
auto allocation = allocationLists[TEMPORARY_ALLOCATION].detachAllocation(requiredSize, requiredPtr, &commandStreamReceiver, allocationType);
|
||||
return allocation;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user