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

2024-08-22 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-22 Thread Joshua Batista via cfe-commits
@@ -459,7 +467,408 @@ 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 Joshua Batista via cfe-commits
@@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +/* +tem

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

2024-08-22 Thread Joshua Batista 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 Joshua Batista via cfe-commits
@@ -0,0 +1,76 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// This test validates the diagnostics that are emitted when a variable with a "resource" type +// is bound to a register using the register annotation + +// expe

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

2024-08-23 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed 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] Create Texture Dimension attribute in HLSL (PR #104239)

2024-08-23 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/104239 >From aaa455933d3703b84634703fd4fcb5c815aa139e Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 14 Aug 2024 14:02:22 -0700 Subject: [PATCH 1/4] create texture dimension attr --- clang/include/clang/Ba

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-21 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify + +// previously, this test would result in an error shown below on the line that +// declares variable a in struct Eg9: +// error: use of undeclared identifier +// 'SV_Dispat

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-21 Thread Joshua Batista via cfe-commits
@@ -2646,6 +2646,9 @@ bool Parser::ParseCXXMemberDeclaratorBeforeInitializer( else DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation()); + if (getLangOpts().HLSL) bob80905 wrote: I think the crucial difference between the two is that one overload i

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-21 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/96346 >From c267be670adf7aac050484dc1b243aa0eff60b5f Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 21 Jun 2024 11:25:22 -0700 Subject: [PATCH 1/3] parse hlsl annotations on struct, add test --- clang/lib/

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-21 Thread Joshua Batista via cfe-commits
@@ -2646,6 +2646,9 @@ bool Parser::ParseCXXMemberDeclaratorBeforeInitializer( else DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation()); + if (getLangOpts().HLSL) bob80905 wrote: Though both would hit an assert if they're called outside of HLSL mod

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-21 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/96346 >From c267be670adf7aac050484dc1b243aa0eff60b5f Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 21 Jun 2024 11:25:22 -0700 Subject: [PATCH 1/4] parse hlsl annotations on struct, add test --- clang/lib/

[clang] [HLSL] add loop unroll (PR #93879)

2024-06-24 Thread Joshua Batista via cfe-commits
@@ -584,6 +585,39 @@ static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) OpenCLUnrollHintAttr(S.Context, A, UnrollFactor); } +static Attr *handleHLSLLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A, +

[clang] [HLSL] add loop unroll (PR #93879)

2024-06-24 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 approved this pull request. https://github.com/llvm/llvm-project/pull/93879 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/96346 >From c267be670adf7aac050484dc1b243aa0eff60b5f Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 21 Jun 2024 11:25:22 -0700 Subject: [PATCH 1/5] parse hlsl annotations on struct, add test --- clang/lib/

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify + +// expected-no-diagnostics + +struct MyBitFields { +unsigned int field1 : 3; // 3 bits for field1 +unsigned int field2 : 4; // 4 bits for field2 +int field3 : 5;

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify + +// previously, this test would result in an error shown below on the line that +// declares variable a in struct Eg9: +// error: use of undeclared identifier +// 'SV_Dispat

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
@@ -1,10 +1,13 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s -// TODO: update once we handle annotations on struct fields +// tests that

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
@@ -1,10 +1,13 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -ast-dump -o - %s | FileCheck %s -// TODO: update once we handle annotations on struct fields +// tests that

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
@@ -1,11 +1,24 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -ast-dump -x hlsl -o - %s | Filecheck %s -// expected-no-diagnostics struct MyBitFields { -unsigned int field1

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/96346 >From c267be670adf7aac050484dc1b243aa0eff60b5f Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 21 Jun 2024 11:25:22 -0700 Subject: [PATCH 1/6] parse hlsl annotations on struct, add test --- clang/lib/

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/96346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-26 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/96346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-27 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/96346 >From c267be670adf7aac050484dc1b243aa0eff60b5f Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 21 Jun 2024 11:25:22 -0700 Subject: [PATCH 1/7] parse hlsl annotations on struct, add test --- clang/lib/

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

2024-06-27 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/87578 >From 3960050439964fe3c0536696490b284a6c470cd1 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 3 Apr 2024 13:15:59 -0700 Subject: [PATCH 01/15] implement binding type error for t/cbuffers and rwbuffers

[clang] [ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (PR #96346)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/96346 ___ 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 errors (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/97103 There are currently no diagnostics being emitted for when a resource is bound to a register with an incorrect binding type prefix. For example, a CBuffer type resource should be bound with a a binding type pref

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 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 flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 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 flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 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] [llvm] Implement resource binding type prefix mismatch errors (PR #87578)

2024-06-28 Thread Joshua Batista via cfe-commits
bob80905 wrote: This PR was based on code from April 3, and the branch is far too stale to update at this point. I'm closing this, and have moved the implementation over to this PR: https://github.com/llvm/llvm-project/pull/97103 https://github.com/llvm/llvm-project/pull/87578

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

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/87578 ___ 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 flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/97103 >From c784272b3f66ca06be4ab8e72a0963e5ebb6a869 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 28 Jun 2024 12:40:56 -0700 Subject: [PATCH 1/2] update tests, update code --- clang/include/clang/Basic/A

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/97103 >From c784272b3f66ca06be4ab8e72a0963e5ebb6a869 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 28 Jun 2024 12:40:56 -0700 Subject: [PATCH 1/3] update tests, update code --- clang/include/clang/Basic/A

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
@@ -437,7 +460,206 @@ void SemaHLSL::handleShaderAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +struct register_binding_flags { + bool resource = false; + bool udt = false; + bool other = false; + bool basic = false; + + bool srv = false; + bool uav =

[clang] Implement resource binding type prefix mismatch flag setting logic (PR #97103)

2024-06-28 Thread Joshua Batista via cfe-commits
@@ -21,6 +21,7 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceLocation.h" #include "clang/Sema/Scope.h" +#include "clang/Sema/Sema.h" bob80905 wrote: Sema.h is needed because it defines `RequireCompleteType` `RequireCompleteType` is re

[clang] [HLSL] Add StructuredBuffer to external sema source (PR #106316)

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/106316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Update StructuredBuffer-AST test after removal of HLSLResourceClassAttr (PR #108292)

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/108292 In a previous PR, the `HLSLResourceClassAttr` attribute was removed from the AST, in favor of using an attributed type that stores the same information instead. This PR fixes test failures that assumed that `H

[clang] Update StructuredBuffer-AST test after removal of HLSLResourceClassAttr (PR #108292)

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/108292 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] fix elementwise bitreverse test (PR #108128)

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 approved this pull request. https://github.com/llvm/llvm-project/pull/108128 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106471 >From 7dfcf804ffcb850c7e3620866bc76f0971d82aaf Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 28 Aug 2024 16:35:36 -0700 Subject: [PATCH] add step --- clang/include/clang/Basic/Builtins.td |

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

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106471 >From 7dfcf804ffcb850c7e3620866bc76f0971d82aaf Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 28 Aug 2024 16:35:36 -0700 Subject: [PATCH 1/2] add step --- clang/include/clang/Basic/Builtins.td

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

2024-09-11 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106471 >From 7dfcf804ffcb850c7e3620866bc76f0971d82aaf Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 28 Aug 2024 16:35:36 -0700 Subject: [PATCH 1/3] add step --- clang/include/clang/Basic/Builtins.td

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

2024-09-12 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/106471 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-12 Thread Joshua Batista via cfe-commits
@@ -817,8 +821,12 @@ static void DiagnoseHLSLRegisterAttribute(Sema &S, SourceLocation &ArgLoc, S.Diag(TheDecl->getLocation(), diag::warn_hlsl_user_defined_type_missing_member) << regTypeNum; - -return; +// Space argument cannot be specifie

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-12 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106782 >From 99408f31a8946df7ef9efa223d0dba2ab876fcd0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 30 Aug 2024 12:08:37 -0700 Subject: [PATCH 1/4] add diag and testing for space and global constants ---

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
@@ -1,5 +1,24 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106782 >From 99408f31a8946df7ef9efa223d0dba2ab876fcd0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 30 Aug 2024 12:08:37 -0700 Subject: [PATCH 1/4] add diag and testing for space and global constants ---

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// valid +cbuffer cbuf { +RWBuffer r : register(u0, space0); +} + +cbuffer cbuf2 { +struct x { +// expected-error@+1 {{'register' attribute only ap

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-13 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106782 >From 99408f31a8946df7ef9efa223d0dba2ab876fcd0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 30 Aug 2024 12:08:37 -0700 Subject: [PATCH 1/5] add diag and testing for space and global constants ---

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106782 >From 99408f31a8946df7ef9efa223d0dba2ab876fcd0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 30 Aug 2024 12:08:37 -0700 Subject: [PATCH 1/6] add diag and testing for space and global constants ---

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/106782 >From 99408f31a8946df7ef9efa223d0dba2ab876fcd0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 30 Aug 2024 12:08:37 -0700 Subject: [PATCH 1/7] add diag and testing for space and global constants ---

[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)

2024-09-16 Thread Joshua Batista via cfe-commits
@@ -0,0 +1,66 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify bob80905 wrote: I will at least say it's simpler for a distinct file to test this, since we test multiple resource types (UDTs, basic, resources) w

[clang] [HLSL] Align language modes on 202x as default (PR #108662)

2024-09-16 Thread Joshua Batista via cfe-commits
@@ -12,7 +12,7 @@ // HALF: #define __HLSL_ENABLE_16_BIT 1 // NOHALF-NOT: __HLSL_ENABLE_16_BIT -// CHECK: #define __HLSL_VERSION 2021 +// CHECK: #define __HLSL_VERSION 2028 bob80905 wrote: I do not understand where this 2028 is coming from. Is 202x intended to

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

2024-10-18 Thread Joshua Batista via cfe-commits
@@ -323,30 +324,99 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename */

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

