Skip to content

Commit 6fcb77d

Browse files
[SYCL][clang] Clarify warning message for potential property conflicts (#20572)
The compiler currently warns when properties are used in conjunction with SYCL 2020 properties, warning about potentially ignored conflicting properties. This commit makes the warning messages a little clearer to help users understand what particular properties may be of concern. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 530e546 commit 6fcb77d

File tree

4 files changed

+78
-72
lines changed

4 files changed

+78
-72
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13425,8 +13425,9 @@ def err_sycl_add_ir_attribute_invalid_filter : Error<
1342513425
"initializer list in the first argument of %0 must contain only string "
1342613426
"literals">;
1342713427
def warn_sycl_old_and_new_kernel_attributes : Warning<
13428-
"kernel has both attribute %0 and kernel properties; conflicting properties "
13429-
"are ignored">, InGroup<IgnoredAttributes>;
13428+
"kernel has both attribute %0 and kernel properties; if the kernel "
13429+
"properties contains the property \"%1\" it will be ignored">,
13430+
InGroup<IgnoredAttributes>;
1343013431
def err_attribute_argument_is_not_valid : Error<
1343113432
"%0 attribute requires integer constant value 0 or 1">;
1343213433

clang/lib/Sema/SemaSYCLDeclAttr.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,14 +3256,19 @@ void SemaSYCL::checkSYCLAddIRAttributesFunctionAttrConflicts(Decl *D) {
32563256
}
32573257

32583258
// If there are potentially conflicting attributes, we issue a warning.
3259-
for (const auto *Attr : std::vector<AttributeCommonInfo *>{
3260-
D->getAttr<SYCLReqdWorkGroupSizeAttr>(),
3261-
D->getAttr<IntelReqdSubGroupSizeAttr>(),
3262-
D->getAttr<SYCLWorkGroupSizeHintAttr>(),
3263-
D->getAttr<SYCLDeviceHasAttr>()})
3259+
for (const auto [Attr, PotentialConflictProp] :
3260+
std::vector<std::pair<AttributeCommonInfo *, StringRef>>{
3261+
{D->getAttr<SYCLReqdWorkGroupSizeAttr>(),
3262+
"sycl::ext::oneapi::experimental::work_group_size"},
3263+
{D->getAttr<IntelReqdSubGroupSizeAttr>(),
3264+
"sycl::ext::oneapi::experimental::sub_group_size"},
3265+
{D->getAttr<SYCLWorkGroupSizeHintAttr>(),
3266+
"sycl::ext::oneapi::experimental::work_group_size_hint"},
3267+
{D->getAttr<SYCLDeviceHasAttr>(),
3268+
"sycl::ext::oneapi::experimental::device_has"}})
32643269
if (Attr)
32653270
Diag(Attr->getLoc(), diag::warn_sycl_old_and_new_kernel_attributes)
3266-
<< Attr;
3271+
<< Attr << PotentialConflictProp;
32673272
}
32683273

32693274
void SemaSYCL::handleSYCLRegisteredKernels(Decl *D, const ParsedAttr &A) {

0 commit comments

Comments
 (0)