|
19 | 19 | # include <unistd.h> |
20 | 20 | # endif |
21 | 21 |
|
22 | | -# if !defined(ACC_OPENCL_MEM_EVTRELEASE) && 1 |
23 | | -# define ACC_OPENCL_MEM_EVTRELEASE |
24 | | -# endif |
25 | 22 | # if !defined(ACC_OPENCL_MEM_ALIGNSCALE) |
26 | 23 | # define ACC_OPENCL_MEM_ALIGNSCALE 8 |
27 | 24 | # endif |
@@ -282,12 +279,10 @@ int c_dbcsr_acc_host_mem_deallocate(void* host_mem, void* stream) { |
282 | 279 | } |
283 | 280 | } |
284 | 281 | # endif |
285 | | -# if defined(ACC_OPENCL_MEM_EVTRELEASE) |
286 | 282 | if (NULL != event) { |
287 | 283 | result2 = clReleaseEvent(event); |
288 | 284 | if (EXIT_SUCCESS == result) result = result2; |
289 | 285 | } |
290 | | -# endif |
291 | 286 | } |
292 | 287 | result2 = clReleaseMemObject(info.memory); |
293 | 288 | if (EXIT_SUCCESS == result) result = result2; |
@@ -336,9 +331,7 @@ void CL_CALLBACK c_dbcsr_acc_memcpy_notify(cl_event event, cl_int event_status, |
336 | 331 | } break; |
337 | 332 | } |
338 | 333 | } |
339 | | -# if defined(ACC_OPENCL_MEM_EVTRELEASE) |
340 | 334 | if (NULL != event) ACC_OPENCL_EXPECT(EXIT_SUCCESS == clReleaseEvent(event)); |
341 | | -# endif |
342 | 335 | } |
343 | 336 |
|
344 | 337 |
|
@@ -602,12 +595,10 @@ int c_dbcsr_acc_memcpy_h2d(const void* host_mem, void* dev_mem, size_t nbytes, v |
602 | 595 | result = clSetEventCallback(event, CL_COMPLETE, c_dbcsr_acc_memcpy_notify, dev_mem); |
603 | 596 | if (EXIT_SUCCESS == result) event = NULL; /* prevent releasing the event */ |
604 | 597 | } |
605 | | -# if defined(ACC_OPENCL_MEM_EVTRELEASE) |
606 | 598 | if (NULL != event) { |
607 | 599 | const int result_release = clReleaseEvent(event); |
608 | 600 | if (EXIT_SUCCESS == result) result = result_release; |
609 | 601 | } |
610 | | -# endif |
611 | 602 | } |
612 | 603 | } |
613 | 604 | } |
@@ -658,16 +649,14 @@ int c_dbcsr_acc_memcpy_d2h(const void* dev_mem, void* host_mem, size_t nbytes, v |
658 | 649 | ACC_OPENCL_RELEASE(c_dbcsr_acc_opencl_config.lock_memory); |
659 | 650 | if (NULL != event) { |
660 | 651 | if (EXIT_SUCCESS == result) { |
661 | | - assert(NULL != c_dbcsr_acc_opencl_config.hist_d2h); |
| 652 | + assert(NULL != c_dbcsr_acc_opencl_config.hist_d2h /*&& NULL == devinfo->clEnqueueMemcpyINTEL*/); |
662 | 653 | result = clSetEventCallback(event, CL_COMPLETE, c_dbcsr_acc_memcpy_notify, nconst.ptr); |
663 | 654 | if (EXIT_SUCCESS == result) event = NULL; /* prevent releasing the event */ |
664 | 655 | } |
665 | | -# if defined(ACC_OPENCL_MEM_EVTRELEASE) |
666 | 656 | if (NULL != event) { |
667 | 657 | const int result_release = clReleaseEvent(event); |
668 | 658 | if (EXIT_SUCCESS == result) result = result_release; |
669 | 659 | } |
670 | | -# endif |
671 | 660 | } |
672 | 661 | } |
673 | 662 | # if defined(ACC_OPENCL_PROFILE_DBCSR) |
@@ -720,18 +709,21 @@ int c_dbcsr_acc_memcpy_d2d(const void* devmem_src, void* devmem_dst, size_t nbyt |
720 | 709 | } |
721 | 710 | if (NULL != event) { |
722 | 711 | if (EXIT_SUCCESS == result) { |
723 | | - if (NULL == stream) result = clWaitForEvents(1, &event); |
724 | | - if (EXIT_SUCCESS == result && NULL != c_dbcsr_acc_opencl_config.hist_d2d) { |
| 712 | + if (NULL != c_dbcsr_acc_opencl_config.hist_d2d) { |
| 713 | + assert(NULL == c_dbcsr_acc_opencl_config.device.clEnqueueMemcpyINTEL); |
725 | 714 | result = clSetEventCallback(event, CL_COMPLETE, c_dbcsr_acc_memcpy_notify, nconst.ptr); |
726 | | - if (EXIT_SUCCESS == result) event = NULL; /* prevent releasing the event */ |
| 715 | + if (EXIT_SUCCESS == result) { |
| 716 | + const cl_event wait = event; |
| 717 | + event = NULL; /* prevent releasing the event */ |
| 718 | + if (NULL == stream) result = clWaitForEvents(1, &wait); |
| 719 | + } |
727 | 720 | } |
| 721 | + else if (NULL == stream) result = clWaitForEvents(1, &event); |
728 | 722 | } |
729 | | -# if defined(ACC_OPENCL_MEM_EVTRELEASE) |
730 | 723 | if (NULL != event) { |
731 | 724 | const int result_release = clReleaseEvent(event); |
732 | 725 | if (EXIT_SUCCESS == result) result = result_release; |
733 | 726 | } |
734 | | -# endif |
735 | 727 | } |
736 | 728 | } |
737 | 729 | # if defined(ACC_OPENCL_PROFILE_DBCSR) |
@@ -778,15 +770,12 @@ int c_dbcsr_acc_opencl_memset(void* dev_mem, int value, size_t offset, size_t nb |
778 | 770 | ACC_OPENCL_RELEASE(c_dbcsr_acc_opencl_config.lock_memory); |
779 | 771 | } |
780 | 772 | if (NULL != event) { |
| 773 | + int result_release; |
781 | 774 | if (NULL == stream && EXIT_SUCCESS == result) { |
782 | 775 | result = clWaitForEvents(1, &event); |
783 | 776 | } |
784 | | -# if defined(ACC_OPENCL_MEM_EVTRELEASE) |
785 | | - { |
786 | | - const int result_release = clReleaseEvent(event); |
787 | | - if (EXIT_SUCCESS == result) result = result_release; |
788 | | - } |
789 | | -# endif |
| 777 | + result_release = clReleaseEvent(event); |
| 778 | + if (EXIT_SUCCESS == result) result = result_release; |
790 | 779 | } |
791 | 780 | } |
792 | 781 | # if defined(ACC_OPENCL_PROFILE_DBCSR) |
|
0 commit comments