[clang] [HLSL] Add 6.2 SM on half availability for length intrinsic (PR #122337)

2025-01-09 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. Does this fix a test failure? https://github.com/llvm/llvm-project/pull/122337 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Cleanup comments in HLSLExternalSemaSource.cpp (PR #119444)

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

[clang] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

2024-11-26 Thread Damyan Pepper via cfe-commits
@@ -564,9 +585,9 @@ struct BuiltinTypeMethodBuilder { OK_Ordinary); } - BuiltinTypeMethodBuilder & - callBuiltin(StringRef BuiltinName, ArrayRef CallParms, - bool AddResourceHandleAsFirstArg = true) { + template + Built

[clang] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

2024-11-26 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: LGTM - a nit and an idea in the comments. https://github.com/llvm/llvm-project/pull/117789 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

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

[clang] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

2024-11-26 Thread Damyan Pepper via cfe-commits
@@ -656,18 +670,20 @@ BuiltinTypeDeclBuilder::addSimpleTemplateParams(ArrayRef Names, } BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addIncrementCounterMethod() { + using PH = BuiltinTypeMethodBuilder::PlaceHolder; return BuiltinTypeMethodBuilder(SemaRef, *this, "Incre

[clang] [HLSL] Implement a header only distance intrinsic (PR #117240)

2024-11-21 Thread Damyan Pepper via cfe-commits
@@ -853,6 +853,45 @@ float3 degrees(float3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_degrees) float4 degrees(float4); +//===--===// +// distance builtins +//===--

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

2024-11-18 Thread Damyan Pepper via cfe-commits
damyanp wrote: @bob80905 - can you associate this with an issue please? https://github.com/llvm/llvm-project/pull/116413 ___ 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 #116413)

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

[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)

2024-11-14 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: This LGTM, but I think we should try and get reviews from @tex3d and @llvm-beanz before completing this PR. https://github.com/llvm/llvm-project/pull/115911 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)

2024-11-12 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s + +// Make sure SV_GroupID translated into dx.group.id. + +// CHECK: define void @foo() +// CHECK: %[[#ID:]] = cal

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

2024-11-06 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-11-06 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,127 @@ 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-11-06 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,127 @@ 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-11-06 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,127 @@ 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-11-06 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: Some notes, mostly about the comments. 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-11-06 Thread Damyan Pepper via cfe-commits
@@ -323,30 +324,127 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename *

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Damyan Pepper via cfe-commits
@@ -4,21 +4,30 @@ // NOTE: SPIRV codegen for resource types is not yet implemented StructuredBuffer Buf : register(t10); +RWStructuredBuffer Buf2 : register(u5, space1); // CHECK: %"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", float, 0, 0), float } +// CHE

[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

2024-10-23 Thread Damyan Pepper via cfe-commits
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s + +// NOTE: The number in type name and whether the struct is packed or not will mostly +// likely change once subscript oper

[clang] [HLSL][NFC] Move IsIntangibleType from SemaHLSL to Type to make it accessible outside of Sema (PR #113206)

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

[clang] [HLSL][NFC] Move IsIntangibleType from SemaHLSL to Type to make it accessible outside of Sema (PR #113206)

2024-10-22 Thread Damyan Pepper via cfe-commits
@@ -5030,6 +5030,29 @@ bool Type::hasSizedVLAType() const { return false; } +bool Type::isHLSLIntangibleType() const { + const Type *Ty = getUnqualifiedDesugaredType(); + + // check if it's a builtin type first (simple check, no need to cache it) damyanp w

[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
@@ -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] 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
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
@@ -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
@@ -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, 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
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-17 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-17 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-17 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-17 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: hmmmaybe a line endings change issue on this file? I'm wondering if some config in the root of this

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

2024-10-17 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp commented: Some comments based on a quick read through: 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-17 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-17 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-17 Thread Damyan Pepper via cfe-commits
@@ -1078,10 +1078,10 @@ ConceptDecl *ConceptDecl::Create(ASTContext &C, DeclContext *DC, TemplateParameterList *Params, Expr *ConstraintExpr) { bool Invalid = AdoptTemplateParameterList(Params, DC); - auto *T

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

2024-10-17 Thread Damyan Pepper via cfe-commits
@@ -483,10 +554,109 @@ 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-17 Thread Damyan Pepper via cfe-commits
@@ -483,10 +554,109 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, + SourceLocation NameLoc, +

[clang] [HLSL] Simplify debug check in ResourceBindings::addDeclBindingInfo (PR #112661)

2024-10-17 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. https://github.com/llvm/llvm-project/pull/112661 ___ 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
@@ -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
@@ -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
@@ -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 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
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
@@ -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
@@ -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
@@ -58,31 +56,82 @@ static RegisterType getRegisterType(ResourceClass RC) { llvm_unreachable("unexpected ResourceClass value"); } -static RegisterType getRegisterType(StringRef Slot) { +// Converts the first letter of string Slot to RegisterType. +// Returns false if the let

[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
@@ -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
@@ -58,31 +56,82 @@ static RegisterType getRegisterType(ResourceClass RC) { llvm_unreachable("unexpected ResourceClass value"); } -static RegisterType getRegisterType(StringRef Slot) { +// Converts the first letter of string Slot to RegisterType. +// Returns false if the let

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

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -58,31 +56,82 @@ static RegisterType getRegisterType(ResourceClass RC) { llvm_unreachable("unexpected ResourceClass value"); } -static RegisterType getRegisterType(StringRef Slot) { +// Converts the first letter of string Slot to RegisterType. +// Returns false if the let

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

2024-10-16 Thread Damyan Pepper via cfe-commits
@@ -58,31 +56,82 @@ static RegisterType getRegisterType(ResourceClass RC) { llvm_unreachable("unexpected ResourceClass value"); } -static RegisterType getRegisterType(StringRef Slot) { +// Converts the first letter of string Slot to RegisterType. +// Returns false if the let

[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
@@ -58,31 +56,82 @@ static RegisterType getRegisterType(ResourceClass RC) { llvm_unreachable("unexpected ResourceClass value"); } -static RegisterType getRegisterType(StringRef Slot) { +// Converts the first letter of string Slot to RegisterType. +// Returns false if the let

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

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

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

2024-10-16 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: Could someone file the bu

[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] [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] [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] [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] [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
@@ -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
@@ -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 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] [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] Add cross builtins and cross HLSL function to DirectX and SPIR-V backend (PR #109180)

2024-10-02 Thread Damyan Pepper via cfe-commits
@@ -74,6 +75,42 @@ static Value *expandAbs(CallInst *Orig) { "dx.max"); } +static Value *expandCrossIntrinsic(CallInst *Orig) { + + VectorType *VT = cast(Orig->getType()); + if (cast(VT)->getNumElements() != 3) +report_fatal_error(Twine("

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

2024-10-02 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. LGTM, and I see you've addressed all of the feedback. Would be good to check @bogner is happy with the resolution of [this issue](https://github.com/llvm/llvm-project/pull/109180#discussion_r1781967896) before merging. https://github.com/

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

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

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

2024-10-02 Thread Damyan Pepper via cfe-commits
@@ -1704,6 +1704,20 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_cross: { +if (SemaRef.checkArgCount(TheCall, 2)) + return true; +if (CheckVectorElementCallA

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-09-27 Thread Damyan Pepper via cfe-commits
@@ -4488,6 +4488,30 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) { mangleType(cast(T)); } +void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) { + mangleType(T->getWrappedType()); + const HLSLAttributedResourceType::Attributes &Attrs =

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-09-27 Thread Damyan Pepper via cfe-commits
@@ -29,19 +29,48 @@ class DirectXTargetCodeGenInfo : public TargetCodeGenInfo { llvm::Type *DirectXTargetCodeGenInfo::getHLSLType(CodeGenModule &CGM, const Type *Ty) const { - auto *BuiltinTy = dyn_cast(Ty); - if (!BuiltinTy

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-09-27 Thread Damyan Pepper via cfe-commits
@@ -4488,6 +4488,30 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) { mangleType(cast(T)); } +void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) { + mangleType(T->getWrappedType()); + const HLSLAttributedResourceType::Attributes &Attrs =

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-09-27 Thread Damyan Pepper via cfe-commits
@@ -29,19 +29,48 @@ class DirectXTargetCodeGenInfo : public TargetCodeGenInfo { llvm::Type *DirectXTargetCodeGenInfo::getHLSLType(CodeGenModule &CGM, const Type *Ty) const { - auto *BuiltinTy = dyn_cast(Ty); - if (!BuiltinTy

[clang] [llvm] [HLSL] Replace `element_type*` handles in HLSLExternalSemaSource with `__hlsl_resource_t` builtin type (PR #110079)

2024-09-26 Thread Damyan Pepper via cfe-commits
@@ -2272,8 +2272,8 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const { #include "clang/Basic/AMDGPUTypes.def" #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: #include "clang/Basic/HLSLIntangibleTypes.def" - Width = 0; - Align = 8;

[clang] [HLSL] Allow resource type attributes only on `__hlsl_resource_t` (PR #110143)

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

[clang] [llvm] [HLSL] Replace `element_type*` handles in HLSLExternalSemaSource with `__hlsl_resource_t` builtin type (PR #110079)

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

[clang] [llvm] [HLSL] Remove `__builtin_hlsl_create_handle` (PR #109910)

2024-09-26 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. LGTM It's a shame we don't have a better way to review changes like this, so I'm a little uncomfortable about a commit leaving things in a transitional state, but I think my appreciation of being able to review this separately from the nex

[clang] [HLSL] Warn about incomplete language support (PR #108894)

2024-09-18 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. LGTM, I'm happy to get this warning in! https://github.com/llvm/llvm-project/pull/108894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

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

2024-09-18 Thread Damyan Pepper via cfe-commits
@@ -29,15 +29,21 @@ RWBuffer Buffer; // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <> implicit class RWBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <> Implicit final -// CHECK-NEXT: implicit h 'element_type * {{\[\[}}hlsl::resource_class(UAV)]] {{\[\[}}hlsl::co

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

2024-09-17 Thread Damyan Pepper via cfe-commits
https://github.com/damyanp approved this pull request. 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] 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] 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
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] 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
@@ -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
@@ -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
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

  1   2   3   4   5   >