@@ -340,6 +340,10 @@ TEST(TestDPCTLSyclQueueInterface, CheckMemOpsZeroQRef)
340
340
ASSERT_NO_FATAL_FAILURE (ERef = DPCTLQueue_Memcpy (QRef, p1, p2, n_bytes));
341
341
ASSERT_FALSE (bool (ERef));
342
342
343
+ ASSERT_NO_FATAL_FAILURE (
344
+ ERef = DPCTLQueue_MemcpyWithEvents (QRef, p1, p2, n_bytes, NULL , 0 ));
345
+ ASSERT_FALSE (bool (ERef));
346
+
343
347
ASSERT_NO_FATAL_FAILURE (ERef = DPCTLQueue_Prefetch (QRef, p1, n_bytes));
344
348
ASSERT_FALSE (bool (ERef));
345
349
@@ -391,6 +395,10 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckMemOpsNullPtr)
391
395
ASSERT_NO_FATAL_FAILURE (ERef = DPCTLQueue_Memcpy (QRef, p1, p2, n_bytes));
392
396
ASSERT_FALSE (bool (ERef));
393
397
398
+ ASSERT_NO_FATAL_FAILURE (
399
+ ERef = DPCTLQueue_MemcpyWithEvents (QRef, p1, p2, n_bytes, NULL , 0 ));
400
+ ASSERT_FALSE (bool (ERef));
401
+
394
402
ASSERT_NO_FATAL_FAILURE (ERef = DPCTLQueue_Prefetch (QRef, p1, n_bytes));
395
403
if (ERef) {
396
404
ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
@@ -450,6 +458,38 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckMemset)
450
458
delete[] host_arr;
451
459
}
452
460
461
+ TEST_P (TestDPCTLQueueMemberFunctions, CheckMemset2)
462
+ {
463
+ DPCTLSyclUSMRef p = nullptr ;
464
+ DPCTLSyclEventRef Memset_ERef = nullptr ;
465
+ DPCTLSyclEventRef Memcpy_ERef = nullptr ;
466
+ uint8_t val = 42 ;
467
+ size_t nbytes = 256 ;
468
+ uint8_t *host_arr = new uint8_t [nbytes];
469
+
470
+ ASSERT_FALSE (host_arr == nullptr );
471
+
472
+ ASSERT_NO_FATAL_FAILURE (p = DPCTLmalloc_device (nbytes, QRef));
473
+ ASSERT_FALSE (p == nullptr );
474
+
475
+ ASSERT_NO_FATAL_FAILURE (
476
+ Memset_ERef = DPCTLQueue_Memset (QRef, (void *)p, val, nbytes));
477
+
478
+ ASSERT_NO_FATAL_FAILURE (Memcpy_ERef = DPCTLQueue_MemcpyWithEvents (
479
+ QRef, host_arr, p, nbytes, &Memset_ERef, 1 ));
480
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (Memcpy_ERef));
481
+
482
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memset_ERef));
483
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memcpy_ERef));
484
+
485
+ ASSERT_NO_FATAL_FAILURE (DPCTLfree_with_queue (p, QRef));
486
+
487
+ for (size_t i = 0 ; i < nbytes; ++i) {
488
+ ASSERT_TRUE (host_arr[i] == val);
489
+ }
490
+ delete[] host_arr;
491
+ }
492
+
453
493
TEST (TestDPCTLSyclQueueInterface, CheckFillNullQRef)
454
494
{
455
495
DPCTLSyclQueueRef QRef = nullptr ;
@@ -481,7 +521,8 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill8)
481
521
{
482
522
using T = uint8_t ;
483
523
DPCTLSyclUSMRef p = nullptr ;
484
- DPCTLSyclEventRef ERef = nullptr ;
524
+ DPCTLSyclEventRef Fill8_ERef = nullptr ;
525
+ DPCTLSyclEventRef Memcpy_ERef = nullptr ;
485
526
T val = static_cast <T>(0xB );
486
527
size_t nelems = 256 ;
487
528
T *host_arr = new T[nelems];
@@ -492,17 +533,15 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill8)
492
533
ASSERT_NO_FATAL_FAILURE (p = DPCTLmalloc_device (nbytes, QRef));
493
534
ASSERT_FALSE (p == nullptr );
494
535
495
- ASSERT_NO_FATAL_FAILURE (ERef =
536
+ ASSERT_NO_FATAL_FAILURE (Fill8_ERef =
496
537
DPCTLQueue_Fill8 (QRef, (void *)p, val, nelems));
497
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
498
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
499
538
500
- ERef = nullptr ;
539
+ ASSERT_NO_FATAL_FAILURE (Memcpy_ERef = DPCTLQueue_MemcpyWithEvents (
540
+ QRef, host_arr, p, nbytes, &Fill8_ERef, 1 ));
541
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (Memcpy_ERef));
501
542
502
- ASSERT_NO_FATAL_FAILURE (ERef =
503
- DPCTLQueue_Memcpy (QRef, host_arr, p, nbytes));
504
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
505
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
543
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Fill8_ERef));
544
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memcpy_ERef));
506
545
507
546
ASSERT_NO_FATAL_FAILURE (DPCTLfree_with_queue (p, QRef));
508
547
@@ -517,7 +556,8 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill16)
517
556
using T = uint16_t ;
518
557
519
558
DPCTLSyclUSMRef p = nullptr ;
520
- DPCTLSyclEventRef ERef = nullptr ;
559
+ DPCTLSyclEventRef Fill16_ERef = nullptr ;
560
+ DPCTLSyclEventRef Memcpy_ERef = nullptr ;
521
561
T val = static_cast <T>(0xAB );
522
562
size_t nelems = 256 ;
523
563
T *host_arr = new T[nelems];
@@ -529,16 +569,14 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill16)
529
569
ASSERT_FALSE (p == nullptr );
530
570
531
571
ASSERT_NO_FATAL_FAILURE (
532
- ERef = DPCTLQueue_Fill16 (QRef, (void *)p, val, nelems));
533
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
534
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
572
+ Fill16_ERef = DPCTLQueue_Fill16 (QRef, (void *)p, val, nelems));
535
573
536
- ERef = nullptr ;
574
+ ASSERT_NO_FATAL_FAILURE (Memcpy_ERef = DPCTLQueue_MemcpyWithEvents (
575
+ QRef, host_arr, p, nbytes, &Fill16_ERef, 1 ));
576
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (Memcpy_ERef));
537
577
538
- ASSERT_NO_FATAL_FAILURE (ERef =
539
- DPCTLQueue_Memcpy (QRef, host_arr, p, nbytes));
540
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
541
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
578
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Fill16_ERef));
579
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memcpy_ERef));
542
580
543
581
ASSERT_NO_FATAL_FAILURE (DPCTLfree_with_queue (p, QRef));
544
582
@@ -553,7 +591,8 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill32)
553
591
using T = uint32_t ;
554
592
555
593
DPCTLSyclUSMRef p = nullptr ;
556
- DPCTLSyclEventRef ERef = nullptr ;
594
+ DPCTLSyclEventRef Fill32_ERef = nullptr ;
595
+ DPCTLSyclEventRef Memcpy_ERef = nullptr ;
557
596
T val = static_cast <T>(0xABCD );
558
597
size_t nelems = 256 ;
559
598
T *host_arr = new T[nelems];
@@ -565,16 +604,14 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill32)
565
604
ASSERT_FALSE (p == nullptr );
566
605
567
606
ASSERT_NO_FATAL_FAILURE (
568
- ERef = DPCTLQueue_Fill32 (QRef, (void *)p, val, nelems));
569
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
570
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
607
+ Fill32_ERef = DPCTLQueue_Fill32 (QRef, (void *)p, val, nelems));
571
608
572
- ERef = nullptr ;
609
+ ASSERT_NO_FATAL_FAILURE (Memcpy_ERef = DPCTLQueue_MemcpyWithEvents (
610
+ QRef, host_arr, p, nbytes, &Fill32_ERef, 1 ));
611
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (Memcpy_ERef));
573
612
574
- ASSERT_NO_FATAL_FAILURE (ERef =
575
- DPCTLQueue_Memcpy (QRef, host_arr, p, nbytes));
576
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
577
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
613
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Fill32_ERef));
614
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memcpy_ERef));
578
615
579
616
ASSERT_NO_FATAL_FAILURE (DPCTLfree_with_queue (p, QRef));
580
617
@@ -589,7 +626,8 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill64)
589
626
using T = uint64_t ;
590
627
591
628
DPCTLSyclUSMRef p = nullptr ;
592
- DPCTLSyclEventRef ERef = nullptr ;
629
+ DPCTLSyclEventRef Fill64_ERef = nullptr ;
630
+ DPCTLSyclEventRef Memcpy_ERef = nullptr ;
593
631
T val = static_cast <T>(0xABCDEF73 );
594
632
size_t nelems = 256 ;
595
633
T *host_arr = new T[nelems];
@@ -601,16 +639,14 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill64)
601
639
ASSERT_FALSE (p == nullptr );
602
640
603
641
ASSERT_NO_FATAL_FAILURE (
604
- ERef = DPCTLQueue_Fill64 (QRef, (void *)p, val, nelems));
605
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
606
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
642
+ Fill64_ERef = DPCTLQueue_Fill64 (QRef, (void *)p, val, nelems));
607
643
608
- ERef = nullptr ;
644
+ ASSERT_NO_FATAL_FAILURE (Memcpy_ERef = DPCTLQueue_MemcpyWithEvents (
645
+ QRef, host_arr, p, nbytes, &Fill64_ERef, 1 ));
646
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (Memcpy_ERef));
609
647
610
- ASSERT_NO_FATAL_FAILURE (ERef =
611
- DPCTLQueue_Memcpy (QRef, host_arr, p, nbytes));
612
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
613
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
648
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Fill64_ERef));
649
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memcpy_ERef));
614
650
615
651
ASSERT_NO_FATAL_FAILURE (DPCTLfree_with_queue (p, QRef));
616
652
@@ -639,7 +675,8 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill128)
639
675
using T = value128_t ;
640
676
641
677
DPCTLSyclUSMRef p = nullptr ;
642
- DPCTLSyclEventRef ERef = nullptr ;
678
+ DPCTLSyclEventRef Fill128_ERef = nullptr ;
679
+ DPCTLSyclEventRef Memcpy_ERef = nullptr ;
643
680
T val{static_cast <uint64_t >(0xABCDEF73 ), static_cast <uint64_t >(0x3746AF05 )};
644
681
size_t nelems = 256 ;
645
682
T *host_arr = new T[nelems];
@@ -651,17 +688,15 @@ TEST_P(TestDPCTLQueueMemberFunctions, CheckFill128)
651
688
ASSERT_FALSE (p == nullptr );
652
689
653
690
ASSERT_NO_FATAL_FAILURE (
654
- ERef = DPCTLQueue_Fill128 (QRef, (void *)p,
655
- reinterpret_cast <uint64_t *>(&val), nelems));
656
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
657
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
691
+ Fill128_ERef = DPCTLQueue_Fill128 (
692
+ QRef, (void *)p, reinterpret_cast <uint64_t *>(&val), nelems));
658
693
659
- ERef = nullptr ;
694
+ ASSERT_NO_FATAL_FAILURE (Memcpy_ERef = DPCTLQueue_MemcpyWithEvents (
695
+ QRef, host_arr, p, nbytes, &Fill128_ERef, 1 ));
696
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (Memcpy_ERef));
660
697
661
- ASSERT_NO_FATAL_FAILURE (ERef =
662
- DPCTLQueue_Memcpy (QRef, host_arr, p, nbytes));
663
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
664
- ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (ERef));
698
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Fill128_ERef));
699
+ ASSERT_NO_FATAL_FAILURE (DPCTLEvent_Delete (Memcpy_ERef));
665
700
666
701
ASSERT_NO_FATAL_FAILURE (DPCTLfree_with_queue (p, QRef));
667
702
0 commit comments