[clang] [HLSL] Use HLSLToolChain for Vulkan (PR #110306)

2024-09-27 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/110306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-19 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/106146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-19 Thread Xiang Li via cfe-commits
@@ -19,20 +19,20 @@ using namespace llvm; static bool finalizeLinkage(Module &M) { - SmallPtrSet EntriesAndExports; + SmallPtrSet Funcs; // Find all entry points and export functions for (Function &EF : M.functions()) { -if (!EF.hasFnAttribute("hlsl.shader") && !

[clang] [HLSL] generate hlsl.wavesize attribute (PR #107176)

2024-09-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae closed https://github.com/llvm/llvm-project/pull/107176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] generate hlsl.wavesize attribute (PR #107176)

2024-09-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/107176 >From 6de0eb900e845e6ac7918433c597bf3665b93741 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 3 Sep 2024 22:56:21 -0400 Subject: [PATCH 1/2] [HLSL] generate hlsl.wavesize attribute Generate function att

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/106782 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] update StructuredBuffer subscript test for alwaysinline (PR #109023)

2024-09-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/109023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Update resource attribute tests (PR #108919)

2024-09-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/108919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Update resource attribute tests (PR #108919)

2024-09-17 Thread Xiang Li via cfe-commits
@@ -1,16 +1,25 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s // CHECK: CXXRecordDecl 0x{{[0-9a-f]+}} {{.*}} struct MyBuffer definition -// CHECK: FieldDecl 0x{{[0-9a-f]+}} col:68 h '__hlsl_resource_t {{\[\[}}hlsl::reso

[clang] [HLSL][NFC] Remove RegisterBindingFlags struct (PR #108924)

2024-09-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/108924 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implementing `asfloat` using `bit_cast` (PR #108686)

2024-09-16 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/108686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-16 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. Why the name is contained_type instead of element_type? https://github.com/llvm/llvm-project/pull/108456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Xiang Li via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Xiang Li via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add HLSL 202y language mode (PR #108437)

2024-09-12 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/108437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add HLSL 202y language mode (PR #108437)

2024-09-12 Thread Xiang Li via cfe-commits
@@ -12397,6 +12397,9 @@ 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 ext_hlsl_auto_type_specifier : ExtWarn< python3k

[clang] Update StructuredBuffer-AST test after removal of HLSLResourceClassAttr (PR #108292)

2024-09-11 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/108292 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] generate hlsl.wavesize attribute (PR #107176)

2024-09-11 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/107176 >From 3b4ba1436220d6eef11bce713618aefb272ea74f Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 3 Sep 2024 22:56:21 -0400 Subject: [PATCH 1/2] [HLSL] generate hlsl.wavesize attribute Generate function att

[clang] [llvm] [clang][hlsl] Add atan2 intrinsic part 1 (PR #107923)

2024-09-11 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/107923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Xiang Li via cfe-commits
python3kgae wrote: > > > This pull request is missing the appropriate text in 'ReleaseNotes.rst'. > > > I am looking for advice on what is appropriate to put in that file, and > > > where. > > > > > > Here's a PR with ReleaseNotes.rst change > > [57f879c#diff-ec770381d76c859f5f572db789175fe4

[clang] [llvm] [HLSL] Implement elementwise popcount (PR #108121)

2024-09-11 Thread Xiang Li via cfe-commits
python3kgae wrote: > This pull request is missing the appropriate text in 'ReleaseNotes.rst'. I am > looking for advice on what is appropriate to put in that file, and where. Here's a PR with ReleaseNotes.rst change https://github.com/llvm/llvm-project/commit/57f879cdd4c63189c569bdc1ce4e87e734

[clang] [HLSL] Add `[[hlsl::row_access]]` attribute (PR #107954)

2024-09-10 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/107954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Warn on duplicate is_rov attribute; remove unnecessary parentheses (PR #107973)

2024-09-10 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/107973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)

2024-09-05 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/106588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add step builtins and step HLSL function to DirectX and SPIR-V backend (PR #106471)

2024-09-04 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/106471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] generate hlsl.wavesize attribute (PR #107176)

2024-09-03 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/107176 Generate function attribute hlsl.wavesize from [WaveSize]. For #70118 >From 3b4ba1436220d6eef11bce713618aefb272ea74f Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 3 Sep 2024 22:56:21 -0400 Subject: [P

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-31 Thread Xiang Li via cfe-commits
https://github.com/python3kgae closed https://github.com/llvm/llvm-project/pull/101240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-31 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From 65b4ab94bc533c8dee9733761947671a4d326e90 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/7] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From 65b4ab94bc533c8dee9733761947671a4d326e90 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/7] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
@@ -153,6 +154,25 @@ HLSLNumThreadsAttr *SemaHLSL::mergeNumThreadsAttr(Decl *D, HLSLNumThreadsAttr(getASTContext(), AL, X, Y, Z); } +HLSLWaveSizeAttr *SemaHLSL::mergeWaveSizeAttr(Decl *D, + const AttributeCommonInfo &AL, +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
@@ -357,6 +398,74 @@ void SemaHLSL::handleNumThreadsAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +static bool isValidWaveSizeValue(unsigned Value) { + return (Value >= 4 && Value <= 128 && ((Value & (Value - 1)) == 0)); python3kgae wrote:

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-pixel -x hlsl %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-vertex -x hlsl %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-geometry -x hlsl %s -verify +// RUN: %clang_cc1 -triple d

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From 65b4ab94bc533c8dee9733761947671a4d326e90 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/7] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From 65b4ab94bc533c8dee9733761947671a4d326e90 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/6] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From 65b4ab94bc533c8dee9733761947671a4d326e90 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/5] [HLSL] AST support for WaveSize attribute. First step for su

[clang] Create Texture Dimension attribute in HLSL (PR #104239)

2024-08-21 Thread Xiang Li via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLTextureDimensionAttr 0x{{[0-9a-f]+}} 1 +struct [[hlsl::texture_dimension(1)]] Eg1 { python3kgae wrote: Should we limit this a

[clang] [DirectX] Add DirectXTargetCodeGenInfo (PR #104856)

2024-08-20 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/104856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DirectX] Add DirectXTargetCodeGenInfo (PR #104856)

2024-08-19 Thread Xiang Li via cfe-commits
@@ -0,0 +1,60 @@ +//===- DirectX.cpp +//---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier

[clang] [HLSL] update default validator version to 1.8. (PR #104040)

2024-08-15 Thread Xiang Li via cfe-commits
https://github.com/python3kgae closed https://github.com/llvm/llvm-project/pull/104040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] update default validator version to 1.8. (PR #104040)

2024-08-15 Thread Xiang Li via cfe-commits
python3kgae wrote: > > > How does this relate to #102963? > > > > > > It will make default 1.8 so default case will work. But we still need to > > have a plan for what to do with -validator-version. > > Chatting with @bharadwajy, it sounds like this PR should also fix #102963. Added Fixes fo

[clang] [HLSL] update default validator version to 1.8. (PR #104040)

2024-08-15 Thread Xiang Li via cfe-commits
https://github.com/python3kgae edited https://github.com/llvm/llvm-project/pull/104040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] update default validator version to 1.8. (PR #104040)

2024-08-15 Thread Xiang Li via cfe-commits
python3kgae wrote: > How does this relate to #102963? It will make default 1.8 so default case will work. But we still need to have a plan for what to do with -validator-version. https://github.com/llvm/llvm-project/pull/104040 ___ cfe-commits mailing

[clang] [HLSL] update default validator version to 1.8. (PR #104040)

2024-08-14 Thread Xiang Li via cfe-commits
@@ -283,14 +283,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, DAL->append(A); } - // Add default validator version if not set. python3kgae wrote: The default value in Options.td will take care. https://github.com/

[clang] [HLSL] update default validator version to 1.8. (PR #104040)

2024-08-14 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/104040 Change default validator version to 1.8 in Options.td. Remove the default value set in HLSL.cpp. This is for #99910. >From 56511b7d2d565bbf974b665491cee47c0be9a2bc Mon Sep 17 00:00:00 2001 From: Xiang Li

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-07 Thread Xiang Li via cfe-commits
@@ -144,6 +145,25 @@ HLSLNumThreadsAttr *SemaHLSL::mergeNumThreadsAttr(Decl *D, HLSLNumThreadsAttr(getASTContext(), AL, X, Y, Z); } +HLSLWaveSizeAttr *SemaHLSL::mergeWaveSizeAttr(Decl *D, + const AttributeCommonInfo &AL, +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-07 Thread Xiang Li via cfe-commits
@@ -2862,6 +2862,10 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D, else if (const auto *NT = dyn_cast(Attr)) NewAttr = S.HLSL().mergeNumThreadsAttr(D, *NT, NT->getX(), NT->getY(), NT->getZ()); + else if (const auto *NT

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-07 Thread Xiang Li via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-library -x hlsl -ast-dump -o - %s | FileCheck %s + +// CHECK-LABLE:FunctionDecl 0x{{[0-9a-f]+}} <{{.*}}> w0 'void ()' +// CHECK:HLSLWaveSizeAttr 0x{{[0-9a-f]+}} <{{.*}}> 128 0 0 + [numthreads(8,8,1)] + [WaveSize(

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-07 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From c7a476a4d8b06e399e9c076cc15208871e1b5a25 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/5] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] Add list of exported functions as named metadata node `dx.exports` (PR #102275)

2024-08-07 Thread Xiang Li via cfe-commits
python3kgae wrote: > > Could this be an analysis pass which collect the list as a > > SmallVector instead of creating the list in 'dx.exports' > > metadata? > > You mean the DXILFinalizeLinkage pass (coming soon) that needs a list of > entries and exported functions should get the information

[clang] [llvm] [HLSL] Add list of exported functions as named metadata node `dx.exports` (PR #102275)

2024-08-07 Thread Xiang Li via cfe-commits
python3kgae wrote: Could this be an analysis pass which collect the list as a SmallVector instead of creating the list in 'dx.exports' metadata? https://github.com/llvm/llvm-project/pull/102275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [HLSL] Change default linkage of HLSL functions and groupshared variables (v2) (PR #95331)

2024-08-02 Thread Xiang Li via cfe-commits
@@ -664,11 +664,25 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D, if (PrevVar->getStorageClass() == SC_Static) return LinkageInfo::internal(); } + +if (Context.getLangOpts().HLSL && +Var->hasAttr()) + return LinkageInfo::i

[clang] [HLSL] Change default linkage of HLSL functions and groupshared variables (v2) (PR #95331)

2024-08-02 Thread Xiang Li via cfe-commits
@@ -1223,9 +1223,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, if (getLangOpts().OpenMP && CurCodeDecl) CGM.getOpenMPRuntime().emitFunctionProlog(*this, CurCodeDecl); - // Handle emitting HLSL entry functions. - if (D && D->hasAttr()) -C

[clang] [HLSL] Change default linkage of HLSL functions and groupshared variables (v2) (PR #95331)

2024-08-02 Thread Xiang Li via cfe-commits
@@ -664,11 +664,25 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D, if (PrevVar->getStorageClass() == SC_Static) return LinkageInfo::internal(); } + +if (Context.getLangOpts().HLSL && +Var->hasAttr()) + return LinkageInfo::i

[clang] [HLSL] Change default linkage of HLSL functions and groupshared variables (v2) (PR #95331)

2024-08-01 Thread Xiang Li via cfe-commits
@@ -967,6 +967,10 @@ static void checkUndefinedButUsed(Sema &S) { Func->getIdentifier()->isMangledOpenMPVariantName(); } } + // Do not warn on undefined internal functions in HLSL, they will get python3kgae wrote:

[clang] [lldb] [HLSL] Implement intangible AST type (PR #97362)

2024-07-31 Thread Xiang Li via cfe-commits
@@ -1390,7 +1390,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, #include "clang/Basic/HLSLIntangibleTypes.def" } - if (Target.hasAArch64SVETypes()) { + if (Target.hasAArch64SVETypes() || python3kgae wrote: Is this expected change for in

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-31 Thread Xiang Li via cfe-commits
@@ -245,6 +274,18 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) { << llvm::Triple::getEnvironmentTypeName(ST); FD->setInvalidDecl(); } +if (const auto *NT = FD->getAttr()) { python3kgae wrote: Renamed. https://github.com/llvm/llv

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-31 Thread Xiang Li via cfe-commits
@@ -245,6 +274,18 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) { << llvm::Triple::getEnvironmentTypeName(ST); FD->setInvalidDecl(); } +if (const auto *NT = FD->getAttr()) { + if (Ver < VersionTuple(6, 6)) { +Diag(NT->getLocation(), di

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-31 Thread Xiang Li via cfe-commits
@@ -12361,6 +12361,21 @@ def warn_hlsl_availability_unavailable : def err_hlsl_export_not_on_function : Error< "export declaration can only be used on functions">; +def err_hlsl_attribute_in_wrong_shader_model: Error< + "attribute %0 requires shader model %1 or greater">; +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Xiang Li via cfe-commits
@@ -245,6 +274,20 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) { << llvm::Triple::getEnvironmentTypeName(ST); FD->setInvalidDecl(); } +if (const auto *NT = FD->getAttr()) { + if (Ver.getMajor() < 6u || + (Ver.getMajor() == 6u && Ver.

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From c7a476a4d8b06e399e9c076cc15208871e1b5a25 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/3] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Xiang Li via cfe-commits
@@ -348,6 +391,77 @@ void SemaHLSL::handleNumThreadsAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleWaveSizeAttr(Decl *D, const ParsedAttr &AL) { + // validate that the wavesize argument is a power of 2 between 4 and 128 + // inclusive

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/101240 >From c7a476a4d8b06e399e9c076cc15208871e1b5a25 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 30 Jul 2024 16:34:40 -0400 Subject: [PATCH 1/2] [HLSL] AST support for WaveSize attribute. First step for su

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/101240 First step for support WaveSize attribute in https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html and https://microsoft.github.io/hlsl-specs/proposals/0013-wave-size-range.html A new attr

[clang] [HLSL][NFC] Initialize DiagnoseHLSLAvailability members (PR #100778)

2024-07-27 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/100778 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Initialize DiagnoseHLSLAvailability members (PR #100778)

2024-07-26 Thread Xiang Li via cfe-commits
@@ -650,7 +650,10 @@ class DiagnoseHLSLAvailability bool HasMatchingEnvironmentOrNone(const AvailabilityAttr *AA); public: - DiagnoseHLSLAvailability(Sema &SemaRef) : SemaRef(SemaRef) {} + DiagnoseHLSLAvailability(Sema &SemaRef) + : SemaRef(SemaRef), +CurrentS

[clang] [Doc][HLSL] Add documentation for root signature (PR #88781)

2024-07-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/88781 >From 4da15566a6dbe3f7fec1e09ec1bd5ea681a7bab5 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 15 Apr 2024 12:23:46 -0700 Subject: [PATCH 1/5] [Doc][HLSL] Add documentation for root signature This patch a

[clang] [Doc][HLSL] Add documentation for root signature (PR #88781)

2024-07-17 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/88781 >From 0065f8eade1fc00bce560ceeba9431a4616615b9 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 15 Apr 2024 12:23:46 -0700 Subject: [PATCH 1/5] [Doc][HLSL] Add documentation for root signature This patch a

[clang] [Doc][HLSL] Add documentation for root signature (PR #88781)

2024-07-17 Thread Xiang Li via cfe-commits
@@ -0,0 +1,292 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bou

[clang] [Doc][HLSL] Add documentation for root signature (PR #88781)

2024-07-17 Thread Xiang Li via cfe-commits
@@ -0,0 +1,292 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bou

[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-07-16 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/97103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-07-16 Thread Xiang Li via cfe-commits
@@ -459,7 +467,475 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc)); } -void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) { +struct RegisterBindingFlags {

[clang] [HLSL] Remove hlsl::Resource (PR #98938)

2024-07-15 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/98938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-07-12 Thread Xiang Li via cfe-commits
@@ -1,9 +1,10 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify -// expected-error@+1 {{invalid resource class specifier 'c' used; expected 'b', 's', 't', or 'u'}} -float a : register(c0, space1); +// valid, The register keywor

[clang] [HLSL] Set default DwarfVersion to 4 for HLSL. (PR #97854)

2024-07-10 Thread Xiang Li via cfe-commits
https://github.com/python3kgae closed https://github.com/llvm/llvm-project/pull/97854 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-07-10 Thread Xiang Li via cfe-commits
https://github.com/python3kgae edited https://github.com/llvm/llvm-project/pull/97103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Set default DwarfVersion to 4 for HLSL. (PR #97854)

2024-07-05 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/97854 Set default DwarfVersion to 4 for HLSL to match DXIL which does not support DwarfVersion 5. Based on https://registry.khronos.org/SPIR-V/specs/unified1/DebugInfo.html SPIRV is currently using Dwarf4 as well

[clang] [lldb] [HLSL] Implement intangible AST type (PR #97362)

2024-07-03 Thread Xiang Li via cfe-commits
@@ -757,7 +757,8 @@ void USRGenerator::VisitType(QualType T) { case BuiltinType::OCLReserveID: Out << "@BT@OCLReserveID"; break; case BuiltinType::OCLSampler: - Out << "@BT@OCLSampler"; break; + Out << "@BT@OCLSampler"; + bre

[clang] [lldb] [HLSL] Implement intangible AST type (PR #97362)

2024-07-03 Thread Xiang Li via cfe-commits
@@ -2241,6 +2247,11 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { Align = ALIGN; \ break; #include "clang/Basic/AMDGPUTypes.def" +#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case Buil

[clang] [HLSL] Run availability diagnostic on exported functions (PR #97352)

2024-07-02 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/97352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add test for export function redeclaration (PR #97370)

2024-07-02 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/97370 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Run availability diagnostic on exported functions (PR #97352)

2024-07-01 Thread Xiang Li via cfe-commits
@@ -129,6 +129,55 @@ class MyClass } }; +// Exported function without body - not used +export void exportedFunctionUnused(float f); python3kgae wrote: Will there be an error if has export when declare like ``` export void export_mismatch(float f); ``` But w

[clang] [HLSL][clang][Driver] Fix error when using the option -fcgl in --driver-mode=dxc. (PR #97001)

2024-07-01 Thread Xiang Li via cfe-commits
https://github.com/python3kgae closed https://github.com/llvm/llvm-project/pull/97001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][clang][Driver] Fix error when using the option -fcgl in --driver-mode=dxc. (PR #97001)

2024-07-01 Thread Xiang Li via cfe-commits
https://github.com/python3kgae edited https://github.com/llvm/llvm-project/pull/97001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-29 Thread Xiang Li via cfe-commits
@@ -21,6 +21,7 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceLocation.h" #include "clang/Sema/Scope.h" +#include "clang/Sema/Sema.h" python3kgae wrote: If only SemaHLSL.cpp needs the header, could we move the include to SemaHLSL.cpp?

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-29 Thread Xiang Li via cfe-commits
@@ -437,7 +460,206 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +struct register_binding_flags { + bool resource = false; + bool udt = false; + bool other = false; + bool basic = false; + + bool srv = false; + bool uav =

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-28 Thread Xiang Li via cfe-commits
@@ -21,6 +21,7 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceLocation.h" #include "clang/Sema/Scope.h" +#include "clang/Sema/Sema.h" python3kgae wrote: What led us to include Sema.h? https://github.com/llvm/llvm-project/pull/97103 __

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-28 Thread Xiang Li via cfe-commits
@@ -437,7 +460,206 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +struct register_binding_flags { + bool resource = false; + bool udt = false; + bool other = false; + bool basic = false; + + bool srv = false; + bool uav =

[clang] [HLSL][clang][Driver] Fix error when using the option -fcgl in --driver-mode=dxc. (PR #97001)

2024-06-27 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/97001 When -fcgl is set in --driver-mode=dxc, both -S and -emit-llvm are currently enabled. This results in the following error: ``` error: '-S' action ignored; '-emit-llvm' action specified previously. ``` Thi

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Xiang Li via cfe-commits
@@ -1,11 +1,24 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -ast-dump -x hlsl -o - %s | Filecheck %s -// expected-no-diagnostics struct MyBitFields { -unsigned int field1

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Xiang Li via cfe-commits
@@ -1,10 +1,13 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s -// TODO: update once we handle annotations on struct fields +// tests that

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-24 Thread Xiang Li via cfe-commits
https://github.com/python3kgae approved this pull request. https://github.com/llvm/llvm-project/pull/96346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-21 Thread Xiang Li via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify python3kgae wrote: Could we add another test which compiles successfully and check the AST? https://github.com/llvm/llvm-project/pull/96346 _

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
python3kgae wrote: > > This PR will not change this. The padding will only be added when required. > > _That's the problem_ > > > ```hlsl > > cbuffer { > > float F; > > float2 V; > > } > > ``` > > > > > > > > > > > > > > > > > > > > > > > > will stil

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
python3kgae wrote: > > You can use `type <{ float, <2 x float>}>` if you need the tightly-packed > > layout. > > I think we need to figure out how we're going to lower this too. Loading from > this memory space requires loading 128 bytes at a time, and we need to slice > it down to just the p

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
https://github.com/python3kgae edited https://github.com/llvm/llvm-project/pull/91999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
https://github.com/python3kgae edited https://github.com/llvm/llvm-project/pull/91999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
python3kgae wrote: > > Could you explain more about can't put any vectors or matrices into the > > cbuffer structure type? > > Consider this example (regardless of packoffset): > > ```hlsl > cbuffer { > float F; > float2 V; > } > ``` > > The layout for this is basically: > > ```c > struc

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
@@ -5671,6 +5671,54 @@ HLSLBufferDecl *HLSLBufferDecl::CreateDeserialized(ASTContext &C, SourceLocation(), SourceLocation()); } +static uint64_t calculateLegacyCbufferAlign(const ASTContext &Context, +

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-16 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/91999 >From de2b6cab831ac07bf6adcfe563fd9d866e295071 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 13 May 2024 12:59:48 -0400 Subject: [PATCH 1/2] [HLSL] support packoffset in clang codeGen Implement packoffs

[clang] [HLSL] support packoffset in clang codeGen (PR #91999)

2024-05-15 Thread Xiang Li via cfe-commits
python3kgae wrote: > I'm a little concerned about the strategy here. LLVM generally doesn't > explicitly capture padding it relies on the data layout rules to capture that. > > If this is the approach we're going with you can't put any vectors or > matrices into the cbuffer structure type and

  1   2   3   4   >