Files
compute-runtime/runtime/helpers/mem_properties_parser_helper.h
Igor Venevtsev 63fd26f6d6 Always specify rootDeviceIndex for graphics memory allocations
Related-To: NEO-2941

Change-Id: Ia2362fd6b4e72ede02919152475f40b3edbc3658
Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
2019-11-15 15:14:41 +01:00

45 lines
1.7 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "common/helpers/bit_helpers.h"
#include "public/cl_ext_private.h"
#include "runtime/memory_manager/allocation_properties.h"
#include "memory_properties_flags.h"
namespace NEO {
class MemoryPropertiesParser {
public:
enum class ObjType {
UNKNOWN,
BUFFER,
IMAGE,
};
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryPropertiesFlags &memoryProperties, cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, ObjType objectType);
static AllocationProperties getAllocationProperties(uint32_t rootDeviceIndex, MemoryPropertiesFlags memoryProperties, bool allocateMemory,
size_t size, GraphicsAllocation::AllocationType type, bool multiStorageResource) {
AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource);
fillPoliciesInProperties(allocationProperties, memoryProperties);
return allocationProperties;
}
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties);
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
bool deviceOnlyVisibilty) {
allocationProperties.flags.uncacheable = uncached;
auto cacheFlushRequired = !uncached && !readOnly && !deviceOnlyVisibilty;
allocationProperties.flags.flushL3RequiredForRead = cacheFlushRequired;
allocationProperties.flags.flushL3RequiredForWrite = cacheFlushRequired;
}
};
} // namespace NEO