@@ -508,30 +508,24 @@ class reduction_impl : private reduction_impl_base {
508
508
}
509
509
510
510
// / Constructs reduction_impl when the identity value is statically known.
511
- // Note that aliasing constructor was used to initialize MRWAcc to avoid
512
- // destruction of the object referenced by the parameter Acc.
513
511
template <
514
512
typename _T = T,
515
513
enable_if_t <IsKnownIdentityOp<_T, BinaryOperation>::value> * = nullptr >
516
514
reduction_impl (rw_accessor_type &Acc)
517
- : MRWAcc(shared_ptr_class<rw_accessor_type>(
518
- shared_ptr_class<rw_accessor_type>{}, &Acc)),
519
- MIdentity(getIdentity()), InitializeToIdentity(false ) {
515
+ : MRWAcc(new rw_accessor_type(Acc)), MIdentity(getIdentity()),
516
+ InitializeToIdentity(false ) {
520
517
if (Acc.get_count () != 1 )
521
518
throw sycl::runtime_error (" Reduction variable must be a scalar." ,
522
519
PI_INVALID_VALUE);
523
520
}
524
521
525
522
// / Constructs reduction_impl when the identity value is statically known.
526
- // Note that aliasing constructor was used to initialize MDWAcc to avoid
527
- // destruction of the object referenced by the parameter Acc.
528
523
template <
529
524
typename _T = T,
530
525
enable_if_t <IsKnownIdentityOp<_T, BinaryOperation>::value> * = nullptr >
531
526
reduction_impl (dw_accessor_type &Acc)
532
- : MDWAcc(shared_ptr_class<dw_accessor_type>(
533
- shared_ptr_class<dw_accessor_type>{}, &Acc)),
534
- MIdentity(getIdentity()), InitializeToIdentity(true ) {
527
+ : MDWAcc(new dw_accessor_type(Acc)), MIdentity(getIdentity()),
528
+ InitializeToIdentity(true ) {
535
529
if (Acc.get_count () != 1 )
536
530
throw sycl::runtime_error (" Reduction variable must be a scalar." ,
537
531
PI_INVALID_VALUE);
@@ -567,15 +561,12 @@ class reduction_impl : private reduction_impl_base {
567
561
568
562
// / Constructs reduction_impl when the identity value is statically known,
569
563
// / and user still passed the identity value.
570
- // Note that aliasing constructor was used to initialize MRWAcc to avoid
571
- // destruction of the object referenced by the parameter Acc.
572
564
template <
573
565
typename _T = T,
574
566
enable_if_t <IsKnownIdentityOp<_T, BinaryOperation>::value> * = nullptr >
575
567
reduction_impl (rw_accessor_type &Acc, const T & /* Identity*/ , BinaryOperation)
576
- : MRWAcc(shared_ptr_class<rw_accessor_type>(
577
- shared_ptr_class<rw_accessor_type>{}, &Acc)),
578
- MIdentity(getIdentity()), InitializeToIdentity(false ) {
568
+ : MRWAcc(new rw_accessor_type(Acc)), MIdentity(getIdentity()),
569
+ InitializeToIdentity(false ) {
579
570
if (Acc.get_count () != 1 )
580
571
throw sycl::runtime_error (" Reduction variable must be a scalar." ,
581
572
PI_INVALID_VALUE);
@@ -592,13 +583,14 @@ class reduction_impl : private reduction_impl_base {
592
583
// list of known operations does not break the existing programs.
593
584
}
594
585
586
+ // / Constructs reduction_impl when the identity value is statically known,
587
+ // / and user still passed the identity value.
595
588
template <
596
589
typename _T = T,
597
590
enable_if_t <IsKnownIdentityOp<_T, BinaryOperation>::value> * = nullptr >
598
591
reduction_impl (dw_accessor_type &Acc, const T & /* Identity*/ , BinaryOperation)
599
- : MDWAcc(shared_ptr_class<dw_accessor_type>(
600
- shared_ptr_class<dw_accessor_type>{}, &Acc)),
601
- MIdentity(getIdentity()), InitializeToIdentity(true ) {
592
+ : MDWAcc(new dw_accessor_type(Acc)), MIdentity(getIdentity()),
593
+ InitializeToIdentity(true ) {
602
594
if (Acc.get_count () != 1 )
603
595
throw sycl::runtime_error (" Reduction variable must be a scalar." ,
604
596
PI_INVALID_VALUE);
@@ -632,30 +624,24 @@ class reduction_impl : private reduction_impl_base {
632
624
}
633
625
634
626
// / Constructs reduction_impl when the identity value is unknown.
635
- // Note that aliasing constructor was used to initialize MRWAcc to avoid
636
- // destruction of the object referenced by the parameter Acc.
637
627
template <
638
628
typename _T = T,
639
629
enable_if_t <!IsKnownIdentityOp<_T, BinaryOperation>::value> * = nullptr >
640
630
reduction_impl (rw_accessor_type &Acc, const T &Identity, BinaryOperation BOp)
641
- : MRWAcc(shared_ptr_class<rw_accessor_type>(
642
- shared_ptr_class<rw_accessor_type>{}, &Acc)),
643
- MIdentity(Identity), MBinaryOp(BOp), InitializeToIdentity(false ) {
631
+ : MRWAcc(new rw_accessor_type(Acc)), MIdentity(Identity), MBinaryOp(BOp),
632
+ InitializeToIdentity(false ) {
644
633
if (Acc.get_count () != 1 )
645
634
throw sycl::runtime_error (" Reduction variable must be a scalar." ,
646
635
PI_INVALID_VALUE);
647
636
}
648
637
649
638
// / Constructs reduction_impl when the identity value is unknown.
650
- // Note that aliasing constructor was used to initialize MDWAcc to avoid
651
- // destruction of the object referenced by the parameter Acc.
652
639
template <
653
640
typename _T = T,
654
641
enable_if_t <!IsKnownIdentityOp<_T, BinaryOperation>::value> * = nullptr >
655
642
reduction_impl (dw_accessor_type &Acc, const T &Identity, BinaryOperation BOp)
656
- : MDWAcc(shared_ptr_class<dw_accessor_type>(
657
- shared_ptr_class<dw_accessor_type>{}, &Acc)),
658
- MIdentity(Identity), MBinaryOp(BOp), InitializeToIdentity(true ) {
643
+ : MDWAcc(new dw_accessor_type(Acc)), MIdentity(Identity), MBinaryOp(BOp),
644
+ InitializeToIdentity(true ) {
659
645
if (Acc.get_count () != 1 )
660
646
throw sycl::runtime_error (" Reduction variable must be a scalar." ,
661
647
PI_INVALID_VALUE);
0 commit comments