[clang] Add Chris as the HLSL maintainer (PR #114863)

2024-11-04 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Thank you for the vote of confidence :smile: https://github.com/llvm/llvm-project/pull/114863 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] Enable matrices in HLSL (PR #111415)

2024-11-04 Thread Chris B via cfe-commits
@@ -852,34 +852,51 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) { void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) +OS <

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. I think there is actually a bigger problem with your earlier PR that we need to address. There is an inconsistency in the [design document](https://github.com/llvm/wg-hlsl/blob/main/proposals/0011-resource-element-type-valid

[clang] [Clang][SYCL] Introduce clang-sycl-linker to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz dismissed https://github.com/llvm/llvm-project/pull/112245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-08 Thread Chris B via cfe-commits
@@ -323,30 +324,127 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename *

[clang] [Clang][perf-training] Do build of libLLVMSupport for perf training (PR #111625)

2024-11-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Love it! https://github.com/llvm/llvm-project/pull/111625 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-08 Thread Chris B via cfe-commits
@@ -1,109 +1,28 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s // expected-no-diagnostics -struct oneInt { -int i; -}; - -struct twoInt { - int aa; - int ab; -}; - -struct threeInts { - oneInt o; -

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-08 Thread Chris B via cfe-commits
@@ -2200,47 +2200,43 @@ static void BuildFlattenedTypeList(QualType BaseTy, } bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) { - if (QT.isNull()) + // null and array types are not allowed. + if (QT.isNull() || QT->isArrayType()) return false; -

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-08 Thread Chris B via cfe-commits
@@ -2200,47 +2200,43 @@ static void BuildFlattenedTypeList(QualType BaseTy, } bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) { - if (QT.isNull()) + // null and array types are not allowed. + if (QT.isNull() || QT->isArrayType()) return false; -

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-08 Thread Chris B via cfe-commits
@@ -2200,47 +2200,43 @@ static void BuildFlattenedTypeList(QualType BaseTy, } bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) { - if (QT.isNull()) + // null and array types are not allowed. + if (QT.isNull() || QT->isArrayType()) return false; -

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-08 Thread Chris B via cfe-commits
@@ -2200,47 +2200,43 @@ static void BuildFlattenedTypeList(QualType BaseTy, } bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) { - if (QT.isNull()) + // null and array types are not allowed. + if (QT.isNull() || QT->isArrayType()) return false; -

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

2024-10-31 Thread Chris B via cfe-commits
@@ -359,6 +356,176 @@ struct TemplateParameterListBuilder { return Builder; } }; + +// Builder for methods of builtin types. Allows adding methods to builtin types +// using the builder pattern like this: +// +// BuiltinTypeMethodBuilder(Sema, RecordBuilder, "MethodName

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

2024-10-31 Thread Chris B via cfe-commits
@@ -282,6 +258,23 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; +if (FD && FD->getType()->isHLSLAttributedResourceType()) llvm-beanz wrote: These should be `asserts` rat

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

2024-10-31 Thread Chris B via cfe-commits
@@ -359,6 +356,176 @@ struct TemplateParameterListBuilder { return Builder; } }; + +// Builder for methods of builtin types. Allows adding methods to builtin types +// using the builder pattern like this: +// +// BuiltinTypeMethodBuilder(Sema, RecordBuilder, "MethodName

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

2024-10-31 Thread Chris B via cfe-commits
@@ -282,6 +258,23 @@ struct BuiltinTypeDeclBuilder { return *this; } + FieldDecl *getResourceHandleField() { +FieldDecl *FD = Fields["h"]; +if (FD && FD->getType()->isHLSLAttributedResourceType()) + return FD; +return nullptr; + } + + QualType getFirs

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

