@@ -2898,32 +2898,15 @@ static bool checkWorkGroupSizeValues(Sema &S, Decl *D, const ParsedAttr &Attr,
2898
2898
/* ReverseAttrs=*/ true );
2899
2899
2900
2900
if (const auto *A = D->getAttr <SYCLIntelMaxWorkGroupSizeAttr>()) {
2901
- if (S.getLangOpts ().SYCLIsDevice &&
2902
- !(WGSize[2 ] <= A->getXDim () && WGSize[1 ] <= A->getYDim () &&
2903
- WGSize[0 ] <= A->getZDim ())) {
2904
- S.Diag (Attr.getLoc (), diag::err_conflicting_sycl_function_attributes)
2905
- << Attr << A->getSpelling ();
2906
- Result &= false ;
2907
- }
2908
- if (!S.getLangOpts ().SYCLIsDevice &&
2909
- !(WGSize[0 ] <= A->getXDim () && WGSize[1 ] <= A->getYDim () &&
2901
+ if (!(WGSize[0 ] <= A->getXDim () && WGSize[1 ] <= A->getYDim () &&
2910
2902
WGSize[2 ] <= A->getZDim ())) {
2911
2903
S.Diag (Attr.getLoc (), diag::err_conflicting_sycl_function_attributes)
2912
2904
<< Attr << A->getSpelling ();
2913
2905
Result &= false ;
2914
2906
}
2915
2907
}
2916
2908
if (const auto *A = D->getAttr <ReqdWorkGroupSizeAttr>()) {
2917
-
2918
- if (S.getLangOpts ().SYCLIsDevice &&
2919
- !(WGSize[2 ] >= A->getXDim () && WGSize[1 ] >= A->getYDim () &&
2920
- WGSize[0 ] >= A->getZDim ())) {
2921
- S.Diag (Attr.getLoc (), diag::err_conflicting_sycl_function_attributes)
2922
- << Attr << A->getSpelling ();
2923
- Result &= false ;
2924
- }
2925
- if (!S.getLangOpts ().SYCLIsDevice &&
2926
- !(WGSize[0 ] >= A->getXDim () && WGSize[1 ] >= A->getYDim () &&
2909
+ if (!(WGSize[0 ] >= A->getXDim () && WGSize[1 ] >= A->getYDim () &&
2927
2910
WGSize[2 ] >= A->getZDim ())) {
2928
2911
S.Diag (Attr.getLoc (), diag::err_conflicting_sycl_function_attributes)
2929
2912
<< Attr << A->getSpelling ();
@@ -2940,13 +2923,9 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
2940
2923
return ;
2941
2924
2942
2925
uint32_t WGSize[3 ];
2943
- if (const auto *A = D->getAttr <SYCLIntelReqdWorkGroupSizeAttr>()){
2944
- WGSize[1 ] = SYCLIntelReqdWorkGroupSizeAttr::DefaultYDim;
2945
- WGSize[2 ] = SYCLIntelReqdWorkGroupSizeAttr::DefaultZDim;
2946
- }
2947
2926
for (unsigned i = 0 ; i < 3 ; ++i) {
2948
2927
const Expr *E = AL.getArgAsExpr (i);
2949
- if (i < AL. getNumArgs () && !checkUInt32Argument (S, AL, E, WGSize[i], i,
2928
+ if (!checkUInt32Argument (S, AL, E, WGSize[i], i,
2950
2929
/* StrictlyUnsigned=*/ true ))
2951
2930
return ;
2952
2931
if (WGSize[i] == 0 ) {
@@ -2956,25 +2935,20 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
2956
2935
}
2957
2936
}
2958
2937
2938
+ // For a SYCLDevice WorkGroupAttr arguments are reversed
2939
+ if (S.getLangOpts ().SYCLIsDevice ) {
2940
+ std::swap (WGSize[0 ], WGSize[2 ]);
2941
+ }
2959
2942
WorkGroupAttr *Existing = D->getAttr <WorkGroupAttr>();
2960
- if (S.getLangOpts ().SYCLIsDevice && Existing &&
2961
- !(Existing->getXDim () == WGSize[2 ] && Existing->getYDim () == WGSize[1 ] &&
2962
- Existing->getZDim () == WGSize[0 ]))
2963
- S.Diag (AL.getLoc (), diag::warn_duplicate_attribute) << AL;
2964
- if (!S.getLangOpts ().SYCLIsDevice && Existing &&
2943
+ if (Existing &&
2965
2944
!(Existing->getXDim () == WGSize[0 ] && Existing->getYDim () == WGSize[1 ] &&
2966
2945
Existing->getZDim () == WGSize[2 ]))
2967
2946
S.Diag (AL.getLoc (), diag::warn_duplicate_attribute) << AL;
2968
-
2969
2947
if (!checkWorkGroupSizeValues (S, D, AL, WGSize))
2970
2948
return ;
2971
2949
2972
- if (S.getLangOpts ().SYCLIsDevice )
2973
- D->addAttr (::new (S.Context ) WorkGroupAttr (S.Context , AL, WGSize[2 ],
2974
- WGSize[1 ], WGSize[0 ]));
2975
- else
2976
- D->addAttr (::new (S.Context ) WorkGroupAttr (S.Context , AL, WGSize[0 ],
2977
- WGSize[1 ], WGSize[2 ]));
2950
+ D->addAttr (::new (S.Context )
2951
+ WorkGroupAttr (S.Context , AL, WGSize[0 ], WGSize[1 ], WGSize[2 ]));
2978
2952
}
2979
2953
2980
2954
// Handles intel_reqd_sub_group_size.
0 commit comments