[clang] [HLSL] Fix global resource initialization (PR #123394)

2025-01-17 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/123394 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix global resource initialization (PR #123394)

2025-01-17 Thread Helena Kotas via cfe-commits
https://github.com/hekota ready_for_review https://github.com/llvm/llvm-project/pull/123394 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix global resource initialization (PR #123394)

2025-01-17 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/123394 >From 1d04bfa8e1b138a13acf30c3fc46428d3b260569 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Fri, 17 Jan 2025 12:40:21 -0800 Subject: [PATCH 1/2] [HLSL] Fix global resource initialization Fixes #120636 ---

[clang] [HLSL] Fix global resource initialization (PR #123394)

2025-01-17 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/123394 >From 1d04bfa8e1b138a13acf30c3fc46428d3b260569 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Fri, 17 Jan 2025 12:40:21 -0800 Subject: [PATCH 1/2] [HLSL] Fix global resource initialization Fixes #120636 ---

[clang] [HLSL] Fix global resource initialization (PR #123394)

2025-01-17 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/123394 Create separate resource initialization function for each resource and add them to CodeGenModule's `CXXGlobalInits` list. fixes Fixes #120636 and addresses this [comment ](https://github.com/llvm/llvm-project/p

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-16 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/122820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] cbuffer: Create host layout structs (PR #122820)

2025-01-16 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/122820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-16 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/122820 >From 71ddb5a2b4cc8a9609410b436e896484401f5e90 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Mon, 13 Jan 2025 15:03:12 -0800 Subject: [PATCH 1/4] [HLSL] cbuffer: Create host layout struct and add resource ha

[clang] [SPIR-V] Add hlsl_private address space for HLSL/SPIR-V (PR #122103)

2025-01-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/122103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [SPIR-V] Add hlsl_private address space for HLSL/SPIR-V (PR #122103)

2025-01-14 Thread Helena Kotas via cfe-commits
@@ -5362,6 +5362,23 @@ LangAS CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) { if (OpenMPRuntime->hasAllocateAttributeForGlobalVar(D, AS)) return AS; } + + if (LangOpts.HLSL) { +if (D == nullptr) + return LangAS::hlsl_private; + +// Except

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/122820 >From 71ddb5a2b4cc8a9609410b436e896484401f5e90 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Mon, 13 Jan 2025 15:03:12 -0800 Subject: [PATCH 1/3] [HLSL] cbuffer: Create host layout struct and add resource ha

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/122820 >From 71ddb5a2b4cc8a9609410b436e896484401f5e90 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Mon, 13 Jan 2025 15:03:12 -0800 Subject: [PATCH 1/2] [HLSL] cbuffer: Create host layout struct and add resource ha

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Helena Kotas via cfe-commits
@@ -253,12 +257,253 @@ static void validatePackoffset(Sema &S, HLSLBufferDecl *BufDecl) { } } +// Returns true if the array has a zero size = if any of the dimensions is 0 +static bool isZeroSizedArray(const ConstantArrayType *CAT) { + while (CAT && !CAT->isZeroSize()) +

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/122820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-14 Thread Helena Kotas via cfe-commits
@@ -253,12 +257,253 @@ static void validatePackoffset(Sema &S, HLSLBufferDecl *BufDecl) { } } +// Returns true if the array has a zero size = if any of the dimensions is 0 +static bool isZeroSizedArray(const ConstantArrayType *CAT) { + while (CAT && !CAT->isZeroSize()) +

[clang] [HLSL] cbuffer: Create host layout struct and add resource handle to AST (PR #122820)

2025-01-13 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/122820 >From 71ddb5a2b4cc8a9609410b436e896484401f5e90 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Mon, 13 Jan 2025 15:03:12 -0800 Subject: [PATCH] [HLSL] cbuffer: Create host layout struct and add resource handle

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-09 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/121989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
@@ -194,17 +196,19 @@ static unsigned calculateLegacyCbufferSize(const ASTContext &Context, calculateLegacyCbufferSize(Context, VT->getElementType()); Size = ElementSize * ElementCount; } else { -Size = Context.getTypeSize(T); +Size = Context.getTypeSize(

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/121989 >From f68ea5a099636f840561335dcf2daaed82c7405c Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Tue, 7 Jan 2025 12:07:28 -0800 Subject: [PATCH 1/2] [HLSL][NFC] Move packoffset validation to separate function an

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
@@ -219,33 +223,41 @@ void SemaHLSL::ActOnFinishBuffer(Decl *Dcl, SourceLocation RBrace) { } } - if (HasPackOffset && HasNonPackOffset) -Diag(BufDecl->getLocation(), diag::warn_hlsl_packoffset_mix); - - if (HasPackOffset) { -ASTContext &Context = getASTContext

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
@@ -4721,9 +4721,9 @@ def HLSLPackOffset: HLSLAnnotationAttr { let Args = [IntArgument<"Subcomponent">, IntArgument<"Component">]; let Documentation = [HLSLPackOffsetDocs]; let AdditionalMembers = [{ - unsigned getOffset() { -return subcomponent * 4 + compone

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
@@ -219,33 +223,41 @@ void SemaHLSL::ActOnFinishBuffer(Decl *Dcl, SourceLocation RBrace) { } } - if (HasPackOffset && HasNonPackOffset) hekota wrote: This is best to review with 'Hide whitespaces' https://github.com/llvm/llvm-project/pull/121989

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
https://github.com/hekota ready_for_review https://github.com/llvm/llvm-project/pull/121989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/121989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/121989 >From f68ea5a099636f840561335dcf2daaed82c7405c Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Tue, 7 Jan 2025 12:07:28 -0800 Subject: [PATCH] [HLSL][NFC] Move packoffset validation to separate function and ca

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

2025-01-07 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/121989 There will be more changes coming in to `SemaHLSL::ActOnFinishBuffer` so it would be good to move the packoffset validation out to a separate function. This PR also unifies the units for cbuffer offset calculati

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Helena Kotas via cfe-commits
https://github.com/hekota converted_to_draft https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add Load(int) method on structured buffers (PR #120663)

2024-12-20 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/120663 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add Load(int) method on structured buffers (PR #120663)

2024-12-19 Thread Helena Kotas via cfe-commits
https://github.com/hekota ready_for_review https://github.com/llvm/llvm-project/pull/120663 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add Load(int) method on structured buffers (PR #120663)

2024-12-19 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/120663 Adds `T Load(int)` method on `StructuredBuffer`, `RWStructuredBuffer` and `RasterizerOrderedStructuredBuffer`. Uses the existing `addLoadMethods` in HLSLExternalSemalSource so most of this change is just tests.

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-19 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/119755 >From 8cebb59304a1f893d94f2a758bc47a62f27c1b8b Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Thu, 12 Dec 2024 11:37:46 -0800 Subject: [PATCH 1/4] [HLSL] Codegen for simple `cbuffer` blocks without embedded a

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-19 Thread Helena Kotas via cfe-commits
https://github.com/hekota ready_for_review https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-19 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/119755 >From 8cebb59304a1f893d94f2a758bc47a62f27c1b8b Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Thu, 12 Dec 2024 11:37:46 -0800 Subject: [PATCH 1/3] [HLSL] Codegen for simple `cbuffer` blocks without embedded a

[clang] Add concepts for Structured buffers (PR #119643)

2024-12-19 Thread Helena Kotas via cfe-commits
https://github.com/hekota approved this pull request. LGTM! Please add [HLSL] to the title. https://github.com/llvm/llvm-project/pull/119643 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] Add concepts for Structured buffers (PR #119643)

2024-12-19 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_structured_resource_element_compatible %s | FileCheck %s + +// CHECK: ConceptDecl 0x{{[0-9a-f]+}} <> __is_structured_resource_element_compatible +// CHECK: |-Temp

[clang] Add concepts for Structured buffers (PR #119643)

2024-12-19 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_structured_resource_element_compatible %s | FileCheck %s + +// CHECK: ConceptDecl 0x{{[0-9a-f]+}} <> __is_structured_resource_element_compatible +// CHECK: |-Temp

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-17 Thread Helena Kotas via cfe-commits
https://github.com/hekota converted_to_draft https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Fix static analyzer concerns (PR #120090)

2024-12-17 Thread Helena Kotas via cfe-commits
hekota wrote: Thank you @Fznamznon ! https://github.com/llvm/llvm-project/pull/120090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-17 Thread Helena Kotas via cfe-commits
@@ -54,69 +54,110 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { StringRef Key = "dx.disable_optimizations";

[clang] Add concepts for raw buffers (PR #119643)

2024-12-13 Thread Helena Kotas via cfe-commits
@@ -868,8 +868,54 @@ static Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, return TypedResExpr; } -static ConceptDecl *constructTypedBufferConceptDecl(Sema &S, -NamespaceDecl *NSD) { +static Expr

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-13 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-13 Thread Helena Kotas via cfe-commits
@@ -164,18 +164,18 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } -// Calculate the size of a legacy cbuffer type based on +// Calculate the size of a legacy cbuffer type in bytes based on // https://learn.microsoft.com/en-us/window

[clang] [HLSL] Codegen for `cbuffer` blocks without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/119755 >From 8cebb59304a1f893d94f2a758bc47a62f27c1b8b Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Thu, 12 Dec 2024 11:37:46 -0800 Subject: [PATCH 1/2] [HLSL] Codegen for simple `cbuffer` blocks without embedded a

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Codegen for `cbuffer` blocks without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
https://github.com/hekota ready_for_review https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Codegen for `cbuffer` blocks without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
@@ -1,26 +0,0 @@ -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: dxil-pc-shadermodel6.3-library %s \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s - -// CHECK: @[[CB:.+]] = external constant { float, double } -cbuffer A : register(b0, spa

[clang] [HLSL] Codegen for `cbuffer` blocks without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
@@ -54,69 +54,110 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { hekota wrote: Intentional wh

[clang] [HLSL] Codegen for `cbuffer` blocks without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
@@ -164,18 +164,18 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } -// Calculate the size of a legacy cbuffer type based on +// Calculate the size of a legacy cbuffer type in bytes based on hekota wrote: Cbuffer & pac

[clang] [HLSL] Codegen for `cbuffer` blocks without embedded arrays or structs (PR #119755)

2024-12-12 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/119755 Introduces translations of `cbuffer` to LLVM target type `target("dx.CBuffer", ...) `. At this point only `cbuffer`s containing scalars and vectors are supported as we are still working on the target type design

[clang] [HLSL] Move `_init_resource_bindings` to entry point functions (PR #119311)

2024-12-11 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/119311 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Move `_init_resource_bindings` to entry point functions (PR #119311)

2024-12-11 Thread Helena Kotas via cfe-commits
hekota wrote: You are correct @llvm-beanz, this change is not needed at all. Sorry for wasting your time! https://github.com/llvm/llvm-project/pull/119311 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [HLSL] Move `_init_resource_bindings` to entry point functions (PR #119311)

2024-12-10 Thread Helena Kotas via cfe-commits
hekota wrote: > Is this the right solution, or should we be doing something to force the > constructor function to be generated? I'm a little worried that we have one > path for initializing some types of globals and a different approach for > other globals. I'll see if I can move creation of

[clang] [HLSL] Move `_init_resource_bindings` to entry point functions (PR #119311)

2024-12-10 Thread Helena Kotas via cfe-commits
https://github.com/hekota converted_to_draft https://github.com/llvm/llvm-project/pull/119311 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement `Append` and `Consume` methods on `Append`/`ConsumeStructuredBuffer` (PR #118536)

2024-12-09 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/118536 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Do not print details in IR for target extension types (PR #115971)

2024-12-09 Thread Helena Kotas via cfe-commits
hekota wrote: LGTM! https://github.com/llvm/llvm-project/pull/115971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add ByteAddressBuffer, RWByteAddressBuffer and RasterizerOrderedByteAddressBuffer definitions to HLSLExternalSemaSource #113477 (PR #116699)

2024-12-06 Thread Helena Kotas via cfe-commits
https://github.com/hekota approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/116699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add ByteAddressBuffer, RWByteAddressBuffer and RasterizerOrderedByteAddressBuffer definitions to HLSLExternalSemaSource #113477 (PR #116699)

2024-12-04 Thread Helena Kotas via cfe-commits
@@ -540,10 +555,10 @@ struct BuiltinTypeMethodBuilder { // create method decl auto *TSInfo = AST.getTrivialTypeSourceInfo(MethodTy, SourceLocation()); -Method = -CXXMethodDecl::Create(AST, DeclBuilder.Record, SourceLocation(), -

[clang] [HLSL] Implement `Append` and `Consume` methods on `Append`/`ConsumeStructuredBuffer` (PR #118536)

2024-12-04 Thread Helena Kotas via cfe-commits
https://github.com/hekota updated https://github.com/llvm/llvm-project/pull/118536 >From 97391c97c16029e2a3376ff2938ebc7e94393149 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Tue, 3 Dec 2024 11:13:47 -0800 Subject: [PATCH 1/2] [HLSL] Add Append and Consume methods on Append/ConsumeStructu

[clang] [HLSL] Implement `Append` and `Consume` methods on `Append`/`ConsumeStructuredBuffer` (PR #118536)

2024-12-04 Thread Helena Kotas via cfe-commits
@@ -674,6 +700,34 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name, .finalizeMethod(); } +BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() { + using PH = BuiltinTypeMethodBuilder::PlaceHolder; + ASTContext &AST = SemaRef.getAST

[clang] [HLSL] Implement `Append` and `Consume` methods on `Append`/`ConsumeStructuredBuffer` (PR #118536)

2024-12-04 Thread Helena Kotas via cfe-commits
@@ -674,6 +700,34 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name, .finalizeMethod(); } +BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() { + using PH = BuiltinTypeMethodBuilder::PlaceHolder; + ASTContext &AST = SemaRef.getAST

[clang] [HLSL] Implement `Append` and `Consume` methods on `Append`/`ConsumeStructuredBuffer` (PR #118536)

2024-12-03 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/118536 The methods are using existing clang builtins `__builtin_hlsl_buffer_update_counter` and `__builtin_hlsl_resource_getpointer` to update the buffer counter and then load or store the value. Fixes #112968 >From

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

2024-11-27 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/116699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-27 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL +// RUN-DISABLED: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s

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

2024-11-27 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,49 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \ hekota wrote: Since the test now covers multiple buffers please rename it to ByteAddressBuffer**s**-AST.hlsl and update the PR title and description. https:

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-26 Thread Helena Kotas via cfe-commits
https://github.com/hekota approved this pull request. https://github.com/llvm/llvm-project/pull/117017 ___ 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 Helena Kotas via cfe-commits
@@ -502,7 +520,10 @@ struct BuiltinTypeMethodBuilder { HLSLParamModifierAttr::Spelling Modifier = HLSLParamModifierAttr::Keyword_in) { assert(Method == nullptr && "Cannot add param, method already

[clang] [HLSL][NFC] Refactor resource buffers AST tests (PR #117659)

2024-11-26 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/117659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Refactor resource buffers AST tests (PR #117659)

2024-11-25 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/117659 This is a test-only change. This PR merges 5 tests for structured buffers ASTs into one file with multiple run lines and check prefixes because these tests have a lot of common output. It also renames RWBuffer-A

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-25 Thread Helena Kotas via cfe-commits
@@ -343,27 +336,224 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #117608)

2024-11-25 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/117608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-25 Thread Helena Kotas via cfe-commits
@@ -271,53 +246,70 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; hekota wrote: Yeah, it would probably work fine too, if default value `ValueTy()` just means `nullptr` when

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #117608)

2024-11-25 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/117608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-25 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #117608)

2024-11-25 Thread Helena Kotas via cfe-commits
hekota wrote: [First version](llvm/llvm-project#114148) of this PR was reverted because of build break. https://github.com/llvm/llvm-project/pull/117608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [llvm] Revert "[HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (#114148)" (PR #117448)

2024-11-23 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/117448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Revert "[HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (#114148)" (PR #117448)

2024-11-23 Thread Helena Kotas via cfe-commits
https://github.com/hekota created https://github.com/llvm/llvm-project/pull/117448 This reverts commit 94bde8cdc39ff7e9c59ee0cd5edda882955242aa. >From 4edec79a02e7d32fe16e257f6151669a2f009d85 Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Sat, 23 Nov 2024 11:43:29 -0800 Subject: [PATCH] Rev

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-23 Thread Helena Kotas via cfe-commits
https://github.com/hekota closed https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-22 Thread Helena Kotas via cfe-commits
@@ -67,6 +67,7 @@ struct BuiltinTypeDeclBuilder { Record = CXXRecordDecl::Create(AST, TagDecl::TagKind::Class, HLSLNamespace, SourceLocation(), SourceLocation(), &II, PrevDecl, true); +Record->startDe

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

2024-11-22 Thread Helena Kotas via cfe-commits
@@ -1474,6 +1474,11 @@ DeclContext *DeclContext::getPrimaryContext() { case Decl::ObjCCategoryImpl: return this; + case Decl::CXXRecord: +if (auto *OPD = dyn_cast(this)) + if (auto *Def = OPD->getDefinition()) +return Def; +return this; default:

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-22 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/117017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-22 Thread Helena Kotas via cfe-commits
@@ -2,36 +2,36 @@ // RUN: %clang_cc1 -triple spirv-pc-vulkan-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s -check-prefixes=SPIRV // NOTE: The type name number and whether the struct is packed or not will mostly -// likely change once s

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-22 Thread Helena Kotas via cfe-commits
@@ -12487,6 +12487,7 @@ def err_hlsl_pointers_unsupported : Error< "%select{pointers|references}0 are unsupported in HLSL">; def err_hlsl_missing_resource_class : Error<"HLSL resource needs to have [[hlsl::resource_class()]] attribute">; def err_hlsl_attribute_needs_intangib

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

2024-11-21 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/116699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -1474,6 +1474,11 @@ DeclContext *DeclContext::getPrimaryContext() { case Decl::ObjCCategoryImpl: return this; + case Decl::CXXRecord: +if (auto *OPD = dyn_cast(this)) + if (auto *Def = OPD->getDefinition()) +return Def; +return this; default:

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -2,36 +2,36 @@ // RUN: %clang_cc1 -triple spirv-pc-vulkan-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s -check-prefixes=SPIRV // NOTE: The type name number and whether the struct is packed or not will mostly -// likely change once s

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/117017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -12487,6 +12487,7 @@ def err_hlsl_pointers_unsupported : Error< "%select{pointers|references}0 are unsupported in HLSL">; def err_hlsl_missing_resource_class : Error<"HLSL resource needs to have [[hlsl::resource_class()]] attribute">; def err_hlsl_attribute_needs_intangib

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -1,28 +1,28 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s -check-prefixes=DXIL // NOTE: The number in type name and whether the struct is packed or not will mostly -// likely cha

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
https://github.com/hekota approved this pull request. Few nits, otherwise LGTM! https://github.com/llvm/llvm-project/pull/117017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -4738,6 +4738,12 @@ def GetDeviceSideMangledName : LangBuiltin<"CUDA_LANG"> { } // HLSL +def HLSLTypedBufferPointer : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_resource_getpointer"]; hekota wrote: Is this for all buffer types or just t

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -1,22 +1,22 @@ // 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 ope

[clang] [HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (PR #117017)

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -1,22 +1,22 @@ // 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 ope

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

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -531,6 +531,16 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { .addArraySubscriptOperators() .completeDefinition(); }); + + Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "ByteAddressBuffer") + .Record; + on

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

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump %s | FileCheck %s + hekota wrote: FYI, we ar

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

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -1474,6 +1474,11 @@ DeclContext *DeclContext::getPrimaryContext() { case Decl::ObjCCategoryImpl: return this; + case Decl::CXXRecord: +if (auto *OPD = dyn_cast(this)) + if (auto *Def = OPD->getDefinition()) +return Def; +return this; default:

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

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -531,6 +531,16 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { .addArraySubscriptOperators() .completeDefinition(); }); + + Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "ByteAddressBuffer") + .Record; + on

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

2024-11-21 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL hekota wrote: Rename to ByteAddressBuffer**s**-constructor**s**.hlsl - test cases for oth

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Add `Increment`/`DecrementCounter` methods to structured buffers (PR #114148)

2024-11-14 Thread Helena Kotas via cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   6   7   >