[clang] [HLSL] Reland; Make it possible to assign an array from a cbuffer (PR #136580)

2025-04-21 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/136580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (PR #136234)

2025-04-19 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/136234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (PR #136234)

2025-04-18 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,7 @@ +// RUN: %if clang-dxc %{not %clang_dxc -T lib_6_3 %s 2>&1 | FileCheck %s %} bogner wrote: I don't think there's a `clang-dxc` feature, so I suspect this just never runs at all. This will fail if the DirectX backend isn't available, so I don't th

[clang] [llvm] [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (PR #136234)

2025-04-18 Thread Justin Bogner via cfe-commits
@@ -756,9 +756,10 @@ class OpLowerer { case Intrinsic::not_intrinsic: continue; default: { -DiagnosticInfoUnsupported Diag( -F, "Unsupported intrinsic for DXIL lowering"); -M.getContext().diagnose(Diag); +std::string Msg =

[clang] [llvm] [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (PR #136234)

2025-04-18 Thread Justin Bogner via cfe-commits
@@ -139,7 +139,7 @@ class DiagnosticInfo { using DiagnosticHandlerFunction = std::function; class DiagnosticInfoGeneric : public DiagnosticInfo { - const Twine &MsgStr; + const Twine MsgStr; bogner wrote: All of the Twine usage in Diagnostic info is super s

[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

2025-04-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. The fact that we get memcpy here points out some of the issues we have with representing cbuffers - it would really be nicer if this ended up generating elementwise copies instead. However, I think fixing that is out of the scope of this ch

[clang] [llvm] [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (PR #136234)

2025-04-18 Thread Justin Bogner via cfe-commits
bogner wrote: This doesn't seem right. Are we just misusing `DiagnosticInfoUnsupported` here? The `Function` argument for `DiagnosticInfoWithLocationBase` is clearly meant to be part of the location (as evidenced by the "in function XYZ" part of the message). I suspect that we should really be

[clang] [llvm] [HLSL][RootSignature] Add infastructure to parse parameters (PR #133800)

2025-04-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/133800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-17 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/135909 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][RootSignature] Add infastructure to parse parameters (PR #133800)

2025-04-16 Thread Justin Bogner via cfe-commits
bogner wrote: I'm not entirely convinced the generic `ParsedParamState` is the right level of abstraction. In some ways the declarative nature is nice, but I think it's quite a bit more complex than a simple recursive descent here. Warning - lots of untested and never compiled code follows. C

[clang] [HLSL] Don't invoke `dxv` from `clang-dxc` for text output (PR #135876)

2025-04-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/135876 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
bogner wrote: > As a general comment, your approach of just checking for the existence of the > binding attribute may not in itself be sufficient. Consider this PR: > https://github.com/llvm/llvm-project/pull/135287/files There is a potential > case where the binding attribute has a slot = -1,

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
@@ -3278,6 +3284,9 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { << static_cast(RT); } } + + if (!HasBinding && VD->getType()->isHLSLResourceRecord()) bogner wrote: Good catch! Added some tests with arrays and updated this to

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
@@ -14,6 +14,12 @@ RWBuffer c; // No warning - explicit binding. RWBuffer d : register(u0); +// No warning - explicit binding. +RWBuffer dd : register(space1); bogner wrote: Yes, you're correct. I've updated the latest, though this is commented out now becau

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -Wno-error=hlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// expected-warning@+1 {{resource has implicit register binding}} +cbuffer cb0 { + int a; +} + +// No warning - this is an elemen

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/135909 >From cabe20bfd129a574f978c2a10e4f66a04cb85794 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 2 Apr 2025 11:34:00 -0700 Subject: [PATCH 1/6] [HLSL] Add a warning for implicit bindings Implicit bindi

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/135909 >From cabe20bfd129a574f978c2a10e4f66a04cb85794 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 2 Apr 2025 11:34:00 -0700 Subject: [PATCH 1/2] [HLSL] Add a warning for implicit bindings Implicit bindi

[clang] [HLSL] Add a warning for implicit bindings (PR #135909)

2025-04-16 Thread Justin Bogner via cfe-commits
@@ -3278,6 +3284,9 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { << static_cast(RT); } } + + if (!HasBinding && VD->getType()->isHLSLResourceRecord()) +SemaRef.Diag(VD->getLocation(), diag::warn_hlsl_implicit_binding); bog

[clang] [HLSL] Don't invoke `dxv` from `clang-dxc` for text output (PR #135876)

2025-04-16 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/135876 >From de6d197193e758d649cbebe6d96cd8e5af95d9ac Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 15 Apr 2025 15:05:21 -0700 Subject: [PATCH 1/2] [HLSL] Don't invoke `dxv` from `clang-dxc` for text

[clang] [HLSL] Don't invoke `dxv` from `clang-dxc` for text output (PR #135876)

2025-04-15 Thread Justin Bogner via cfe-commits
@@ -309,6 +309,9 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, } bool HLSLToolChain::requiresValidation(DerivedArgList &Args) const { + if (!Args.hasArg(options::OPT_dxc_Fo)) +return false; bogner wrote: I'm not sure I

[clang] [HLSL] Don't invoke `dxv` from `clang-dxc` for text output (PR #135876)

2025-04-15 Thread Justin Bogner via cfe-commits
e sense to do so. Fixes #135874. >From de6d197193e758d649cbebe6d96cd8e5af95d9ac Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 15 Apr 2025 15:05:21 -0700 Subject: [PATCH] [HLSL] Don't invoke `dxv` from `clang-dxc` for text output Running `clang-dxc` with textual output wa

[clang] [HLSL][OpenCL] Strip addrspace from implicit cast diags (PR #135830)

2025-04-15 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/135830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][OpenCL] Strip addrspace from implicit cast diags (PR #135830)

2025-04-15 Thread Justin Bogner via cfe-commits
@@ -11360,6 +11360,14 @@ static void AnalyzeAssignment(Sema &S, BinaryOperator *E) { static void DiagnoseImpCast(Sema &S, Expr *E, QualType SourceType, QualType T, SourceLocation CContext, unsigned diag, bool pruneControl

[clang] [llvm] [DirectX] Use scalar arguments for @llvm.dx.dot intrinsics (PR #134570)

2025-04-14 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/134570 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Include SPIRV in LLVM_TARGETS_TO_BUILD in the HLSL cmake cache (PR #133287)

2025-04-07 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/133287 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Use scalar arguments for @llvm.dx.dot intrinsics (PR #134570)

2025-04-06 Thread Justin Bogner via cfe-commits
rom 7f8833f723d4a7d4d69160765477ee646fba1083 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 2 Apr 2025 15:21:21 -0700 Subject: [PATCH] [DirectX] Use scalar arguments for @llvm.dx.dot intrinsics The `dx.dot2`, `dot3`, and `dot4` intrinsics exist purely to lower `dx.fdot`, and they map exactly to the D

[clang] [HLSL][NFC] Refactor HLSLExternalSemaSource (PR #131032)

2025-04-05 Thread Justin Bogner via cfe-commits
@@ -21,20 +21,15 @@ class NamespaceDecl; class Sema; class HLSLExternalSemaSource : public ExternalSemaSource { +private: bogner wrote: The default visibility in `class` is private, so this doesn't do anything https://github.com/llvm/llvm-project/pull/131032

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

2025-04-05 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/130231 >From bf5e5b4b1060f51d37b05c905b4327a40316f158 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 6 Mar 2025 17:50:12 -0800 Subject: [PATCH 1/3] [HLSL] Buffer handle globals should not be constants

[clang] [Clang][Cmake] fix libtool duplicate member name warnings (PR #133619)

2025-04-05 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. This looks sensible to me. https://github.com/llvm/llvm-project/pull/133619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-04 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/130231 >From bf5e5b4b1060f51d37b05c905b4327a40316f158 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 6 Mar 2025 17:50:12 -0800 Subject: [PATCH 1/2] [HLSL] Buffer handle globals should not be constants

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-31 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/133302 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][RootSignature] Make Root Signature lexer keywords case-insensitive (PR #132967)

2025-03-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/132967 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [IRBuilder] Add new overload for CreateIntrinsic (PR #131942)

2025-03-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/131942 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix codegen to support classes in `cbuffer` (PR #132828)

2025-03-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/132828 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,110 @@ +//===--- ParseHLSLRootSignature.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,188 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +#include "llvm/Support/raw_ostream.h" + +using namespace llvm::hlsl::rootsig; + +namespace clang { +namespace hlsl { + +static std::string FormatTokenKinds(ArrayRef Kinds) { bogner wrote: You c

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,188 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +#include "llvm/Support/raw_ostream.h" + +using namespace llvm::hlsl::rootsig; + +namespace clang { +namespace hlsl { + +static std::string FormatTokenKinds(ArrayRef Kinds) { + std::string TokenString; + llvm::

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,188 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +#include "llvm/Support/raw_ostream.h" + +using namespace llvm::hlsl::rootsig; + +namespace clang { +namespace hlsl { + +static std::string FormatTokenKinds(ArrayRef Kinds) { + std::string TokenString; + llvm::

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,110 @@ +//===--- ParseHLSLRootSignature.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,110 @@ +//===--- ParseHLSLRootSignature.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,188 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +#include "llvm/Support/raw_ostream.h" + +using namespace llvm::hlsl::rootsig; + +namespace clang { +namespace hlsl { + +static std::string FormatTokenKinds(ArrayRef Kinds) { + std::string TokenString; + llvm::

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/133302 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][RootSignature] Implement parsing of a DescriptorTable with empty clauses (PR #133302)

2025-03-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner commented: One comment saying you should rename all of the methods in this patch and a few small suggestions, but this is looking pretty close https://github.com/llvm/llvm-project/pull/133302 ___ cfe-commits mailing list cfe-

[clang] [HLSL] Include SPIRV in LLVM_TARGETS_TO_BUILD in the HLSL cmake cache (PR #133287)

2025-03-27 Thread Justin Bogner via cfe-commits
@@ -1,13 +1,10 @@ # Including the native target is important because some of LLVM's tests fail if # you don't. -set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "") +set(LLVM_TARGETS_TO_BUILD "Native;SPIRV" CACHE STRING "") -# Include the DirectX target for DXIL code generation,

[clang] [HLSL] Include SPIRV in LLVM_TARGETS_TO_BUILD in the HLSL cmake cache (PR #133287)

2025-03-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/133287 Since SPIRV is no longer an experimental target this wasn't actually enabling it any more. >From 5c4b19d99275440eef8a360f5d8f1affd7869e0e Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 27 Mar

[clang] [HLSL][NFC] Refactor HLSLExternalSemaSource (PR #131032)

2025-03-24 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/131032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-03-20 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/130231 >From bf5e5b4b1060f51d37b05c905b4327a40316f158 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 6 Mar 2025 17:50:12 -0800 Subject: [PATCH] [HLSL] Buffer handle globals should not be constants If th

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

2025-03-20 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed 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] [llvm] [HLSL] Buffer handle globals should not be constants (PR #130231)

2025-03-20 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/130231 >From bf5e5b4b1060f51d37b05c905b4327a40316f158 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 6 Mar 2025 17:50:12 -0800 Subject: [PATCH 1/4] [HLSL] Buffer handle globals should not be constants

[clang] [HLSL][NFC] Update HLSL AST tests to be more readable (PR #130910)

2025-03-12 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/130910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][NFC] Update resource metadata tests to not use obsolete metadata annotations (PR #130222)

2025-03-11 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. One issue with inaccurate comments but otherwise LGTM! https://github.com/llvm/llvm-project/pull/130222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Justin Bogner via cfe-commits
@@ -45,6 +45,10 @@ template struct is_arithmetic { static const bool Value = __is_arithmetic(T); }; +template +using HLSL_FIXED_VECTOR = bogner wrote: `HLSL_FIXED_VECTOR` looks like a macro to me rather than a type. Why use all caps convention here? htt

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. Looks good to me. One suggestion for an alternative approach (using `= delete` on some overloads) but you can use your judgement on whether that's worth trying. https://github.com/llvm/llvm-project/pull/130724 __

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Justin Bogner via cfe-commits
@@ -89,23 +89,31 @@ void asuint(double4, out uint4, out uint4); /// \param X The X input value. /// \param Y The Y input value. +template _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) -const inline half distance(half X, half Y) { +const inline __detail::enable_if_t<__detail::is

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/130724 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

2025-03-11 Thread Justin Bogner via cfe-commits
@@ -89,23 +89,31 @@ void asuint(double4, out uint4, out uint4); /// \param X The X input value. /// \param Y The Y input value. +template _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) -const inline half distance(half X, half Y) { +const inline __detail::enable_if_t<__detail::is

[clang] [HLSL][Driver] Use temporary files correctly (PR #130436)

2025-03-08 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/130436 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][NFC] Update resource metadata tests to not use obsolete metadata annotations (PR #130222)

2025-03-06 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,80 @@ +; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s +; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT +; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT + +target datalayout

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

2025-03-06 Thread Justin Bogner via cfe-commits
001 From: Justin Bogner Date: Thu, 6 Mar 2025 17:50:12 -0800 Subject: [PATCH] [HLSL] Buffer handle globals should not be constants If these are constants their initializers will be removed by InstCombine. Change them to not be constants and initialize them with poison. --- clang/lib/Code

[clang] [HLSL] Make sure `isSigned` flag is set on target type for `TypedBuffer` resources with signed int vectors (PR #130223)

2025-03-06 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/130223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][NFC] Update resource metadata tests to not use obsolete metadata annotations (PR #130222)

2025-03-06 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/130222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][NFC] Update resource metadata tests to not use obsolete metadata annotations (PR #130222)

2025-03-06 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,103 @@ +; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s +; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT +; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT + +target datalayout

[clang] [DXC] Add `-metal` flag to DXC driver (PR #130173)

2025-03-06 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/130173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/127137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-26 Thread Justin Bogner via cfe-commits
@@ -738,6 +739,16 @@ def UMin : DXILOp<40, binary> { let attributes = [Attributes]; } +def UAddc : DXILOp<44, binaryWithCarryOrBorrow > { + let Doc = "Unsigned 32-bit integer arithmetic add with carry. uaddc(a,b) = (a+b, a+b overflowed ? 1 : 0)"; bogner wr

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-26 Thread Justin Bogner via cfe-commits
@@ -738,6 +739,16 @@ def UMin : DXILOp<40, binary> { let attributes = [Attributes]; } +def UAddc : DXILOp<44, binaryWithCarryOrBorrow > { + let Doc = "Unsigned 32-bit integer arithmetic add with carry. uaddc(a,b) = (a+b, a+b overflowed ? 1 : 0)"; + let intrinsics = [Intri

[clang] Match .exe on Windows (PR #128894)

2025-02-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/128894 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-25 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,72 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; CHECK: %dx.types.i32c = type { i32, i1 } + +define noundef i

[clang] [HLSL] Implement default constant buffer $Globals (2nd attempt) (PR #128589)

2025-02-24 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/128589 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Allow EmptyDecl in cbuffer/tbuffer (PR #128250)

2025-02-21 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/128250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-21 Thread Justin Bogner via cfe-commits
bogner wrote: We can simplify the op lowering part a bit if we do #128247 first. https://github.com/llvm/llvm-project/pull/127137 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reland "[HLSL] Implement the reflect HLSL function" (PR #125599)

2025-02-21 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/125599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reland "[HLSL] Implement the reflect HLSL function" (PR #125599)

2025-02-21 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. I have some misgivings about the way we're partially introducing the error handling here, but my disagreements are largely philosophical and procedural. Since we've worked around the issues with the hwasan bot at this point it's probably fi

[clang] [llvm] Reland "[HLSL] Implement the reflect HLSL function" (PR #125599)

2025-02-21 Thread Justin Bogner via cfe-commits
@@ -905,6 +903,14 @@ bool SPIRVInstructionSelector::selectExtInst(Register ResVReg, const SPIRVType *ResType, MachineInstr &I, GL::GLSLExtInst

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-20 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/124886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reland "[HLSL] Implement the reflect HLSL function" (PR #125599)

2025-02-19 Thread Justin Bogner via cfe-commits
@@ -905,6 +903,14 @@ bool SPIRVInstructionSelector::selectExtInst(Register ResVReg, const SPIRVType *ResType, MachineInstr &I, GL::GLSLExtInst

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-19 Thread Justin Bogner via cfe-commits
@@ -19445,6 +19445,70 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, return nullptr; switch (BuiltinID) { + case Builtin::BI__builtin_hlsl_adduint64: { +Value *OpA = EmitScalarExpr(E->getArg(0)); +Value *OpB = EmitScalarExpr(E->getArg(1)); +

[clang] [llvm] [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (PR #127137)

2025-02-19 Thread Justin Bogner via cfe-commits
@@ -19445,6 +19445,70 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, return nullptr; switch (BuiltinID) { + case Builtin::BI__builtin_hlsl_adduint64: { +Value *OpA = EmitScalarExpr(E->getArg(0)); +Value *OpB = EmitScalarExpr(E->getArg(1)); +

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-19 Thread Justin Bogner via cfe-commits
@@ -249,6 +249,23 @@ bool all(double3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_all) bool all(double4); +//===--===// +// and builtins +//===--===

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-19 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/127098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-19 Thread Justin Bogner via cfe-commits
bogner wrote: LGTM - I've gone ahead and merged this for you. Thanks! https://github.com/llvm/llvm-project/pull/127098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-19 Thread Justin Bogner via cfe-commits
@@ -249,6 +249,23 @@ bool all(double3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_all) bool all(double4); +//===--===// +// and builtins +//===--===

[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

2025-02-19 Thread Justin Bogner via cfe-commits
@@ -249,6 +249,23 @@ bool all(double3); _HLSL_BUILTIN_ALIAS(__builtin_hlsl_all) bool all(double4); +//===--===// +// and builtins +//===--===

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -115,48 +83,176 @@ llvm::Triple::ArchType CGHLSLRuntime::getArch() { return CGM.getTarget().getTriple().getArch(); } -void CGHLSLRuntime::addConstant(VarDecl *D, Buffer &CB) { - if (D->getStorageClass() == SC_Static) { -// For static inside cbuffer, take as global st

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,39 @@ +//===- HLSLTargetInfo.h ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,39 @@ +//===- HLSLTargetInfo.h ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -115,48 +83,176 @@ llvm::Triple::ArchType CGHLSLRuntime::getArch() { return CGM.getTarget().getTriple().getArch(); } -void CGHLSLRuntime::addConstant(VarDecl *D, Buffer &CB) { - if (D->getStorageClass() == SC_Static) { -// For static inside cbuffer, take as global st

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -115,48 +83,176 @@ llvm::Triple::ArchType CGHLSLRuntime::getArch() { return CGM.getTarget().getTriple().getArch(); } -void CGHLSLRuntime::addConstant(VarDecl *D, Buffer &CB) { - if (D->getStorageClass() == SC_Static) { -// For static inside cbuffer, take as global st

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -115,48 +83,176 @@ llvm::Triple::ArchType CGHLSLRuntime::getArch() { return CGM.getTarget().getTriple().getArch(); } -void CGHLSLRuntime::addConstant(VarDecl *D, Buffer &CB) { - if (D->getStorageClass() == SC_Static) { -// For static inside cbuffer, take as global st

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -56,9 +75,18 @@ llvm::Type *DirectXTargetCodeGenInfo::getHLSLType(CodeGenModule &CGM, return llvm::TargetExtType::get(Ctx, TypeName, {ElemType}, Ints); } - case llvm::dxil::ResourceClass::CBuffer: -llvm_unreachable("dx.CBuffer handles are not implemented yet");

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -115,48 +83,176 @@ llvm::Triple::ArchType CGHLSLRuntime::getArch() { return CGM.getTarget().getTriple().getArch(); } -void CGHLSLRuntime::addConstant(VarDecl *D, Buffer &CB) { - if (D->getStorageClass() == SC_Static) { -// For static inside cbuffer, take as global st

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,39 @@ +//===- HLSLTargetInfo.h ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner commented: This is looking pretty good, though I have some misgivings about `CommonHLSLTargetCodeGenInfo` and think it might be better to introduce a `HLSLLayoutBuilder` that can be used by targets as necessary instead. If you take that suggestion a couple of my comme

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/124886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Constant buffers codegen (PR #124886)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,39 @@ +//===- HLSLTargetInfo.h ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [HLSL] Allow arrays to copy-initialize (PR #127557)

2025-02-18 Thread Justin Bogner via cfe-commits
@@ -2927,6 +2898,53 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle, } } +// CheckHLSLCStyleCast - Returns `true` ihe cast is handled or errored as an +// HLSL-specific cast. Returns false if the cast should be checked as a CXX +// C-Style cast. +bool CastOpe

[clang] [HLSL] Allow arrays to copy-initialize (PR #127557)

2025-02-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/127557 ___ 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 Justin Bogner 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] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-02-18 Thread Justin Bogner 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] [llvm] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-02-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited 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

  1   2   3   4   5   6   7   8   9   10   >