Remove cleaning allocation lists methods from memory manager

Change-Id: I4a58a5373e7dc4cf8dc5d90390e84c4f23689139
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2018-10-26 11:05:31 +00:00
committed by sys_ocldev
parent 7b1d19eaec
commit a30c70d84b
16 changed files with 263 additions and 288 deletions

View File

@@ -51,10 +51,10 @@ CommandStreamReceiver::~CommandStreamReceiver() {
cleanupResources();
if (!allocationsForReuse.peekIsEmpty()) {
getMemoryManager()->freeAllocationsList(-1, allocationsForReuse);
internalAllocationStorage->freeAllocationsList(-1, allocationsForReuse);
}
if (!temporaryAllocations.peekIsEmpty()) {
getMemoryManager()->freeAllocationsList(-1, temporaryAllocations);
internalAllocationStorage->freeAllocationsList(-1, temporaryAllocations);
}
}
@@ -115,7 +115,7 @@ void CommandStreamReceiver::waitForTaskCountAndCleanAllocationList(uint32_t requ
if (allocationList.peekIsEmpty()) {
return;
}
getMemoryManager()->freeAllocationsList(requiredTaskCount, allocationList);
internalAllocationStorage->freeAllocationsList(requiredTaskCount, allocationList);
}
MemoryManager *CommandStreamReceiver::getMemoryManager() const {

View File

@@ -8,7 +8,7 @@
#include "public/cl_ext_private.h"
#include "runtime/command_queue/command_queue.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/memory_manager/internal_allocation_storage.h"
#include "runtime/context/context.h"
#include "runtime/device/device.h"
#include "runtime/event/event.h"
@@ -310,8 +310,8 @@ inline bool Event::wait(bool blocking, bool useQuickKmdSleep) {
DEBUG_BREAK_IF(this->taskLevel == Event::eventNotReady && this->executionStatus >= 0);
auto *memoryManager = cmdQueue->getDevice().getMemoryManager();
memoryManager->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
auto *allocationStorage = cmdQueue->getDevice().getCommandStreamReceiver().getInternalAllocationStorage();
allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
return true;
}
@@ -346,7 +346,8 @@ void Event::updateExecutionStatus() {
transitionExecutionStatus(CL_COMPLETE);
executeCallbacks(CL_COMPLETE);
unblockEventsBlockedByThis(CL_COMPLETE);
cmdQueue->getDevice().getMemoryManager()->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
auto *allocationStorage = cmdQueue->getDevice().getCommandStreamReceiver().getInternalAllocationStorage();
allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
return;
}

View File

@@ -7,6 +7,7 @@
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/memory_manager/host_ptr_manager.h"
#include "runtime/memory_manager/internal_allocation_storage.h"
#include "runtime/memory_manager/memory_manager.h"
using namespace OCLRT;
@@ -282,8 +283,9 @@ RequirementsStatus HostPtrManager::checkAllocationsForOverlapping(MemoryManager
// clean temporary allocations
auto commandStreamReceiver = memoryManager.getCommandStreamReceiver(0);
auto allocationStorage = commandStreamReceiver->getInternalAllocationStorage();
uint32_t taskCount = *commandStreamReceiver->getTagAddress();
memoryManager.cleanAllocationList(taskCount, TEMPORARY_ALLOCATION);
allocationStorage->cleanAllocationList(taskCount, TEMPORARY_ALLOCATION);
// check overlapping again
checkedFragments->fragments[i] = getFragmentAndCheckForOverlaps(requirements->AllocationFragments[i].allocationPtr, requirements->AllocationFragments[i].allocationSize, checkedFragments->status[i]);
@@ -294,7 +296,7 @@ RequirementsStatus HostPtrManager::checkAllocationsForOverlapping(MemoryManager
;
taskCount = *commandStreamReceiver->getTagAddress();
memoryManager.cleanAllocationList(taskCount, TEMPORARY_ALLOCATION);
allocationStorage->cleanAllocationList(taskCount, TEMPORARY_ALLOCATION);
// check overlapping last time
checkedFragments->fragments[i] = getFragmentAndCheckForOverlaps(requirements->AllocationFragments[i].allocationPtr, requirements->AllocationFragments[i].allocationSize, checkedFragments->status[i]);
@@ -306,4 +308,4 @@ RequirementsStatus HostPtrManager::checkAllocationsForOverlapping(MemoryManager
}
}
return status;
}
}

View File

@@ -17,14 +17,15 @@ class GraphicsAllocation;
class InternalAllocationStorage {
public:
MOCKABLE_VIRTUAL ~InternalAllocationStorage() = default;
InternalAllocationStorage(CommandStreamReceiver &commandStreamReceiver);
void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage);
MOCKABLE_VIRTUAL void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage);
void freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList);
void storeAllocation(std::unique_ptr<GraphicsAllocation> gfxAllocation, uint32_t allocationUsage);
void storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation> gfxAllocation, uint32_t allocationUsage, uint32_t taskCount);
std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, bool isInternalAllocationRequired);
private:
protected:
std::recursive_mutex mutex;
CommandStreamReceiver &commandStreamReceiver;
};

View File

@@ -171,15 +171,6 @@ void MemoryManager::applyCommonCleanup() {
}
}
bool MemoryManager::cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage) {
getCommandStreamReceiver(0)->getInternalAllocationStorage()->cleanAllocationList(waitTaskCount, allocationUsage);
return false;
}
void MemoryManager::freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList) {
getCommandStreamReceiver(0)->getInternalAllocationStorage()->freeAllocationsList(waitTaskCount, allocationsList);
}
TagAllocator<HwTimeStamps> *MemoryManager::getEventTsAllocator() {
if (profilingTimeStampAllocator.get() == nullptr) {
profilingTimeStampAllocator = std::make_unique<TagAllocator<HwTimeStamps>>(this, TagCount, MemoryConstants::cacheLineSize);

View File

@@ -200,10 +200,6 @@ class MemoryManager {
virtual uint64_t getInternalHeapBaseAddress() = 0;
virtual bool cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage);
void freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList);
TagAllocator<HwTimeStamps> *getEventTsAllocator();
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
TagAllocator<TimestampPacket> *getTimestampPacketAllocator();