mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Create helper for memory properties
-Move logics from mem_obj_helper Related-To: NEO-3374 Change-Id: I167cdcc8fcb08cb1fa6d19640fd266f0004f4c6b Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
f21e5e85e0
commit
b5020eac81
39
runtime/helpers/mem_properties_parser_helper.cpp
Normal file
39
runtime/helpers/mem_properties_parser_helper.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 MemoryProperties &memoryProperties) {
|
||||
fillCachePolicyInProperties(allocationProperties,
|
||||
isValueSet(memoryProperties.flags_intel, CL_MEM_LOCALLY_UNCACHED_RESOURCE),
|
||||
isValueSet(memoryProperties.flags, CL_MEM_READ_ONLY),
|
||||
false);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user