@@ -2925,10 +2925,13 @@ static bool checkWorkGroupSizeValues(Sema &S, Decl *D, const ParsedAttr &Attr,
29252925 return Result;
29262926 }
29272927
2928- if (const auto *A = D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>())
2929- if (A->getNumber () == 0 )
2928+ if (const auto *A = D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>()) {
2929+ int64_t AttrValue =
2930+ A->getValue ()->getIntegerConstantExpr (S.Context )->getSExtValue ();
2931+ if (AttrValue == 0 )
29302932 Result &= checkZeroDim (A, WGSize[0 ], WGSize[1 ], WGSize[2 ],
29312933 /* ReverseAttrs=*/ true );
2934+ }
29322935
29332936 if (const auto *A = D->getAttr <SYCLIntelMaxWorkGroupSizeAttr>()) {
29342937 if (!(WGSize[0 ] <= A->getXDim () && WGSize[1 ] <= A->getYDim () &&
@@ -3087,34 +3090,23 @@ static void handleMaxGlobalWorkDimAttr(Sema &S, Decl *D,
30873090 if (D->isInvalidDecl ())
30883091 return ;
30893092
3090- uint32_t MaxGlobalWorkDim;
3091- const Expr *E = Attr.getArgAsExpr (0 );
3092- if (!checkUInt32Argument (S, Attr, E, MaxGlobalWorkDim, 0 ,
3093- /* StrictlyUnsigned=*/ true ))
3094- return ;
3093+ Expr *E = Attr.getArgAsExpr (0 );
30953094
3096- if (MaxGlobalWorkDim > 3 ) {
3097- S. Diag (Attr. getLoc (), diag::err_intel_attribute_argument_is_not_in_range)
3098- << Attr ;
3095+ uint32_t WGSize[ 3 ] = { 1 , 1 , 1 };
3096+ if (! checkWorkGroupSizeValues (S, D, Attr, WGSize)) {
3097+ D-> setInvalidDecl () ;
30993098 return ;
31003099 }
31013100
3102- if (MaxGlobalWorkDim == 0 ) {
3103- uint32_t WGSize[3 ] = {1 , 1 , 1 };
3104- if (!checkWorkGroupSizeValues (S, D, Attr, WGSize)) {
3105- D->setInvalidDecl ();
3106- return ;
3107- }
3108- }
31093101 if (D->getAttr <SYCLIntelMaxGlobalWorkDimAttr>())
31103102 S.Diag (Attr.getLoc (), diag::warn_duplicate_attribute) << Attr;
31113103
31123104 if (checkDeprecatedSYCLAttributeSpelling (S, Attr))
31133105 S.Diag (Attr.getLoc (), diag::note_spelling_suggestion)
31143106 << " 'intel::max_global_work_dim'" ;
31153107
3116- D-> addAttr (:: new (S. Context ) SYCLIntelMaxGlobalWorkDimAttr (
3117- S. Context , Attr, MaxGlobalWorkDim) );
3108+ S. addIntelSYCLSingleArgFunctionAttr < SYCLIntelMaxGlobalWorkDimAttr>(D, Attr,
3109+ E );
31183110}
31193111
31203112static void handleVecTypeHint (Sema &S, Decl *D, const ParsedAttr &AL) {
0 commit comments