Files
compute-runtime/runtime/helpers/memory_properties_flags_helpers_base.inl
Mrozek, Michal 33f6c7f0da Add new flag to disable L3 for stateful accesses.
- With this flag resource will not be cached in L3 for stateful accesses.

Change-Id: Icf9a393ab92d55c2cdf30444420ea40da0d5630c
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
2019-08-29 23:38:26 -07:00

81 lines
3.0 KiB
C++

/*
* 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.flags.readWrite = true;
}
if (isValueSet(properties.flags, CL_MEM_WRITE_ONLY)) {
memoryPropertiesFlags.flags.writeOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_READ_ONLY)) {
memoryPropertiesFlags.flags.readOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
memoryPropertiesFlags.flags.useHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_ALLOC_HOST_PTR)) {
memoryPropertiesFlags.flags.allocHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_COPY_HOST_PTR)) {
memoryPropertiesFlags.flags.copyHostPtr = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_WRITE_ONLY)) {
memoryPropertiesFlags.flags.hostWriteOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_READ_ONLY)) {
memoryPropertiesFlags.flags.hostReadOnly = true;
}
if (isValueSet(properties.flags, CL_MEM_HOST_NO_ACCESS)) {
memoryPropertiesFlags.flags.hostNoAccess = true;
}
if (isValueSet(properties.flags, CL_MEM_KERNEL_READ_AND_WRITE)) {
memoryPropertiesFlags.flags.kernelReadAndWrite = true;
}
if (isValueSet(properties.flags, CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
isValueSet(properties.flags_intel, CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
memoryPropertiesFlags.flags.forceLinearStorage = true;
}
if (isValueSet(properties.flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
memoryPropertiesFlags.flags.accessFlagsUnrestricted = true;
}
if (isValueSet(properties.flags, CL_MEM_NO_ACCESS_INTEL)) {
memoryPropertiesFlags.flags.noAccess = true;
}
if (isValueSet(properties.flags, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
isValueSet(properties.flags_intel, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
memoryPropertiesFlags.flags.allowUnrestrictedSize = true;
}
if (isValueSet(properties.flags_intel, CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
memoryPropertiesFlags.flags.locallyUncachedResource = true;
}
if (isValueSet(properties.flags_intel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE)) {
memoryPropertiesFlags.flags.locallyUncachedInSurfaceState = true;
}
if (isValueSet(properties.flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
memoryPropertiesFlags.flags.forceSharedPhysicalMemory = true;
}
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, properties);
return memoryPropertiesFlags;
}
} // namespace NEO