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