2024-10-18 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/14] ConceptSpecializationExpr shows up in AST!!! --- .../c

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

2024-10-18 Thread Joshua Batista via cfe-commits
@@ -483,10 +573,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, + SourceLocation NameLoc, +

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

2024-10-18 Thread Joshua Batista via cfe-commits
@@ -1,64 +1,64 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s bob80905 wrote: Fixed! https://github.com/llvm/llvm-project/pull/112600 ___

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

2024-10-18 Thread Joshua Batista via cfe-commits
@@ -323,30 +324,119 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename *

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

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 approved this pull request. 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] [NFC][HLSL] Fix test function names (PR #112602)

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/112602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][HLSL] Fix test function names (PR #112602)

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 approved this pull request. https://github.com/llvm/llvm-project/pull/112602 ___ 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-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/10] ConceptSpecializationExpr shows up in AST!!! --- .../c

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

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/11] ConceptSpecializationExpr shows up in AST!!! --- .../c

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

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/112600 This PR is step one on the journey to implement resource element type validation via C++20 concepts. The PR sets up the infrastructure for injecting implicit concept decls / concept specialization expressions

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

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 1/7] ConceptSpecializationExpr shows up in AST!!! --- .../cla

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

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/11] ConceptSpecializationExpr shows up in AST!!! --- .../c

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

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 ready_for_review 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 implicit resource element type concepts to AST (PR #112600)

2024-10-16 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 1/8] ConceptSpecializationExpr shows up in AST!!! --- .../cla

