[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 14:53:25 PST 2024
================
@@ -784,6 +785,17 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) {
HLSLSV_DispatchThreadIDAttr(getASTContext(), AL));
}
+void SemaHLSL::handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL) {
+ auto *VD = cast<ValueDecl>(D);
+ if (!isLegalTypeForHLSLSV_ThreadOrGroupID(VD->getType())) {
+ Diag(AL.getLoc(), diag::err_hlsl_attr_invalid_type)
+ << AL << "uint/uint2/uint3";
----------------
llvm-beanz wrote:
There are 4 that have the same validation requirement:
* SV_DispatchThreadID
* SV_GroupThreadID
* SV_GroupID
* SV_DispatchGrid
All of them except the last one have `ID` in the name, which is why I suggested that naming. I think having the name of th method be too specific will be misleading as we extend to support additional semantics.
I also think this pattern of 3-element vectors for IDs/indices is super common, so we may do more of this in the future.
https://github.com/llvm/llvm-project/pull/115911
More information about the cfe-commits
mailing list