[clang] [llvm] [HLSL] Add list of exported functions as named metadata node `dx.exports` (PR #102275)

2024-08-07 Thread Helena Kotas via cfe-commits
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 '

[clang] [llvm] [HLSL] Mark exported functions with "hlsl.export" attribute (PR #102275)

2024-08-07 Thread Helena Kotas via 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

[clang] [llvm] [HLSL] Mark exported functions with "hlsl.export" attribute (PR #102275)

2024-08-07 Thread Helena Kotas via 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

[clang] [llvm] [HLSL] Mark exported functions with "hlsl.export" attribute (PR #102275)

2024-08-07 Thread Helena Kotas via 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

[clang] [llvm] [HLSL] Mark exported functions with "hlsl.export" attribute (PR #102275)

2024-08-07 Thread Helena Kotas via 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

[clang] [DirectX] Add DirectXTargetCodeGenInfo (PR #104856)

2024-08-19 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Implement '__builtin_hlsl_is_intangible' type trait (PR #104544)

2024-08-19 Thread Helena Kotas via cfe-commits
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/

[clang] [DirectX] Add DirectXTargetCodeGenInfo (PR #104856)

2024-08-21 Thread Helena Kotas via cfe-commits
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

[clang] [DirectX] Add DirectXTargetCodeGenInfo (PR #104856)

2024-08-21 Thread Helena Kotas via cfe-commits
@@ -0,0 +1,54 @@ +//===- DirectX.cpp +//---===// hekota wrote: Oops ;) https://github.com/llvm/llvm-project/pull/104856 ___ cfe-commits mailing list cfe-commits@l

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

2024-08-22 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-08-22 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-08-22 Thread Helena Kotas via cfe-commits
@@ -503,9 +503,11 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "RWBuffer") .addSimpleTemplateParams(*SemaPtr, {"element_type"}) .Record; + onCompletion(Decl, [th

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

2024-08-22 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-08-22 Thread Helena Kotas via 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 {

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

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

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

2024-08-22 Thread Helena Kotas via 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 {

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

2024-08-22 Thread Helena Kotas via 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 {

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

2024-08-22 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-08-22 Thread Helena Kotas via 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 {

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

2024-08-22 Thread Helena Kotas via 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 {

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

2024-08-22 Thread Helena Kotas via 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 {

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

2024-08-22 Thread Helena Kotas via 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 {

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

2024-08-22 Thread Helena Kotas via 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

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

2024-08-22 Thread Helena Kotas via 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

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

2024-08-22 Thread Helena Kotas via 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

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

2024-08-23 Thread Helena Kotas via 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 {

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

2024-08-23 Thread Helena Kotas via 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 {

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

2024-08-23 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-26 Thread Helena Kotas via 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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-26 Thread Helena Kotas via cfe-commits
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/

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Helena Kotas via cfe-commits
@@ -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;

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Helena Kotas via cfe-commits
@@ -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

[clang] [HLSL] Implement `export` keyword (PR #96823)

2024-06-27 Thread Helena Kotas via cfe-commits
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/

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

2024-09-12 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via 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

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

2024-09-12 Thread Helena Kotas via 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/5] [HLSL] Add `[[hlsl::row_access]]` attribute This PR introduces

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

2024-09-12 Thread Helena Kotas via 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

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

2024-09-12 Thread Helena Kotas via 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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via 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

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

2024-09-12 Thread Helena Kotas via 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/6] [HLSL] Add `[[hlsl::row_access]]` attribute This PR introduces

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via cfe-commits
@@ -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, -

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via 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/4] [HLSL] Add `[[hlsl::contained_type()]]` resource type attribu

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

2024-09-12 Thread Helena Kotas via 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/7] [HLSL] Add `[[hlsl::row_access]]` attribute This PR introduces

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

2024-09-12 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via 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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via cfe-commits
@@ -563,18 +566,23 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } -bool clang::CreateHLSLAttributedResourceType(Sema &S, QualType Wrapped, - ArrayRef AttrList, -

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-12 Thread Helena Kotas via 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/5] [HLSL] Add `[[hlsl::contained_type()]]` resource type attribu

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

2024-09-16 Thread Helena Kotas via cfe-commits
@@ -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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-16 Thread Helena Kotas via cfe-commits
@@ -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 *

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-16 Thread Helena Kotas via cfe-commits
@@ -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 *

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-16 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-16 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL] Add `[[hlsl::contained_type()]]` attribute (PR #108456)

2024-09-16 Thread Helena Kotas via 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

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

2024-09-16 Thread Helena Kotas via 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

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

2024-09-16 Thread Helena Kotas via 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/9] [HLSL] Add `[[hlsl::row_access]]` attribute This PR introduces

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

2024-09-16 Thread Helena Kotas via cfe-commits
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

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

2024-09-16 Thread Helena Kotas via 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

[clang] [HLSL][NFC] Remove RegisterBindingFlags struct (PR #108924)

2024-09-16 Thread Helena Kotas via cfe-commits
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

[clang] [HLSL][NFC] Remove RegisterBindingFlags struct (PR #108924)

2024-09-16 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-10-07 Thread Helena Kotas via cfe-commits
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

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

2024-10-07 Thread Helena Kotas via 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

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

2024-10-08 Thread Helena Kotas via 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

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

2024-10-08 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-10-08 Thread Helena Kotas via cfe-commits
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

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

2024-10-08 Thread Helena Kotas via 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

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

2024-10-08 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-10-10 Thread Helena Kotas via 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/4] [HLSL] Collect explicit resource binding information (part 1)

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

2024-10-09 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-10-11 Thread Helena Kotas via 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/9] Add codegen for existing resource types and make HLSLAttribut

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-11 Thread Helena Kotas via cfe-commits
@@ -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

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

2024-10-04 Thread Helena Kotas via cfe-commits
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

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

2024-10-04 Thread Helena Kotas via 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

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

2024-10-04 Thread Helena Kotas via 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

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

2024-10-04 Thread Helena Kotas via 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

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

2024-10-04 Thread Helena Kotas via 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)

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

2024-10-04 Thread Helena Kotas via cfe-commits
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

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

2024-09-29 Thread Helena Kotas via cfe-commits
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

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

2024-09-29 Thread Helena Kotas via 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

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

2024-10-15 Thread Helena Kotas via 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/5] [HLSL] Collect explicit resource binding information (part 1)

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

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

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

2024-10-15 Thread Helena Kotas via 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

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

2024-10-15 Thread Helena Kotas via 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

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

2024-10-15 Thread Helena Kotas via 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

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

2024-10-15 Thread Helena Kotas via cfe-commits
@@ -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

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

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

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

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

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

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

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

2024-10-21 Thread Helena Kotas via cfe-commits
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

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

2024-10-16 Thread Helena Kotas via cfe-commits
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

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

2024-10-16 Thread Helena Kotas via 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

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

2024-10-16 Thread Helena Kotas via cfe-commits
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:

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

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

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

2024-10-16 Thread Helena Kotas via cfe-commits
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

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

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

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

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

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

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

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

2024-10-16 Thread Helena Kotas via 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/7] [HLSL] Collect explicit resource binding information (part 1)

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

2024-10-16 Thread Helena Kotas via cfe-commits
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

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

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

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

2024-10-16 Thread Helena Kotas via 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

<    1   2   3   4   5   6   7   8   9   >