[clang] Attach resource attributes to handle within record, instead of record (PR #101433)

2024-08-02 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/101433 ___ 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-08-16 Thread Damyan Pepper via cfe-commits
@@ -551,24 +541,21 @@ getHLSLResourceAttrFromEitherDecl(VarDecl *VD, // the resource attr could be on the record decl itself or on one of // its fields (the resource handle, most commonly) damyanp wrote: I was going to add a comment about the name of

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

2024-08-16 Thread Damyan Pepper via cfe-commits
@@ -551,24 +541,21 @@ getHLSLResourceAttrFromEitherDecl(VarDecl *VD, // the resource attr could be on the record decl itself or on one of // its fields (the resource handle, most commonly) -const auto *Attr = TheRecordDecl->getAttr(); +const auto *Attr = TheRec

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

2024-08-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp 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] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

2024-08-16 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,407 @@ 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-08-16 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,407 @@ 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-08-16 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,407 @@ 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-08-19 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,131 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// TODO: Implement "Buffer", we use a substitute UDT +// to test the 't' binding type for this test. + +template +struct [[hlsl::resource_class(SRV)]] MyTemplated

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

2024-08-19 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp requested changes to 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-08-19 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-19 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,413 @@ 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-08-19 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-19 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,103 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// TODO: Implement "Buffer" +struct Eg1 { + float f; + // Buffer Buf; + RWBuffer RWBuf; + }; +Eg1 e1 : /* register(t0) :*/ register(u0); +// Valid: f is skip

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

2024-08-19 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,413 @@ 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-08-19 Thread Damyan Pepper via cfe-commits
@@ -492,14 +999,21 @@ void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) { // Validate. if (!Slot.empty()) { switch (Slot[0]) { damyanp wrote: This still seems to be essentially a duplicate of `getRegisterTypeIndex`. You may nee

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

2024-08-19 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,413 @@ 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-08-19 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,131 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// TODO: Implement "Buffer", we use a substitute UDT +// to test the 't' binding type for this test. damyanp wrote: I don't think that this TODO

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

2024-08-19 Thread Damyan Pepper via cfe-commits
@@ -459,7 +468,413 @@ 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] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-20 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/104656 ___ 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-08-21 Thread Damyan Pepper via cfe-commits
@@ -31,6 +31,7 @@ class SemaHLSL : public SemaBase { public: SemaHLSL(Sema &S); + HLSLResourceAttr *mergeHLSLResourceAttr(bool CBuffer); damyanp wrote: I don't think `mergeHLSLResourceAttr` exists any more? https://github.com/llvm/llvm-project/pull/97103

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

2024-08-21 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +/* +tem

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

2024-08-21 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp requested changes to 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-08-21 Thread Damyan Pepper via cfe-commits
@@ -459,7 +467,408 @@ 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-08-21 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,131 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// TODO: Implement "Buffer", we use a substitute UDT +// to test the 't' binding type for this test. + +template +struct [[hlsl::resource_class(SRV)]] MyTemplated

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

2024-08-22 Thread Damyan Pepper via cfe-commits
@@ -459,7 +467,506 @@ 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-08-22 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-22 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +/* +tem

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

2024-08-22 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp requested changes to this pull request. A few open issues I'd like to see addressed before approving this: * https://github.com/llvm/llvm-project/pull/97103#discussion_r1720126674 * https://github.com/llvm/llvm-project/pull/97103#discussion_r1722532927 * https://github

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

2024-08-22 Thread Damyan Pepper via cfe-commits
@@ -551,24 +541,21 @@ getHLSLResourceAttrFromEitherDecl(VarDecl *VD, // the resource attr could be on the record decl itself or on one of // its fields (the resource handle, most commonly) -const auto *Attr = TheRecordDecl->getAttr(); +const auto *Attr = TheRec

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

2024-08-22 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-22 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-22 Thread Damyan Pepper via cfe-commits
@@ -459,7 +467,408 @@ 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-08-22 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. Thank you! 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] Create Texture Dimension attribute in HLSL (PR #104239)

2024-08-23 Thread Damyan Pepper via cfe-commits
damyanp wrote: We should get the proposal approved before implementing it. https://github.com/llvm/llvm-project/pull/104239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-26 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/106096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-26 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -o - -disable-llvm-passes %s | FileCheck %s + +// Verify that no per variable _Init_thread instructions are emitted for non-trivial static locals +// These would normally be emitted by the Mic

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-26 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -o - -disable-llvm-passes %s | FileCheck %s + +// Verify that no per variable _Init_thread instructions are emitted for non-trivial static locals +// These would normally be emitted by the Mic

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

2024-06-21 Thread Damyan Pepper via cfe-commits
@@ -2646,6 +2646,9 @@ bool Parser::ParseCXXMemberDeclaratorBeforeInitializer( else DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation()); + if (getLangOpts().HLSL) damyanp wrote: I'm not proposing we combine them. My observation is that one of them

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

2024-06-21 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited 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-27 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp 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] [HLSL] fix elementwise bitreverse test (PR #108128)

2024-09-11 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/108128 ___ 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-12 Thread Damyan Pepper via cfe-commits
damyanp wrote: Seems that this change is doing a bit more than just adding a new version of popcount. Can the description be updated appropriately please? https://github.com/llvm/llvm-project/pull/108121 ___ cfe-commits mailing list cfe-commits@lists

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

2024-09-12 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited 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] Add testing for space parameter on global constants (PR #106782)

2024-09-12 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. LGTM - I think one of the test cases may be redundant (or in the wrong file). https://github.com/llvm/llvm-project/pull/106782 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

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

2024-09-12 Thread Damyan Pepper via cfe-commits
@@ -1,5 +1,24 @@ // 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 Damyan Pepper 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 Damyan Pepper via cfe-commits
@@ -1,5 +1,24 @@ // 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 Damyan Pepper 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 Damyan Pepper via cfe-commits
https://github.com/damyanp requested changes to 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] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Damyan Pepper 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 Damyan Pepper via cfe-commits
https://github.com/damyanp deleted 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] Add `[[hlsl::raw_buffer]]` attribute (PR #107954)

2024-09-13 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp 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] Add `[[hlsl::raw_buffer]]` attribute (PR #107954)

2024-09-13 Thread Damyan Pepper via cfe-commits
@@ -6168,10 +6168,19 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { struct Attributes { // Data gathered from HLSL resource attributes llvm::dxil::ResourceClass ResourceClass; + +LLVM_PREFERRED_TYPE(bool) uint8_t IsROV : 1;

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

2024-09-13 Thread Damyan Pepper via cfe-commits
@@ -6168,10 +6168,19 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { struct Attributes { // Data gathered from HLSL resource attributes llvm::dxil::ResourceClass ResourceClass; + +LLVM_PREFERRED_TYPE(bool) uint8_t IsROV : 1;

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

2024-09-13 Thread Damyan Pepper via cfe-commits
@@ -6168,10 +6168,19 @@ class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { struct Attributes { // Data gathered from HLSL resource attributes llvm::dxil::ResourceClass ResourceClass; + +LLVM_PREFERRED_TYPE(bool) uint8_t IsROV : 1;

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

2024-09-13 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s damyanp wrote: Presumably we have tests somewhere for resource handles that don't have raw_buffer on them, and they just don't show up here beca

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

2024-09-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited 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] Add testing for space parameter on global constants (PR #106782)

2024-09-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. I'm marking this as approved - I think that there's some cleanup and rearranging of the tests here that would improve this change. It might be worth trying to get a review with someone who has more experience of testing strategies for thes

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

2024-09-16 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,66 @@ +// 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 { +// this test validates that no diagnostic is emitte

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

2024-09-16 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,66 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify damyanp wrote: This file seems to now mostly be testing non-error cases of specifying a space for registers. I think it'd probably be better to ju

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

2024-09-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited 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] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: LGTM - reviewed mostly to see if I could read and get a high level gist of what it was doing. I'm afraid I've not carefully looked through the real meat of this change. https://github.com/llvm/llvm-project/pull/108659 _

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited https://github.com/llvm/llvm-project/pull/108659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-16 Thread Damyan Pepper via cfe-commits
@@ -12881,6 +12886,12 @@ QualType Sema::CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, if (!getLangOpts().CPlusPlus && !(isa(vType->getAs( return InvalidLogicalVectorOperands(Loc, LHS, RHS); + if (getLangOpts().HLSL && + getLangOpts().getHLS

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-16 Thread Damyan Pepper via cfe-commits
@@ -12881,6 +12886,12 @@ QualType Sema::CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, if (!getLangOpts().CPlusPlus && !(isa(vType->getAs( return InvalidLogicalVectorOperands(Loc, LHS, RHS); + if (getLangOpts().HLSL && + getLangOpts().getHLS

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -83,6 +81,49 @@ static RegisterType getRegisterType(StringRef Slot) { } } +static ResourceClass getResourceClass(RegisterType RT) { + switch (RT) { + case RegisterType::SRV: +return ResourceClass::SRV; + case RegisterType::UAV: +return ResourceClass::UAV; + ca

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited https://github.com/llvm/llvm-project/pull/111203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -83,6 +81,49 @@ static RegisterType getRegisterType(StringRef Slot) { } } +static ResourceClass getResourceClass(RegisterType RT) { + switch (RT) { + case RegisterType::SRV: +return ResourceClass::SRV; + case RegisterType::UAV: +return ResourceClass::UAV; + ca

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: I've looked through some of this and added some comments. I called out one place where there's some missing `const`s on members, but I think in general the code is not const correct and I didn't call out all the spots that I saw. I have to admit I'm pretty

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -4593,6 +4593,44 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -28,13 +28,62 @@ class AttributeCommonInfo; class IdentifierInfo; class ParsedAttr; class Scope; +class VarDecl; + +using llvm::dxil::ResourceClass; // FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no // longer need to create builtin buffer types

[clang] [llvm] [HLSL] Add handle initialization for simple resource declarations (PR #111207)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() { GV->eraseFromParent(); } } + +// Returns handle type of a resource, if the type is a resource +// or an array of resources +static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy

[clang] [llvm] [HLSL] Add handle initialization for simple resource declarations (PR #111207)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -489,3 +494,100 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() { GV->eraseFromParent(); } } + +// Returns handle type of a resource, if the type is a resource +// or an array of resources +static const HLSLAttributedResourceType *findHandleTypeOnResource(QualTy

[clang] [llvm] [HLSL] Add handle initialization for simple resource declarations (PR #111207)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -1121,6 +1121,11 @@ CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn, if (Decls[i]) EmitRuntimeCall(Decls[i]); +if (getLangOpts().HLSL) + if (llvm::Function *ResInitFn = + CGM.getHLSLRuntime().createResourceBindingInitFn())

[clang] [llvm] [HLSL] Add handle initialization for simple resource declarations (PR #111207)

2024-10-14 Thread Damyan Pepper via cfe-commits
@@ -5622,6 +5622,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, getCUDARuntime().handleVarRegistration(D, *GV); } + if (LangOpts.HLSL) +getHLSLRuntime().handleGlobalVarDefinition(D, GV); damyanp wrote: Just checking you know th

[clang] [Sema] Support negation/parens with __builtin_available (PR #111439)

2024-10-07 Thread Damyan Pepper via cfe-commits
damyanp wrote: > Hey Damyan, GH suggested you as a reviewer for this. Would you be able to > TAL? Happy to find someone else if not :) I'm not sure why GH would have done that, I'm afraid I wouldn't be able to give an informed review here. (I might have a quick look anyway). https://github.co

[clang] [llvm] [HLSL] Add handle initialization for simple resource declarations (PR #111207)

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -1121,6 +1121,11 @@ CodeGenFunction::GenerateCXXGlobalInitFunc(llvm::Function *Fn, if (Decls[i]) EmitRuntimeCall(Decls[i]); +if (getLangOpts().HLSL) + if (llvm::Function *ResInitFn = + CGM.getHLSLRuntime().createResourceBindingInitFn())

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: LGTM. Would be good to get review from someone more familiar with ASTs and external sema source. https://github.com/llvm/llvm-project/pull/112600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -483,10 +573,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, + SourceLocation NameLoc, +

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -483,10 +573,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, damyanp wrote: ```suggestion BinaryOperator *getSi

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,99 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename */

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited https://github.com/llvm/llvm-project/pull/112600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -1,64 +1,64 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s damyanp wrote: We should try to fix this before completing the PR. https://github.com/llvm/llvm-project/pull/112600

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -483,10 +573,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, + SourceLocation NameLoc, +

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,99 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename */

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -483,10 +573,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, + SourceLocation NameLoc, +

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: Some more notes https://github.com/llvm/llvm-project/pull/112600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-10-18 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,119 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename *

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -28,13 +28,60 @@ class AttributeCommonInfo; class IdentifierInfo; class ParsedAttr; class Scope; +class VarDecl; + +using llvm::dxil::ResourceClass; // FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no // longer need to create builtin buffer types

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -985,88 +1034,85 @@ SemaHLSL::TakeLocForHLSLAttribute(const HLSLAttributedResourceType *RT) { return LocInfo; } -// get the record decl from a var decl that we expect -// represents a resource -static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) { - const Type *

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp edited https://github.com/llvm/llvm-project/pull/111203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. Some comments added, but I think we're probably good to go here. https://github.com/llvm/llvm-project/pull/111203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -985,88 +1034,85 @@ SemaHLSL::TakeLocForHLSLAttribute(const HLSLAttributedResourceType *RT) { return LocInfo; } -// get the record decl from a var decl that we expect -// represents a resource -static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) { - const Type *

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -110,6 +110,19 @@ DeclBindingInfo *ResourceBindings::addDeclBindingInfo(const VarDecl *VD, ResourceClass ResClass) { assert(getDeclBindingInfo(VD, ResClass) == nullptr && "DeclBindingInfo already added"); +#if

[clang] [HLSL] Collect explicit resource binding information (PR #111203)

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -28,13 +28,60 @@ class AttributeCommonInfo; class IdentifierInfo; class ParsedAttr; class Scope; +class VarDecl; + +using llvm::dxil::ResourceClass; // FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no // longer need to create builtin buffer types

<    1   2   3   4   5   >