[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] [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
@@ -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/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
@@ -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-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-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
@@ -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] [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] 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] 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] [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] [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
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] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-23 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/89836 Add HLSLPackOffsetAttr to save packoffset in AST. Since we have to parse the attribute manually in ParseHLSLAnnotations, we could create the ParsedAttribute with a integer offset parameter instead of string.

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-24 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/2] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-24 Thread Xiang Li via cfe-commits
@@ -12154,6 +12154,8 @@ def err_hlsl_missing_semantic_annotation : Error< def err_hlsl_init_priority_unsupported : Error< "initializer priorities are not supported in HLSL">; +def err_hlsl_mismatching_register_resource_type_and_name: Error<"invalid register name prefix '%0'

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-24 Thread Xiang Li via cfe-commits
@@ -25,6 +25,7 @@ enum class ResourceClass : uint8_t { SRV = 0, UAV, CBuffer, + TBuffer, python3kgae wrote: TBuffer should be a resource kind, not resource class. https://github.com/llvm/llvm-project/pull/87578 _

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-25 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/3] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-26 Thread Xiang Li via cfe-commits
@@ -1016,7 +1016,34 @@ static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) { .Case("visionos_app_extension", "xros_app_extension") .Case("ShaderModel", "shadermodel") .Default(Platform); -} }]; +} +static llvm::Strin

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-26 Thread Xiang Li via cfe-commits
@@ -2,39 +2,45 @@ // Supported targets // -// RUN: %clang -target dxil--shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-VALID %s -// RUN: %clang -target dxil-unknown-shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-V

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

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

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-29 Thread Xiang Li via cfe-commits
@@ -44,7 +44,7 @@ void foo2() { // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}} extern RWBuffer U2 : register(u5); } -// FIXME: expect-error once fix https://github.com/llvm/llvm-project/issues/57886. +// expec

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-29 Thread Xiang Li via cfe-commits
@@ -44,7 +44,7 @@ void foo2() { // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}} extern RWBuffer U2 : register(u5); } -// FIXME: expect-error once fix https://github.com/llvm/llvm-project/issues/57886. +// expec

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-29 Thread Xiang Li via cfe-commits
@@ -44,7 +44,7 @@ void foo2() { // expected-warning@+1 {{'register' attribute only applies to cbuffer/tbuffer and external global variables}} extern RWBuffer U2 : register(u5); } -// FIXME: expect-error once fix https://github.com/llvm/llvm-project/issues/57886. +// expec

[clang] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Xiang Li via cfe-commits
@@ -0,0 +1,799 @@ +== +DXIL Resource Handling +== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +Resources in DXIL are represented via ``TargetExtType`` in LLVM IR and +eventually lowered by the Di

[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] [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/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
@@ -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
@@ -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
@@ -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-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] 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-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-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] 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] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Xiang Li via cfe-commits
@@ -0,0 +1,794 @@ +== +DXIL Resource Handling +== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +Resources in DXIL are represented via ``TargetExtType`` in LLVM IR and +eventually lowered by the Di

[clang] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -0,0 +1,799 @@ +== +DXIL Resource Handling +== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +Resources in DXIL are represented via ``TargetExtType`` in LLVM IR and +eventually lowered by the Di

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/4] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -ast-dump -x hlsl %s | FileCheck %s + + +// CHECK: HLSLBufferDecl {{.*}} cbuffer A +cbuffer A +{ +// CHECK-NEXT: VarDecl {{.*}} C1 'float4' python3k

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -verify %s + +// expected-error@+1{{cannot mix packoffset elements with nonpackoffset elements in a cbuffer}} +cbuffer Mix +{ +float4 M1 : packoffset(c0); +float M2; +

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -183,6 +183,86 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes &Attrs, return; } } break; + case ParsedAttr::AT_HLSLPackOffset: { +// Parse 'packoffset( c[Subcomponent][.component] )'. +// Check '('. +if (ExpectAndConsume(tok::l_paren, diag::er

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -ast-dump -x hlsl %s | FileCheck %s + + +// CHECK: HLSLBufferDecl {{.*}} cbuffer A +cbuffer A +{ +// CHECK-NEXT: VarDecl {{.*}} C1 'float4' +// CHECK-NEXT: HLSLP

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -7398,6 +7398,26 @@ The full documentation is available here: https://docs.microsoft.com/en-us/windo }]; } +def HLSLPackOffsetDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The packoffset attribute is used to change the layout of a cbuffer.

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/5] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -7314,6 +7314,41 @@ static void handleHLSLSV_DispatchThreadIDAttr(Sema &S, Decl *D, D->addAttr(::new (S.Context) HLSLSV_DispatchThreadIDAttr(S.Context, AL)); } +static void handleHLSLPackOffsetAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (!isa(D) || !isa(D->getDe

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">]; --

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

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

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">]; --

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -1745,5 +1745,7 @@ def err_hlsl_separate_attr_arg_and_number : Error<"wrong argument format for hls def ext_hlsl_access_specifiers : ExtWarn< "access specifiers are a clang HLSL extension">, InGroup; +def err_hlsl_unsupported_component : Error<"invalid component '%0' us

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/6] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -7398,6 +7398,26 @@ The full documentation is available here: https://docs.microsoft.com/en-us/windo }]; } +def HLSLPackOffsetDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The packoffset attribute is used to change the layout of a cbuffer.

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -760,7 +760,7 @@ using namespace clang::targets; TargetInfo * TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr &Opts) { - llvm::Triple Triple(Opts->Triple); + llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple)

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-01 Thread Xiang Li via cfe-commits
@@ -760,7 +760,7 @@ using namespace clang::targets; TargetInfo * TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr &Opts) { - llvm::Triple Triple(Opts->Triple); + llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple)

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-02 Thread Xiang Li via cfe-commits
@@ -115,6 +115,30 @@ StringRef Triple::getArchName(ArchType Kind, SubArchType SubArch) { if (SubArch == AArch64SubArch_arm64e) return "arm64e"; break; + case Triple::dxil: +switch (SubArch) { +case Triple::NoSubArch: python3kgae wrote:

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-05-02 Thread Xiang Li via cfe-commits
@@ -1,13 +1,15 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -ast-dump -o - %s | FileCheck %s python3kgae wrote: Should we support ``` float c : register(c10); ``` It is legal in dxc. https://github.com/llvm/llvm-project/pull/87578 __

[clang] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

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

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-06 Thread Xiang Li via cfe-commits
@@ -2454,4 +2454,19 @@ TEST(TripleTest, isArmMClass) { EXPECT_TRUE(T.isArmMClass()); } } + +TEST(TripleTest, DXILNormaizeWithVersion) { + EXPECT_EQ("dxilv1.0-unknown-shadermodel6.0", +Triple::normalize("dxilv1.0--shadermodel6.0")); python3kga

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-06 Thread Xiang Li via cfe-commits
@@ -2454,4 +2454,19 @@ TEST(TripleTest, isArmMClass) { EXPECT_TRUE(T.isArmMClass()); } } + +TEST(TripleTest, DXILNormaizeWithVersion) { + EXPECT_EQ("dxilv1.0-unknown-shadermodel6.0", +Triple::normalize("dxilv1.0--shadermodel6.0")); python3kga

[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

2024-05-06 Thread Xiang Li via cfe-commits
@@ -2454,4 +2454,19 @@ TEST(TripleTest, isArmMClass) { EXPECT_TRUE(T.isArmMClass()); } } + +TEST(TripleTest, DXILNormaizeWithVersion) { + EXPECT_EQ("dxilv1.0-unknown-shadermodel6.0", +Triple::normalize("dxilv1.0--shadermodel6.0")); python3kga

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-06 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/7] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-06 Thread Xiang Li via cfe-commits
python3kgae wrote: > I'm marking this as requesting changes because I don't think we should land > this as-is. Switched to warning. https://github.com/llvm/llvm-project/pull/89836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/8] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Xiang Li via cfe-commits
@@ -4372,6 +4372,13 @@ def HLSLResourceBinding: InheritableAttr { let Documentation = [HLSLResourceBindingDocs]; } +def HLSLPackOffset: HLSLAnnotationAttr { + let Spellings = [HLSLAnnotation<"packoffset">]; + let LangOpts = [HLSL]; + let Args = [IntArgument<"Offset">]; --

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 1/9] [HLSL] Support packoffset attribute in AST Add HLSLPackOffset

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-05-07 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/89836 >From 4d8c72688656fe3b2ce8817087d8cf7352b5876b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 23 Apr 2024 17:49:02 -0400 Subject: [PATCH 01/10] [HLSL] Support packoffset attribute in AST Add HLSLPackOffs

[clang] [llvm] [DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #91407)

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

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

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

[clang] Revert "[HLSL] Support packoffset attribute in AST (#89836)" (PR #91473)

2024-05-08 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/91473 This reverts commit c5509fedc5757fffece385d9d068e36b26793ade. >From 5809281176c75712752fe152c160ce964993726e Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 8 May 2024 09:46:44 -0400 Subject: [PATCH] Reve

[clang] Revert "[HLSL] Support packoffset attribute in AST (#89836)" (PR #91473)

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

[clang] [HLSL] reenable add packoffset in AST (PR #91474)

2024-05-08 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/91474 Fix the test fail caused by missing -fnative-half-type. For #57914 >From 5809281176c75712752fe152c160ce964993726e Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 8 May 2024 09:46:44 -0400 Subject: [PATC

[clang] [HLSL] reenable add packoffset in AST (PR #91474)

2024-05-08 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/91474 >From 251bbfbd77f9fa968a3fe76156e216f27eeb973f Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 8 May 2024 09:48:30 -0400 Subject: [PATCH 1/2] Revert "Revert "[HLSL] Support packoffset attribute in AST (#8

[clang] [HLSL] reenable add packoffset in AST (PR #91474)

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

[clang] [HLSL] reenable add packoffset in AST (PR #91474)

2024-05-08 Thread Xiang Li via cfe-commits
python3kgae wrote: > When reapplying a change that was reverted, please include enough information > in the description so that it can be understood without having to dig up the > old change. Something like: > > > [HLSL] reenable add packoffset in AST > > This reapplies > > [c5509fe](https://

[clang] [HLSL] reenable add packoffset in AST (PR #91474)

2024-05-08 Thread Xiang Li via cfe-commits
https://github.com/python3kgae updated https://github.com/llvm/llvm-project/pull/91474 >From 251bbfbd77f9fa968a3fe76156e216f27eeb973f Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 8 May 2024 09:48:30 -0400 Subject: [PATCH 1/2] Revert "Revert "[HLSL] Support packoffset attribute in AST (#8

[clang] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-05-08 Thread Xiang Li via cfe-commits
@@ -0,0 +1,794 @@ +== +DXIL Resource Handling +== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +Resources in DXIL are represented via ``TargetExtType`` in LLVM IR and +eventually lowered by the Di

[clang] [HLSL] reenable add packoffset in AST (PR #91474)

2024-05-09 Thread Xiang Li via cfe-commits
https://github.com/python3kgae closed https://github.com/llvm/llvm-project/pull/91474 ___ 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-13 Thread Xiang Li via cfe-commits
https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/91999 Implement packoffset as offset in the layouted struct for cbuffer. cbuffer CB { float a : packoffset(c2); float b : packoffset(c4); float2 c : packoffset(c2.z); } will get layout struct like struct CB

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-05-14 Thread Xiang Li via cfe-commits
@@ -18,14 +18,21 @@ namespace hlsl { #define _HLSL_BUILTIN_ALIAS(builtin) \ __attribute__((clang_builtin_alias(builtin))) -#define _HLSL_AVAILABILITY(environment, version) \ - __attribute__((availabil

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-15 Thread Xiang Li via cfe-commits
@@ -0,0 +1,53 @@ += +HLSL Availability Diagnostics += + +.. contents:: + :local: + +Introduction + + +HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable sha

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-15 Thread Xiang Li via cfe-commits
@@ -0,0 +1,53 @@ += +HLSL Availability Diagnostics += + +.. contents:: + :local: + +Introduction + + +HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable sha

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-15 Thread Xiang Li via cfe-commits
@@ -0,0 +1,53 @@ += +HLSL Availability Diagnostics += + +.. contents:: + :local: + +Introduction + + +HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable sha

[clang] HLSL availability diagnostics design doc (PR #92207)

2024-05-15 Thread Xiang Li via cfe-commits
@@ -0,0 +1,53 @@ += +HLSL Availability Diagnostics += + +.. contents:: + :local: + +Introduction + + +HLSL availability diagnostics emits errors or warning when unavailable shader APIs are used. Unavailable sha

[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

[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-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
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
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: > > 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
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] 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] [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] [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

<    1   2   3   4   >