2019-08-05 21:16:57 +08:00
|
|
|
/*
|
|
|
|
* 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)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.readWrite = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_WRITE_ONLY)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.writeOnly = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_READ_ONLY)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.readOnly = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.useHostPtr = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_ALLOC_HOST_PTR)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.allocHostPtr = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_COPY_HOST_PTR)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.copyHostPtr = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_HOST_WRITE_ONLY)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.hostWriteOnly = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_HOST_READ_ONLY)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.hostReadOnly = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_HOST_NO_ACCESS)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.hostNoAccess = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_KERNEL_READ_AND_WRITE)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.kernelReadAndWrite = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_FORCE_LINEAR_STORAGE_INTEL) ||
|
2019-10-15 16:35:14 +08:00
|
|
|
isValueSet(properties.flagsIntel, CL_MEM_FORCE_LINEAR_STORAGE_INTEL)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.forceLinearStorage = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.accessFlagsUnrestricted = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_NO_ACCESS_INTEL)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.noAccess = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
|
|
|
if (isValueSet(properties.flags, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL) ||
|
2019-10-15 16:35:14 +08:00
|
|
|
isValueSet(properties.flagsIntel, CL_MEM_ALLOW_UNRESTRICTED_SIZE_INTEL)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.allowUnrestrictedSize = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
2019-10-15 16:35:14 +08:00
|
|
|
if (isValueSet(properties.flagsIntel, CL_MEM_LOCALLY_UNCACHED_RESOURCE)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.locallyUncachedResource = true;
|
2019-08-05 21:16:57 +08:00
|
|
|
}
|
2019-08-30 14:18:34 +08:00
|
|
|
|
2019-10-15 16:35:14 +08:00
|
|
|
if (isValueSet(properties.flagsIntel, CL_MEM_LOCALLY_UNCACHED_SURFACE_STATE_RESOURCE)) {
|
2019-08-30 14:18:34 +08:00
|
|
|
memoryPropertiesFlags.flags.locallyUncachedInSurfaceState = true;
|
|
|
|
}
|
|
|
|
|
2019-08-09 18:20:05 +08:00
|
|
|
if (isValueSet(properties.flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
|
2019-08-22 18:31:07 +08:00
|
|
|
memoryPropertiesFlags.flags.forceSharedPhysicalMemory = true;
|
2019-08-09 18:20:05 +08:00
|
|
|
}
|
2019-08-05 21:16:57 +08:00
|
|
|
|
|
|
|
addExtraMemoryPropertiesFlags(memoryPropertiesFlags, properties);
|
|
|
|
|
|
|
|
return memoryPropertiesFlags;
|
|
|
|
}
|
|
|
|
|
2019-08-30 14:18:34 +08:00
|
|
|
} // namespace NEO
|