Skip to content

Commit afa45bd

Browse files
Add support for mem advise to set cache policy in buffer object
Signed-off-by: Milczarek, Slawomir <[email protected]>
1 parent 45de132 commit afa45bd

File tree

13 files changed

+145
-31
lines changed

13 files changed

+145
-31
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "shared/source/indirect_heap/indirect_heap.h"
2424
#include "shared/source/memory_manager/allocation_properties.h"
2525
#include "shared/source/memory_manager/graphics_allocation.h"
26+
#include "shared/source/memory_manager/memadvise_flags.h"
2627
#include "shared/source/memory_manager/memory_manager.h"
2728
#include "shared/source/os_interface/hw_info_config.h"
2829
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
@@ -736,7 +737,7 @@ template <GFXCORE_FAMILY gfxCoreFamily>
736737
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemAdvise(ze_device_handle_t hDevice,
737738
const void *ptr, size_t size,
738739
ze_memory_advice_t advice) {
739-
MemAdviseFlags flags;
740+
NEO::MemAdviseFlags flags;
740741
flags.memadvise_flags = 0;
741742

742743
auto allocData = device->getDriverHandle()->getSvmAllocsManager()->getSVMAlloc(ptr);
@@ -776,8 +777,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemAdvise(ze_device_hand
776777
break;
777778
}
778779

779-
NEO::PageFaultManager *pageFaultManager = nullptr;
780-
pageFaultManager = device->getDriverHandle()->getMemoryManager()->getPageFaultManager();
780+
auto memoryManager = device->getDriverHandle()->getMemoryManager();
781+
auto pageFaultManager = memoryManager->getPageFaultManager();
781782
if (pageFaultManager) {
782783
/* If Read Only and Device Preferred Hints have been cleared, then cpu_migration of Shared memory can be re-enabled*/
783784
if (flags.cpu_migration_blocked) {
@@ -789,6 +790,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemAdvise(ze_device_hand
789790
/* Given MemAdvise hints, use different gpu Domain Handler for the Page Fault Handling */
790791
pageFaultManager->setGpuDomainHandler(L0::handleGpuDomainTransferForHwWithHints);
791792
}
793+
794+
auto alloc = allocData->gpuAllocations.getGraphicsAllocation(deviceImp->getRootDeviceIndex());
795+
memoryManager->setMemAdvise(alloc, flags);
796+
792797
deviceImp->memAdviseSharedAllocations[allocData] = flags;
793798
return ZE_RESULT_SUCCESS;
794799
}

level_zero/core/source/device/device_imp.h

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "shared/source/helpers/topology_map.h"
1111
#include "shared/source/memory_manager/allocations_list.h"
12+
#include "shared/source/memory_manager/memadvise_flags.h"
1213
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
1314
#include "shared/source/utilities/spinlock.h"
1415

@@ -27,21 +28,6 @@
2728
namespace L0 {
2829
struct SysmanDevice;
2930

30-
typedef union {
31-
uint8_t memadvise_flags; /* all memadvise_flags */
32-
struct
33-
{
34-
uint8_t read_only : 1, /* ZE_MEMORY_ADVICE_SET_READ_MOSTLY or ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY */
35-
device_preferred_location : 1, /* ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION or ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION */
36-
non_atomic : 1, /* ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY or ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY */
37-
cached_memory : 1, /* ZE_MEMORY_ADVICE_BIAS_CACHED or ZE_MEMORY_ADVICE_BIAS_UNCACHED */
38-
cpu_migration_blocked : 1, /* ZE_MEMORY_ADVICE_SET_READ_MOSTLY and ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION */
39-
reserved2 : 1,
40-
reserved1 : 1,
41-
reserved0 : 1;
42-
};
43-
} MemAdviseFlags;
44-
4531
struct DeviceImp : public Device {
4632
uint32_t getRootDeviceIndex() override;
4733
ze_result_t canAccessPeer(ze_device_handle_t hPeerDevice, ze_bool_t *value) override;
@@ -135,7 +121,7 @@ struct DeviceImp : public Device {
135121

136122
NEO::SVMAllocsManager::MapBasedAllocationTracker peerAllocations;
137123
NEO::SpinLock peerAllocationsMutex;
138-
std::map<NEO::SvmAllocationData *, MemAdviseFlags> memAdviseSharedAllocations;
124+
std::map<NEO::SvmAllocationData *, NEO::MemAdviseFlags> memAdviseSharedAllocations;
139125
NEO::AllocationsList allocationsForReuse;
140126
void createSysmanHandle(bool isSubDevice);
141127

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseSetAndClearReadMostlyT
177177
EXPECT_NE(nullptr, ptr);
178178

179179
ze_result_t returnValue;
180-
L0::MemAdviseFlags flags;
180+
NEO::MemAdviseFlags flags;
181181
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
182182
ASSERT_NE(nullptr, commandList);
183183

@@ -209,7 +209,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseSetAndClearPreferredLo
209209
EXPECT_NE(nullptr, ptr);
210210

211211
ze_result_t returnValue;
212-
L0::MemAdviseFlags flags;
212+
NEO::MemAdviseFlags flags;
213213
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
214214
ASSERT_NE(nullptr, commandList);
215215

@@ -241,7 +241,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseSetAndClearNonAtomicTh
241241
EXPECT_NE(nullptr, ptr);
242242

243243
ze_result_t returnValue;
244-
L0::MemAdviseFlags flags;
244+
NEO::MemAdviseFlags flags;
245245
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
246246
ASSERT_NE(nullptr, commandList);
247247

@@ -273,7 +273,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseSetAndClearCachingThen
273273
EXPECT_NE(nullptr, ptr);
274274

275275
ze_result_t returnValue;
276-
L0::MemAdviseFlags flags;
276+
NEO::MemAdviseFlags flags;
277277
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
278278
ASSERT_NE(nullptr, commandList);
279279

@@ -283,10 +283,13 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseSetAndClearCachingThen
283283
L0::DeviceImp *deviceImp = static_cast<L0::DeviceImp *>((L0::Device::fromHandle(device)));
284284
flags = deviceImp->memAdviseSharedAllocations[allocData];
285285
EXPECT_EQ(1, flags.cached_memory);
286+
auto memoryManager = static_cast<MockMemoryManager *>(device->getDriverHandle()->getMemoryManager());
287+
EXPECT_EQ(1, memoryManager->memAdviseFlags.cached_memory);
286288
res = commandList->appendMemAdvise(device, ptr, size, ZE_MEMORY_ADVICE_BIAS_UNCACHED);
287289
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
288290
flags = deviceImp->memAdviseSharedAllocations[allocData];
289291
EXPECT_EQ(0, flags.cached_memory);
292+
EXPECT_EQ(0, memoryManager->memAdviseFlags.cached_memory);
290293

291294
res = context->freeMem(ptr);
292295
ASSERT_EQ(res, ZE_RESULT_SUCCESS);
@@ -307,7 +310,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerThenAppend
307310
EXPECT_NE(nullptr, ptr);
308311

309312
ze_result_t returnValue;
310-
L0::MemAdviseFlags flags;
313+
NEO::MemAdviseFlags flags;
311314
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
312315
ASSERT_NE(nullptr, commandList);
313316

@@ -355,7 +358,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerThenGpuDom
355358
EXPECT_NE(nullptr, ptr);
356359

357360
ze_result_t returnValue;
358-
L0::MemAdviseFlags flags;
361+
NEO::MemAdviseFlags flags;
359362
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
360363
ASSERT_NE(nullptr, commandList);
361364

@@ -396,7 +399,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerAndGpuDoma
396399
EXPECT_NE(nullptr, ptr);
397400

398401
ze_result_t returnValue;
399-
L0::MemAdviseFlags flags;
402+
NEO::MemAdviseFlags flags;
400403
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
401404
ASSERT_NE(nullptr, commandList);
402405

@@ -442,7 +445,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerAndGpuDoma
442445
EXPECT_NE(nullptr, ptr);
443446

444447
ze_result_t returnValue;
445-
L0::MemAdviseFlags flags;
448+
NEO::MemAdviseFlags flags;
446449
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
447450
ASSERT_NE(nullptr, commandList);
448451

@@ -511,7 +514,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerAndGpuDoma
511514
EXPECT_NE(nullptr, ptr);
512515

513516
ze_result_t returnValue;
514-
L0::MemAdviseFlags flags;
517+
NEO::MemAdviseFlags flags;
515518
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
516519
ASSERT_NE(nullptr, commandList);
517520

@@ -566,7 +569,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerAndGpuDoma
566569
EXPECT_NE(nullptr, ptr);
567570

568571
ze_result_t returnValue;
569-
L0::MemAdviseFlags flags;
572+
NEO::MemAdviseFlags flags;
570573
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
571574
ASSERT_NE(nullptr, commandList);
572575

@@ -607,7 +610,7 @@ TEST_F(CommandListMemAdvisePageFault, givenValidPtrAndPageFaultHandlerAndGpuDoma
607610
EXPECT_NE(nullptr, ptr);
608611

609612
ze_result_t returnValue;
610-
L0::MemAdviseFlags flags;
613+
NEO::MemAdviseFlags flags;
611614
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
612615
ASSERT_NE(nullptr, commandList);
613616

@@ -653,7 +656,7 @@ TEST_F(CommandListMemAdvisePageFault, givenInvalidPtrAndPageFaultHandlerAndGpuDo
653656
EXPECT_NE(nullptr, ptr);
654657

655658
ze_result_t returnValue;
656-
L0::MemAdviseFlags flags;
659+
NEO::MemAdviseFlags flags;
657660
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
658661
ASSERT_NE(nullptr, commandList);
659662

opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4352,6 +4352,42 @@ TEST(DrmAllocationTest, givenDrmAllocationWhenCacheRegionIsSetSuccessfullyThenSe
43524352
}
43534353
}
43544354

4355+
TEST(DrmAllocationTest, givenDrmAllocationWhenBufferObjectIsCreatedThenApplyDefaultCachePolicy) {
4356+
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
4357+
executionEnvironment->prepareRootDeviceEnvironments(1);
4358+
4359+
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
4360+
4361+
MockBufferObject bo(&drm, 0, 0, 1);
4362+
MockDrmAllocation allocation(GraphicsAllocation::AllocationType::BUFFER, MemoryPool::LocalMemory);
4363+
allocation.bufferObjects[0] = &bo;
4364+
4365+
for (auto bo : allocation.bufferObjects) {
4366+
if (bo != nullptr) {
4367+
EXPECT_EQ(CachePolicy::WriteBack, bo->peekCachePolicy());
4368+
}
4369+
}
4370+
}
4371+
4372+
TEST(DrmAllocationTest, givenDrmAllocationWhenSetCachePolicyIsCalledThenUpdatePolicyInBufferObject) {
4373+
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
4374+
executionEnvironment->prepareRootDeviceEnvironments(1);
4375+
4376+
DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]);
4377+
4378+
MockBufferObject bo(&drm, 0, 0, 1);
4379+
MockDrmAllocation allocation(GraphicsAllocation::AllocationType::BUFFER, MemoryPool::LocalMemory);
4380+
allocation.bufferObjects[0] = &bo;
4381+
4382+
allocation.setCachePolicy(CachePolicy::Uncached);
4383+
4384+
for (auto bo : allocation.bufferObjects) {
4385+
if (bo != nullptr) {
4386+
EXPECT_EQ(CachePolicy::Uncached, bo->peekCachePolicy());
4387+
}
4388+
}
4389+
}
4390+
43554391
TEST(DrmAllocationTest, givenBoWhenMarkingForCaptureThenBosAreMarked) {
43564392
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
43574393
executionEnvironment->prepareRootDeviceEnvironments(1);
@@ -4678,4 +4714,20 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenGetLocalMemoryIsCalledThen
46784714
EXPECT_EQ(0 * GB, memoryManager->getLocalMemorySize(rootDeviceIndex, 0xF));
46794715
}
46804716

4717+
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetMemAdviseIsCalledThenUpdateCachePolicyInBufferObject) {
4718+
TestedDrmMemoryManager memoryManager(false, false, false, *executionEnvironment);
4719+
BufferObject bo(mock, 1, 1024, 0);
4720+
4721+
DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNIFIED_SHARED_MEMORY, &bo, nullptr, 0u, 0u, MemoryPool::LocalMemory);
4722+
EXPECT_EQ(&bo, drmAllocation.getBO());
4723+
4724+
for (auto isCached : {false, true}) {
4725+
MemAdviseFlags flags{};
4726+
flags.cached_memory = isCached;
4727+
4728+
memoryManager.setMemAdvise(&drmAllocation, flags);
4729+
EXPECT_EQ(isCached ? CachePolicy::WriteBack : CachePolicy::Uncached, bo.peekCachePolicy());
4730+
}
4731+
}
4732+
46814733
} // namespace NEO
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include <stdint.h>
11+
12+
namespace NEO {
13+
14+
typedef union {
15+
uint8_t memadvise_flags; /* all memadvise_flags */
16+
struct
17+
{
18+
uint8_t read_only : 1, /* ZE_MEMORY_ADVICE_SET_READ_MOSTLY or ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY */
19+
device_preferred_location : 1, /* ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION or ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION */
20+
non_atomic : 1, /* ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY or ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY */
21+
cached_memory : 1, /* ZE_MEMORY_ADVICE_BIAS_CACHED or ZE_MEMORY_ADVICE_BIAS_UNCACHED */
22+
cpu_migration_blocked : 1, /* ZE_MEMORY_ADVICE_SET_READ_MOSTLY and ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION */
23+
reserved2 : 1,
24+
reserved1 : 1,
25+
reserved0 : 1;
26+
};
27+
} MemAdviseFlags;
28+
29+
} // namespace NEO

shared/source/memory_manager/memory_manager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "shared/source/memory_manager/graphics_allocation.h"
2020
#include "shared/source/memory_manager/host_ptr_defines.h"
2121
#include "shared/source/memory_manager/local_memory_usage.h"
22+
#include "shared/source/memory_manager/memadvise_flags.h"
2223
#include "shared/source/memory_manager/multi_graphics_allocation.h"
2324
#include "shared/source/os_interface/os_interface.h"
2425
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
@@ -208,6 +209,8 @@ class MemoryManager {
208209
virtual void registerSysMemAlloc(GraphicsAllocation *allocation){};
209210
virtual void registerLocalMemAlloc(GraphicsAllocation *allocation, uint32_t rootDeviceIndex){};
210211

212+
virtual void setMemAdvise(GraphicsAllocation *gfxAllocation, MemAdviseFlags flags){};
213+
211214
bool isExternalAllocation(GraphicsAllocation::AllocationType allocationType);
212215
LocalMemoryUsageBankSelector *getLocalMemoryUsageBankSelector(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex);
213216

shared/source/os_interface/linux/cache_info.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313
namespace NEO {
1414

15+
enum class CachePolicy : uint32_t {
16+
Uncached = 0,
17+
WriteCombined = 1,
18+
WriteThrough = 2,
19+
WriteBack = 3,
20+
};
21+
1522
enum class CacheRegion : uint16_t {
1623
Default = 0,
1724
Region1,

shared/source/os_interface/linux/drm_allocation.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ uint64_t DrmAllocation::peekInternalHandle(MemoryManager *memoryManager) {
2929
return static_cast<uint64_t>((static_cast<DrmMemoryManager *>(memoryManager))->obtainFdFromHandle(getBO()->peekHandle(), this->rootDeviceIndex));
3030
}
3131

32+
void DrmAllocation::setCachePolicy(CachePolicy memType) {
33+
for (auto bo : bufferObjects) {
34+
if (bo != nullptr) {
35+
bo->setCachePolicy(memType);
36+
}
37+
}
38+
}
39+
3240
bool DrmAllocation::setCacheAdvice(Drm *drm, size_t regionSize, CacheRegion regionIndex) {
3341
if (!drm->getCacheInfo()->getCacheRegion(regionSize, regionIndex)) {
3442
return false;

shared/source/os_interface/linux/drm_allocation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace NEO {
1313
class BufferObject;
1414
class OsContext;
1515
class Drm;
16+
enum class CachePolicy : uint32_t;
1617
enum class CacheRegion : uint16_t;
1718

1819
struct OsHandleLinux : OsHandle {
@@ -66,6 +67,7 @@ class DrmAllocation : public GraphicsAllocation {
6667

6768
bool setCacheRegion(Drm *drm, CacheRegion regionIndex);
6869
bool setCacheAdvice(Drm *drm, size_t regionSize, CacheRegion regionIndex);
70+
void setCachePolicy(CachePolicy memType);
6971

7072
void *getMmapPtr() { return this->mmapPtr; }
7173
void setMmapPtr(void *ptr) { this->mmapPtr = ptr; }

shared/source/os_interface/linux/drm_buffer_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ class BufferObject {
9090
void setCacheRegion(CacheRegion regionIndex) { cacheRegion = regionIndex; }
9191
CacheRegion peekCacheRegion() const { return cacheRegion; }
9292

93+
void setCachePolicy(CachePolicy memType) { cachePolicy = memType; }
94+
CachePolicy peekCachePolicy() const { return cachePolicy; }
95+
9396
protected:
9497
Drm *drm = nullptr;
9598
bool perContextVmsUsed = false;
@@ -115,6 +118,7 @@ class BufferObject {
115118
uint64_t unmapSize = 0;
116119

117120
CacheRegion cacheRegion = CacheRegion::Default;
121+
CachePolicy cachePolicy = CachePolicy::WriteBack;
118122

119123
std::vector<std::array<bool, EngineLimits::maxHandleCount>> bindInfo;
120124
StackVec<uint32_t, 2> bindExtHandles;

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ bool DrmMemoryManager::isKmdMigrationAvailable(uint32_t rootDeviceIndex) {
201201
return useKmdMigration;
202202
}
203203

204+
void DrmMemoryManager::setMemAdvise(GraphicsAllocation *gfxAllocation, MemAdviseFlags flags) {
205+
DrmAllocation *drmAllocation = static_cast<DrmAllocation *>(gfxAllocation);
206+
207+
CachePolicy memType = flags.cached_memory ? CachePolicy::WriteBack : CachePolicy::Uncached;
208+
drmAllocation->setCachePolicy(memType);
209+
}
210+
204211
NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size, uint64_t flags, uint32_t rootDeviceIndex) {
205212
drm_i915_gem_userptr userptr = {};
206213
userptr.user_ptr = address;

shared/source/os_interface/linux/drm_memory_manager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class DrmMemoryManager : public MemoryManager {
6565

6666
bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) override;
6767

68+
void setMemAdvise(GraphicsAllocation *gfxAllocation, MemAdviseFlags flags) override;
69+
6870
std::unique_lock<std::mutex> acquireAllocLock();
6971
std::vector<GraphicsAllocation *> &getSysMemAllocs();
7072
std::vector<GraphicsAllocation *> &getLocalMemAllocs(uint32_t rootDeviceIndex);

0 commit comments

Comments
 (0)