Add support for mem advise to set cache policy in buffer object

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2021-10-06 23:22:22 +00:00
committed by Compute-Runtime-Automation
parent 45de13233a
commit afa45bd9e7
13 changed files with 145 additions and 31 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/helpers/topology_map.h"
#include "shared/source/memory_manager/allocations_list.h"
#include "shared/source/memory_manager/memadvise_flags.h"
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
#include "shared/source/utilities/spinlock.h"
@@ -27,21 +28,6 @@
namespace L0 {
struct SysmanDevice;
typedef union {
uint8_t memadvise_flags; /* all memadvise_flags */
struct
{
uint8_t read_only : 1, /* ZE_MEMORY_ADVICE_SET_READ_MOSTLY or ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY */
device_preferred_location : 1, /* ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION or ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION */
non_atomic : 1, /* ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY or ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY */
cached_memory : 1, /* ZE_MEMORY_ADVICE_BIAS_CACHED or ZE_MEMORY_ADVICE_BIAS_UNCACHED */
cpu_migration_blocked : 1, /* ZE_MEMORY_ADVICE_SET_READ_MOSTLY and ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION */
reserved2 : 1,
reserved1 : 1,
reserved0 : 1;
};
} MemAdviseFlags;
struct DeviceImp : public Device {
uint32_t getRootDeviceIndex() override;
ze_result_t canAccessPeer(ze_device_handle_t hPeerDevice, ze_bool_t *value) override;
@@ -135,7 +121,7 @@ struct DeviceImp : public Device {
NEO::SVMAllocsManager::MapBasedAllocationTracker peerAllocations;
NEO::SpinLock peerAllocationsMutex;
std::map<NEO::SvmAllocationData *, MemAdviseFlags> memAdviseSharedAllocations;
std::map<NEO::SvmAllocationData *, NEO::MemAdviseFlags> memAdviseSharedAllocations;
NEO::AllocationsList allocationsForReuse;
void createSysmanHandle(bool isSubDevice);