[clang] [clang] Update argument checking tablegen code to use a 'full' name (PR #99993)

2024-07-23 Thread Justin Bogner via cfe-commits
@@ -314,64 +314,92 @@ void Parser::ParseGNUAttributes(ParsedAttributes &Attrs, } /// Determine whether the given attribute has an identifier argument. -static bool attributeHasIdentifierArg(const IdentifierInfo &II) { +static bool attributeHasIdentifierArg(const IdentifierInfo

[clang] [clang] Update argument checking tablegen code to use a 'full' name (PR #99993)

2024-07-23 Thread Justin Bogner via cfe-commits
@@ -191,6 +191,12 @@ class AttributeCommonInfo { /// __gnu__::__attr__ will be normalized to gnu::attr). std::string getNormalizedFullName() const; + /// Gets a normalized full name, with syntax, scope and name. + static std::string + getNormalizedFullNameWithSyntax(con

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

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

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

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

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

2024-07-30 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-07-15 Thread Justin Bogner via cfe-commits
bogner wrote: Just noticed that this was missing the change I had locally for updating the load and store operations to reflect the two different buffer types. I've pushed that in the latest update. https://github.com/llvm/llvm-project/pull/90553 ___

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

2024-07-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/90553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIRV][HLSL] Add lowering of frac to SPIR-V (PR #97111)

2024-07-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/97111 ___ 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-24 Thread Justin Bogner via cfe-commits
@@ -7334,6 +7334,100 @@ static void handleHLSLShaderAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +static void DiagnoseHLSLResourceRegType(Sema &S, SourceLocation &ArgLoc, +Decl *D, StringRef &Slot) { + // S

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

2024-04-24 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,74 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// the below will cause an llvm unreachable, because RWBuffers don't have resource attributes yet +// expected-error@+1 {{invalid register name prefix 'b' for re

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

2024-04-24 Thread Justin Bogner via cfe-commits
@@ -25,6 +25,7 @@ enum class ResourceClass : uint8_t { SRV = 0, UAV, CBuffer, + TBuffer, bogner wrote: I hadn't noticed this. Xiang's right, this isn't correct. See `CGHLSLRuntime::finishCodeGen` - a tbuffer is annotated with a resource class of `SRV`

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

2024-04-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner 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] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner requested changes to this pull request. There's a lot of churn here so I'm not 100% sure I saw all of the real changes, but I think I got them all. It might be nice to move the NFC parts into their own commit (if we actually need them, see my other comments). I don't

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

2024-04-26 Thread Justin Bogner via cfe-commits
@@ -1171,18 +1181,27 @@ TEST(TripleTest, Normalization) { Triple::getOSTypeName(FirstOSType), Triple::getEnvironmentTypeName(FirstEnvType)}; for (int Arch = FirstArchType; Arch <= Triple::LastArchType; ++Arch) { -StringR

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

2024-04-26 Thread Justin Bogner via cfe-commits
@@ -98,9 +103,47 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // dxil-unknown-shadermodel-hull + // Determine DXIL version number using the minor version number of Shader + // Mo

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

2024-04-26 Thread Justin Bogner 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 Justin Bogner 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::DXILSubArch_v1_0: + return "dxilv1.0"; +

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

2024-04-26 Thread Justin Bogner 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] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-29 Thread Justin Bogner via cfe-commits
@@ -7334,6 +7334,92 @@ static void handleHLSLShaderAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +static void DiagnoseHLSLResourceRegType(Sema &S, SourceLocation &ArgLoc, +Decl *D, StringRef &Slot) { + // Sa

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

2024-04-29 Thread Justin Bogner via cfe-commits
@@ -7334,6 +7334,92 @@ static void handleHLSLShaderAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +static void DiagnoseHLSLResourceRegType(Sema &S, SourceLocation &ArgLoc, +Decl *D, StringRef &Slot) { + // Sa

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

2024-04-30 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Justin Bogner 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] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-26 Thread Justin Bogner via cfe-commits
@@ -16,262 +16,220 @@ #ifdef __HLSL_ENABLE_16_BIT // DXIL_NATIVE_HALF: define noundef i1 @ // SPIR_NATIVE_HALF: define spir_func noundef i1 @ -// DXIL_NATIVE_HALF: %hlsl.all = call i1 @llvm.dx.all.i16 -// SPIR_NATIVE_HALF: %hlsl.all = call i1 @llvm.spv.all.i16 +// DXIL_NATIVE_H

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-26 Thread Justin Bogner via cfe-commits
@@ -1,12 +1,12 @@ -// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner commented: I think this looks basically reasonable, though some parts are a bit hard to decipher without the actual attributed types present yet. We probably need someone familar with the clang AST, Sema, and serialization to take a look as well - maybe @AaronBallman?

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -6155,6 +6155,63 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { +public: + struct Attributes { +// This is where data gathered from HLSL resource attribut

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -2048,6 +2049,17 @@ void TypePrinter::printBTFTagAttributedAfter(const BTFTagAttributedType *T, printAfter(T->getWrappedType(), OS); } +void TypePrinter::printHLSLAttributedResourceBefore( +const HLSLAttributedResourceType *T, raw_ostream &OS) { + printBefore(T->get

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/106181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/106181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -6155,6 +6155,53 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { +public: + struct Attributes { +// Data gathered from HLSL resource attributes +uint8_

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. A few nitpicks, but otherwise LGTM! https://github.com/llvm/llvm-project/pull/106181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -2048,6 +2049,24 @@ void TypePrinter::printBTFTagAttributedAfter(const BTFTagAttributedType *T, printAfter(T->getWrappedType(), OS); } +void TypePrinter::printHLSLAttributedResourceBefore( +const HLSLAttributedResourceType *T, raw_ostream &OS) { + printBefore(T->get

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -6155,6 +6155,53 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { +public: + struct Attributes { +// Data gathered from HLSL resource attributes +uint8_

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -6155,6 +6155,53 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { +public: + struct Attributes { +// Data gathered from HLSL resource attributes +uint8_

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -6155,6 +6155,53 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class HLSLAttributedResourceType : public Type, public llvm::FoldingSetNode { +public: + struct Attributes { +// Data gathered from HLSL resource attributes +uint8_

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -799,6 +799,19 @@ static bool IsEquivalentExceptionSpec(StructuralEquivalenceContext &Context, return true; } +// Determine structural equivalence of two instances of +// HLSLAttributedResourceType::Attributes +static bool +IsStructurallyEquivalent(StructuralEquivalenceC

[clang] [HLSL] Add HLSLAttributedResourceType (PR #106181)

2024-08-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/106181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-27 Thread Justin Bogner via cfe-commits
@@ -1,98 +1,83 @@ // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. Looks great, thanks! Do you need someone to commit this for you? https://github.com/llvm/llvm-project/pull/105930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/105930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Justin Bogner via cfe-commits
@@ -15,49 +15,49 @@ // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_CHECK #ifdef __HLSL_ENABLE_16_BIT -// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.dx.umad.i16(i16 %0, i16 %1, i16 %2) +// DXIL_NATIVE_HALF: %dx.umad = call i16 @llvm.[[ICF:dx]].umad.i16(i16

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/105930 ___ 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-30 Thread Justin Bogner via cfe-commits
@@ -153,6 +154,25 @@ HLSLNumThreadsAttr *SemaHLSL::mergeNumThreadsAttr(Decl *D, HLSLNumThreadsAttr(getASTContext(), AL, X, Y, Z); } +HLSLWaveSizeAttr *SemaHLSL::mergeWaveSizeAttr(Decl *D, + const AttributeCommonInfo &AL, +

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

2024-08-30 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. 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] [HLSL][Doc] Document multi-argument resolution (PR #104474)

2024-08-30 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/104474 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Don't add DWARF debug info when assembling .s with clang-cl /Z7 (PR #106686)

2024-09-02 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/106686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Adjust resource binding diagnostic flags code (PR #106657)

2024-09-03 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/106657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Adjust resource binding diagnostic flags code (PR #106657)

2024-09-03 Thread Justin Bogner via cfe-commits
@@ -612,57 +588,61 @@ static RegisterBindingFlags HLSLFillRegisterBindingFlags(Sema &S, return Flags; } - if (!isDeclaredWithinCOrTBuffer(TheDecl)) { -// make sure the type is a basic / numeric type -if (TheVarDecl) { - QualType TheQualTy = TheVarDecl->get

[clang-tools-extra] Fix Default Asset File locator for clang docs (PR #97505)

2024-07-08 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/97505 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Fix Default Asset File locator for clang docs (PR #97505)

2024-07-08 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. It's kind of unfortunate how this works dependency-wise - we end up creating "Debug/share/clang-doc/${f}" even when we only build "Release" and vice-versa, as the "copy-clang-doc-assets" explicitly depends on each version of this file. Also

[clang-tools-extra] Fix Default Asset File locator for clang docs (PR #97505)

2024-07-08 Thread Justin Bogner via cfe-commits
@@ -25,12 +25,14 @@ set(assets ) set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets") -set(resource_dir "${CMAKE_BINARY_DIR}/share/clang-doc") set(out_files) function(copy_files_to_dst src_dir dst_dir file) set(src "${src_dir}/${file}") set(dst "${dst_dir}/${file}"

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

2024-07-10 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. 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] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,49 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +llvm::dxil::ResourceClass +getResourceClassFromStr(StringRef ResourceClassTypeStrRef) { + if (ResourceClassTypeStrRef == "SRV") +return llvm::dxil::ResourceC

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { + int i; +}; + +Eg1 e1; + +// CHECK: -CXXRecordDecl 0x{

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -o - %s -verify + +// expected-error@+1{{'resource_class' attribute takes one argument}} +struct [[hlsl::resource_class()]] Eg1 { + int i; +}; + +Eg1 e1; + +// expected-error@+1{{invalid resource class

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,49 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +llvm::dxil::ResourceClass +getResourceClassFromStr(StringRef ResourceClassTypeStrRef) { + if (ResourceClassTypeStrRef == "SRV") +return llvm::dxil::ResourceC

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-10 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { bogner wrote: For the purpose of these t

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s + + +// CHECK: -HLSLResourceClassAttr 0x{{[0-9a-f]+}} <> SRV +struct [[hlsl::resource_class(SRV)]] Eg1 { bogner wrote: Ah, I hadn't noticed the "

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,33 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { + if (!AL.isArgIdent(0)) { +Diag(AL.getLoc(), diag::err_attribute_argument_type) +

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -437,6 +437,33 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleResourceClassAttr(Decl *D, const ParsedAttr &AL) { + if (!AL.isArgIdent(0)) { +Diag(AL.getLoc(), diag::err_attribute_argument_type) +

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-11 Thread Justin Bogner via cfe-commits
@@ -115,12 +115,19 @@ struct BuiltinTypeDeclBuilder { return addMemberVariable("h", Ty, Access); } - BuiltinTypeDeclBuilder &annotateResourceClass(ResourceClass RC, -ResourceKind RK, bool IsROV) { + BuiltinTypeDeclBuilder

[clang] [HLSL] Split out resource class data from resource attribute (PR #98419)

2024-07-12 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/98419 ___ 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-07-13 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/90553 ___ 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-07-13 Thread Justin Bogner 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-07-13 Thread Justin Bogner 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-07-15 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-07-15 Thread Justin Bogner via cfe-commits
https://github.com/bogner ready_for_review https://github.com/llvm/llvm-project/pull/90553 ___ 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-07-15 Thread Justin Bogner via cfe-commits
@@ -29,6 +29,7 @@ pointer of the template parameter type. The pointer is populated from a call to data through until lowering in the backend. Resource types are annotated with the ``HLSLResource`` attribute, which drives -code generation for resource binding metadata. The ``h

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

2024-04-30 Thread Justin Bogner 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] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-04-30 Thread Justin Bogner 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] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

2024-05-01 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/90694 ___ 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-03 Thread Justin Bogner via cfe-commits
@@ -4675,7 +4676,7 @@ bool CompilerInvocation::CreateFromArgsImpl( // FIXME: We shouldn't have to pass the DashX option around here InputKind DashX = Res.getFrontendOpts().DashX; ParseTargetArgs(Res.getTargetOpts(), Args, Diags); - llvm::Triple T(Res.getTargetOpts().Trip

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

2024-05-03 Thread Justin Bogner via cfe-commits
@@ -630,7 +630,7 @@ extern "C" int optMain( } } - Triple ModuleTriple(M->getTargetTriple()); + Triple ModuleTriple(Triple::normalize(M->getTargetTriple())); bogner wrote: Similarly to my concern about updating `createTargetMachineForTriple`, I don't

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

2024-05-03 Thread Justin Bogner via cfe-commits
@@ -744,7 +744,7 @@ void codegen::setFunctionAttributes(StringRef CPU, StringRef Features, Expected> codegen::createTargetMachineForTriple(StringRef TargetTriple, CodeGenOptLevel OptLevel) { - Triple TheTriple(TargetTriple); + Triple The

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

2024-05-03 Thread Justin Bogner via cfe-commits
@@ -1200,6 +1224,27 @@ std::string Triple::normalize(StringRef Str) { } } + // Normalize DXIL triple if it does not include DXIL version number. + // Determine DXIL version number using the minor version number of Shader + // Model version specified in target triple,

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

2024-05-03 Thread Justin Bogner 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: +case Triple::DXILSubArch_v1_0: +

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

2024-05-06 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/90809 ___ 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 Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. Other than [my comment here](https://github.com/llvm/llvm-project/pull/90809/files#r1589771652) about what to do in getArchName this looks reasonable. The string handling in `normalize` feels a bit unwieldy, but I don't have any obvious th

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

2024-05-06 Thread Justin Bogner via cfe-commits
@@ -744,7 +744,7 @@ void codegen::setFunctionAttributes(StringRef CPU, StringRef Features, Expected> codegen::createTargetMachineForTriple(StringRef TargetTriple, CodeGenOptLevel OptLevel) { - Triple TheTriple(TargetTriple); + Triple The

[clang] [llvm] [clang][hlsl] Add tan intrinsic part 1 (PR #90276)

2024-05-07 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/90276 ___ 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 Justin Bogner via cfe-commits
bogner 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 c5509fedc575 "[HLSL] Support packoffse

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

2024-05-08 Thread Justin Bogner via cfe-commits
bogner wrote: > > It would be nice to mention in the description what the sanitizer fix was > > compared to the original PR. > > Thanks! The fix to address ASAN failure is in commit > [8522e36](https://github.com/llvm/llvm-project/commit/8522e3609869d72b7b457a4752149a802be4662d) > of this PR.

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

2024-05-08 Thread Justin Bogner via cfe-commits
https://github.com/bogner 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] reenable add packoffset in AST (PR #91474)

2024-05-08 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. 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] Fix unused private field warning (PR #91500)

2024-05-08 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/91500 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][SPIR-V] Always add convergence intrinsics (PR #88918)

2024-05-13 Thread Justin Bogner via cfe-commits
Nathan =?utf-8?q?Gau=C3=ABr?= , Nathan =?utf-8?q?Gau=C3=ABr?= , Nathan =?utf-8?q?Gau=C3=ABr?= , Nathan =?utf-8?q?Gau=C3=ABr?= Message-ID: In-Reply-To: https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/88918

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/92011 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. Including clang-tools-extra makes sense to me. Setting up the distribution may not be as universal but it seems fine too as a default in this cache file. LGTM https://github.com/llvm/llvm-project/pull/92011 _

[clang] [HLSL][CMake] Add clangd and distribution settings (PR #92011)

2024-05-16 Thread Justin Bogner via cfe-commits
@@ -8,6 +8,12 @@ set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX;SPIRV" CACHE STRING "") # HLSL support is currently limted to clang, eventually it will expand to # clang-tools-extra too. -set(LLVM_ENABLE_PROJECTS "clang" CACHE STRING "") +set(LLVM_ENABLE_PROJECTS "clang;clan

[clang] [HLSL][CMake] Cache files don't have generator vars (PR #92793)

2024-05-20 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/92793 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-23 Thread Justin Bogner via cfe-commits
bogner wrote: I don't really understand the rationale for this, and it's kind of annoying. Most of the compiler's flags behave in the "last one wins" fashion (such as `-O2` and `-O0`) and it's always been convenient to add the flag you want at the end. Why treat action flags any differently? A

[clang] [llvm] [clang] Add tanf16 builtin and support for tan constrained intrinsic (PR #93314)

2024-05-24 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/93314 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

2024-08-01 Thread Justin Bogner via cfe-commits
@@ -4707,6 +4707,12 @@ def HLSLIsinf : LangBuiltin<"HLSL_LANG"> { let Prototype = "void(...)"; } +def HLSLLength : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_elementwise_length"]; bogner wrote: I think this should be "__builtin_hlsl_leng

[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

2024-08-01 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,10 @@ +; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s + +; DXIL operation length does not support double overload type +; CHECK: LLVM ERROR: Invalid Overload + +define noundef double @test_length_double2(<2 x double> nou

[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

2024-08-01 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,133 @@ +; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s --check-prefixes=CHECK,EXPCHECK +; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library < %s | FileCheck %s --check-prefixes=CHECK,DOPCHECK + +; Make sure dxil operation function call

[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

2024-08-01 Thread Justin Bogner via cfe-commits
@@ -157,6 +158,35 @@ static bool expandAnyIntrinsic(CallInst *Orig) { return true; } +static bool expandLengthIntrinsic(CallInst *Orig) { + Value *X = Orig->getOperand(0); + IRBuilder<> Builder(Orig->getParent()); + Builder.SetInsertPoint(Orig); + Type *Ty = X->getType()

[clang] [llvm] Add length HLSL function to DirectX Backend (PR #101256)

2024-08-01 Thread Justin Bogner via cfe-commits
@@ -18460,6 +18460,20 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, /*ReturnType=*/X->getType(), CGM.getHLSLRuntime().getLerpIntrinsic(), ArrayRef{X, Y, S}, nullptr, "hlsl.lerp"); } + case Builtin::BI__builtin_hlsl_elementwise_length: {

<    1   2   3   4   5   6   7   8   9   >