[clang] [clang][HLSL] Add sign intrinsic part 4 (PR #108396)

2024-10-16 Thread Joshua Batista via cfe-commits
@@ -155,3 +197,24 @@ int3 test_sign_int64_t3(int64_t3 p0) { return sign(p0); } // CHECK: %hlsl.sign = call <4 x i32> @llvm.[[TARGET]].sign.v4i64( // CHECK: ret <4 x i32> %hlsl.sign int4 test_sign_int64_t4(int64_t4 p0) { return sign(p0); } + + +// CHECK: define [[FNATTRS]] i32 @

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

2024-10-17 Thread Joshua Batista via cfe-commits
@@ -323,30 +324,99 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename */

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

2024-10-17 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/13] ConceptSpecializationExpr shows up in AST!!! --- .../c

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

2024-10-17 Thread Joshua Batista via cfe-commits
@@ -323,30 +324,99 @@ struct TemplateParameterListBuilder { S.Context, Builder.Record->getDeclContext(), SourceLocation(), SourceLocation(), /* TemplateDepth */ 0, Position, &S.Context.Idents.get(Name, tok::TokenKind::identifier), -/* Typename */

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

2024-10-17 Thread Joshua Batista via cfe-commits
@@ -1,64 +1,64 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY %s | FileCheck -check-prefix=EMPTY %s bob80905 wrote: Yes, line endings seem to be messed up. I've checked out main for both these files and only changed the

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

2024-10-18 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/112600 >From 0739f6da81d7c1edd9578ae4ff9dd699e5c828c6 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/14] ConceptSpecializationExpr shows up in AST!!! --- .../c

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

