1818#include " runtime/gmm_helper/gmm_helper.h"
1919#include " runtime/helpers/hw_helper.h"
2020#include " runtime/helpers/hw_info.h"
21+ #include " runtime/helpers/memory_properties_flags_helpers.h"
2122#include " runtime/helpers/timestamp_packet.h"
2223#include " runtime/helpers/validators.h"
2324#include " runtime/mem_obj/mem_obj_helper.h"
@@ -151,7 +152,8 @@ Buffer *Buffer::create(Context *context,
151152 memoryManager->isLocalMemorySupported (),
152153 HwHelper::get (context->getDevice (0 )->getHardwareInfo ().platform .eRenderCoreFamily ).obtainRenderBufferCompressionPreference (size));
153154
154- checkMemory (properties.flags , size, hostPtr, errcodeRet, alignementSatisfied, copyMemoryFromHostPtr, memoryManager);
155+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
156+ checkMemory (memoryProperties, size, hostPtr, errcodeRet, alignementSatisfied, copyMemoryFromHostPtr, memoryManager);
155157
156158 if (errcodeRet != CL_SUCCESS) {
157159 return nullptr ;
@@ -323,7 +325,7 @@ Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, Sharing
323325 return sharedBuffer;
324326}
325327
326- void Buffer::checkMemory (cl_mem_flags flags ,
328+ void Buffer::checkMemory (MemoryPropertiesFlags memoryProperties ,
327329 size_t size,
328330 void *hostPtr,
329331 cl_int &errcodeRet,
@@ -340,13 +342,13 @@ void Buffer::checkMemory(cl_mem_flags flags,
340342 }
341343
342344 if (hostPtr) {
343- if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR) )) {
345+ if (!(memoryProperties. useHostPtr || memoryProperties. copyHostPtr )) {
344346 errcodeRet = CL_INVALID_HOST_PTR;
345347 return ;
346348 }
347349 }
348350
349- if (flags & CL_MEM_USE_HOST_PTR ) {
351+ if (memoryProperties. useHostPtr ) {
350352 if (hostPtr) {
351353 auto fragment = memoryManager->getHostPtrManager ()->getFragment (hostPtr);
352354 if (fragment && fragment->driverAllocation ) {
@@ -364,7 +366,7 @@ void Buffer::checkMemory(cl_mem_flags flags,
364366 }
365367 }
366368
367- if (flags & CL_MEM_COPY_HOST_PTR ) {
369+ if (memoryProperties. copyHostPtr ) {
368370 if (hostPtr) {
369371 copyMemoryFromHostPtr = true ;
370372 } else {
0 commit comments