Add new allocation type for internal allocations in system memory
Related-To: NEO-2733 Change-Id: I256d414c1e92647469dd2a80f83bdbfc8721cf43 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
97bc604316
commit
74ae06b131
|
@ -250,7 +250,7 @@ void CommandStreamReceiver::addAubComment(const char *comment) {}
|
|||
|
||||
GraphicsAllocation *CommandStreamReceiver::allocateDebugSurface(size_t size) {
|
||||
UNRECOVERABLE_IF(debugSurface != nullptr);
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties({size, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
return debugSurface;
|
||||
}
|
||||
|
||||
|
@ -361,8 +361,8 @@ bool CommandStreamReceiver::createAllocationForHostSurface(HostPtrSurface &surfa
|
|||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties, surface.getMemoryPointer());
|
||||
if (allocation == nullptr && surface.peekIsPtrCopyAllowed()) {
|
||||
// Try with no host pointer allocation and copy
|
||||
AllocationProperties copyProperties{surface.getSurfaceSize(), GraphicsAllocation::AllocationType::UNDECIDED};
|
||||
properties.alignment = MemoryConstants::pageSize;
|
||||
AllocationProperties copyProperties{surface.getSurfaceSize(), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY};
|
||||
copyProperties.alignment = MemoryConstants::pageSize;
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties(copyProperties);
|
||||
if (allocation) {
|
||||
memcpy_s(allocation->getUnderlyingBuffer(), allocation->getUnderlyingBufferSize(), surface.getMemoryPointer(), surface.getSurfaceSize());
|
||||
|
|
|
@ -24,9 +24,9 @@ ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr,
|
|||
experimentalAllocationOffset(0),
|
||||
defaultPrint(true),
|
||||
timerResolution(profilingTimerResolution) {
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ void DeviceQueueHw<GfxFamily>::allocateSlbBuffer() {
|
|||
slbSize += (4 * MemoryConstants::pageSize); // +4 pages spec restriction
|
||||
slbSize = alignUp(slbSize, MemoryConstants::pageSize);
|
||||
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({slbSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
slbBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({slbSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -31,7 +31,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(Batch
|
|||
batchBuffer.chainedBatchBuffer->setAubWritable(false);
|
||||
auto sizeMainBatchBuffer = batchBuffer.chainedBatchBufferStartOffset - batchBuffer.startOffset;
|
||||
auto alignedMainBatchBufferSize = alignUp(sizeMainBatchBuffer + indirectPatchCommandsSize + batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), MemoryConstants::pageSize);
|
||||
AllocationProperties flatBatchBufferProperties(alignedMainBatchBufferSize, GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
AllocationProperties flatBatchBufferProperties(alignedMainBatchBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
|
||||
flatBatchBuffer =
|
||||
getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
||||
|
@ -109,7 +109,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(Batch
|
|||
|
||||
flatBatchBufferSize = alignUp(flatBatchBufferSize, MemoryConstants::pageSize);
|
||||
flatBatchBufferSize += CSRequirements::csOverfetchSize;
|
||||
AllocationProperties flatBatchBufferProperties(static_cast<size_t>(flatBatchBufferSize), GraphicsAllocation::AllocationType::UNDECIDED);
|
||||
AllocationProperties flatBatchBufferProperties(static_cast<size_t>(flatBatchBufferSize), GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY);
|
||||
flatBatchBufferProperties.alignment = MemoryConstants::pageSize;
|
||||
flatBatchBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
||||
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);
|
||||
|
|
|
@ -1505,7 +1505,7 @@ void Kernel::createReflectionSurface() {
|
|||
kernelReflectionSize += blockCount * alignUp(maxConstantBufferSize, sizeof(void *));
|
||||
kernelReflectionSize += parentImageCount * sizeof(IGIL_ImageParamters);
|
||||
kernelReflectionSize += parentSamplerCount * sizeof(IGIL_ParentSamplerParams);
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({kernelReflectionSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({kernelReflectionSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
for (uint32_t i = 0; i < blockCount; i++) {
|
||||
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
|
||||
|
@ -1579,7 +1579,7 @@ void Kernel::createReflectionSurface() {
|
|||
|
||||
if (DebugManager.flags.ForceDispatchScheduler.get()) {
|
||||
if (this->isSchedulerKernel && kernelReflectionSurface == nullptr) {
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
kernelReflectionSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
|||
INDIRECT_OBJECT_HEAP,
|
||||
INSTRUCTION_HEAP,
|
||||
INTERNAL_HEAP,
|
||||
INTERNAL_HOST_MEMORY,
|
||||
KERNEL_ISA,
|
||||
LINEAR_STREAM,
|
||||
PIPE,
|
||||
|
|
|
@ -110,13 +110,13 @@ void MemoryManager::cleanGraphicsMemoryCreatedFromHostPtr(GraphicsAllocation *gr
|
|||
|
||||
GraphicsAllocation *MemoryManager::createGraphicsAllocationWithPadding(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
if (!paddingAllocation) {
|
||||
paddingAllocation = allocateGraphicsMemoryWithProperties({paddingBufferSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
paddingAllocation = allocateGraphicsMemoryWithProperties({paddingBufferSize, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
}
|
||||
return createPaddedAllocation(inputGraphicsAllocation, sizeWithPadding);
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::createPaddedAllocation(GraphicsAllocation *inputGraphicsAllocation, size_t sizeWithPadding) {
|
||||
return allocateGraphicsMemoryWithProperties({sizeWithPadding, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
return allocateGraphicsMemoryWithProperties({sizeWithPadding, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY});
|
||||
}
|
||||
|
||||
void MemoryManager::freeSystemMemory(void *ptr) {
|
||||
|
@ -280,6 +280,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
|||
case GraphicsAllocation::AllocationType::SVM_CPU:
|
||||
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
|
||||
case GraphicsAllocation::AllocationType::TAG_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::UNDECIDED:
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
default:
|
||||
|
|
|
@ -331,6 +331,12 @@ const char *DebugSettingsManager<DebugLevel>::getAllocationTypeString(GraphicsAl
|
|||
return "INDIRECT_OBJECT_HEAP";
|
||||
case GraphicsAllocation::AllocationType::INSTRUCTION_HEAP:
|
||||
return "INSTRUCTION_HEAP";
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HEAP:
|
||||
return "INTERNAL_HEAP";
|
||||
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
|
||||
return "INTERNAL_HOST_MEMORY";
|
||||
case GraphicsAllocation::AllocationType::KERNEL_ISA:
|
||||
return "KERNEL_ISA";
|
||||
case GraphicsAllocation::AllocationType::LINEAR_STREAM:
|
||||
return "LINEAR_STREAM";
|
||||
case GraphicsAllocation::AllocationType::PIPE:
|
||||
|
@ -343,6 +349,10 @@ const char *DebugSettingsManager<DebugLevel>::getAllocationTypeString(GraphicsAl
|
|||
return "PROFILING_TAG_BUFFER";
|
||||
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
|
||||
return "SCRATCH_SURFACE";
|
||||
case GraphicsAllocation::AllocationType::SHARED_BUFFER:
|
||||
return "SHARED_BUFFER";
|
||||
case GraphicsAllocation::AllocationType::SHARED_IMAGE:
|
||||
return "SHARED_IMAGE";
|
||||
case GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY:
|
||||
return "SHARED_RESOURCE_COPY";
|
||||
case GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP:
|
||||
|
@ -361,6 +371,7 @@ const char *DebugSettingsManager<DebugLevel>::getAllocationTypeString(GraphicsAl
|
|||
return "UNDECIDED";
|
||||
case GraphicsAllocation::AllocationType::UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
|
||||
default:
|
||||
return "ILLEGAL_VALUE";
|
||||
}
|
||||
|
|
|
@ -374,6 +374,12 @@ TEST(MemoryManagerTest, givenDeviceQueueBufferTypeWhenGetAllocationDataIsCalledT
|
|||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenInternalHostMemoryTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY}, {}, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenFillPatternTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::FILL_PATTERN}, {}, nullptr);
|
||||
|
|
|
@ -904,12 +904,17 @@ AllocationTypeTestCase allocationTypeValues[] = {
|
|||
{GraphicsAllocation::AllocationType::IMAGE, "IMAGE"},
|
||||
{GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP, "INDIRECT_OBJECT_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::INSTRUCTION_HEAP, "INSTRUCTION_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::INTERNAL_HEAP, "INTERNAL_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, "INTERNAL_HOST_MEMORY"},
|
||||
{GraphicsAllocation::AllocationType::KERNEL_ISA, "KERNEL_ISA"},
|
||||
{GraphicsAllocation::AllocationType::LINEAR_STREAM, "LINEAR_STREAM"},
|
||||
{GraphicsAllocation::AllocationType::PIPE, "PIPE"},
|
||||
{GraphicsAllocation::AllocationType::PRINTF_SURFACE, "PRINTF_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::PRIVATE_SURFACE, "PRIVATE_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER, "PROFILING_TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::SCRATCH_SURFACE, "SCRATCH_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_BUFFER, "SHARED_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_IMAGE, "SHARED_IMAGE"},
|
||||
{GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY, "SHARED_RESOURCE_COPY"},
|
||||
{GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP, "SURFACE_STATE_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::SVM_CPU, "SVM_CPU"},
|
||||
|
|
Loading…
Reference in New Issue