2018-09-05 16:10:26 +08:00
|
|
|
/*
|
2019-01-09 19:56:38 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-09-05 16:10:26 +08:00
|
|
|
*
|
2018-09-17 20:03:37 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-09-05 16:10:26 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "runtime/mem_obj/mem_obj_helper.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "common/helpers/bit_helpers.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-09-05 16:10:26 +08:00
|
|
|
|
2018-10-31 16:51:31 +08:00
|
|
|
bool MemObjHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &propertiesStruct) {
|
|
|
|
if (properties == nullptr) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; properties[i] != 0; i += 2) {
|
|
|
|
switch (properties[i]) {
|
|
|
|
case CL_MEM_FLAGS:
|
|
|
|
propertiesStruct.flags |= static_cast<cl_mem_flags>(properties[i + 1]);
|
|
|
|
break;
|
|
|
|
case CL_MEM_FLAGS_INTEL:
|
|
|
|
propertiesStruct.flags_intel |= static_cast<cl_mem_flags_intel>(properties[i + 1]);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-04-26 15:48:23 +08:00
|
|
|
void MemObjHelper::fillPoliciesInProperties(AllocationProperties &allocationProperties, MemoryProperties &memoryProperties) {
|
2019-04-17 16:02:31 +08:00
|
|
|
fillCachePolicyInProperties(allocationProperties,
|
|
|
|
isValueSet(memoryProperties.flags_intel, CL_MEM_LOCALLY_UNCACHED_RESOURCE),
|
2019-04-26 15:48:23 +08:00
|
|
|
isValueSet(memoryProperties.flags, CL_MEM_READ_ONLY),
|
|
|
|
false);
|
2018-09-17 20:03:37 +08:00
|
|
|
}
|
|
|
|
|
2019-03-19 19:57:47 +08:00
|
|
|
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType, bool preferCompression) {
|
2019-03-12 21:19:01 +08:00
|
|
|
return renderCompressed;
|
2019-01-28 22:27:15 +08:00
|
|
|
}
|
|
|
|
|
2019-01-09 19:56:38 +08:00
|
|
|
bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &properties) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MemObjHelper::addExtraMemoryProperties(MemoryProperties &properties) {
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|