@@ -3417,8 +3417,17 @@ static bool InvalidWorkGroupSizeAttrs(const Expr *MGValue, const Expr *XDim,
3417
3417
//
3418
3418
// If the 'reqd_work_group_size' attribute is specified on a declaration along
3419
3419
// with 'max_work_group_size' attribute, check to see if values of
3420
- // 'reqd_work_group_size' attribute arguments are equal and less than values of
3421
- // 'max_work_group_size' attribute arguments.
3420
+ // 'reqd_work_group_size' attribute arguments are equal to or less than values
3421
+ // of 'max_work_group_size' attribute arguments.
3422
+ //
3423
+ // The arguments to reqd_work_group_size are ordered based on which index
3424
+ // increments the fastest. In OpenCL, the first argument is the index that
3425
+ // increments the fastest, and in SYCL, the last argument is the index that
3426
+ // increments the fastest.
3427
+ //
3428
+ // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
3429
+ // mode. All spellings of reqd_work_group_size attribute (regardless of
3430
+ // syntax used) follow the SYCL rules when in SYCL mode.
3422
3431
static bool checkMaxAllowedWorkGroupSize (
3423
3432
Sema &S, const Expr *RWGSXDim, const Expr *RWGSYDim, const Expr *RWGSZDim,
3424
3433
const Expr *MWGSXDim, const Expr *MWGSYDim, const Expr *MWGSZDim) {
@@ -3491,21 +3500,11 @@ void Sema::AddSYCLIntelMaxWorkGroupSizeAttr(Decl *D,
3491
3500
3492
3501
// If the 'max_work_group_size' attribute is specified on a declaration along
3493
3502
// with 'reqd_work_group_size' attribute, check to see if values of
3494
- // 'reqd_work_group_size' attribute arguments are equal or less than values
3503
+ // 'reqd_work_group_size' attribute arguments are equal to or less than values
3495
3504
// of 'max_work_group_size' attribute arguments.
3496
3505
//
3497
3506
// We emit diagnostic if values of 'reqd_work_group_size' attribute arguments
3498
3507
// are greater than values of 'max_work_group_size' attribute arguments.
3499
- //
3500
- // The arguments to reqd_work_group_size are ordered based on which index
3501
- // increments the fastest. In OpenCL, the first argument is the index that
3502
- // increments the fastest, and in SYCL, the last argument is the index that
3503
- // increments the fastest.
3504
- //
3505
- // [[sycl::reqd_work_group_size]] and [[cl::reqd_work_group_size]] are
3506
- // available in SYCL modes and follow the SYCL rules.
3507
- // __attribute__((reqd_work_group_size)) is only available in OpenCL mode
3508
- // and follows the OpenCL rules.
3509
3508
if (const auto *DeclAttr = D->getAttr <ReqdWorkGroupSizeAttr>()) {
3510
3509
if (checkMaxAllowedWorkGroupSize (*this , DeclAttr->getXDim (),
3511
3510
DeclAttr->getYDim (), DeclAttr->getZDim (),
@@ -3518,7 +3517,7 @@ void Sema::AddSYCLIntelMaxWorkGroupSizeAttr(Decl *D,
3518
3517
}
3519
3518
3520
3519
// If the declaration has a SYCLIntelMaxWorkGroupSizeAttr, check to see if
3521
- // the attribute holds equal values to (1, 1, 1) in case the value of
3520
+ // the attribute holds values equal to (1, 1, 1) in case the value of
3522
3521
// SYCLIntelMaxGlobalWorkDimAttr equals to 0.
3523
3522
if (const auto *DeclAttr = D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>()) {
3524
3523
if (InvalidWorkGroupSizeAttrs (DeclAttr->getValue (), XDim, YDim, ZDim)) {
@@ -3579,21 +3578,11 @@ SYCLIntelMaxWorkGroupSizeAttr *Sema::MergeSYCLIntelMaxWorkGroupSizeAttr(
3579
3578
3580
3579
// If the 'max_work_group_size' attribute is specified on a declaration along
3581
3580
// with 'reqd_work_group_size' attribute, check to see if values of
3582
- // 'reqd_work_group_size' attribute arguments are equal or less than values
3581
+ // 'reqd_work_group_size' attribute arguments are equal to or less than values
3583
3582
// of 'max_work_group_size' attribute arguments.
3584
3583
//
3585
3584
// We emit diagnostic if values of 'reqd_work_group_size' attribute arguments
3586
3585
// are greater than values of 'max_work_group_size' attribute arguments.
3587
- //
3588
- // The arguments to reqd_work_group_size are ordered based on which index
3589
- // increments the fastest. In OpenCL, the first argument is the index that
3590
- // increments the fastest, and in SYCL, the last argument is the index that
3591
- // increments the fastest.
3592
- //
3593
- // [[sycl::reqd_work_group_size]] and [[cl::reqd_work_group_size]] are
3594
- // available in SYCL modes and follow the SYCL rules.
3595
- // __attribute__((reqd_work_group_size)) is only available in OpenCL mode
3596
- // and follows the OpenCL rules.
3597
3586
if (const auto *DeclAttr = D->getAttr <ReqdWorkGroupSizeAttr>()) {
3598
3587
if (checkMaxAllowedWorkGroupSize (*this , DeclAttr->getXDim (),
3599
3588
DeclAttr->getYDim (), DeclAttr->getZDim (),
@@ -3605,10 +3594,9 @@ SYCLIntelMaxWorkGroupSizeAttr *Sema::MergeSYCLIntelMaxWorkGroupSizeAttr(
3605
3594
}
3606
3595
}
3607
3596
3608
- // If the declaration has a SYCLIntelMaxWorkGroupSizeAttr,
3609
- // check to see if the attribute holds equal values to
3610
- // (1, 1, 1) in case the value of SYCLIntelMaxGlobalWorkDimAttr
3611
- // equals to 0.
3597
+ // If the declaration has a SYCLIntelMaxWorkGroupSizeAttr, check to see if
3598
+ // the attribute holds values equal to (1, 1, 1) in case the value of
3599
+ // SYCLIntelMaxGlobalWorkDimAttr equals to 0.
3612
3600
if (const auto *DeclAttr = D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>()) {
3613
3601
if (InvalidWorkGroupSizeAttrs (DeclAttr->getValue (), A.getXDim (),
3614
3602
A.getYDim (), A.getZDim ())) {
@@ -3639,6 +3627,10 @@ static void handleSYCLIntelMaxWorkGroupSize(Sema &S, Decl *D,
3639
3627
// increments the fastest. In OpenCL, the first argument is the index that
3640
3628
// increments the fastest, and in SYCL, the last argument is the index that
3641
3629
// increments the fastest.
3630
+ //
3631
+ // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
3632
+ // mode. All spellings of reqd_work_group_size attribute (regardless of
3633
+ // syntax used) follow the SYCL rules when in SYCL mode.
3642
3634
static bool CheckWorkGroupSize (Sema &S, const Expr *NSWIValue,
3643
3635
const Expr *RWGSXDim, const Expr *RWGSZDim) {
3644
3636
// If any of the operand is still value dependent, we can't test anything.
@@ -3657,7 +3649,7 @@ static bool CheckWorkGroupSize(Sema &S, const Expr *NSWIValue,
3657
3649
: (RWGSZDimExpr->getResultAsAPSInt ()).getZExtValue ();
3658
3650
3659
3651
// Check if the required work group size specified by 'num_simd_work_items'
3660
- // attribute must evenly divide the index that increments fastest in the
3652
+ // attribute evenly divides the index that increments fastest in the
3661
3653
// 'reqd_work_group_size' attribute.
3662
3654
return WorkGroupSize % NSWIValueExpr->getResultAsAPSInt ().getZExtValue () != 0 ;
3663
3655
}
@@ -3694,7 +3686,7 @@ void Sema::AddReqdWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI,
3694
3686
return ;
3695
3687
3696
3688
// If the declaration has a ReqdWorkGroupSizeAttr, check to see if
3697
- // the attribute holds equal values to (1, 1, 1) in case the value of
3689
+ // the attribute holds values equal to (1, 1, 1) in case the value of
3698
3690
// SYCLIntelMaxGlobalWorkDimAttr equals to 0.
3699
3691
if (const auto *DeclAttr = D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>()) {
3700
3692
if (InvalidWorkGroupSizeAttrs (DeclAttr->getValue (), XDim, YDim, ZDim)) {
@@ -3705,20 +3697,11 @@ void Sema::AddReqdWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI,
3705
3697
3706
3698
// If the 'max_work_group_size' attribute is specified on a declaration along
3707
3699
// with 'reqd_work_group_size' attribute, check to see if values of
3708
- // 'reqd_work_group_size' attribute arguments are equal or less than values
3700
+ // 'reqd_work_group_size' attribute arguments are equal to or less than values
3709
3701
// of 'max_work_group_size' attribute arguments.
3710
3702
//
3711
3703
// We emit diagnostic if values of 'reqd_work_group_size' attribute arguments
3712
3704
// are greater than values of 'max_work_group_size' attribute arguments.
3713
- //
3714
- // The arguments to reqd_work_group_size are ordered based on which index
3715
- // increments the fastest. In OpenCL, the first argument is the index that
3716
- // increments the fastest, and in SYCL, the last argument is the index that
3717
- // increments the fastest.
3718
- //
3719
- // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
3720
- // mode. All spellings of reqd_work_group_size attribute (regardless of
3721
- // syntax used) follow the SYCL rules when in SYCL mode.
3722
3705
if (const auto *DeclAttr = D->getAttr <SYCLIntelMaxWorkGroupSizeAttr>()) {
3723
3706
if (checkMaxAllowedWorkGroupSize (*this , XDim, YDim, ZDim,
3724
3707
DeclAttr->getXDim (), DeclAttr->getYDim (),
@@ -3734,15 +3717,6 @@ void Sema::AddReqdWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI,
3734
3717
// along with 'num_simd_work_items' attribute, the required work group size
3735
3718
// specified by 'num_simd_work_items' attribute must evenly divide the index
3736
3719
// that increments fastest in the 'reqd_work_group_size' attribute.
3737
- //
3738
- // The arguments to reqd_work_group_size are ordered based on which index
3739
- // increments the fastest. In OpenCL, the first argument is the index that
3740
- // increments the fastest, and in SYCL, the last argument is the index that
3741
- // increments the fastest.
3742
- //
3743
- // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
3744
- // mode. All spellings of reqd_work_group_size attribute
3745
- // (regardless of syntax used) follow the SYCL rules when in SYCL mode.
3746
3720
if (const auto *DeclAttr = D->getAttr <SYCLIntelNumSimdWorkItemsAttr>()) {
3747
3721
if (CheckWorkGroupSize (*this , DeclAttr->getValue (), XDim, ZDim)) {
3748
3722
Diag (DeclAttr->getLoc (), diag::err_sycl_num_kernel_wrong_reqd_wg_size)
@@ -3780,10 +3754,9 @@ void Sema::AddReqdWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI,
3780
3754
3781
3755
ReqdWorkGroupSizeAttr *
3782
3756
Sema::MergeReqdWorkGroupSizeAttr (Decl *D, const ReqdWorkGroupSizeAttr &A) {
3783
- // If the declaration has a ReqdWorkGroupSizeAttr,
3784
- // check to see if the attribute holds equal values to
3785
- // (1, 1, 1) in case the value of SYCLIntelMaxGlobalWorkDimAttr
3786
- // equals to 0.
3757
+ // If the declaration has a ReqdWorkGroupSizeAttr, check to see if the
3758
+ // attribute holds values equal to (1, 1, 1) in case the value of
3759
+ // SYCLIntelMaxGlobalWorkDimAttr equals to 0.
3787
3760
if (const auto *DeclAttr = D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>()) {
3788
3761
if (InvalidWorkGroupSizeAttrs (DeclAttr->getValue (), A.getXDim (),
3789
3762
A.getYDim (), A.getZDim ())) {
@@ -3800,15 +3773,6 @@ Sema::MergeReqdWorkGroupSizeAttr(Decl *D, const ReqdWorkGroupSizeAttr &A) {
3800
3773
//
3801
3774
// We emit diagnostic if values of 'reqd_work_group_size' attribute arguments
3802
3775
// are greater than values of 'max_work_group_size' attribute arguments.
3803
- //
3804
- // The arguments to reqd_work_group_size are ordered based on which index
3805
- // increments the fastest. In OpenCL, the first argument is the index that
3806
- // increments the fastest, and in SYCL, the last argument is the index that
3807
- // increments the fastest.
3808
- //
3809
- // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
3810
- // mode. All spellings of reqd_work_group_size attribute (regardless of
3811
- // syntax used) follow the SYCL rules when in SYCL mode.
3812
3776
if (const auto *DeclAttr = D->getAttr <SYCLIntelMaxWorkGroupSizeAttr>()) {
3813
3777
if (checkMaxAllowedWorkGroupSize (
3814
3778
*this , A.getXDim (), A.getYDim (), A.getZDim (), DeclAttr->getXDim (),
@@ -3824,15 +3788,6 @@ Sema::MergeReqdWorkGroupSizeAttr(Decl *D, const ReqdWorkGroupSizeAttr &A) {
3824
3788
// along with 'num_simd_work_items' attribute, the required work group size
3825
3789
// specified by 'num_simd_work_items' attribute must evenly divide the index
3826
3790
// that increments fastest in the 'reqd_work_group_size' attribute.
3827
- //
3828
- // The arguments to reqd_work_group_size are ordered based on which index
3829
- // increments the fastest. In OpenCL, the first argument is the index that
3830
- // increments the fastest, and in SYCL, the last argument is the index that
3831
- // increments the fastest.
3832
- //
3833
- // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
3834
- // mode. All spellings of reqd_work_group_size attribute
3835
- // (regardless of syntax used) follow the SYCL rules when in SYCL mode.
3836
3791
if (const auto *DeclAttr = D->getAttr <SYCLIntelNumSimdWorkItemsAttr>()) {
3837
3792
if (CheckWorkGroupSize (*this , DeclAttr->getValue (), A.getXDim (),
3838
3793
A.getZDim ())) {
@@ -4048,15 +4003,6 @@ void Sema::AddSYCLIntelNumSimdWorkItemsAttr(Decl *D,
4048
4003
// along with 'num_simd_work_items' attribute, the required work group size
4049
4004
// specified by 'num_simd_work_items' attribute must evenly divide the index
4050
4005
// that increments fastest in the 'reqd_work_group_size' attribute.
4051
- //
4052
- // The arguments to reqd_work_group_size are ordered based on which index
4053
- // increments the fastest. In OpenCL, the first argument is the index that
4054
- // increments the fastest, and in SYCL, the last argument is the index that
4055
- // increments the fastest.
4056
- //
4057
- // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
4058
- // mode. All spellings of reqd_work_group_size attribute
4059
- // (regardless of syntax used) follow the SYCL rules when in SYCL mode.
4060
4006
if (const auto *DeclAttr = D->getAttr <ReqdWorkGroupSizeAttr>()) {
4061
4007
if (CheckWorkGroupSize (*this , E, DeclAttr->getXDim (),
4062
4008
DeclAttr->getZDim ())) {
@@ -4092,15 +4038,6 @@ SYCLIntelNumSimdWorkItemsAttr *Sema::MergeSYCLIntelNumSimdWorkItemsAttr(
4092
4038
// along with 'num_simd_work_items' attribute, the required work group size
4093
4039
// specified by 'num_simd_work_items' attribute must evenly divide the index
4094
4040
// that increments fastest in the 'reqd_work_group_size' attribute.
4095
- //
4096
- // The arguments to reqd_work_group_size are ordered based on which index
4097
- // increments the fastest. In OpenCL, the first argument is the index that
4098
- // increments the fastest, and in SYCL, the last argument is the index that
4099
- // increments the fastest.
4100
- //
4101
- // __attribute__((reqd_work_group_size)) follows the OpenCL rules in OpenCL
4102
- // mode. All spellings of reqd_work_group_size attribute
4103
- // (regardless of syntax used) follow the SYCL rules when in SYCL mode.
4104
4041
if (const auto *DeclAttr = D->getAttr <ReqdWorkGroupSizeAttr>()) {
4105
4042
if (CheckWorkGroupSize (*this , A.getValue (), DeclAttr->getXDim (),
4106
4043
DeclAttr->getZDim ())) {
@@ -4344,9 +4281,9 @@ void Sema::AddSYCLIntelMaxGlobalWorkDimAttr(Decl *D,
4344
4281
}
4345
4282
4346
4283
// If the declaration has a SYCLIntelMaxWorkGroupSizeAttr or
4347
- // ReqdWorkGroupSizeAttr, check to see if they hold equal values
4348
- // (1, 1, 1) in case the value of SYCLIntelMaxGlobalWorkDimAttr
4349
- // equals to 0.
4284
+ // ReqdWorkGroupSizeAttr, check to see if the attribute holds values equal
4285
+ // to (1, 1, 1) in case the value of SYCLIntelMaxGlobalWorkDimAttr equals
4286
+ // to 0.
4350
4287
if (ArgVal == 0 ) {
4351
4288
if (checkWorkGroupSizeAttrExpr<SYCLIntelMaxWorkGroupSizeAttr>(*this , D,
4352
4289
CI) ||
@@ -4376,9 +4313,8 @@ SYCLIntelMaxGlobalWorkDimAttr *Sema::MergeSYCLIntelMaxGlobalWorkDimAttr(
4376
4313
}
4377
4314
4378
4315
// If the declaration has a SYCLIntelMaxWorkGroupSizeAttr or
4379
- // ReqdWorkGroupSizeAttr, check to see if they hold equal values
4380
- // (1, 1, 1) in case the value of SYCLIntelMaxGlobalWorkDimAttr
4381
- // equals to 0.
4316
+ // ReqdWorkGroupSizeAttr, check to see if the attribute holds values equal to
4317
+ // (1, 1, 1) in case the value of SYCLIntelMaxGlobalWorkDimAttr equals to 0.
4382
4318
const auto *MergeExpr = dyn_cast<ConstantExpr>(A.getValue ());
4383
4319
if (MergeExpr->getResultAsAPSInt () == 0 ) {
4384
4320
if (checkWorkGroupSizeAttrExpr<SYCLIntelMaxWorkGroupSizeAttr>(*this , D,
0 commit comments