Skip to content

Commit 694b643

Browse files
Add useLocalMemory flag to ImageInfo
Change-Id: I664f9e17c0c480c2b7b2b34dcfaefa7929b9ddfe
1 parent 20fd137 commit 694b643

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

runtime/helpers/surface_formats.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ struct ImageInfo {
220220
uint32_t baseMipLevel;
221221
uint32_t mipCount;
222222
bool preferRenderCompression;
223+
bool useLocalMemory;
223224
};
224225

225226
struct McsSurfaceInfo {

unit_tests/memory_manager/memory_manager_tests.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,22 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenAllocateGraphicsMemor
563563
memoryManager.freeGraphicsMemory(imageAllocation);
564564
}
565565

566+
TEST(OsAgnosticMemoryManager, givenEnabledLocalMemoryWhenAllocateGraphicsMemoryForImageIsCalledThenUseLocalMemoryIsNotSet) {
567+
ExecutionEnvironment executionEnvironment;
568+
MockMemoryManager memoryManager(false, true, executionEnvironment);
569+
cl_image_desc imgDesc = {};
570+
imgDesc.image_width = 1;
571+
imgDesc.image_height = 1;
572+
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
573+
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
574+
575+
executionEnvironment.initGmm(*platformDevices);
576+
auto imageAllocation = memoryManager.allocateGraphicsMemoryForImage(imgInfo, nullptr);
577+
ASSERT_NE(nullptr, imageAllocation);
578+
EXPECT_FALSE(imgInfo.useLocalMemory);
579+
memoryManager.freeGraphicsMemory(imageAllocation);
580+
}
581+
566582
TEST(OsAgnosticMemoryManager, givenHostPointerNotRequiringCopyWhenAllocateGraphicsMemoryForImageFromHostPtrIsCalledThenGraphicsAllocationIsReturned) {
567583
ExecutionEnvironment executionEnvironment;
568584
OsAgnosticMemoryManager memoryManager(false, false, executionEnvironment);

0 commit comments

Comments
 (0)