Files
compute-runtime/shared/source/helpers/memory_properties_helpers.h
Milczarek, Slawomir 25a5ed0dca Allocate buffers in local memory for PVC multi root device platforms (1/n)
PVC platform with no support for atomic operations on system memory
must always allocate buffers in local memory to avoid atomic access violation.
Note: the feature is being implemented under the new registry key
AllocateBuffersInLocalMemoryForMultiRootDeviceContexts (disabled by default)

Related-To: NEO-7092

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2022-11-14 13:56:50 +01:00

48 lines
1.8 KiB
C++

/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "memory_properties_flags.h"
namespace NEO {
class MemoryPropertiesHelper {
public:
enum class ObjType {
UNKNOWN,
BUFFER,
IMAGE,
};
static AllocationProperties getAllocationProperties(
uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties, bool allocateMemory, size_t size,
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
static DeviceBitfield adjustDeviceBitfield(uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties,
DeviceBitfield subDevicesBitfieldParam);
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, bool deviceOnlyVisibilty);
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
bool deviceOnlyVisibilty, uint32_t cacheRegion);
static uint32_t getCacheRegion(const MemoryProperties &memoryProperties);
static GraphicsAllocation::UsmInitialPlacement getUSMInitialPlacement(const MemoryProperties &memoryProperties);
static void setUSMInitialPlacement(AllocationProperties &allocationProperties, GraphicsAllocation::UsmInitialPlacement initialPlacement);
static bool useSystemMemoryForCrossRootDeviceAccess(bool multiRootDevice);
static bool useMultiStorageForCrossRootDeviceAccess(bool multiRootDevice);
};
} // namespace NEO