Hide details of AllocationsList from header

Signed-off-by: Daniel Chabrowski <daniel.chabrowski@intel.com>
This commit is contained in:
Daniel Chabrowski
2022-07-07 18:33:25 +00:00
committed by Compute-Runtime-Automation
parent 7c538b956a
commit bdf0483068
2 changed files with 22 additions and 25 deletions

View File

@@ -9,24 +9,35 @@
#include "shared/source/command_stream/command_stream_receiver.h"
namespace NEO {
namespace {
struct ReusableAllocationRequirements {
const void *requiredPtr;
size_t requiredMinimalSize;
volatile uint32_t *csrTagAddress;
AllocationType allocationType;
NEO::AllocationType allocationType;
uint32_t contextId;
uint32_t activeTileCount;
uint32_t tagOffset;
};
bool checkTagAddressReady(ReusableAllocationRequirements *requirements, NEO::GraphicsAllocation *gfxAllocation) {
auto tagAddress = requirements->csrTagAddress;
auto taskCount = gfxAllocation->getTaskCount(requirements->contextId);
for (uint32_t count = 0; count < requirements->activeTileCount; count++) {
if (*tagAddress < taskCount) {
return false;
}
tagAddress = ptrOffset(tagAddress, requirements->tagOffset);
}
return true;
}
} // namespace
namespace NEO {
AllocationsList::AllocationsList(AllocationUsage allocationUsage)
: allocationUsage(allocationUsage) {}
AllocationsList::AllocationsList()
: allocationUsage(REUSABLE_ALLOCATION) {}
std::unique_ptr<GraphicsAllocation> AllocationsList::detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, AllocationType allocationType) {
ReusableAllocationRequirements req;
req.requiredMinimalSize = requiredMinimalSize;
@@ -73,18 +84,4 @@ void AllocationsList::freeAllGraphicsAllocations(Device *neoDevice) {
}
head = nullptr;
}
bool AllocationsList::checkTagAddressReady(ReusableAllocationRequirements *requirements, GraphicsAllocation *gfxAllocation) {
auto tagAddress = requirements->csrTagAddress;
auto taskCount = gfxAllocation->getTaskCount(requirements->contextId);
for (uint32_t count = 0; count < requirements->activeTileCount; count++) {
if (*tagAddress < taskCount) {
return false;
}
tagAddress = ptrOffset(tagAddress, requirements->tagOffset);
}
return true;
}
} // namespace NEO

View File

@@ -8,24 +8,24 @@
#pragma once
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/utilities/idlist.h"
#include <mutex>
#include <memory>
namespace NEO {
class CommandStreamReceiver;
struct ReusableAllocationRequirements;
class AllocationsList : public IDList<GraphicsAllocation, true, true> {
public:
AllocationsList() = default;
AllocationsList(AllocationUsage allocationUsage);
AllocationsList();
std::unique_ptr<GraphicsAllocation> detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, AllocationType allocationType);
void freeAllGraphicsAllocations(Device *neoDevice);
private:
GraphicsAllocation *detachAllocationImpl(GraphicsAllocation *, void *);
bool checkTagAddressReady(ReusableAllocationRequirements *requirements, GraphicsAllocation *gfxAllocation);
const AllocationUsage allocationUsage;
const AllocationUsage allocationUsage{REUSABLE_ALLOCATION};
};
} // namespace NEO