2024-10-02 Thread Joshua Batista via cfe-commits
@@ -74,6 +75,42 @@ static Value *expandAbs(CallInst *Orig) { "dx.max"); } +static Value *expandCrossIntrinsic(CallInst *Orig) { + + VectorType *VT = cast(Orig->getType()); + if (cast(VT)->getNumElements() != 3) +report_fatal_error(Twine("

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

2024-10-02 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/109180 >From 3c58861f3e8c2f1333d0b36c6f5b7ba7f3d9e187 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Wed, 18 Sep 2024 12:20:19 -0700 Subject: [PATCH 1/8] add cross hlsl function --- clang/include/clang/Basic/Bu

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

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -1135,21 +1147,19 @@ static void ValidateMultipleRegisterAnnotations(Sema &S, Decl *TheDecl, RegisterType otherRegType = getRegisterType(attr->getSlot()); if (RegisterTypesDetected[static_cast(otherRegType)]) { -if (PreviousConflicts[TheDecl].count(othe

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

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -115,12 +114,14 @@ struct Eg13{ MySRV s1; MySRV s2; }; -// expected-warning@+4{{binding type 'u' only applies to types containing UAV resources}} // expected-warning@+3{{binding type 'u' only applies to types containing UAV resources}} -// expected-warning@+2{{binding

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

2024-10-04 Thread Joshua Batista 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] Collect explicit resource binding information (part 1) (PR #111203)

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -2228,3 +2242,62 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) { Ty.addRestrict(); return Ty; } + +// Walks though existing explicit bindings, finds the actual resource class +// decl the binding applies to and sets it to attr->ResourceField. +// Additional pr

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

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -2228,3 +2242,62 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) { Ty.addRestrict(); return Ty; } + +// Walks though existing explicit bindings, finds the actual resource class +// decl the binding applies to and sets it to attr->ResourceField. +// Additional pr

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

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -2228,3 +2242,62 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) { Ty.addRestrict(); return Ty; } + +// Walks though existing explicit bindings, finds the actual resource class +// decl the binding applies to and sets it to attr->ResourceField. +// Additional pr

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

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -2228,3 +2242,62 @@ QualType SemaHLSL::getInoutParameterType(QualType Ty) { Ty.addRestrict(); return Ty; } + +// Walks though existing explicit bindings, finds the actual resource class +// decl the binding applies to and sets it to attr->ResourceField. +// Additional pr

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

2024-10-04 Thread Joshua Batista via cfe-commits
@@ -4588,6 +4588,35 @@ def HLSLResourceBinding: InheritableAttr { let LangOpts = [HLSL]; let Args = [StringArgument<"Slot">, StringArgument<"Space", 1>]; let Documentation = [HLSLResourceBindingDocs]; + let AdditionalMembers = [{ + enum class RegisterType : unsigned

[clang] [HLSL] add IsTypedResourceElementCompatible type trait (PR #113730)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/113730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert add builtin line vector compatible (PR #114852)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/114852 Reverts https://github.com/llvm/llvm-project/pull/113730 >From a31199224c19c1087b114de29d864125b720e6d8 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Fri, 25 Oct 2024 12:33:05 -0700 Subject: [PATCH 1/7]

[clang] [HLSL] add IsTypedResourceElementCompatible type trait (PR #114864)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/114864 This PR implements a new type trait as a builtin, __builtin_hlsl_is_typed_resource_element_compatible This type traits verifies that the given input type is suitable as a typed resource element type. It checks

[clang] [HLSL] add IsTypedResourceElementCompatible type trait (PR #114864)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/114864 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[HLSL] add IsTypedResourceElementCompatible type trait" (PR #114853)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/114853 Reverts llvm/llvm-project#113730 >From c110aaa2eb7862657df58c5f76e4231f27110450 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Mon, 4 Nov 2024 11:11:46 -0800 Subject: [PATCH] Revert "[HLSL] add IsTypedRes

[clang] Revert "[HLSL] add IsTypedResourceElementCompatible type trait" (PR #114853)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 edited https://github.com/llvm/llvm-project/pull/114853 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert add builtin line vector compatible (PR #114852)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/114852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[HLSL] add IsTypedResourceElementCompatible type trait" (PR #114853)

2024-11-04 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/114853 ___ 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-05 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 updated https://github.com/llvm/llvm-project/pull/115045 >From ef4a7eea3eacce4f77b628aebe7f2838733971d0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Tue, 5 Nov 2024 10:35:59 -0800 Subject: [PATCH 1/2] add empty struct test cases --- .../SemaHLSL/Types/Traits

[clang] [HLSL] add IsTypedResourceElementCompatible type trait (PR #114864)

2024-11-05 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 closed https://github.com/llvm/llvm-project/pull/114864 ___ 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-05 Thread Joshua Batista via cfe-commits
https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/115045 This PR adds empty struct cases to the test file for the builtin. >From ef4a7eea3eacce4f77b628aebe7f2838733971d0 Mon Sep 17 00:00:00 2001 From: Joshua Batista Date: Tue, 5 Nov 2024 10:35:59 -0800 Subject: [PAT

[clang] [HLSL] add IsTypedResourceElementCompatible type trait (PR #114864)

2024-11-05 Thread Joshua Batista via cfe-commits
@@ -2163,6 +2163,50 @@ static void BuildFlattenedTypeList(QualType BaseTy, } } +bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) { + if (QT.isNull()) +return false; + + // check if the outer type was an array type + if (QT->isArrayType()) +retur

<    1   2   3   4   5   6   >