llvm / llvm/llvm-project

Clean up AMDGPU kernel attribute spelling and diagnostics

Open
#211,451 2 comments 0 reactions 1 assignee Claimed by @yxsamliu View on GitHub
backend:AMDGPU clang:diagnostics clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

AMDGPU kernel attributes have some common cleanup work.

Today these attributes generally follow the existing AMDGPU pattern:

- GNU spelling works in C and C++.
- `[[clang::...]]` spelling works in C++, but not in C23.
- The attributes are accepted on non-AMDGPU targets and then ignored.
- Some kernel-only checks are handled in a manual Sema chain.

This is confusing because the GNU spelling already gives the attributes C semantics, so the C23 `[[clang::...]]` spelling should probably work too. Also, Clang generally diagnoses ignored attributes when an attribute has no effect.

This issue tracks follow-up cleanup for AMDGPU kernel attributes:

- Support C23 `[[clang::...]]` spelling where the GNU spelling already works in C.
- Diagnose AMDGPU-only attributes as ignored when used on targets where they have no effect.
- If feasible, move the repeated kernel-only AMDGPU attribute checks out of the manual Sema chain into a shared mechanism.

This was discussed in review for #211059.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.