Remove OCL object from MemoryProperties 1/n

Create struct MemoryPropertiesFlags and helper for it

Related-To: NEO-3132
Change-Id: If303a563d7dbae8cf897aa8182b9caab08593c75
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2019-08-05 15:16:57 +02:00
committed by sys_ocldev
parent 6ae0ca3c56
commit c3a54dd5ad
11 changed files with 290 additions and 4 deletions

View File

@@ -58,8 +58,11 @@ set(RUNTIME_SRCS_HELPERS_BASE
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/kernel_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.h
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mem_properties_parser_helper.h
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mem_properties_parser_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mem_properties_parser_helper.h
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/memory_properties_flags_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_helpers_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h
${CMAKE_CURRENT_SOURCE_DIR}/options.cpp

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/helpers/memory_properties_flags_helpers_base.inl"
namespace NEO {
void MemoryPropertiesFlagsParser::addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlag, MemoryProperties properties) {
}
} // namespace NEO

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "mem_obj_types.h"
#include "memory_properties_flags.h"
namespace NEO {
class MemoryPropertiesFlagsParser {
public:
static void addExtraMemoryPropertiesFlags(MemoryPropertiesFlags &propertiesFlags, MemoryProperties properties);
static MemoryPropertiesFlags createMemoryPropertiesFlags(MemoryProperties properties);
};
} // namespace NEO

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "common/helpers/bit_helpers.h"
#include "public/cl_ext_private.h"
#include "runtime/helpers/memory_properties_flags_helpers.h"
#include "CL/cl_ext_intel.h"
namespace NEO {
MemoryPropertiesFlags MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(MemoryProperties properties) {
MemoryPropertiesFlags memoryPropertiesFlags;
if (isValueSet(properties.flags, CL_MEM_READ_WRITE)) {
memoryPropertiesFlags.readWrite = true;
}
if (isValueSet(properties.flags, CL_MEM_WRITE_ONLY)) {
memoryPropertiesFlags.writeOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_READ_ONLY)) {
memoryPropertiesFlags.readOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
memoryPropertiesFlags.useHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_ALLOC_HOST_PTR)) {
memoryPropertiesFlags.allocHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_COPY_HOST_PTR)) {
memoryPropertiesFlags.copyHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_WRITE_ONLY)) {
memoryPropertiesFlags.hostWriteOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_READ_ONLY)) {
memoryPropertiesFlags.hostReadOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_NO_ACCESS)) {
memoryPropertiesFlags.hostNoAccess = true;
}
if (isValueSet(properties.flags, CL_MEM_KERNEL_READ_AND_WRITE)) {
memoryPropertiesFlags.kernelReadAndWrite = true;
}
if (isValueSet(properties.flags, CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
isValueSet(properties.flags_intel, CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
memoryPropertiesFlags.forceLinearStorage = true;
}
if (isValueSet(properties.flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
memoryPropertiesFlags.accessFlagsUnrestricted = true;
}
if (isValueSet(properties.flags, CL_MEM_NO_ACCESS_INTEL)) {
memoryPropertiesFlags.noAccess = true;
}
if (isValueSet(properties.flags, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
isValueSet(properties.flags_intel, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
memoryPropertiesFlags.allowUnrestrictedSize = true;
}
if (isValueSet(properties.flags_intel, CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
memoryPropertiesFlags.locallyUncachedResource = true;
}
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, properties);
return memoryPropertiesFlags;
}
} // namespace NEO