[clang] [llvm] [HLSL] Use hidden visibility for external linkage. (PR #140292)

2025-05-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/140292 >From af7ac509a1bf1baf14d5d50ebe72a5d95ef9 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Fri, 16 May 2025 14:21:01 -0400 Subject: [PATCH] [HLSL] Use hidden visibility for external linkage. Implements

[clang] [llvm] [HLSL] Use hidden visibility for external linkage. (PR #140292)

2025-05-16 Thread Steven Perron via cfe-commits
s-perron wrote: FYI: @pow2clk Here is a possible implementation for https://github.com/llvm/wg-hlsl/blob/main/proposals/0026-symbol-visibility.md. I still need to update tests, but the change seems simple enough. https://github.com/llvm/llvm-project/pull/140292

[clang] [llvm] [HLSL] Use hidden visibility for external linkage. (PR #140292)

2025-05-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/140292 Implements https://github.com/llvm/wg-hlsl/blob/main/proposals/0026-symbol-visibility.md. The change is to stop using the `hlsl.export` attribute. Instead, symbols with "program linkage" in HLSL will have expor

[clang] [HLSL][SPIRV] Implement the SPIR-V target type for cbuffers. (PR #140061)

2025-05-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron ready_for_review https://github.com/llvm/llvm-project/pull/140061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Implement the SPIR-V target type for cbuffers. (PR #140061)

2025-05-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/140061 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-

[clang] [llvm] [SPIRV] Add PreLegalizer instCombine for `faceforward` (PR #139959)

2025-05-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: I have a minor concern about how specific the `N` and `0-N` checks are. Otherwise this looks good to me. https://github.com/llvm/llvm-project/pull/139959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [llvm] [SPIRV] Add PreLegalizer instCombine for `faceforward` (PR #139959)

2025-05-16 Thread Steven Perron via cfe-commits
@@ -98,21 +110,98 @@ void applySPIRVDistance(MachineInstr &MI, MachineRegisterInfo &MRI, SPIRVGlobalRegistry *GR = MI.getMF()->getSubtarget().getSPIRVGlobalRegistry(); - auto RemoveAllUses = [&](Register Reg) { -SmallVector UsesToErase( -llvm::make_pointe

[clang] [llvm] [SPIRV] Add PreLegalizer instCombine for `faceforward` (PR #139959)

2025-05-16 Thread Steven Perron via cfe-commits
@@ -98,21 +110,98 @@ void applySPIRVDistance(MachineInstr &MI, MachineRegisterInfo &MRI, SPIRVGlobalRegistry *GR = MI.getMF()->getSubtarget().getSPIRVGlobalRegistry(); - auto RemoveAllUses = [&](Register Reg) { -SmallVector UsesToErase( -llvm::make_pointe

[clang] [llvm] [SPIRV] Add PreLegalizer instCombine for `faceforward` (PR #139959)

2025-05-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/139959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit convergence tokens for loop in global array init (PR #140120)

2025-05-15 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/140120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Emit convergence tokens for loop in global array init (PR #140120)

2025-05-15 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/140120 When initializing a global array, a loop is generated, but no convergence is emitted for the loop. This fixes that up. >From 65ba89dc7c1496c4ff5f194c34472e308402b47d Mon Sep 17 00:00:00 2001 From: Steven Perro

[clang] [HLSL][SPIRV] Implement the SPIR-V target type for cbuffers. (PR #140061)

2025-05-15 Thread Steven Perron via cfe-commits
https://github.com/s-perron converted_to_draft https://github.com/llvm/llvm-project/pull/140061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Implement the SPIR-V target type for cbuffers. (PR #140061)

2025-05-15 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/140061 This change implement the type used to represent cbuffer for SPIR-V. Fixes https://github.com/llvm/llvm-project/issues/138274. Rate limit · GitHub body { backgr

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Steven Perron via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: s-perron wrote: Could you add a tests to [SemaHLSL](https://github.com/llvm/llvm-project/tree/44856d957e3a878e1f15d5ab0009bff9c

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Steven Perron via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: @@ -5759,9 +5761,18 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, getCUDARuntime().internalizeDeviceSideVar(D, Linkage);

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Steven Perron via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: @@ -5636,6 +5636,8 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, Init = llvm::UndefValue::get(getTypes().ConvertTypeForMem

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add CLI option `-fspv-extension` (PR #137985)

2025-05-02 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/137985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add CLI option `-fspv-extension` (PR #137985)

2025-05-02 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/137985 >From d44ed16655870a2435023dc7a4289ea8b3073071 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Mon, 28 Apr 2025 15:55:31 -0400 Subject: [PATCH 1/2] [HLSL][SPIRV] Add CLI option `-fspv-extension` This commit

[clang] [llvm] [HLSL] Run finalize linkage pass for all targets (PR #134260)

2025-04-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron reopened https://github.com/llvm/llvm-project/pull/134260 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add CLI option `-fspv-extension` (PR #137985)

2025-04-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/137985 This commit implements DXC's `-fspv-extension` options. It is implemented by replaced it with the equivalent `-spirv-ext` option. Note that if the option is not used, that is the same as enabling all extension,

[clang] [llvm] [HLSL] Run finalize linkage pass for all targets (PR #134260)

2025-04-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/134260 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Allow non `.hlsl` files as source files (PR #137378)

2025-04-29 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/137378 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Allow non `.hlsl` files as source files (PR #137378)

2025-04-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/137378 >From 163b214e77e63d919ea7fdd1e52762263037175d Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Fri, 25 Apr 2025 13:16:53 -0400 Subject: [PATCH 1/2] [HLSL] Allow non `.hlsl` files as source files Changes the

[clang] [HLSL] Allow non `.hlsl` files as source files (PR #137378)

2025-04-25 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/137378 Changes the driver to assume input file with an unknown extension are HLSL source files instead of object files. Fixes https://github.com/llvm/llvm-project/issues/137370 >From 163b214e77e63d919ea7fdd1e5276226

[clang] [llvm] [HLSL] Run finalize linkage pass for all targets (PR #134260)

2025-04-24 Thread Steven Perron via cfe-commits
s-perron wrote: > The idea that a symbol should be externally visible before linking, and not > externally visible afterwards, isn't new: many platforms have some form of > symbol visibility. I'm not sure why you don't want to express that in LLVM > IR... having an implicit HLSL-specific rule

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-22 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/127675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-22 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 2a288bc3528ae63f05551492518cbf500689108d Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/6] [HLSL] Use hlsl_device address space for getpointer. We ad

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-22 Thread Steven Perron via cfe-commits
@@ -89,12 +89,12 @@ RESOURCE Buffer; // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] // CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]] -// CHECK-SUBSCRIPT: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const' +// CHECK-SUBSCRIPT: CXXMethodDecl

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-22 Thread Steven Perron via cfe-commits
@@ -121,15 +121,15 @@ RESOURCE Buffer; // CHECK-SUBSCRIPT-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'Index' 'unsigned int' // CHECK-SUBSCRIPT-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline -// CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'const el

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-22 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 2a288bc3528ae63f05551492518cbf500689108d Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/5] [HLSL] Use hlsl_device address space for getpointer. We ad

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-22 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 81c31fcdee28482ceea703064b0103eccb2a93ad Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/5] [HLSL] Use hlsl_device address space for getpointer. We ad

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

2025-04-16 Thread Steven Perron via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/122103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

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

2025-04-16 Thread Steven Perron via cfe-commits
Nathan =?utf-8?q?Gau=C3=ABr?= , Nathan =?utf-8?q?Gau=C3=ABr?= Message-ID: In-Reply-To: s-perron wrote: This PR is superseded by #133464 https://github.com/llvm/llvm-project/pull/122103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[clang] [HLSL] Implement `SpirvType` and `SpirvOpaqueType` (PR #134034)

2025-04-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: I've done some extra testing and playing with it. It seems to be working. However, I do not know enough about how things are done in clang to know if this is the best way to do it. It look reasonable to me. Others will have to review the implementation.

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-16 Thread Steven Perron via cfe-commits
s-perron wrote: @hekota Do you have any more things that need to be fixed? https://github.com/llvm/llvm-project/pull/127675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-14 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 81c31fcdee28482ceea703064b0103eccb2a93ad Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/4] [HLSL] Use hlsl_device address space for getpointer. We ad

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-14 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 81c31fcdee28482ceea703064b0103eccb2a93ad Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/3] [HLSL] Use hlsl_device address space for getpointer. We ad

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-14 Thread Steven Perron via cfe-commits
@@ -751,13 +751,14 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name, using PH = BuiltinTypeMethodBuilder::PlaceHolder; QualType ElemTy = getHandleElementType(); - // TODO: Map to an hlsl_device address space. - QualType ElemPtrTy = AST.getPointer

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-14 Thread Steven Perron via cfe-commits
@@ -89,12 +89,12 @@ RESOURCE Buffer; // CHECK-SAME{LITERAL}: [[hlsl::raw_buffer]] // CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]] -// CHECK-SUBSCRIPT: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const' +// CHECK-SUBSCRIPT: CXXMethodDecl

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-14 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 81c31fcdee28482ceea703064b0103eccb2a93ad Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/2] [HLSL] Use hlsl_device address space for getpointer. We ad

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-10 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 81c31fcdee28482ceea703064b0103eccb2a93ad Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH] [HLSL] Use hlsl_device address space for getpointer. We add th

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-10 Thread Steven Perron via cfe-commits
https://github.com/s-perron ready_for_review https://github.com/llvm/llvm-project/pull/127675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-10 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 769344277c6a870b149467fedbe6bcd668c83e95 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH] [HLSL] Use hlsl_device address space for getpointer. We add th

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-10 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 7e1a486302d4029c926362287341cd79dcdc21cf Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH] [HLSL] Use hlsl_device address space for getpointer. We add th

[clang] [llvm] [HLSL] Run finalize linkage pass for all targets (PR #134260)

2025-04-08 Thread Steven Perron via cfe-commits
s-perron wrote: I'm following a design that was put in place by others, so I cannot fully answer all of the questions. However, I'll do my best. > Is there some form of linker involved? No linker is involved yet, but I believe the long term plan is to have some type of linker. When that is a

[clang] [HLSL] Add separate handle for the counter (PR #134864)

2025-04-08 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/134864 >From 496aaf5a3265793fc0b4b5a1a6dfb526531d825c Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 2 Apr 2025 15:53:50 -0400 Subject: [PATCH 1/2] [HLSL] Add separate handle for the counter In DXIL, the cou

[clang] [HLSL] Add separate handle for the counter (PR #134864)

2025-04-08 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/134864 >From 496aaf5a3265793fc0b4b5a1a6dfb526531d825c Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 2 Apr 2025 15:53:50 -0400 Subject: [PATCH 1/3] [HLSL] Add separate handle for the counter In DXIL, the cou

[clang] [HLSL] Add separate handle for the counter (PR #134864)

2025-04-08 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/134864 In DXIL, the counters associated with some types of structured buffers are accessed using the same handle as the buffer. That is not the case for SPIR-V. This PR creates a separate handle for the coutner buffer.

[clang] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From acd00a62efc6ca58311800caffe1e46735f8cc57 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH] [HLSL] Use hlsl_device address space for getpointer. We add th

[clang] [HLSL] Add support for SV_GroupIndex in SPIR-V (PR #130672)

2025-04-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/130672 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-03 Thread Steven Perron via cfe-commits
Nathan =?utf-8?q?Gau=C3=ABr?= , Nathan =?utf-8?q?Gau=C3=ABr?= Message-ID: In-Reply-To: https://github.com/s-perron approved this pull request. https://github.com/llvm/llvm-project/pull/133464 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [llvm] [HLSL] Run finalize linkage pass for all targets (PR #134260)

2025-04-03 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/134260 HLSL has three levels of visibility for functions. See section 3.6 of the [HLSL spec](https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf) for details. 1. Functions marked `static` have internal linkage. Thes

[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

2025-03-31 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. https://github.com/llvm/llvm-project/pull/133469 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/133464 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-28 Thread Steven Perron via cfe-commits
@@ -94,6 +94,8 @@ bool Qualifiers::isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, (A == LangAS::Default && (B == LangAS::cuda_constant || B == LangAS::cuda_device || B == LangAS::cuda_shared)) || + // Default is a superset of HLSL priv

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

2025-03-28 Thread Steven Perron via cfe-commits
@@ -5150,6 +5152,9 @@ bool Type::isHLSLIntangibleType() const { CXXRecordDecl *RD = RT->getAsCXXRecordDecl(); assert(RD != nullptr && "all HLSL structs and classes should be CXXRecordDecl"); + + if (!RD->isCompleteDefinition()) +return false; assert(RD->isC

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

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: Please add more AST tests. You seem to only have one, which is the static in a cbuffer. I believe all of the AST work should be correct at this point. Can you test global scalars, global struct with member functions, etc.. Make the sure AST is correct in

[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/133469 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: The changes look correct, but I want to double check that they are complete. https://github.com/llvm/llvm-project/pull/133469 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

2025-03-28 Thread Steven Perron via cfe-commits
@@ -57,22 +58,37 @@ void main(unsigned GI : SV_GroupIndex) { // CHECK: define void @main() // CHECK-NEXT: entry: // Verify destructor is emitted -// NOINLINE-NEXT: call void @_GLOBAL__sub_I_GlobalDestructors.hlsl() -// NOINLINE-NEXT: %0 = call i32 @llvm.dx.flattened.th

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/133468 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/133468 >From 7838678ca8ec5870cd8df81b109f9e1b30699f4e Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Fri, 24 Jan 2025 13:04:29 -0500 Subject: [PATCH 1/2] [HLSL] Add SPIR-V target type for RWStructuredBuffers This

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Steven Perron via cfe-commits
@@ -386,13 +386,22 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType( if (ContainedTy.isNull()) return nullptr; -assert(!ResAttrs.RawBuffer && - "Raw buffers handles are not implemented for SPIR-V yet"); assert(!ResAttrs.IsROV &&

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Steven Perron via cfe-commits
@@ -386,13 +386,22 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType( if (ContainedTy.isNull()) return nullptr; -assert(!ResAttrs.RawBuffer && - "Raw buffers handles are not implemented for SPIR-V yet"); assert(!ResAttrs.IsROV &&

[clang] [llvm] [HLSL] Add SPIR-V target type for StructuredBuffers (PR #132027)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/132027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Steven Perron via cfe-commits
s-perron wrote: FYI: @cassiebeckley can you review too? https://github.com/llvm/llvm-project/pull/133468 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/133468 This PR adds the target type for main storage for HLSL raw buffer types. It does not handle the counter variables that are associated with those buffers. This is implementing part of https://github.com/llvm/wg

[clang] [llvm] [SPIRV] Emit HLSL structured buffers (PR #132034)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/132034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add __spirv__ macro (PR #132848)

2025-03-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/132848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add __spirv__ macro (PR #132848)

2025-03-26 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. This is useful because to will match the DXC behaviour, and make code more easier to port. Even if we have `__SPIRV__` is to good to have `__spirv__`. https://github.com/llvm/llvm-project/pull/132848 ___

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. The SPV code looks good to me. I just want one small suggestion. https://github.com/llvm/llvm-project/pull/132288 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)

2025-03-26 Thread Steven Perron via cfe-commits
@@ -0,0 +1,60 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} s-perron wrote: I would like to start having the

[clang] [llvm] [HLSL] Add SPIR-V target type for StructuredBuffers (PR #132027)

2025-03-25 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/132027 >From 78348586c0b237db689b669fcf4352e6b42898a1 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH 1/3] [HLSL] Use hlsl_device address space for getpointer. We ad

[clang] [HLSL] Add __spirv__ macro (PR #132848)

2025-03-25 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: Thanks. I was thinking of adding this myself, but it was pushed off. I don't know the best place to put it. I'll let others who know the FE review. https://github.com/llvm/llvm-project/pull/132848 ___ cfe-commits

[clang] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-03-20 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/127675 >From 78348586c0b237db689b669fcf4352e6b42898a1 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 12 Feb 2025 15:45:32 -0500 Subject: [PATCH] [HLSL] Use hlsl_device address space for getpointer. We add th

[clang] [llvm] [SPIRV] Emit HLSL structured buffers (PR #132034)

2025-03-19 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/132034 >From d56c4165207aaf1b14802f115a0706e189571c4f Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Fri, 24 Jan 2025 13:04:29 -0500 Subject: [PATCH 1/5] [HLSL] Add SPIR-V target type for RWStructuredBuffers This

[clang] [llvm] [SPIRV] Emit HLSL structured buffers (PR #132034)

2025-03-19 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/132034 >From d56c4165207aaf1b14802f115a0706e189571c4f Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Fri, 24 Jan 2025 13:04:29 -0500 Subject: [PATCH 1/4] [HLSL] Add SPIR-V target type for RWStructuredBuffers This

[clang] [HLSL] Add SPIR-V target type for StructuredBuffers (PR #132027)

2025-03-19 Thread Steven Perron via cfe-commits
https://github.com/s-perron converted_to_draft https://github.com/llvm/llvm-project/pull/132027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #132027)

2025-03-19 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/132027 This PR adds the target type that should be used for RWStructuredBuffers. It does not handle ByteAddressBuffers yet. For now all structs will be laid out using the standard C/C++ layout rules. Other layout rule

[clang] [HLSL] Add support for SV_GroupIndex in SPIR-V (PR #130672)

2025-03-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. https://github.com/llvm/llvm-project/pull/130672 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add support for SV_GroupIndex in SPIR-V (PR #130672)

2025-03-17 Thread Steven Perron via cfe-commits
@@ -1,7 +1,8 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s

[clang] [HLSL] Buffer handle globals should not be constants (PR #130231)

2025-03-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. https://github.com/llvm/llvm-project/pull/130231 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix resource wrapper declaration (PR #129100)

2025-03-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/129100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix resource wrapper declaration (PR #129100)

2025-03-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/129100 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix resrouce wrapper declaration (PR #129100)

2025-03-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/129100 >From 1e794cd4b79235282795891f943f8f4609738d4f Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 4 Feb 2025 11:47:42 -0500 Subject: [PATCH 1/6] [HLSL] Fix resrouce wrapper declaration The resource wrappe

[clang] [HLSL] Fix resrouce wrapper declaration (PR #129100)

2025-03-05 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/129100 >From 6961d5683a4bc38c2fee053bc956475d0ccb0b80 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 4 Feb 2025 11:47:42 -0500 Subject: [PATCH 1/6] [HLSL] Fix resrouce wrapper declaration The resource wrappe

[clang] [HLSL] Fix resrouce wrapper declaration (PR #129100)

2025-02-27 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/129100 >From 6961d5683a4bc38c2fee053bc956475d0ccb0b80 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 4 Feb 2025 11:47:42 -0500 Subject: [PATCH 1/2] [HLSL] Fix resrouce wrapper declaration The resource wrappe

[clang] [HLSL] Fix resrouce wrapper declaration (PR #129100)

2025-02-27 Thread Steven Perron via cfe-commits
s-perron wrote: I created a new PR to make the resource wrappers static. @hekota Was right. Not much needed to change in codegen. We were already initializing all global (internal or external) that have the resource binding attribute. I must have been testing the wrong examples when I said cod

[clang] [HLSL] Fix resrouce wrapper declaration (PR #129100)

2025-02-27 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/129100 The resource wrapper should have internal linkage because it contains a handle to the global resource, and it not the actual global. Makeing this changed exposed that we were zeroinitializing the resouce, which

[clang] [HLSL] Fix resource wrapper declaration (PR #125718)

2025-02-26 Thread Steven Perron via cfe-commits
s-perron wrote: We discussed, and we will be make the wrapper static, but it should be done in sema. https://github.com/llvm/llvm-project/pull/125718 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [HLSL] Fix resource wrapper declaration (PR #125718)

2025-02-26 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/125718 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-02-19 Thread Steven Perron via cfe-commits
@@ -94,6 +94,11 @@ bool Qualifiers::isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, (A == LangAS::Default && (B == LangAS::cuda_constant || B == LangAS::cuda_device || B == LangAS::cuda_shared)) || + // In HLSL, the this pointer for mem

[clang] [HLSL] Fix resource wrapper declaration (PR #125718)

2025-02-18 Thread Steven Perron via cfe-commits
s-perron wrote: > 2\. It feels wrong to do this in CodeGen. It seems like we should be > identifying an appropriate storage class in Sema such that we assign the > correct linkage automatically. If we change the storage class in Sema, then codegen is not able to distinguish between: ``` stat

[clang] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-02-18 Thread Steven Perron via cfe-commits
@@ -94,6 +94,11 @@ bool Qualifiers::isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, (A == LangAS::Default && (B == LangAS::cuda_constant || B == LangAS::cuda_device || B == LangAS::cuda_shared)) || + // In HLSL, the this pointer for mem

[clang] [HLSL] Fix resource wrapper declaration (PR #125718)

2025-02-18 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/125718 >From 3ba76b95757a43002d8f799651d7846658011e37 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 4 Feb 2025 11:47:42 -0500 Subject: [PATCH 1/2] [HLSL] Fix resrouce wrapper declaration The resource wrappe

[clang] [HLSL] Fix resource wrapper declaration (PR #125718)

2025-02-18 Thread Steven Perron via cfe-commits
https://github.com/s-perron converted_to_draft https://github.com/llvm/llvm-project/pull/125718 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-02-18 Thread Steven Perron via cfe-commits
@@ -94,6 +94,11 @@ bool Qualifiers::isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, (A == LangAS::Default && (B == LangAS::cuda_constant || B == LangAS::cuda_device || B == LangAS::cuda_shared)) || + // In HLSL, the this pointer for mem

  1   2   3   >