https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/102275
>From 340834e9c1ea12c8de4ee9f5a6b7c0191e96f489 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Tue, 6 Aug 2024 23:19:20 -0700
Subject: [PATCH 1/4] [HLSL] Add list of exported functions as named metadata
node '
https://github.com/hekota edited
https://github.com/llvm/llvm-project/pull/102275
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota edited
https://github.com/llvm/llvm-project/pull/102275
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota edited
https://github.com/llvm/llvm-project/pull/102275
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,19 @@
+; RUN: opt -S -dxil-metadata-emit %s | FileCheck %s
+
+target triple = "dxilv1.3-unknown-shadermodel6.3-library"
+
+define void @"?f1@@YAXXZ"() #0 {
+entry:
+ ret void
+}
+
+define void @"?f2@MyNamespace@@YAXXZ"() #0 {
+entry:
+ ret void
+}
+
h
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/104856
Adds target codegen info class for DirectX. For now it always translates
`__hlsl_resource_t` handle to `target("dx.TypedBuffer", i32, 1, 0, 1)`
(`RWBuffer`). More work is needed to determine the actual target ex
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/104544
>From 6d5f8991a4ef9e79bc1bed30addf7b29b7ed0d2e Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Thu, 15 Aug 2024 19:03:29 -0700
Subject: [PATCH 1/8] Implement `__builtin_is_intangible`
---
clang/include/clang/
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/104856
>From 44e814b925a1ad8ac40fe6904542cbade516c065 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 19 Aug 2024 13:34:13 -0700
Subject: [PATCH 1/3] [DirectX] Add DirectXTargetCodeGenInfo
Adds TargetCodeGenInfo
@@ -0,0 +1,54 @@
+//===- DirectX.cpp
+//---===//
hekota wrote:
Oops ;)
https://github.com/llvm/llvm-project/pull/104856
___
cfe-commits mailing list
cfe-commits@l
@@ -1547,6 +1547,9 @@ def DXILValidation : DiagGroup<"dxil-validation">;
// Warning for HLSL API availability
def HLSLAvailability : DiagGroup<"hlsl-availability">;
+// Warnings for legacy binding behavior
+def DisallowLegacyBindingRules : DiagGroup<"disallow-legacy-binding-ru
@@ -12342,7 +12342,13 @@ def err_hlsl_missing_semantic_annotation : Error<
def err_hlsl_init_priority_unsupported : Error<
"initializer priorities are not supported in HLSL">;
-def err_hlsl_unsupported_register_type : Error<"invalid resource class
specifier '%0' used; expec
@@ -503,9 +503,11 @@ void
HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "RWBuffer")
.addSimpleTemplateParams(*SemaPtr, {"element_type"})
.Record;
+
onCompletion(Decl, [th
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o -
-fsyntax-only %s -verify
+
+struct MySRV {
+ [[hlsl::resource_class(SRV)]] int x;
+};
+
+struct MySampler {
+ [[hlsl::resource_class(Sampler)]] int x;
+};
+
+struct MyUAV {
+ [[hlsl::reso
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -551,24 +541,21 @@ getHLSLResourceAttrFromEitherDecl(VarDecl *VD,
// the resource attr could be on the record decl itself or on one of
// its fields (the resource handle, most commonly)
-const auto *Attr = TheRecordDecl->getAttr();
+const auto *Attr = TheRec
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o -
-fsyntax-only %s -verify
+
+struct MySRV {
+ [[hlsl::resource_class(SRV)]] int x;
+};
+
+struct MySampler {
+ [[hlsl::resource_class(Sampler)]] int x;
+};
+
+struct MyUAV {
+ [[hlsl::reso
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/97103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/97103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota edited https://github.com/llvm/llvm-project/pull/97103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
@@ -459,7 +467,412 @@ void SemaHLSL::handleResourceClassAttr(Decl *D, const
ParsedAttr &AL) {
D->addAttr(HLSLResourceClassAttr::Create(getASTContext(), RC, ArgLoc));
}
-void SemaHLSL::handleResourceBindingAttr(Decl *D, const ParsedAttr &AL) {
+struct RegisterBindingFlags {
https://github.com/hekota approved this pull request.
https://github.com/llvm/llvm-project/pull/97103
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/96823
Implements `export` keyword in HLSL.
There are two ways the `export` keyword can be used:
1. On individual function declarations
```
export void f() {}
```
2. On a group of function declaration:
```
export {
vo
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/96823
>From b67ecd20cc2c11f4f99c2d90c95fdbd988659947 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Wed, 26 Jun 2024 12:31:39 -0700
Subject: [PATCH 1/2] [HLSL] Implement `export` keyword
Fixes #92812
---
.../clang/
@@ -851,6 +851,21 @@ Decl *Sema::ActOnStartExportDecl(Scope *S, SourceLocation
ExportLoc,
CurContext->addDecl(D);
PushDeclContext(S, D);
+ if (getLangOpts().HLSL) {
+// exported functions cannot be in an unnamed namespace
+for (const DeclContext *DC = CurContext;
@@ -924,6 +939,23 @@ static bool checkExportedDeclContext(Sema &S, DeclContext
*DC,
/// Check that it's valid to export \p D.
static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) {
+ // HLSL: export declaration is valid only on functions
+ if (S.getLan
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/96823
>From b67ecd20cc2c11f4f99c2d90c95fdbd988659947 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Wed, 26 Jun 2024 12:31:39 -0700
Subject: [PATCH 1/3] [HLSL] Implement `export` keyword
Fixes #92812
---
.../clang/
https://github.com/hekota converted_to_draft
https://github.com/llvm/llvm-project/pull/107954
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/108456
Introducing a new HLSL resource type attribute `[[contained_type(T)]]` which
describes the "contained type" of a buffer or resource type. Specifically, the
attribute will be used on the resource handle in templa
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/107954
>From 1c66d2767ca20f42b6edaae834cc186be7d23712 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 9 Sep 2024 19:39:02 -0700
Subject: [PATCH 1/5] [HLSL] Add `[[hlsl::row_access]]` attribute
This PR introduces
https://github.com/hekota edited
https://github.com/llvm/llvm-project/pull/107954
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota edited
https://github.com/llvm/llvm-project/pull/107954
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/108456
>From 9906af110af550643d816b1ed729c19e16027288 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Tue, 10 Sep 2024 14:38:19 -0700
Subject: [PATCH 1/3] [HLSL] Add `[[hlsl::contained_type()]]` resource type
attribu
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/107954
>From 1c66d2767ca20f42b6edaae834cc186be7d23712 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 9 Sep 2024 19:39:02 -0700
Subject: [PATCH 1/6] [HLSL] Add `[[hlsl::row_access]]` attribute
This PR introduces
@@ -30,9 +31,9 @@ class Scope;
// FIXME: This can be hidden (as static function in SemaHLSL.cpp) once we no
// longer need to create builtin buffer types in HLSLExternalSemaSource.
-bool CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped,
-
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/108456
>From 9906af110af550643d816b1ed729c19e16027288 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Tue, 10 Sep 2024 14:38:19 -0700
Subject: [PATCH 1/4] [HLSL] Add `[[hlsl::contained_type()]]` resource type
attribu
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/107954
>From 1c66d2767ca20f42b6edaae834cc186be7d23712 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 9 Sep 2024 19:39:02 -0700
Subject: [PATCH 1/7] [HLSL] Add `[[hlsl::row_access]]` attribute
This PR introduces
https://github.com/hekota ready_for_review
https://github.com/llvm/llvm-project/pull/107954
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -114,19 +115,30 @@ struct BuiltinTypeDeclBuilder {
AccessSpecifier Access = AccessSpecifier::AS_private) {
if (Record->isCompleteDefinition())
return *this;
+
+TypeSourceInfo *ElementTypeTSI = nullptr;
+
QualType Ty = Record->getASTContex
@@ -563,18 +566,23 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr
&AL) {
D->addAttr(NewAttr);
}
-bool clang::CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped,
- ArrayRef AttrList,
-
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/108456
>From 9906af110af550643d816b1ed729c19e16027288 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Tue, 10 Sep 2024 14:38:19 -0700
Subject: [PATCH 1/5] [HLSL] Add `[[hlsl::contained_type()]]` resource type
attribu
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o
- %s | FileCheck %s
hekota wrote:
Yep, that would be `clang/test/ParserHLSL/hlsl_resource_handle_attrs.hlsl`.
https://github.com/llvm/llvm-project/pull/107954
@@ -30,15 +29,15 @@ 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)]]':'element_type *
@@ -30,15 +29,15 @@ 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)]]':'element_type *
hekota wrote:
> Why the name is contained_type instead of element_type?
I am not sure if the name was discussed but `contained_type` seems a bit more
general than `element_type`. We can always change it as we iron out details of
other resources type like textures or samplers, and change it if
https://github.com/hekota closed
https://github.com/llvm/llvm-project/pull/108456
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota edited
https://github.com/llvm/llvm-project/pull/108456
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/107954
>From 1c66d2767ca20f42b6edaae834cc186be7d23712 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 9 Sep 2024 19:39:02 -0700
Subject: [PATCH 1/8] [HLSL] Add `[[hlsl::row_access]]` attribute
This PR introduces
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/107954
>From 1c66d2767ca20f42b6edaae834cc186be7d23712 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 9 Sep 2024 19:39:02 -0700
Subject: [PATCH 1/9] [HLSL] Add `[[hlsl::row_access]]` attribute
This PR introduces
https://github.com/hekota closed
https://github.com/llvm/llvm-project/pull/107954
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/108919
- split resource attribute checks to multiple lines
- use @LINE expressions to match line numbers
>From ef22d6e40b6c835a4a46633ba87f2053285c1b49 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Mon, 16 Sep 2024
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/108924
When diagnosing register bindings we just need to make sure there is a resource
that matches the provided register type. We can emit the diagnostics right away
instead of collecting flags in the RegisterBindingF
@@ -41,6 +41,47 @@
using namespace clang;
+enum class RegisterType { SRV, UAV, CBuffer, Sampler, C, I, Invalid };
hekota wrote:
This is moved from below.
https://github.com/llvm/llvm-project/pull/108924
___
cfe-co
https://github.com/hekota converted_to_draft
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
https://github.com/hekota converted_to_draft
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
@@ -3437,6 +3437,9 @@ static void encodeTypeForFunctionPointerAuth(const
ASTContext &Ctx,
OS << II->getLength() << II->getName();
return;
}
+ case Type::HLSLAttributedResource:
hekota wrote:
The other "should never get here"' is in a different swit
@@ -13672,6 +13690,9 @@ static QualType getCommonNonSugarTypeNode(ASTContext
&Ctx, const Type *X,
TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
getCommonDecl(TX->getDecl(), TY->getDecl()));
}
+ case Type::HLSLAttributedResource: {
h
https://github.com/hekota approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/111439
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/110327
>From 4f235c0e9c539cdaa2bab9a7f8228f33c0fea2b8 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Thu, 26 Sep 2024 14:34:16 -0700
Subject: [PATCH 1/7] Add codegen for existing resource types and make
HLSLAttribut
@@ -32,6 +32,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CRC.h"
+#include "llvm/Support/DXILABI.h"
hekota wrote:
Nope :)
https://github.com/llvm/llvm-project/pull/110327
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/111203
>From f545a14e11556c91d10b14617e3588fe5eae6d42 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Fri, 4 Oct 2024 12:21:51 -0700
Subject: [PATCH 1/4] [HLSL] Collect explicit resource binding information
(part 1)
@@ -985,44 +983,43 @@ 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 *T
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/110327
>From 4f235c0e9c539cdaa2bab9a7f8228f33c0fea2b8 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Thu, 26 Sep 2024 14:34:16 -0700
Subject: [PATCH 1/9] Add codegen for existing resource types and make
HLSLAttribut
@@ -0,0 +1,222 @@
+; RUN: opt -S -dxil-finalize-linkage
-mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s
+; RUN: llc %s --filetype=asm -o - | FileCheck %s
hekota wrote:
Shouldn't the exported functions stay in the module when it is compiled as a
l
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/111207
Adds `@_init_resource_bindings()` function to module initialization that
includes `handle.fromBinding` intrinsic calls for simple resource declarations.
Arrays of resources or resources inside user defined types
https://github.com/hekota converted_to_draft
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
https://github.com/hekota ready_for_review
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
https://github.com/hekota ready_for_review
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
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/111203
>From f545a14e11556c91d10b14617e3588fe5eae6d42 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Fri, 4 Oct 2024 12:21:51 -0700
Subject: [PATCH 1/2] [HLSL] Collect explicit resource binding information
(part 1)
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/111203
Adds fields to `HLSLResourceBindingAttr` to store processed binding
information. This will be used by CodeGen or Sema for resource initialization
or overlapping mapping diagnostic.
Moves binding checks for user
https://github.com/hekota closed
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
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/110079
>From 970aab0a930e38dfd266c01065112602bb274a5e Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Wed, 25 Sep 2024 15:48:18 -0700
Subject: [PATCH 1/5] [HLSL] Allow resource type attributes only on
__hlsl_resource
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/111203
>From f545a14e11556c91d10b14617e3588fe5eae6d42 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Fri, 4 Oct 2024 12:21:51 -0700
Subject: [PATCH 1/5] [HLSL] Collect explicit resource binding information
(part 1)
@@ -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
https://github.com/hekota 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
https://github.com/hekota 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
@@ -102,6 +152,15 @@ class SemaHLSL : public SemaBase {
llvm::DenseMap
LocsForHLSLAttributedResources;
+
+ // List of all resource bindings
+ ResourceBindings Bindings;
+
+private:
+ void FindResourcesOnVarDecl(VarDecl *D);
+ void FindResourcesOnUserRecordDecl(const
@@ -2235,3 +2280,107 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) {
Ty.addRestrict();
return Ty;
}
+
+void SemaHLSL::ActOnVariableDeclarator(VarDecl *VD) {
+ if (VD->hasGlobalStorage()) {
+// make sure the declaration has a complete type
+if (SemaRef.Re
@@ -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())
@@ -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
@@ -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
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/113206
Moves `IsIntangibleType` from SemaHLSL to Type class and renames it to
`isHLSLIntangibleType`. The existing `isHLSLIntangibleType` is renamed to
`isHLSLBuiltinIntangibleType` and updated to return true only for
https://github.com/hekota closed
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
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/111207
>From a13f62d2b5cf1bd1ee7016fce5e0fd95531bf7a2 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Fri, 4 Oct 2024 13:19:27 -0700
Subject: [PATCH 1/4] [HLSL] Add handle initialization for simple resource
declarati
https://github.com/hekota created
https://github.com/llvm/llvm-project/pull/112661
Follow-up for
https://github.com/llvm/llvm-project/pull/111203#pullrequestreview-2373679837.
>From a541abfbda23c9e8b2d2959bf319b8319757af6b Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Wed, 16 Oct 2024 21:
@@ -110,6 +110,19 @@ DeclBindingInfo
*ResourceBindings::addDeclBindingInfo(const VarDecl *VD,
ResourceClass ResClass) {
assert(getDeclBindingInfo(VD, ResClass) == nullptr &&
"DeclBindingInfo already added");
+#if
https://github.com/hekota ready_for_review
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
@@ -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
@@ -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
@@ -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
https://github.com/hekota updated
https://github.com/llvm/llvm-project/pull/111203
>From f545a14e11556c91d10b14617e3588fe5eae6d42 Mon Sep 17 00:00:00 2001
From: Helena Kotas
Date: Fri, 4 Oct 2024 12:21:51 -0700
Subject: [PATCH 1/7] [HLSL] Collect explicit resource binding information
(part 1)
hekota wrote:
> If there's no test coverage that exercises this case then it might be better
> to remove the if guard so that it doesn't accidentally mask some other
> problem we weren't expecting.
The `if (!DBI)` case gets hit when parsing line 112 here where the user defined
type `Eg12` has
@@ -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 *
https://github.com/hekota 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
301 - 400 of 890 matches
Mail list logo