2024-10-31 Thread Chris B via cfe-commits
@@ -528,8 +719,13 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { ResourceKind::TypedBuffer, /*IsROV=*/false, /*RawBuffer=*/true) .addArraySubscriptOperators() +.addIncrementCounterMethod(*SemaP

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

2024-10-31 Thread Chris B via cfe-commits
https://github.com/llvm-beanz 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-10-31 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Mostly looking good. I really like the additions to the builder API. Can you please add an AST test to verify the shape of the new AST nodes and their instantiations? https://github.com/llvm/llvm-project/pull/114148 _

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-23 Thread Chris B via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --enable-var-scope + +// CHECK-LABEL: define void {{.*}}arr_assign1 +// CHECK: [[Arr:%.*]] = alloca [2 x i32], align 4 +// CHECK: [[Arr2:%.*]] = allo

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/109323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: We either need to fix code generation so that we correctly handle modifications of the binary operator's lvalue, or we need to represent the binary operator in the AST as returning an rvalue. This code should either work following C++ rules, or fail to

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-23 Thread Chris B via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --enable-var-scope + +// CHECK-LABEL: define void {{.*}}arr_assign1 +// CHECK: [[Arr:%.*]] = alloca [2 x i32], align 4 +// CHECK: [[Arr2:%.*]] = allo

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-26 Thread Chris B via cfe-commits
@@ -401,6 +401,194 @@ void SemaHLSL::DiagnoseAttrStageMismatch( << (AllowedStages.size() != 1) << join(StageStrings, ", "); } +template +static void castVector(Sema &S, ExprResult &E, QualType &Ty, unsigned Sz) { + if (const auto *VTy = Ty->getAs()) +Ty = VTy->getE

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #110195)

2024-09-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/110195 HLSL has a different set of usual arithmetic conversions for vector types to resolve a common type for binary operator expressions. This PR implements the current spec proposal from: https://github.com/micr

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/108659 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[HLSL] Vector Usual Arithmetic Conversions" (PR #110191)

2024-09-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/110191 Reverts llvm/llvm-project#108659 >From d5ee252c6bddcd27210e3a031cef8065679c8da5 Mon Sep 17 00:00:00 2001 From: Chris B Date: Thu, 26 Sep 2024 19:34:17 -0500 Subject: [PATCH] Revert "[HLSL] Vector Usual Arith

[clang] Revert "[HLSL] Vector Usual Arithmetic Conversions" (PR #110191)

2024-09-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/110191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-28 Thread Chris B via cfe-commits
@@ -422,6 +422,55 @@ template constexpr uint asuint(T F) { return __detail::bit_cast(F); } +//===--===// +// asuint splitdouble builtins +//===---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-28 Thread Chris B via cfe-commits
@@ -438,6 +438,55 @@ template constexpr uint asuint(T F) { return __detail::bit_cast(F); } +//===--===// +// asuint splitdouble builtins +//===---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-28 Thread Chris B via cfe-commits
@@ -3,12 +3,12 @@ // Supported targets // -// RUN: %clang -target dxil-unknown-shadermodel6.2-compute %s -S -o /dev/null 2>&1 | FileCheck --allow-empty --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-vulkan-compute %s -S -o /dev/null 2>&1 | FileCheck --al

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-27 Thread Chris B via cfe-commits
@@ -0,0 +1,217 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump %s | FileCheck %s + +// CHECK-LABEL: arr_assign1 +// CHECK: CompoundStmt 0x{{[0-9a-f]+}} {{.*}} +// CHECK: DeclStmt 0x{{[0-9a-f]+}} {{.*}} +// CHECK: VarDecl [[A:0x[0-9a-f]+]] {{.*}} co

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: A few notes on the test cases, but otherwise I think this is looking good. https://github.com/llvm/llvm-project/pull/109323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #110195)

2024-09-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/110195 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-09-27 Thread Chris B via cfe-commits
@@ -0,0 +1,113 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --enable-var-scope + +// CHECK-LABEL: define void {{.*}}arr_assign1 +// CHECK: [[Arr:%.*]] = alloca [2 x i32], align 4 +// CHECK: [[Arr2:%.*]] = all

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #110195)

2024-09-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/110195 >From 4226fd6d3788396bc7515d20d46cf6f358489d3e Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 26 Sep 2024 20:06:20 -0500 Subject: [PATCH] HLSL has a different set of usual arithmetic conversions for

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #110195)

2024-09-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/110195 >From 4226fd6d3788396bc7515d20d46cf6f358489d3e Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 26 Sep 2024 20:06:20 -0500 Subject: [PATCH] HLSL has a different set of usual arithmetic conversions for

[clang] [HLSL] Use HLSLToolChain for Vulkan (PR #110306)

2024-09-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/110306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-27 Thread Chris B via cfe-commits
@@ -422,6 +422,55 @@ template constexpr uint asuint(T F) { return __detail::bit_cast(F); } +//===--===// +// asuint splitdouble builtins +//===---

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-27 Thread Chris B via cfe-commits
@@ -6,6 +6,10 @@ uint4 test_asuint_too_many_arg(float p0, float p1) { // expected-error@-1 {{no matching function for call to 'asuint'}} // expected-note@hlsl/hlsl_intrinsics.h:* {{candidate function template not viable: requires single argument 'V', but 2 arguments were pr

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-27 Thread Chris B via cfe-commits
@@ -3,12 +3,12 @@ // Supported targets // -// RUN: %clang -target dxil-unknown-shadermodel6.2-compute %s -S -o /dev/null 2>&1 | FileCheck --allow-empty --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-vulkan-compute %s -S -o /dev/null 2>&1 | FileCheck --al

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. I have concerns about a few aspects of this change. @joaosaffran, let's sync up on Monday. https://github.com/llvm/llvm-project/pull/109331 ___ cfe-commits mailing list cfe-commits@

[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

2024-09-28 Thread Chris B via cfe-commits
@@ -3,12 +3,12 @@ // Supported targets // -// RUN: %clang -target dxil-unknown-shadermodel6.2-compute %s -S -o /dev/null 2>&1 | FileCheck --allow-empty --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-vulkan-compute %s -S -o /dev/null 2>&1 | FileCheck --al

[clang] [HLSL] Make casting functions constexpr (PR #108902)

2024-09-20 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/108902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-09-20 Thread Chris B via cfe-commits
https://github.com/llvm-beanz closed https://github.com/llvm/llvm-project/pull/108894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Vector Usual Arithmetic Conversions (PR #108659)

2024-09-20 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/108659 >From 9a3660e32da5e3829d2167ae7d160e4f973a9e33 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Fri, 30 Aug 2024 18:40:43 -0500 Subject: [PATCH 1/2] [HLSL] Vector Usual Arithmetic Conversions HLSL has a d

[clang] [clang][NFC] add static for internal linkage function and extract common function to header file (PR #109436)

2024-09-20 Thread Chris B via cfe-commits
llvm-beanz wrote: I think we should separate adding the internal linkage (missing `static` keywords) from the other refactoring since they're unrelated. Adding the missing `static` keywords is all good. I'm not sure I agree with the other refactoring. https://github.com/llvm/llvm-project/pull

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

2024-09-30 Thread Chris B via cfe-commits
@@ -312,6 +312,8 @@ def err_invalid_vector_long_double_decl_spec : Error< "cannot use 'long double' with '__vector'">; def err_invalid_vector_complex_decl_spec : Error< "cannot use '_Complex' with '__vector'">; +def err_invalid_vector_size : Error< + "expected vector size

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

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

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

2024-09-30 Thread Chris B via cfe-commits
@@ -3753,6 +3754,32 @@ void MicrosoftCXXNameMangler::mangleType(const DependentBitIntType *T, Error(Range.getBegin(), "DependentBitInt type") << Range; } +void MicrosoftCXXNameMangler::mangleType(const HLSLAttributedResourceType *T, +

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

2024-09-30 Thread Chris B via cfe-commits
@@ -10506,7 +10506,9 @@ def err_second_argument_to_cwsc_not_pointer : Error< "second argument to __builtin_call_with_static_chain must be of pointer type">; def err_vector_incorrect_num_initializers : Error< - "%select{too many|too few}0 elements in vector initialization (

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

2024-09-30 Thread Chris B via cfe-commits
@@ -10506,7 +10506,9 @@ def err_second_argument_to_cwsc_not_pointer : Error< "second argument to __builtin_call_with_static_chain must be of pointer type">; def err_vector_incorrect_num_initializers : Error< - "%select{too many|too few}0 elements in vector initialization (

[clang] [HLSL] Array by-value assignment (PR #109323)

2024-10-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/109323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Treat `main` as any other function (PR #110546)

2024-09-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/110546 HLSL doesn't distinguish `main` from any other function. It does treat entry points special, but they're not required to be called `main` so we have a different attribute annotation to mark them. At the mom

[clang] [HLSL] Treat `main` as any other function (PR #110546)

2024-09-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/110546 >From c966c604e8e40ddae4e738d6048bb7f87cfeeb25 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 30 Sep 2024 13:05:09 -0500 Subject: [PATCH 1/3] [HLSL] Treat `main` as any other function HLSL doesn't

[clang] [HLSL] Treat `main` as any other function (PR #110546)

2024-09-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/110546 >From c966c604e8e40ddae4e738d6048bb7f87cfeeb25 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 30 Sep 2024 13:05:09 -0500 Subject: [PATCH 1/2] [HLSL] Treat `main` as any other function HLSL doesn't

[clang] [HLSL] Treat `main` as any other function (PR #110546)

2024-09-30 Thread Chris B via cfe-commits
llvm-beanz wrote: > There is still logic elsewhere that sets the default entry point to "main", > right? This looks right to me. Yes, and we apply the HLSLShader attribute to main and key generating the entry off that in clangCodeGen. https://github.com/llvm/llvm-project/pull/110546 _

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

2024-09-30 Thread Chris B via cfe-commits
@@ -4492,6 +4492,31 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) { mangleType(cast(T)); } +void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) { llvm-beanz wrote: I assume the intent is that we're mangling this as a vend

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-07 Thread Chris B via cfe-commits
llvm-beanz wrote: > Correct, I'll edit the spec to reflect this more clearly. I've removed most > of the struct tests. I don't think that solves this problem. The code as implemented doesn't match what it should be doing. You shouldn't need to build the flattened type list if only vectors and

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Why is this a clang-based tool? Other than using clang/Basic to get the clang version (which could also be retrieved from LLVM), this doesn't seem to have any dependencies on Clang. As I'm seeing the SYCL patches coming in I'm getting concerned that the

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. I'd really like to understand why this is a clang-level tool and get feedback from @AaronBallman before this goes further. https://github.com/llvm/llvm-project/pull/112245 ___ cfe-c

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: At a minimum I think this change needs more tests. There's a lot of code added with very minimal test coverage. I'm uncomfortable with adding a design that is effectively a workaround with an unwritten "TODO" to fix it up later, but I also don't want to

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: > I don't think `lld` makes sense, but you can definitely use the LTO interface > inside of this tool to create a similar effect. Why not? `lld` is a toolchain linker (which you said this is supposed to emulate), and it is an interface to the LTO interface... so it seems to

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: > I guess the closest analogue would be the WASM target? LLD has a wasm target. > It seems like overkill since the `ld.lld` source code doesn't really share > much code and this target pretty much only consumes LLVM-IR. I think LLD also needs to eventually gain a SPIR-V targ

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: I think we could all benefit from some documentation describing how the SYCL compiler flow is intended to work, what tools are added/modified, and what the expected outputs are at each compiler phase. Without some idea of the architecture of what is being built changes like t

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: > The goal is to just have a tool that clang can use as a normal toolchain > linker so we can reuse as much as possible when it comes to creating link > jobs. Clang can use `lld`, `llvm-ar`, and `dsymutil` (among others), so being part of Clang certainly isn't necessary for

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: > I don't know if there's some existing heuristic for what clang tools do, but > generally I find it to either be something that the user interfaces in, or > something that clang uses when it's building job actions. This is the latter. Generally clang-based tools have depende

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: I'm also concerned that there are no tests for the new tool. There are tests for the clang driver changes, but none for the new tool. The new tool seems to be just a wrapper around llvm-link, which does make me think this should probably just be folded into llvm-link. Underst

[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)

2024-10-15 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/111010 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][SYCL] Introduce clang-sycl-link-wrapper to link SYCL offloading device code (Part 1 of many) (PR #112245)

2024-10-15 Thread Chris B via cfe-commits
llvm-beanz wrote: It seems to me like this should be done through the LTO interface and driven through `lld`. I can understand if an intermediate step is required while the SPIR-V backend is under development, but clang shouldn't be in the business of linking, and generally neither should llvm

[clang-tools-extra] Rename CODE_OWNERS -> Maintainers (PR #114544)

2024-11-27 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/114544 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I think we need to think a bit about the IR metadata in the middle of the compiler and how it will be used in various scenarios. DXIL and SPIR-V both have branch hints that indicate to the GPU backends if a branch should be profitable to flatten or pres

[clang] [HLSL] Fix placement of `const` for resource operator[] (PR #116698)

2024-11-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/116698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-18 Thread Chris B via cfe-commits
@@ -53,3 +53,6 @@ LLVM_FIXED_MD_KIND(MD_DIAssignID, "DIAssignID", 38) LLVM_FIXED_MD_KIND(MD_coro_outside_frame, "coro.outside.frame", 39) LLVM_FIXED_MD_KIND(MD_mmra, "mmra", 40) LLVM_FIXED_MD_KIND(MD_noalias_addrspace, "noalias.addrspace", 41) +// TODO: this will likelly be pla

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-18 Thread Chris B via cfe-commits
@@ -53,3 +53,6 @@ LLVM_FIXED_MD_KIND(MD_DIAssignID, "DIAssignID", 38) LLVM_FIXED_MD_KIND(MD_coro_outside_frame, "coro.outside.frame", 39) LLVM_FIXED_MD_KIND(MD_mmra, "mmra", 40) LLVM_FIXED_MD_KIND(MD_noalias_addrspace, "noalias.addrspace", 41) +// TODO: this will likelly be pla

[clang] [HLSL] Rename resource's "h" member to "__handle". NFC (PR #116696)

2024-11-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/116696 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-18 Thread Chris B via cfe-commits
@@ -323,19 +325,114 @@ struct TemplateParameterListBuilder { return *this; } - BuiltinTypeDeclBuilder &finalizeTemplateArgs() { + /* +The concept specialization expression (CSE) constructed in llvm-beanz wrote: nit: generally LLVM does per-line commen

[clang] [HLSL] Fix resource kind for RasterizerOrderedStructuredBuffer (PR #116700)

2024-11-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/116700 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-19 Thread Chris B via cfe-commits
@@ -323,19 +325,114 @@ struct TemplateParameterListBuilder { return *this; } - BuiltinTypeDeclBuilder &finalizeTemplateArgs() { + // The concept specialization expression (CSE) constructed in + // constructConceptSpecializationExpr is constructed so that it + // matc

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

2024-11-19 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I think the way that you're staging these changes is awkward and results in more review time than we strictly need. We're also going to need to re-review a bunch of this code in a wider context in the near future, so I'm not sure I'm comfortable with th

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

2024-11-20 Thread Chris B via cfe-commits
@@ -784,6 +785,17 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) { HLSLSV_DispatchThreadIDAttr(getASTContext(), AL)); } +void SemaHLSL::handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL) { + auto *VD = cast(D); + if (!isLega

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

2024-11-19 Thread Chris B via cfe-commits
@@ -323,19 +325,114 @@ struct TemplateParameterListBuilder { return *this; } - BuiltinTypeDeclBuilder &finalizeTemplateArgs() { + // The concept specialization expression (CSE) constructed in + // constructConceptSpecializationExpr is constructed so that it + // matc

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-13 Thread Chris B via cfe-commits
@@ -1,109 +1,28 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s // expected-no-diagnostics -struct oneInt { -int i; -}; - -struct twoInt { - int aa; - int ab; -}; - -struct threeInts { - oneInt o; -

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

2024-11-13 Thread Chris B via cfe-commits
@@ -483,10 +583,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *constructSizeOfLEQ16Expr(ASTContext &Context, + SourceLocation NameLoc, +

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

2024-11-13 Thread Chris B via cfe-commits
@@ -323,30 +324,129 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename *

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-11-13 Thread Chris B via cfe-commits
@@ -5322,6 +5324,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, IRCallArgs[FirstIRArg] = Val; break; } + } else if (I->getType()->isArrayParameterType()) { +// use the tmp created by the HLSLOutArgExpr +/

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

2024-11-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/112600 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-14 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/115045 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-11-20 Thread Chris B via cfe-commits
llvm-beanz wrote: Looks like you added a file that has some odd characters and maybe a diff? https://github.com/llvm/llvm-project/pull/116413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

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

2024-11-20 Thread Chris B via cfe-commits
@@ -472,10 +569,91 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S); } +Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, + TemplateTypeParmDecl

[clang] [HLSL] Make casting functions constexpr (PR #108902)

2024-09-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/108902 >From 9deebd707410a6ad8474f615a97c943937ceeb34 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 16 Sep 2024 18:21:38 -0500 Subject: [PATCH 1/3] [HLSL] Make casting functions constexpr This marks the

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

2024-09-17 Thread Chris B via cfe-commits
@@ -828,101 +831,85 @@ static void updateResourceClassFlagsFromRecordType(RegisterBindingFlags &Flags, const Type *FieldTy = FD->getType().getTypePtr(); if (const HLSLAttributedResourceType *AttrResType = dyn_cast(FieldTy)) { -updateResourceCl

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

2024-09-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. One minor nit inline, but I think this is fine either way. https://github.com/llvm/llvm-project/pull/108924 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [HLSL] set alwaysinline on HLSL functions (PR #106588)

2024-09-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/106588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] update StructuredBuffer subscript test for alwaysinline (PR #109023)

2024-09-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/109023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][HLSL] Allow target intrinsic switching to optionally be set. (PR #117648)

2024-12-02 Thread Chris B via cfe-commits
@@ -30,22 +30,36 @@ #include #include +#define GENERATE_HLSL_INTRINSIC_FUNCTION_DEFAULT(FunctionName, \ + IntrinsicPostfix) \ + GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix, 1,

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-02 Thread Chris B via cfe-commits
@@ -2076,7 +2076,28 @@ void CodeGenFunction::EmitBranchOnBoolExpr( Weights = createProfileWeights(TrueCount, CurrentCount - TrueCount); } - Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights, Unpredictable); + auto *BrInst = Builder.CreateCondBr(CondV, TrueBloc

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-02 Thread Chris B via cfe-commits
@@ -300,6 +301,36 @@ static MDTuple *emitTopLevelLibraryNode(Module &M, MDNode *RMD, return constructEntryMetadata(nullptr, nullptr, RMD, Properties, Ctx); } +// TODO: We might need to refactor this to be more generic, +// in case we need more metadata to be replaced. +stat

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-02 Thread Chris B via cfe-commits
@@ -2694,19 +2694,49 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, } return MIB.constrainAllUses(TII, TRI, RBI); } - case Intrinsic::spv_loop_merge: - case Intrinsic::spv_selection_merge: { -const auto Opcode = IID == Intrinsic::spv_select

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

2024-12-02 Thread Chris B via cfe-commits
https://github.com/llvm-beanz 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] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)

2024-11-13 Thread Chris B via cfe-commits
@@ -1,109 +1,28 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s // expected-no-diagnostics -struct oneInt { -int i; -}; - -struct twoInt { - int aa; - int ab; -}; - -struct threeInts { - oneInt o; -

<    2   3   4   5   6   7   8   9   10   >