|
17 | 17 | #include <CL/sycl/detail/cl.h>
|
18 | 18 | #include <CL/sycl/detail/pi.h>
|
19 | 19 |
|
| 20 | +#include <algorithm> |
20 | 21 | #include <cassert>
|
21 | 22 | #include <cstring>
|
22 | 23 | #include <iostream>
|
23 | 24 | #include <limits>
|
24 | 25 | #include <map>
|
| 26 | +#include <sstream> |
25 | 27 | #include <string>
|
26 | 28 | #include <vector>
|
27 | 29 |
|
@@ -546,22 +548,25 @@ pi_result piMemBufferCreate(pi_context context, pi_mem_flags flags, size_t size,
|
546 | 548 | void *host_ptr, pi_mem *ret_mem,
|
547 | 549 | const pi_mem_properties *properties) {
|
548 | 550 | pi_result ret_err = PI_INVALID_OPERATION;
|
549 |
| - clCreateBufferWithPropertiesINTEL_fn FuncPtr = nullptr; |
550 |
| - |
551 |
| - if (properties) |
| 551 | + if (properties) { |
| 552 | + // TODO: need to check if all properties are supported by OpenCL RT and |
| 553 | + // ignore unsupported |
| 554 | + clCreateBufferWithPropertiesINTEL_fn FuncPtr = nullptr; |
552 | 555 | // First we need to look up the function pointer
|
553 | 556 | ret_err = getExtFuncFromContext<clCreateBufferWithPropertiesName,
|
554 | 557 | clCreateBufferWithPropertiesINTEL_fn>(
|
555 | 558 | context, &FuncPtr);
|
| 559 | + if (FuncPtr) { |
| 560 | + *ret_mem = cast<pi_mem>(FuncPtr(cast<cl_context>(context), properties, |
| 561 | + cast<cl_mem_flags>(flags), size, host_ptr, |
| 562 | + cast<cl_int *>(&ret_err))); |
| 563 | + return ret_err; |
| 564 | + } |
| 565 | + } |
556 | 566 |
|
557 |
| - if (FuncPtr) |
558 |
| - *ret_mem = cast<pi_mem>(FuncPtr(cast<cl_context>(context), properties, |
559 |
| - cast<cl_mem_flags>(flags), size, host_ptr, |
560 |
| - cast<cl_int *>(&ret_err))); |
561 |
| - else |
562 |
| - *ret_mem = cast<pi_mem>(clCreateBuffer(cast<cl_context>(context), |
563 |
| - cast<cl_mem_flags>(flags), size, |
564 |
| - host_ptr, cast<cl_int *>(&ret_err))); |
| 567 | + *ret_mem = cast<pi_mem>(clCreateBuffer(cast<cl_context>(context), |
| 568 | + cast<cl_mem_flags>(flags), size, |
| 569 | + host_ptr, cast<cl_int *>(&ret_err))); |
565 | 570 | return ret_err;
|
566 | 571 | }
|
567 | 572 |
|
|
0 commit comments