mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add new allocation type for device queue's allocatons
remove not used mustBeZeroCopy flag Related-To: NEO-2733 Change-Id: I8b8faf4e2d46249f897a06170dd777193c7f8729 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
e40a82336c
commit
1e11d8939f
@ -99,21 +99,21 @@ void DeviceQueue::allocateResources() {
|
||||
auto &caps = device->getDeviceInfo();
|
||||
|
||||
uint32_t alignedQueueSize = alignUp(queueSize, MemoryConstants::pageSize);
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({alignedQueueSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
queueBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({alignedQueueSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
auto eventPoolBufferSize = static_cast<size_t>(caps.maxOnDeviceEvents) * sizeof(IGIL_DeviceEvent) + sizeof(IGIL_EventPool);
|
||||
eventPoolBufferSize = alignUp(eventPoolBufferSize, MemoryConstants::pageSize);
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({eventPoolBufferSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
eventPoolBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({eventPoolBufferSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
auto maxEnqueue = static_cast<size_t>(alignedQueueSize) / sizeof(IGIL_CommandHeader);
|
||||
auto expectedStackSize = maxEnqueue * sizeof(uint32_t) * 3; // 3 full loads of commands
|
||||
expectedStackSize = alignUp(expectedStackSize, MemoryConstants::pageSize);
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({expectedStackSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
stackBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({expectedStackSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
memset(stackBuffer->getUnderlyingBuffer(), 0, stackBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto queueStorageSize = alignedQueueSize * 2; // place for 2 full loads of queue_t
|
||||
queueStorageSize = alignUp(queueStorageSize, MemoryConstants::pageSize);
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({queueStorageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
queueStorageBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({queueStorageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
memset(queueStorageBuffer->getUnderlyingBuffer(), 0, queueStorageBuffer->getUnderlyingBufferSize());
|
||||
|
||||
auto &hwHelper = HwHelper::get(device->getHardwareInfo().pPlatform->eRenderCoreFamily);
|
||||
@ -122,9 +122,9 @@ void DeviceQueue::allocateResources() {
|
||||
// Additional padding of PAGE_SIZE for PageFaults just after DSH to satisfy hw requirements
|
||||
auto dshSize = (PARALLEL_SCHEDULER_HW_GROUPS + 2) * MAX_DSH_SIZE_PER_ENQUEUE * 8 + IDTSize + colorCalcStateSize + MemoryConstants::pageSize;
|
||||
dshSize = alignUp(dshSize, MemoryConstants::pageSize);
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({dshSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
dshBuffer = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({dshSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::UNDECIDED});
|
||||
debugQueue = device->getMemoryManager()->allocateGraphicsMemoryWithProperties({MemoryConstants::pageSize, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER});
|
||||
debugData = (DebugDataBuffer *)debugQueue->getUnderlyingBuffer();
|
||||
memset(debugQueue->getUnderlyingBuffer(), 0, debugQueue->getUnderlyingBufferSize());
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
BUFFER_HOST_MEMORY,
|
||||
COMMAND_BUFFER,
|
||||
CONSTANT_SURFACE,
|
||||
DEVICE_QUEUE_BUFFER,
|
||||
EXTERNAL_HOST_PTR,
|
||||
FILL_PATTERN,
|
||||
GLOBAL_SURFACE,
|
||||
|
@ -212,7 +212,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
bool allow64KbPages = false;
|
||||
bool allow32Bit = false;
|
||||
bool forcePin = properties.flags.forcePin;
|
||||
bool mustBeZeroCopy = false;
|
||||
bool mayRequireL3Flush = false;
|
||||
|
||||
switch (properties.allocationType) {
|
||||
@ -248,20 +247,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
break;
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::PIPE:
|
||||
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::SVM_CPU:
|
||||
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
|
||||
mustBeZeroCopy = true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::BUFFER:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_COMPRESSED:
|
||||
@ -283,8 +268,14 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
}
|
||||
|
||||
switch (properties.allocationType) {
|
||||
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
case GraphicsAllocation::AllocationType::FILL_PATTERN:
|
||||
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::PIPE:
|
||||
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::SVM_CPU:
|
||||
case GraphicsAllocation::AllocationType::SVM_ZERO_COPY:
|
||||
@ -296,7 +287,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
}
|
||||
|
||||
allocationData.flags.requiresCpuAccess = GraphicsAllocation::isCpuAccessRequired(properties.allocationType);
|
||||
allocationData.flags.mustBeZeroCopy = mustBeZeroCopy;
|
||||
allocationData.flags.allocateMemory = properties.flags.allocateMemory;
|
||||
allocationData.flags.allow32Bit = allow32Bit;
|
||||
allocationData.flags.allow64kbPages = allow64KbPages;
|
||||
@ -307,10 +297,6 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
|
||||
allocationData.flags.preferRenderCompressed = GraphicsAllocation::AllocationType::BUFFER_COMPRESSED == properties.allocationType;
|
||||
allocationData.flags.multiOsContextCapable = properties.flags.multiOsContextCapable;
|
||||
|
||||
if (allocationData.flags.mustBeZeroCopy) {
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
}
|
||||
|
||||
allocationData.hostPtr = hostPtr;
|
||||
allocationData.size = properties.size;
|
||||
allocationData.type = properties.allocationType;
|
||||
|
@ -160,7 +160,6 @@ class MemoryManager {
|
||||
struct AllocationData {
|
||||
union {
|
||||
struct {
|
||||
uint32_t mustBeZeroCopy : 1;
|
||||
uint32_t allocateMemory : 1;
|
||||
uint32_t allow64kbPages : 1;
|
||||
uint32_t allow32Bit : 1;
|
||||
@ -171,7 +170,7 @@ class MemoryManager {
|
||||
uint32_t preferRenderCompressed : 1;
|
||||
uint32_t multiOsContextCapable : 1;
|
||||
uint32_t requiresCpuAccess : 1;
|
||||
uint32_t reserved : 21;
|
||||
uint32_t reserved : 22;
|
||||
} flags;
|
||||
uint32_t allFlags = 0;
|
||||
};
|
||||
|
@ -317,6 +317,8 @@ const char *DebugSettingsManager<DebugLevel>::getAllocationTypeString(GraphicsAl
|
||||
return "COMMAND_BUFFER";
|
||||
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
|
||||
return "CONSTANT_SURFACE";
|
||||
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
|
||||
return "DEVICE_QUEUE_BUFFER";
|
||||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
return "EXTERNAL_HOST_PTR";
|
||||
case GraphicsAllocation::AllocationType::FILL_PATTERN:
|
||||
|
@ -26,19 +26,17 @@ TEST(MemoryManagerGetAlloctionDataTest, givenHostMemoryAllocationTypeAndAllocate
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY);
|
||||
MockMemoryManager::getAllocationData(allocData, properties, {}, nullptr);
|
||||
|
||||
EXPECT_TRUE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
EXPECT_EQ(10u, allocData.size);
|
||||
EXPECT_EQ(nullptr, allocData.hostPtr);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllocationDataIsQueriedThenMustBeZeroCopyAndUseSystemMemoryFlagsAreNotSet) {
|
||||
TEST(MemoryManagerGetAlloctionDataTest, givenNonHostMemoryAllocatoinTypeWhenAllocationDataIsQueriedThenUseSystemMemoryFlagsIsNotSet) {
|
||||
AllocationData allocData;
|
||||
AllocationProperties properties(true, 10, GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
MockMemoryManager::getAllocationData(allocData, properties, {}, nullptr);
|
||||
|
||||
EXPECT_FALSE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_FALSE(allocData.flags.useSystemMemory);
|
||||
EXPECT_EQ(10u, allocData.size);
|
||||
EXPECT_EQ(nullptr, allocData.hostPtr);
|
||||
@ -345,10 +343,9 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenBufferTypeIsPassedAndAllocateInDev
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThenZeroCopyIsRequested) {
|
||||
TEST(MemoryManagerTest, givenSvmAllocationTypeWhenGetAllocationDataIsCalledThenAllocatingMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::SVM_ZERO_COPY}, {}, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_TRUE(allocData.flags.allocateMemory);
|
||||
}
|
||||
|
||||
@ -371,6 +368,12 @@ TEST(MemoryManagerTest, givenTagBufferTypeWhenGetAllocationDataIsCalledThenSyste
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDeviceQueueBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER}, {}, nullptr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenFillPatternTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
|
||||
AllocationData allocData;
|
||||
MockMemoryManager::getAllocationData(allocData, {1, GraphicsAllocation::AllocationType::FILL_PATTERN}, {}, nullptr);
|
||||
@ -461,7 +464,6 @@ TEST(MemoryManagerTest, givenExternalHostMemoryWhenGetAllocationDataIsCalledThen
|
||||
auto hostPtr = reinterpret_cast<void *>(0x1234);
|
||||
MockMemoryManager::getAllocationData(allocData, {false, 1, GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR}, {}, hostPtr);
|
||||
EXPECT_TRUE(allocData.flags.useSystemMemory);
|
||||
EXPECT_TRUE(allocData.flags.mustBeZeroCopy);
|
||||
EXPECT_FALSE(allocData.flags.allocateMemory);
|
||||
EXPECT_FALSE(allocData.flags.allow32Bit);
|
||||
EXPECT_FALSE(allocData.flags.allow64kbPages);
|
||||
|
@ -892,32 +892,33 @@ struct AllocationTypeTestCase {
|
||||
};
|
||||
|
||||
AllocationTypeTestCase allocationTypeValues[] = {
|
||||
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"},
|
||||
{GraphicsAllocation::AllocationType::BUFFER, "BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, "BUFFER_COMPRESSED"},
|
||||
{GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, "BUFFER_HOST_MEMORY"},
|
||||
{GraphicsAllocation::AllocationType::BUFFER, "BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::IMAGE, "IMAGE"},
|
||||
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::LINEAR_STREAM, "LINEAR_STREAM"},
|
||||
{GraphicsAllocation::AllocationType::FILL_PATTERN, "FILL_PATTERN"},
|
||||
{GraphicsAllocation::AllocationType::PIPE, "PIPE"},
|
||||
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TIMESTAMP_PACKET_TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER, "PROFILING_TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::COMMAND_BUFFER, "COMMAND_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::PRINTF_SURFACE, "PRINTF_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::GLOBAL_SURFACE, "GLOBAL_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::PRIVATE_SURFACE, "PRIVATE_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::CONSTANT_SURFACE, "CONSTANT_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::SCRATCH_SURFACE, "SCRATCH_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::INSTRUCTION_HEAP, "INSTRUCTION_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER, "DEVICE_QUEUE_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, "EXTERNAL_HOST_PTR"},
|
||||
{GraphicsAllocation::AllocationType::FILL_PATTERN, "FILL_PATTERN"},
|
||||
{GraphicsAllocation::AllocationType::GLOBAL_SURFACE, "GLOBAL_SURFACE"},
|
||||
{GraphicsAllocation::AllocationType::IMAGE, "IMAGE"},
|
||||
{GraphicsAllocation::AllocationType::INDIRECT_OBJECT_HEAP, "INDIRECT_OBJECT_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP, "SURFACE_STATE_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::INSTRUCTION_HEAP, "INSTRUCTION_HEAP"},
|
||||
{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_RESOURCE_COPY, "SHARED_RESOURCE_COPY"},
|
||||
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM_ZERO_COPY"},
|
||||
{GraphicsAllocation::AllocationType::SURFACE_STATE_HEAP, "SURFACE_STATE_HEAP"},
|
||||
{GraphicsAllocation::AllocationType::SVM_CPU, "SVM_CPU"},
|
||||
{GraphicsAllocation::AllocationType::SVM_GPU, "SVM_GPU"},
|
||||
{GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, "EXTERNAL_HOST_PTR"},
|
||||
{GraphicsAllocation::AllocationType::UNDECIDED, "UNDECIDED"}};
|
||||
{GraphicsAllocation::AllocationType::SVM_ZERO_COPY, "SVM_ZERO_COPY"},
|
||||
{GraphicsAllocation::AllocationType::TAG_BUFFER, "TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER, "TIMESTAMP_PACKET_TAG_BUFFER"},
|
||||
{GraphicsAllocation::AllocationType::UNDECIDED, "UNDECIDED"},
|
||||
{GraphicsAllocation::AllocationType::UNKNOWN, "UNKNOWN"}};
|
||||
|
||||
class AllocationTypeLogging : public ::testing::TestWithParam<AllocationTypeTestCase> {};
|
||||
|
||||
|
Reference in New Issue
Block a user