Skip to content

Commit d06fcc8

Browse files
Dont force system memory for pipe and global surface
Related-To: NEO-3127 Change-Id: Iffb1b04401a19043bdb898b7896068bc760f4797 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 4eb870a commit d06fcc8

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

runtime/memory_manager/graphics_allocation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
172172
static bool isCpuAccessRequired(AllocationType allocationType) {
173173
return allocationType == AllocationType::COMMAND_BUFFER ||
174174
allocationType == AllocationType::CONSTANT_SURFACE ||
175+
allocationType == AllocationType::GLOBAL_SURFACE ||
175176
allocationType == AllocationType::INTERNAL_HEAP ||
176177
allocationType == AllocationType::LINEAR_STREAM ||
178+
allocationType == AllocationType::PIPE ||
177179
allocationType == AllocationType::TIMESTAMP_PACKET_TAG_BUFFER;
178180
}
179181
void *getReservedAddressPtr() const {

runtime/memory_manager/memory_manager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
271271
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
272272
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
273273
case GraphicsAllocation::AllocationType::FILL_PATTERN:
274-
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
275274
case GraphicsAllocation::AllocationType::MCS:
276-
case GraphicsAllocation::AllocationType::PIPE:
277275
case GraphicsAllocation::AllocationType::PREEMPTION:
278276
case GraphicsAllocation::AllocationType::PRINTF_SURFACE:
279277
case GraphicsAllocation::AllocationType::PROFILING_TAG_BUFFER:

unit_tests/memory_manager/graphics_allocation_tests.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,28 +115,36 @@ TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenCheckIfResidency
115115
EXPECT_TRUE(graphicsAllocation.isResidencyTaskCountBelow(currentResidencyTaskCount + 1u, 0u));
116116
}
117117

118+
TEST(GraphicsAllocationTest, whenAllocationTypeIsCommandBufferThenCpuAccessIsRequired) {
119+
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::COMMAND_BUFFER));
120+
}
121+
118122
TEST(GraphicsAllocationTest, whenAllocationTypeIsConstantSurfaceThenCpuAccessIsRequired) {
119123
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::CONSTANT_SURFACE));
120124
}
121125

122-
TEST(GraphicsAllocationTest, whenAllocationTypeIsLinearStreamThenCpuAccessIsRequired) {
123-
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::LINEAR_STREAM));
126+
TEST(GraphicsAllocationTest, whenAllocationTypeIsGlobalSurfaceThenCpuAccessIsRequired) {
127+
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::GLOBAL_SURFACE));
128+
}
129+
130+
TEST(GraphicsAllocationTest, whenAllocationTypeIsInternalHeapThenCpuAccessIsRequired) {
131+
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::INTERNAL_HEAP));
124132
}
125133

126134
TEST(GraphicsAllocationTest, whenAllocationTypeIsKernelIsaThenCpuAccessIsNotRequired) {
127135
EXPECT_FALSE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::KERNEL_ISA));
128136
}
129137

130-
TEST(GraphicsAllocationTest, whenAllocationTypeIsInternalHeapThenCpuAccessIsRequired) {
131-
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::INTERNAL_HEAP));
138+
TEST(GraphicsAllocationTest, whenAllocationTypeIsLinearStreamThenCpuAccessIsRequired) {
139+
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::LINEAR_STREAM));
132140
}
133141

134-
TEST(GraphicsAllocationTest, whenAllocationTypeIsTimestampPacketThenCpuAccessIsRequired) {
135-
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER));
142+
TEST(GraphicsAllocationTest, whenAllocationTypeIsPipeThenCpuAccessIsRequired) {
143+
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::PIPE));
136144
}
137145

138-
TEST(GraphicsAllocationTest, whenAllocationTypeIsCommandBufferThenCpuAccessIsRequired) {
139-
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::COMMAND_BUFFER));
146+
TEST(GraphicsAllocationTest, whenAllocationTypeIsTimestampPacketThenCpuAccessIsRequired) {
147+
EXPECT_TRUE(GraphicsAllocation::isCpuAccessRequired(GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER));
140148
}
141149

142150
TEST(GraphicsAllocationTest, givenDefaultAllocationWhenGettingNumHandlesThenOneIsReturned) {

unit_tests/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,22 @@ TEST(MemoryManagerTest, givenMCSTypeWhenGetAllocationDataIsCalledThenSystemMemor
401401
EXPECT_TRUE(allocData.flags.useSystemMemory);
402402
}
403403

404+
TEST(MemoryManagerTest, givenPipeTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
405+
AllocationData allocData;
406+
MockMemoryManager mockMemoryManager;
407+
AllocationProperties properties{1, GraphicsAllocation::AllocationType::PIPE};
408+
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
409+
EXPECT_FALSE(allocData.flags.useSystemMemory);
410+
}
411+
412+
TEST(MemoryManagerTest, givenGlobalSurfaceTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsNotRequested) {
413+
AllocationData allocData;
414+
MockMemoryManager mockMemoryManager;
415+
AllocationProperties properties{1, GraphicsAllocation::AllocationType::GLOBAL_SURFACE};
416+
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
417+
EXPECT_FALSE(allocData.flags.useSystemMemory);
418+
}
419+
404420
TEST(MemoryManagerTest, givenDeviceQueueBufferTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested) {
405421
AllocationData allocData;
406422
MockMemoryManager mockMemoryManager;

0 commit comments

Comments
 (0)