2019-07-18 00:07:10 +02:00
|
|
|
/*
|
2022-01-31 10:12:51 +00:00
|
|
|
* Copyright (C) 2020-2022 Intel Corporation
|
2019-07-18 00:07:10 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/bit_helpers.h"
|
|
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2019-08-12 10:36:23 +02:00
|
|
|
#include "memory_properties_flags.h"
|
2019-07-18 00:07:10 +02:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
2020-05-04 11:04:43 +02:00
|
|
|
class MemoryPropertiesHelper {
|
2019-07-18 00:07:10 +02:00
|
|
|
public:
|
2019-08-29 08:59:15 +02:00
|
|
|
enum class ObjType {
|
|
|
|
UNKNOWN,
|
|
|
|
BUFFER,
|
|
|
|
IMAGE,
|
|
|
|
};
|
|
|
|
|
2020-11-17 00:23:13 +00:00
|
|
|
static AllocationProperties getAllocationProperties(
|
2022-06-24 15:44:30 +00:00
|
|
|
uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties, bool allocateMemory, size_t size,
|
2022-02-04 13:59:01 +00:00
|
|
|
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
2021-07-07 12:43:54 +00:00
|
|
|
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
|
2020-11-17 00:23:13 +00:00
|
|
|
|
|
|
|
static DeviceBitfield adjustDeviceBitfield(uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties,
|
|
|
|
DeviceBitfield subDevicesBitfieldParam);
|
2019-07-18 00:07:10 +02:00
|
|
|
|
2021-07-07 12:43:54 +00:00
|
|
|
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, bool deviceOnlyVisibilty);
|
2019-07-18 00:07:10 +02:00
|
|
|
|
|
|
|
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
|
2021-02-09 00:31:32 +00:00
|
|
|
bool deviceOnlyVisibilty, uint32_t cacheRegion);
|
|
|
|
|
|
|
|
static uint32_t getCacheRegion(const MemoryProperties &memoryProperties);
|
2022-01-31 10:12:51 +00:00
|
|
|
|
|
|
|
static GraphicsAllocation::UsmInitialPlacement getUSMInitialPlacement(const MemoryProperties &memoryProperties);
|
|
|
|
|
|
|
|
static void setUSMInitialPlacement(AllocationProperties &allocationProperties, GraphicsAllocation::UsmInitialPlacement initialPlacement);
|
2019-07-18 00:07:10 +02:00
|
|
|
};
|
|
|
|
} // namespace NEO
|