18
18
#include " runtime/gmm_helper/gmm_helper.h"
19
19
#include " runtime/helpers/hw_helper.h"
20
20
#include " runtime/helpers/hw_info.h"
21
+ #include " runtime/helpers/memory_properties_flags_helpers.h"
21
22
#include " runtime/helpers/timestamp_packet.h"
22
23
#include " runtime/helpers/validators.h"
23
24
#include " runtime/mem_obj/mem_obj_helper.h"
@@ -151,7 +152,8 @@ Buffer *Buffer::create(Context *context,
151
152
memoryManager->isLocalMemorySupported (),
152
153
HwHelper::get (context->getDevice (0 )->getHardwareInfo ().platform .eRenderCoreFamily ).obtainRenderBufferCompressionPreference (size));
153
154
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);
155
157
156
158
if (errcodeRet != CL_SUCCESS) {
157
159
return nullptr ;
@@ -323,7 +325,7 @@ Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, Sharing
323
325
return sharedBuffer;
324
326
}
325
327
326
- void Buffer::checkMemory (cl_mem_flags flags ,
328
+ void Buffer::checkMemory (MemoryPropertiesFlags memoryProperties ,
327
329
size_t size,
328
330
void *hostPtr,
329
331
cl_int &errcodeRet,
@@ -340,13 +342,13 @@ void Buffer::checkMemory(cl_mem_flags flags,
340
342
}
341
343
342
344
if (hostPtr) {
343
- if (!(flags & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR) )) {
345
+ if (!(memoryProperties. useHostPtr || memoryProperties. copyHostPtr )) {
344
346
errcodeRet = CL_INVALID_HOST_PTR;
345
347
return ;
346
348
}
347
349
}
348
350
349
- if (flags & CL_MEM_USE_HOST_PTR ) {
351
+ if (memoryProperties. useHostPtr ) {
350
352
if (hostPtr) {
351
353
auto fragment = memoryManager->getHostPtrManager ()->getFragment (hostPtr);
352
354
if (fragment && fragment->driverAllocation ) {
@@ -364,7 +366,7 @@ void Buffer::checkMemory(cl_mem_flags flags,
364
366
}
365
367
}
366
368
367
- if (flags & CL_MEM_COPY_HOST_PTR ) {
369
+ if (memoryProperties. copyHostPtr ) {
368
370
if (hostPtr) {
369
371
copyMemoryFromHostPtr = true ;
370
372
} else {
0 commit comments