Files
compute-runtime/runtime/helpers/mem_properties_parser_helper.cpp
Krzysztof Gibala ea47f9745d Remove OCL object from MemoryProperties 4/n
Wire in MemoryPropertiesFlags support to:
-getAllocationPropertiesWithImageInfo
-getAllocationProperties
-fillPoliciesInProperties

Related-To: NEO-3132
Change-Id: I70d7c2d2ebb4814f4d36518b9098a97c88b88f46
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
2019-08-20 09:46:31 +02:00

40 lines
1.2 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/helpers/mem_properties_parser_helper.h"
namespace NEO {
bool NEO::MemoryPropertiesParser::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;
}
void MemoryPropertiesParser::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryPropertiesFlags &memoryProperties) {
fillCachePolicyInProperties(allocationProperties,
memoryProperties.locallyUncachedResource,
memoryProperties.readOnly,
false);
}
} // namespace NEO