Remove OCL object from MemoryProperties 2/n

Wire in MemoryPropertiesFlags support to checkMemory

Related-To: NEO-3132
Change-Id: Ib3762cc05999c4541a9ea7d33427052c237dd018
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2019-08-09 09:52:17 +02:00
committed by sys_ocldev
parent 4d8e808ab8
commit 26774a21e7
2 changed files with 9 additions and 6 deletions

View File

@@ -18,6 +18,7 @@
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/helpers/memory_properties_flags_helpers.h"
#include "runtime/helpers/timestamp_packet.h"
#include "runtime/helpers/validators.h"
#include "runtime/mem_obj/mem_obj_helper.h"
@@ -151,7 +152,8 @@ Buffer *Buffer::create(Context *context,
memoryManager->isLocalMemorySupported(),
HwHelper::get(context->getDevice(0)->getHardwareInfo().platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(size));
checkMemory(properties.flags, size, hostPtr, errcodeRet, alignementSatisfied, copyMemoryFromHostPtr, memoryManager);
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
checkMemory(memoryProperties, size, hostPtr, errcodeRet, alignementSatisfied, copyMemoryFromHostPtr, memoryManager);
if (errcodeRet != CL_SUCCESS) {
return nullptr;
@@ -323,7 +325,7 @@ Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, Sharing
return sharedBuffer;
}
void Buffer::checkMemory(cl_mem_flags flags,
void Buffer::checkMemory(MemoryPropertiesFlags memoryProperties,
size_t size,
void *hostPtr,
cl_int &errcodeRet,
@@ -340,13 +342,13 @@ void Buffer::checkMemory(cl_mem_flags flags,
}
if (hostPtr) {
if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR))) {
if (!(memoryProperties.useHostPtr || memoryProperties.copyHostPtr)) {
errcodeRet = CL_INVALID_HOST_PTR;
return;
}
}
if (flags & CL_MEM_USE_HOST_PTR) {
if (memoryProperties.useHostPtr) {
if (hostPtr) {
auto fragment = memoryManager->getHostPtrManager()->getFragment(hostPtr);
if (fragment && fragment->driverAllocation) {
@@ -364,7 +366,7 @@ void Buffer::checkMemory(cl_mem_flags flags,
}
}
if (flags & CL_MEM_COPY_HOST_PTR) {
if (memoryProperties.copyHostPtr) {
if (hostPtr) {
copyMemoryFromHostPtr = true;
} else {

View File

@@ -13,6 +13,7 @@
#include "runtime/memory_manager/memory_constants.h"
#include "igfxfmid.h"
#include "memory_properties_flags.h"
namespace NEO {
class Buffer;
@@ -139,7 +140,7 @@ class Buffer : public MemObj {
Buffer();
static void checkMemory(cl_mem_flags flags,
static void checkMemory(MemoryPropertiesFlags memoryProperties,
size_t size,
void *hostPtr,
cl_int &errcodeRet,