[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Justin Bogner via cfe-commits
@@ -33,6 +41,21 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +template +constexpr enable_if_t::value || is_same::value, T> +length_impl(T X) { + return __builtin_elementwise_abs(X); +} + +template +enable_if_t::value || is_same::value, T> +

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

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

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-03 Thread Justin Bogner via cfe-commits
@@ -33,6 +41,23 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +template +constexpr enable_if_t::value || is_same::value, T> +length_impl(T X) { + return __builtin_elementwise_abs(X); +} + +template +enable_if_t::value || is_same::value, T> +

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-03 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,59 @@ +//===- SemaSPIRV.cpp - Semantic Analysis for SPIRV constructs +//---===// bogner wrote: same here https://github.com/llvm/llvm-project/pull/121598 ___ cfe-commits mailing list cfe-commits@

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-03 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. The boilerplate all looks correct to me. https://github.com/llvm/llvm-project/pull/121598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-03 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,29 @@ +//===- SemaSPIRV.h - Semantic Analysis for SPIRV constructs +//-===// bogner wrote: clang-format went wrong here https://github.com/llvm/llvm-project/pull/121598 ___ cfe-commits mailin

[clang] [llvm] [SPIRV] Add Target Builtins using Distance ext as an example (PR #121598)

2025-01-03 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/121598 ___ 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 SV_GroupID semantic lowering (PR #121521)

2025-01-03 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/121521 ___ 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 SV_GroupID semantic lowering (PR #121521)

2025-01-03 Thread Justin Bogner via cfe-commits
https://github.com/bogner commented: This basically LGTM but th SV_GroupID.ll test could use a fair amount of cleanup https://github.com/llvm/llvm-project/pull/121521 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [llvm] [HLSL][SPIR-V] implement SV_GroupID semantic lowering (PR #121521)

2025-01-03 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,82 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %} + +; This file generated from the following command: +; clang -cc1 -t

[clang] Reapply "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test (#121160)" (PR #121162)

2024-12-28 Thread Justin Bogner via cfe-commits
bogner wrote: These tests are failing for me locally on windows now. Why are you removing this? https://github.com/llvm/llvm-project/pull/121162 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] Revert "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test" again (PR #121280)

2024-12-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/121280 This reverts #121162, which was a reapply of the previous revert earlier in #121160 - The change blatantly breaks tests on windows and it isn't clear why it's being made. This reverts commit 8e9fda1c1140e067c53

[clang] Revert "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test" again (PR #121280)

2024-12-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/121280 >From 650dd5a50a6228124dc40676ea08a963ecdf3bb0 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Sat, 28 Dec 2024 21:35:03 -0700 Subject: [PATCH 1/2] Revert "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test

[clang] Revert "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test" again (PR #121280)

2024-12-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner closed https://github.com/llvm/llvm-project/pull/121280 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test (#121160)" (PR #121162)

2024-12-28 Thread Justin Bogner via cfe-commits
bogner wrote: I've gone ahead and reverted it. https://github.com/llvm/llvm-project/pull/121162 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[nfc][Driver] Remove {{(.exe)?}} from sanitizer test" again (PR #121280)

2024-12-28 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/121280 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-03 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,173 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#120472): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-03 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,134 @@ +//=== ParseHLSLRootSignatureTest.cpp - Parse Root Signature tests -===// +// +// 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] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-03 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,173 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#120472): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [llvm] [HLSL] Create HLSL legalization passes (PR #123811)

2025-02-03 Thread Justin Bogner via cfe-commits
bogner wrote: Sharing the code here makes sense to me, however, this does make the pass run significantly earlier in the DXIL pipeline. That might be fine but we'll have to make sure we aren't creating dead functions in any of the other DXIL backend passes that might have been cleaned up by th

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-02-04 Thread Justin Bogner via cfe-commits
@@ -6358,3 +6359,81 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E, LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) { return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV; } + +void CodeGenFunction::Fl

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

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

[clang] [HLSL] Constant buffer layout struct update (PR #124840)

2025-02-04 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. This all looks reasonable, though it is kind of a mess of random fixes. It's generally best to commit unrelated things individually, and it would be nice to have commit messages that are full sentences of what and why rather than a bulleted

[clang] [HLSL] Constant buffer layout struct update (PR #124840)

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

[clang] [HLSL] Constant buffer layout struct update (PR #124840)

2025-02-04 Thread Justin Bogner via cfe-commits
@@ -14183,6 +14183,13 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { if (getLangOpts().OpenCL && Var->getType().getAddressSpace() == LangAS::opencl_local) return; + +// In HLSL, objects in the hlsl_constat address space are initialized +// exte

[clang] [HLSL][NFC] Add test check to make sure the resource handle gets stored in the resource global (PR #124866)

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

[clang] [HLSL][NFC] Fix typo in comment in SemaHLSL.cpp (PR #125992)

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

[clang] [HLSL][NFC] Fix typo in comment in SemaHLSL.cpp (PR #125992)

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

[clang] [HLSL][NFC] Fix typo in comment in SemaHLSL.cpp (PR #125992)

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

[clang] [HLSL] Appropriately set function attribute optnone (PR #125937)

2025-02-10 Thread Justin Bogner via cfe-commits
@@ -345,6 +345,9 @@ void clang::CodeGen::CGHLSLRuntime::setHLSLEntryAttributes( WaveSizeAttr->getPreferred()); Fn->addFnAttr(WaveSizeKindStr, WaveSizeStr); } + if (CGM.getCodeGenOpts().OptimizationLevel == 0) { +Fn->addFnAttr(llvm::Attribute::Optimize

[clang] [HLSL] Appropriately set function attribute optnone (PR #125937)

2025-02-10 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. This looks reasonable to me. It would be good to get some feedback from @pow2clk and @llvm-beanz since they've done a bunch of the work in this area. https://github.com/llvm/llvm-project/pull/125937 __

[clang] [HLSL] Appropriately set function attribute optnone (PR #125937)

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

[clang] [HLSL] Fix debug info generation for RWBuffer types (PR #119041)

2024-12-09 Thread Justin Bogner via cfe-commits
@@ -2021,28 +2021,10 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( // ThisPtr may be null if the member function has an explicit 'this' // parameter. if (!ThisPtr.isNull()) { -const CXXRecordDecl *RD = ThisPtr->getPointeeCXXRecordDecl(); -

[clang] [NFC] Cleanup comments in HLSLExternalSemaSource.cpp (PR #119444)

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

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-16 Thread Justin Bogner via cfe-commits
@@ -54,69 +54,110 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { StringRef Key = "dx.disable_optimizations";

[clang] [NFC] Updating Debug Info generation for 'this' (PR #119445)

2024-12-16 Thread Justin Bogner via cfe-commits
bogner wrote: > Don't see a problem with this but could we elaborate on the motivation for > this? Looks like this is required for #119041? Why is that? > > The original change this is based on is: > [microsoft/DirectXShaderCompiler#6296](https://github.com/microsoft/DirectXShaderCompiler/pull

[clang] [HLSL] Fix call convention mismatch for ctor/dtor (PR #118651)

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

[clang] [HLSL] Add RWBuffer::Load(Index) (PR #117018)

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

[clang] [llvm] [DirectX][SPIRV] Consistent names for HLSL resource intrinsics (PR #120466)

2024-12-18 Thread Justin Bogner via cfe-commits
@@ -208,37 +208,44 @@ Examples: .. code-block:: llvm - ; RWBuffer Buf : register(u5, space3) - %buf = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0) - @llvm.dx.handle.fromBinding.tdx.TypedBuffer_f32_1_0( - i32 3, i32 5, i32 1, i32 0, i

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-17 Thread Justin Bogner via cfe-commits
@@ -54,69 +54,110 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { StringRef Key = "dx.disable_optimizations";

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner commented: This looks correct, but how much work is it to update all of these tests to have fast math enabled rather than explicitly disabling it? I worry that (1) folks looking at these tests in the future will think that disabling fast math is a meaningful part of t

[clang] [HLSL] Add RWBuffer::Load(Index) (PR #117018)

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

[clang] Add concepts for raw buffers (PR #119643)

2024-12-12 Thread Justin Bogner via cfe-commits
bogner wrote: This should really be talking about concepts for structured buffers, not raw buffers. At the HLSL language level, there is nothing called a RawBuffer - there is ByteAddressBuffer and various kinds of StructuredBuffer, which are represented lower in the stack as a "raw" buffer. Gi

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

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

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-19 Thread Justin Bogner via cfe-commits
bogner wrote: > Two questions: > > 1. Do we foresee any issue adding `afn` (I suspect not) Adding `afn` should be fine - we don't have library functions per se anyway so this shouldn't make any difference one way or the other. > 2. Do we also need to apply `contract`, which I believe was also

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-19 Thread Justin Bogner via cfe-commits
bogner wrote: Note: To see the bitcode writer crash, apply this patch and set up https://github.com/llvm-beanz/HLSLTest - Basic/simple.test hits an assert: ``` Assertion failed: ((Val & ~(~0U >> (32-NumBits))) == 0 && "High bits set!"), function Emit, file BitstreamWriter.h, line 284. ... #7 0

[clang] Add concepts for Structured buffers (PR #119643)

2024-12-19 Thread Justin Bogner via cfe-commits
@@ -868,8 +868,54 @@ static Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, return TypedResExpr; } -static ConceptDecl *constructTypedBufferConceptDecl(Sema &S, -NamespaceDecl *NSD) { +static Expr

[clang] Add concepts for Structured buffers (PR #119643)

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

[clang] [llvm] [DirectX][SPIRV] Consistent names for HLSL resource intrinsics (PR #120466)

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

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -12528,6 +12530,10 @@ def warn_attr_min_eq_max: Warning< def err_hlsl_attribute_number_arguments_insufficient_shader_model: Error< "attribute %0 with %1 arguments requires shader model %2 or greater">; +def err_hlsl_expect_arg_const_int_one_or_neg_one: Error< + "argumen

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -343,27 +343,232 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

[clang] [llvm] [HLSL] Get the index for resource bindings from the slot (PR #117303)

2024-11-22 Thread Justin Bogner via cfe-commits
https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/117303 >From 05f412f47b8d30ff1db9372225001c75289bed44 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 21 Nov 2024 23:18:13 -0800 Subject: [PATCH 1/2] [HLSL] Get the index for resource bindings from the slot Res

[clang] [llvm] [DirectX] Calculate resource binding offsets using the lower bound (PR #117303)

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -588,7 +588,7 @@ llvm::Function *CGHLSLRuntime::createResourceBindingInitFn() { auto *Slot = llvm::ConstantInt::get(CGM.IntTy, RBA->getSlotNumber()); // FIXME: resource arrays are not yet implemented auto *Range = llvm::ConstantInt::get(CGM.IntTy, 1); -

[clang] [llvm] [DirectX] Calculate resource binding offsets using the lower bound (PR #117303)

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

[clang] [llvm] [DirectX] Calculate resource binding offsets using the lower bound (PR #117303)

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

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

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

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

2024-11-22 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. Just a few nitpicks - this looks great, thanks! https://github.com/llvm/llvm-project/pull/114148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -19371,6 +19371,15 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef{Op0}, nullptr, "hlsl.radians"); } + case Builtin::BI__builtin_hlsl_buffer_update_counter: { +Value *ResHandle = EmitScalarExp

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -570,3 +780,20 @@ void HLSLExternalSemaSource::CompleteType(TagDecl *Tag) { return; It->second(Record); } + +static FunctionDecl *lookupBuiltinFunction(Sema &S, StringRef Name) { + IdentifierInfo &II = + S.getASTContext().Idents.get(Name, tok::TokenKind::identifi

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -343,27 +343,232 @@ struct TemplateParameterListBuilder { Params.clear(); QualType T = Builder.Template->getInjectedClassNameSpecialization(); -T = S.Context.getInjectedClassNameType(Builder.Record, T); +T = AST.getInjectedClassNameType(Builder.Record, T);

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -37,7 +37,7 @@ def int_dx_typedBufferStore : DefaultAttrsIntrinsic<[], [llvm_any_ty, llvm_i32_ty, llvm_anyvector_ty], [IntrWriteMem]>; -def int_dx_updateCounter +def int_dx_bufferUpdateCounter bogner wrote: We'll need to rev

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

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

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -472,10 +571,73 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S); } +Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, + TemplateTypeParmDecl

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -5720,8 +5720,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT, case UTT_IsTypedResourceElementCompatible: assert(Self.getLangOpts().HLSL && "typed resource element compatible types are an HLSL-only feature"); -if (Self.RequireCompleteT

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -472,10 +571,73 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S); } +Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, + TemplateTypeParmDecl

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -289,8 +289,9 @@ struct BuiltinTypeDeclBuilder { } TemplateParameterListBuilder addTemplateArgumentList(Sema &S); - BuiltinTypeDeclBuilder &addSimpleTemplateParams(Sema &S, - ArrayRef Names); + BuiltinTypeDeclBuilder &

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

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -12,44 +12,51 @@ #include "clang/Sema/HLSLExternalSemaSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Attr.h" +#include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" +#include "clang/AST/Expr.h" #include "clang/AST/Type.h" #include "clang/Basic/SourceL

[clang] [HLSL] Get the index for resource bindings from the slot (PR #117303)

2024-11-22 Thread Justin Bogner via cfe-commits
@@ -588,7 +588,7 @@ llvm::Function *CGHLSLRuntime::createResourceBindingInitFn() { auto *Slot = llvm::ConstantInt::get(CGM.IntTy, RBA->getSlotNumber()); // FIXME: resource arrays are not yet implemented auto *Range = llvm::ConstantInt::get(CGM.IntTy, 1); -

[clang] [HLSL] Implement `Append` and `Consume` methods on `Append`/`ConsumeStructuredBuffer` (PR #118536)

2024-12-03 Thread Justin Bogner via cfe-commits
@@ -674,6 +700,34 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name, .finalizeMethod(); } +BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() { + using PH = BuiltinTypeMethodBuilder::PlaceHolder; + ASTContext &AST = SemaRef.getAST

[clang] [llvm] [HLSL] Add SPIR-V version of getPointer. (PR #121963)

2025-01-08 Thread Justin Bogner via cfe-commits
@@ -104,6 +104,8 @@ class CGHLSLRuntime { GENERATE_HLSL_INTRINSIC_FUNCTION(SClamp, sclamp) GENERATE_HLSL_INTRINSIC_FUNCTION(UClamp, uclamp) + GENERATE_HLSL_INTRINSIC_FUNCTION(CreateResourceGetPointer, bogner wrote: Why "CreateResourceGetPointer"? Shouldn

[clang] [HLSL][NFC] Move packoffset validation to separate function and calculate offsets in bytes (PR #121989)

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

[clang] [HLSL][Sema] Fixed Diagnostics that assumed only two arguments (PR #122772)

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

[clang] [HLSL] Fix global resource initialization (PR #123394)

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

[clang] [Clang] Add fake use emission to Clang with -fextend-lifetimes (PR #110102)

2025-01-28 Thread Justin Bogner via cfe-commits
bogner wrote: > I think the forward fix has been identified, and importantly it will take a > bit longer to revert than to submit the fix (adding triples to the tests), > because there are 4 commits that need to be reverted and I need to run a > quick build to ensure that nothing is broken by

[clang] [HLSL] Implement D3DCOLORtoUBYTE4 intrinsic (PR #122202)

2025-01-12 Thread Justin Bogner via cfe-commits
@@ -41,6 +41,14 @@ constexpr enable_if_t bit_cast(T F) { return __builtin_bit_cast(U, F); } +constexpr vector d3d_color_to_ubyte4_impl(vector V) { + // Use the same scaling factor used by FXC (i.e., 255.001953) + // Excerpt from stackoverflow discussion: + // "Built-in r

[clang] [llvm] [HLSL][SPIR-V] implement SV_GroupID semantic lowering (PR #121521)

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

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Justin Bogner via cfe-commits
@@ -142,6 +145,20 @@ void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM) { // Merge SCCSF with that of F FunctionFlags[F].merge(SCCSF); } + + // Set DisableOptimizations flag based on the presence of OptimizeNone + // attribute of entry fun

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,53 @@ +; RUN: opt -S --passes="print-dx-shader-flags" 2>&1 %s | FileCheck %s + + +; CHECK: ; Combined Shader Flags for Module +; CHECK-NEXT: ; Shader Flags Value: 0x0001 + +; CHECK: ; Note: extra DXIL module flags: +; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

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

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,43 @@ +; RUN: opt -S --passes="print-dx-shader-flags" 2>&1 %s | FileCheck %s + + +; CHECK: ; Combined Shader Flags for Module +; CHECK-NEXT: ; Shader Flags Value: 0x0001 + +; CHECK: ; Note: extra DXIL module flags: +; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_

[clang] [llvm] [DirectX] Set Shader Flag DisableOptimizations (PR #126813)

2025-02-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,43 @@ +; RUN: opt -S --passes="print-dx-shader-flags" 2>&1 %s | FileCheck %s + + +; CHECK: ; Combined Shader Flags for Module +; CHECK-NEXT: ; Shader Flags Value: 0x0001 + +; CHECK: ; Note: extra DXIL module flags: +; CHECK-NEXT: ; D3D11_1_SB_GLOBAL_FLAG_SKIP_

[clang] [HLSL] Update target test to use `-cc1` rather than the clang driver (PR #127262)

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

[clang] [HLSL] Update target test to use `-cc1` rather than the clang driver (PR #127262)

2025-02-14 Thread Justin Bogner via cfe-commits
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/127262 This test was unnecessarily invoking `dxv` if it was in your path since it used the driver rather than the `-cc1` command. >From 218469de699d360b70d37a37d55d2b42a2a1e39a Mon Sep 17 00:00:00 2001 From: Justin Bog

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Justin Bogner via cfe-commits
@@ -2582,17 +2582,20 @@ static void BuildFlattenedTypeList(QualType BaseTy, continue; } if (const auto *RT = dyn_cast(T)) { - const RecordDecl *RD = RT->getDecl(); - if (RD->isUnion()) { + const CXXRecordDecl *RD = RT->getAsCXXRecordDecl(); + a

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Justin Bogner via cfe-commits
@@ -3010,3 +3013,193 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) { } } } + +static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E, +llvm::SmallVectorImpl &List, +llvm::SmallVectorImpl &DestT

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Justin Bogner via cfe-commits
@@ -1462,6 +1462,14 @@ void CXXRecordDecl::addedMember(Decl *D) { if (Using->getDeclName().getCXXOverloadedOperator() == OO_Equal) data().HasInheritedAssignment = true; } + + // HLSL: All user-defined data types are aggregates and use aggregate + // initialization

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. This all looks reasonable to me. A couple of nitpicks and a question inline. https://github.com/llvm/llvm-project/pull/123141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-14 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited https://github.com/llvm/llvm-project/pull/123141 ___ 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 #125718)

2025-02-14 Thread Justin Bogner via cfe-commits
bogner wrote: > 1. If/when we support separate compilation, the user-facing exported > "resource" object will be the resource wrapper, not the handle, so that > indicates to me we should probably have the wrappers being public. Depending on which aspect of separate compilation you mean, there

[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 these are

[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] [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] [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-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 If these

[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] [DirectX] Use scalar arguments for @llvm.dx.dot intrinsics (PR #134570)

2025-04-06 Thread Justin Bogner via cfe-commits
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/134570 The `dx.dot2`, `dot3`, and `dot4` intrinsics exist purely to lower `dx.fdot`, and they map exactly to the DXIL ops of the same name. Using vectors for their arguments adds unnecessary complexity and causes us to

[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 2025 10:1

[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] [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

<    3   4   5   6   7   8   9   10   >