https://github.com/danbrown-amd created https://github.com/llvm/llvm-project/pull/196004
Addresses #187188. >From 34438376a35e12e2d71891ef7e77b39ffbf506ec Mon Sep 17 00:00:00 2001 From: danbrown-amd <[email protected]> Date: Wed, 6 May 2026 00:18:37 -0600 Subject: [PATCH] Warns that WaveSize attribute is unsupported for the SPIR-V target. Addresses #187188. --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 4 ++++ clang/lib/Sema/SemaHLSL.cpp | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index e059260778631..e95d9ef58e9dd 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -13703,6 +13703,10 @@ def warn_attr_min_eq_max: Warning< def err_hlsl_attribute_number_arguments_insufficient_shader_model: Error< "attribute %0 with %1 arguments requires shader model %2 or greater">; +def warn_hlsl_wavesize_unsupported_spirv : Warning< + "attribute 'WaveSize' is not supported for the SPIR-V target; " + "consider using VK_EXT_subgroup_size_control">, + InGroup<HLSLAttributeStatement>; def err_hlsl_expect_arg_const_int_one_or_neg_one: Error< "argument %0 must be constant integer 1 or -1">; def err_invalid_hlsl_resource_type: Error< diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp index aba1c5072a5fc..a33e54d15ba2a 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -1000,7 +1000,9 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) { FD->setInvalidDecl(); } if (const auto *WS = FD->getAttr<HLSLWaveSizeAttr>()) { - if (Ver < VersionTuple(6, 6)) { + if (TargetInfo.getTriple().isSPIRV()) { + Diag(WS->getLocation(), diag::warn_hlsl_wavesize_unsupported_spirv); + } else if (Ver < VersionTuple(6, 6)) { Diag(WS->getLocation(), diag::err_hlsl_attribute_in_wrong_shader_model) << WS << "6.6"; FD->setInvalidDecl(); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
