[clang] [HLSL] Implement floating literal suffixes (PR #87270)

2024-04-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/87270 >From c4dd0ba015dd51eea423d5d52d4afa9b2e92d514 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 1 Apr 2024 13:24:00 -0500 Subject: [PATCH 1/2] [HLSL] Implement floating literal suffixes This change im

[clang] [HLSL] Implement floating literal suffixes (PR #87270)

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

[clang] [clang] Introduce `SemaHLSL` (PR #87912)

2024-04-08 Thread Chris B via cfe-commits
@@ -0,0 +1,37 @@ +//===- SemaHLSL.h - Semantic Analysis for HLSL constructs -===// +// +// 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] [clang] Introduce `SemaHLSL` (PR #87912)

2024-04-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I really like this direction. Thank you for taking the initiative on cleaning Sema up! I had one small comment below, but you can take it or leave it. https://github.com/llvm/llvm-project/pull/87912 _

[clang] [clang] Introduce `SemaHLSL` (PR #87912)

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

[clang] [Doc][HLSL] Add documentation for root signature. (PR #83933)

2024-04-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. I think we need to break this PR up into different parts going to different places. Documenting the RootSignature grammar and usage in the Clang docs makes sense. I think documentation of the RootSignature binary format prob

[clang] [clang][cmake] Fixes for PGO builds when invoking ninja twice (PR #92591)

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

[clang] [clang][cmake] Fixes for PGO builds when invoking ninja twice (PR #92591)

2024-06-05 Thread Chris B via cfe-commits
llvm-beanz wrote: LGTM. Sorry for the delay. https://github.com/llvm/llvm-project/pull/92591 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

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

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I think dependencies for object libraries are implicitly `INTERAFCE`, but it might be nice to make that explicit. I know CMake complains if you mix and match implicit and explicit specification of linkage types. Otherwise LGTM. https:/

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
@@ -194,18 +194,20 @@ macro(add_clang_symlink name dest) endmacro() function(clang_target_link_libraries target type) - if (TARGET obj.${target}) -target_link_libraries(obj.${target} ${ARGN}) - endif() - get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-05 Thread Chris B via cfe-commits
@@ -194,18 +194,20 @@ macro(add_clang_symlink name dest) endmacro() function(clang_target_link_libraries target type) - if (TARGET obj.${target}) -target_link_libraries(obj.${target} ${ARGN}) - endif() - get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS

[clang] Enable unguarded availability diagnostic on instantiated template functions (PR #91699)

2024-06-05 Thread Chris B via cfe-commits
llvm-beanz wrote: @nico, am I correct to assume those aren't false positives, just a bunch of places that didn't warn before? https://github.com/llvm/llvm-project/pull/91699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [HLSL] Use hlsl vector template in type printer (PR #95489)

2024-06-13 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/95489 In HLSL we really want to be using the HLSL vector template and other built-in sugared spellings for some builtin types. This updates the type printer to take an option to use HLSL type spellings. This chang

[clang] [HLSL] Use hlsl vector template in type printer (PR #95489)

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

[clang] [HLSL] Use hlsl vector template in type printer (PR #95489)

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

[clang] [HLSL] Strict Availability Diagnostics (PR #93860)

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

[clang] [HLSL] Rework implicit conversion sequences (PR #96011)

2024-06-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/96011 This PR reworks HLSL's implicit conversion sequences. Initially I was seeking to match DXC's behavior more closely, but that was leading to a pile of special case rules to tie-break ambiguous cases that shoul

[clang] [HLSL] Rework implicit conversion sequences (PR #96011)

2024-06-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/96011 >From 0baa7ec1ded4fa093092d491eaa2c803b736742b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 18 Jun 2024 20:25:57 -0500 Subject: [PATCH 1/2] [HLSL] Rework implicit conversion sequences This PR rewo

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

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

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

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

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-29 Thread Chris B via cfe-commits
@@ -1060,18 +1060,25 @@ static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) { .Case("ShaderModel", "shadermodel") .Default(Platform); } -static llvm::StringRef getPrettyEnviromentName(llvm::StringRef Environment) { -return ll

[clang] [HLSL] Default and Relaxed Availability Diagnostics (PR #92704)

2024-05-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I have one suggested code simplification which will also require test updates, but in general I think this is good. https://github.com/llvm/llvm-project/pull/92704 ___ cfe-commits mailing list

[clang] [HLSL] Use llvm::Triple::EnvironmentType instead of HLSLShaderAttr::ShaderType (PR #93847)

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

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

2024-06-03 Thread Chris B via cfe-commits
llvm-beanz wrote: Can you also add some tests for nested loops? Cases like: ```hlsl [unroll] for( int i = 0; i < 100; ++i) { // unroll this for( int j = 0; j < 100; ++j) { // but not this } } ``` https://github.com/llvm/llvm-project/pull/93879

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

2024-06-03 Thread Chris B via cfe-commits
@@ -7401,7 +7495,8 @@ b for constant buffer views (CBV). Register space is specified in the format ``space[number]`` and defaults to ``space0`` if omitted. Here're resource binding examples with and without space: -.. code-block:: c++ + +.. code-block:: hlsl

[clang] [llvm] [test] Avoid writing to a potentially write-protected dir (PR #89242)

2024-04-18 Thread Chris B via cfe-commits
@@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -

[clang] [llvm] [test] Avoid writing to a potentially write-protected dir (PR #89242)

2024-04-18 Thread Chris B via cfe-commits
@@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -

[clang] [llvm] [test] Avoid writing to a potentially write-protected dir (PR #89242)

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

[clang] [NFC] Rename hlsl semantics to hlsl annotations (PR #89309)

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

[clang] [clang][SPIR-V] Always add convervence intrinsics (PR #88918)

2024-04-22 Thread Chris B via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: @@ -3101,3 +3130,68 @@ CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt &S) { return F; } + +namespace { +// Returns the first convergence entry/loop/anchor instruction found in

[clang] [lldb] [HLSL] Implement intangible AST type (PR #97362)

2024-07-25 Thread Chris B via cfe-commits
@@ -8001,6 +8001,12 @@ NamedDecl *Sema::ActOnVariableDeclarator( } } + if (getLangOpts().HLSL) { +if (R->isHLSLSpecificType() && !NewVD->isImplicit()) { + Diag(D.getBeginLoc(), diag::err_hlsl_intangible_type_cannot_be_declared); llvm-beanz wrot

[clang] [HLSL] Initialize DiagnoseHLSLAvailability members (PR #100778)

2024-07-26 Thread Chris B via cfe-commits
llvm-beanz wrote: Does this have any behavior change that can be tested? https://github.com/llvm/llvm-project/pull/100778 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][NFC] Initialize DiagnoseHLSLAvailability members (PR #100778)

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

[clang] [lldb] [HLSL] Implement intangible AST type (PR #97362)

2024-07-26 Thread Chris B via cfe-commits
@@ -8001,6 +8001,12 @@ NamedDecl *Sema::ActOnVariableDeclarator( } } + if (getLangOpts().HLSL) { +if (R->isHLSLSpecificType() && !NewVD->isImplicit()) { + Diag(D.getBeginLoc(), diag::err_hlsl_intangible_type_cannot_be_declared); llvm-beanz wrot

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/101083 HLSL output parameters are denoted with the `inout` and `out` keywords in the function declaration. When an argument to an output parameter is constructed a temporary value is constructed for the argument.

[clang] [HLSL] Implement output parameter (PR #101083)

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

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH] [HLSL] Implement output parameter HLSL output parameters ar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
@@ -4057,6 +4057,10 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, NewQType)) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); +if (getLangOpts().HLSL && Cont

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-29 Thread Chris B via cfe-commits
@@ -4148,6 +4151,30 @@ static void emitWriteback(CodeGenFunction &CGF, assert(!isProvablyNull(srcAddr.getBasePointer()) && "shouldn't have writeback for provably null argument"); + if (CGF.getLangOpts().HLSL) { +if (writeback.CastExpr) { + RValue TmpVal =

[clang] [HLSL] Implement output parameter (PR #101083)

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

[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)

2024-07-30 Thread Chris B via cfe-commits
llvm-beanz wrote: @etcwilde's point above is that the `CLANG_RESOURCE_DIR` is already available in CMake for projects that import the Clang package or are built in-tree with Clang. You can get the directory via CMake with: ```cmake get_target_property(CLANG_IMPORT_HEADERS clang-resource-header

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -12361,6 +12361,21 @@ def warn_hlsl_availability_unavailable : def err_hlsl_export_not_on_function : Error< "export declaration can only be used on functions">; +def err_hlsl_attribute_in_wrong_shader_model: Error< + "attribute %0 requires shader model %1 or greater">; +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -2862,6 +2862,10 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D, else if (const auto *NT = dyn_cast(Attr)) NewAttr = S.HLSL().mergeNumThreadsAttr(D, *NT, NT->getX(), NT->getY(), NT->getZ()); + else if (const auto *NT

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -12361,6 +12361,21 @@ def warn_hlsl_availability_unavailable : def err_hlsl_export_not_on_function : Error< "export declaration can only be used on functions">; +def err_hlsl_attribute_in_wrong_shader_model: Error< + "attribute %0 requires shader model %1 or greater">; +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -245,6 +274,18 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) { << llvm::Triple::getEnvironmentTypeName(ST); FD->setInvalidDecl(); } +if (const auto *NT = FD->getAttr()) { + if (Ver < VersionTuple(6, 6)) { +Diag(NT->getLocation(), di

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -12361,6 +12361,21 @@ def warn_hlsl_availability_unavailable : def err_hlsl_export_not_on_function : Error< "export declaration can only be used on functions">; +def err_hlsl_attribute_in_wrong_shader_model: Error< + "attribute %0 requires shader model %1 or greater">; +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -12361,6 +12361,21 @@ def warn_hlsl_availability_unavailable : def err_hlsl_export_not_on_function : Error< "export declaration can only be used on functions">; +def err_hlsl_attribute_in_wrong_shader_model: Error< + "attribute %0 requires shader model %1 or greater">; +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -12361,6 +12361,21 @@ def warn_hlsl_availability_unavailable : def err_hlsl_export_not_on_function : Error< "export declaration can only be used on functions">; +def err_hlsl_attribute_in_wrong_shader_model: Error< + "attribute %0 requires shader model %1 or greater">; +

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -348,6 +391,77 @@ void SemaHLSL::handleNumThreadsAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +void SemaHLSL::handleWaveSizeAttr(Decl *D, const ParsedAttr &AL) { + // validate that the wavesize argument is a power of 2 between 4 and 128 + // inclusive

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-07-30 Thread Chris B via cfe-commits
@@ -245,6 +274,18 @@ void SemaHLSL::CheckEntryPoint(FunctionDecl *FD) { << llvm::Triple::getEnvironmentTypeName(ST); FD->setInvalidDecl(); } +if (const auto *NT = FD->getAttr()) { llvm-beanz wrote: Why is NT the name here? That doesn't

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
@@ -4613,14 +4613,13 @@ def HLSLGroupSharedAddressSpace : TypeAttr { let Documentation = [HLSLGroupSharedAddressSpaceDocs]; } -def HLSLParamModifier : TypeAttr { +def HLSLParamModifier : ParameterABIAttr { llvm-beanz wrote: DXC currently parses but ignores

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
@@ -5318,3 +5319,13 @@ OMPIteratorExpr *OMPIteratorExpr::CreateEmpty(const ASTContext &Context, alignof(OMPIteratorExpr)); return new (Mem) OMPIteratorExpr(EmptyShell(), NumIterators); } + +HLSLOutArgExpr *HLSLOutArgExpr::Create(const ASTContext &C, QualType Ty, +

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
@@ -4689,6 +4719,32 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, assert(type->isReferenceType() == E->isGLValue() && "reference binding to unmaterialized r-value!"); + // Add writeback for HLSLOutParamExpr. + if (const HLSLOutArgExpr *OE

[clang] [HLSL] Implement output parameter (PR #101083)

2024-07-31 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/101083 >From e8ec3e24e0061714b5dc440b1b92086965809483 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Mon, 29 Jul 2024 16:05:11 -0500 Subject: [PATCH 1/7] [HLSL] Implement output parameter HLSL output parameter

[clang] [HLSL] Remove hlsl::Resource (PR #98938)

2024-07-16 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Yea, this can go. I think I had intended to use this as the underlying type for the resource descriptor heap for dynamic resources. We can figure out a better approach for that when we get there. https://github.com/llvm/llvm-project/pul

[clang] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)

2024-07-16 Thread Chris B via cfe-commits
@@ -0,0 +1,425 @@ +== +DXIL Resource Handling +== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +Resources in DXIL are represented via ``TargetExtType`` in LLVM IR and +eventually lowered by the Di

[clang] [llvm] [DirectX] Start documenting DXIL Resource handling (PR #90553)

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

[clang] [HLSL] Correctly set `__HLSL_ENABLE_16_BIT` (PR #89788)

2024-04-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/89788 The preprocessor define `__HLSL_ENABLE_16_BIT` should be set to 1 if native 16-bit types are enabled and not set if they are not. Previously we were setting the value to match the HLSL active language version

[clang] [HLSL] Correctly set `__HLSL_ENABLE_16_BIT` (PR #89788)

2024-04-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/89788 >From a44bb91986dcde7265666391c6aa46bc0876070d Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 23 Apr 2024 11:13:09 -0500 Subject: [PATCH 1/2] [HLSL] Correctly set `__HLSL_ENABLE_16_BIT` The preproce

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -98,9 +100,47 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // dxil-unknown-shadermodel-hull + // Determine DXIL version number using the minor version number of Shader + // Mo

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -12,7 +12,10 @@ #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Job.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/ErrorHandling.h" llvm-beanz wrote: This header should not be needed. https://github.com/llvm/llvm-project/pu

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -35,6 +38,11 @@ bool isLegalShaderModel(Triple &T) { if (Version.getSubminor()) return false; + // DXIL Version should be set as SubArch + if (T.getSubArch() == Triple::NoSubArch) { +return false; + } llvm-beanz wrote: nit: ```suggestion if

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -12,7 +12,10 @@ #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Job.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/TargetParser/Triple.h" +#include +#include llvm-beanz wrote: Do we need ?

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -98,9 +106,46 @@ std::optional tryParseProfile(StringRef Profile) { else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor)) return std::nullopt; - // dxil-unknown-shadermodel-hull + // Determine DXIL version number using the minor version number of Shader + // Mo

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-23 Thread Chris B via cfe-commits
@@ -68,25 +68,25 @@ TEST(DxcModeTest, TargetProfileValidation) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagConsumer); - validateTargetProfile("-Tvs_6_0", "dxil--shadermodel6.0-vertex", + validateTargetProfile("

[clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-24 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. I'm happy with this approach. We can adjust and iteratively address issues if any appear. https://github.com/llvm/llvm-project/pull/86318 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-24 Thread Chris B via cfe-commits
@@ -68,25 +68,25 @@ TEST(DxcModeTest, TargetProfileValidation) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagConsumer); - validateTargetProfile("-Tvs_6_0", "dxil--shadermodel6.0-vertex", + validateTargetProfile("

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-24 Thread Chris B via cfe-commits
@@ -68,25 +68,25 @@ TEST(DxcModeTest, TargetProfileValidation) { IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions(); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagConsumer); - validateTargetProfile("-Tvs_6_0", "dxil--shadermodel6.0-vertex", + validateTargetProfile("

[clang] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

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

[clang] [HLSL] Correctly set `__HLSL_ENABLE_16_BIT` (PR #89788)

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

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-25 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Overall I really like the direction of this. I'm curious if any of the maintainers from Apple have thoughts since they're the primary users of availability annotations. I think this dramatically simplifies things for what we need, but it might also hav

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

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

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-25 Thread Chris B via cfe-commits
@@ -3859,7 +3862,7 @@ def warn_availability_fuchsia_unavailable_minor : Warning< InGroup; def warn_unguarded_availability : - Warning<"%0 is only available on %1 %2 or newer">, + Warning<"%0 %select{is only|is not}5 available %select{|in %4 environment }3on %1 %2 %select{

[clang] [llvm] [DXIL] implement dot intrinsic lowering for integers (PR #85662)

2024-04-26 Thread Chris B via cfe-commits
@@ -39,11 +39,44 @@ static bool isIntrinsicExpansion(Function &F) { case Intrinsic::dx_uclamp: case Intrinsic::dx_lerp: case Intrinsic::dx_rcp: + case Intrinsic::dx_sdot: + case Intrinsic::dx_udot: return true; } return false; } +static bool expandIntegerD

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-04-26 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/90222 This PR fixes bugs in HLSL floating conversions. HLSL always has `half`, `float` and `double` types, which promote in the order: `half`->`float`->`double` and convert in the order: `double`->`float`->`half`

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-04-26 Thread Chris B via cfe-commits
@@ -0,0 +1,229 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -Wconversion -verify -o - %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -fnative-half-type -finclude-default-header -ast-dump %s | FileCheck %

[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

2024-04-29 Thread Chris B via cfe-commits
llvm-beanz wrote: > While I like the approach of aligning availability parameters closer to > `llvm::Triple`, I am concerned about how this will interact with existing > precedent. There is a lot of code that passes in _platform_ values that > aren't actually `OSType`. For example > `__attrib

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -7398,6 +7398,26 @@ The full documentation is available here: https://docs.microsoft.com/en-us/windo }]; } +def HLSLPackOffsetDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +The packoffset attribute is used to change the layout of a cbuffer.

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -ast-dump -x hlsl %s | FileCheck %s + + +// CHECK: HLSLBufferDecl {{.*}} cbuffer A +cbuffer A +{ +// CHECK-NEXT: VarDecl {{.*}} C1 'float4' +// CHECK-NEXT: HLSLP

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -verify %s + +// expected-error@+1{{cannot mix packoffset elements with nonpackoffset elements in a cbuffer}} +cbuffer Mix +{ +float4 M1 : packoffset(c0); +float M2; +

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -183,6 +183,86 @@ void Parser::ParseHLSLAnnotations(ParsedAttributes &Attrs, return; } } break; + case ParsedAttr::AT_HLSLPackOffset: { +// Parse 'packoffset( c[Subcomponent][.component] )'. +// Check '('. +if (ExpectAndConsume(tok::l_paren, diag::er

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -ast-dump -x hlsl %s | FileCheck %s + + +// CHECK: HLSLBufferDecl {{.*}} cbuffer A +cbuffer A +{ +// CHECK-NEXT: VarDecl {{.*}} C1 'float4' llvm-bea

[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

2024-04-29 Thread Chris B via cfe-commits
@@ -7314,6 +7314,41 @@ static void handleHLSLSV_DispatchThreadIDAttr(Sema &S, Decl *D, D->addAttr(::new (S.Context) HLSLSV_DispatchThreadIDAttr(S.Context, AL)); } +static void handleHLSLPackOffsetAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (!isa(D) || !isa(D->getDe

[clang] [HLSL] Shore up floating point conversions (PR #90222)

2024-04-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/90222 >From a173605b6043739e69f89d3a559a4f6a68d5fc0a Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 25 Apr 2024 15:47:22 -0500 Subject: [PATCH] [HLSL] Shore up floating point conversions This PR fixes bug

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-26 Thread Chris B via cfe-commits
@@ -1121,3 +1121,99 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } return false; } + +bool SemaHLSL::CheckCompatibleParameterABI(FunctionDecl *New, + FunctionDecl *Old) { + if (New->getNumPar

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread Chris B via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-27 Thread Chris B via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] Document runtime config directory options (PR #66593)

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

[clang] [HLSL][Doc] Document multi-argument resolution (PR #104474)

2024-08-28 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/104474 >From a68223e1d0ee5e1b41ea7ec2385c9d581c901e70 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 15 Aug 2024 12:03:55 -0500 Subject: [PATCH 1/3] [HLSL][Doc] Document multi-argument resolution This upd

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread Chris B via cfe-commits
@@ -8511,7 +8514,7 @@ static void HandleHLSLParamModifierAttr(QualType &CurType, return; if (Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_inout || Attr.getSemanticSpelling() == HLSLParamModifierAttr::Keyword_out) -CurType = S.getASTContext().getL

[clang] [HLSL] Implement output parameter (PR #101083)

2024-08-28 Thread Chris B via cfe-commits
@@ -11427,6 +11427,19 @@ static void AnalyzeImplicitConversions( return; } + if (auto *OutArgE = dyn_cast(E)) { +// The base expression is only used to initialize the parameter for +// arguments to `inout` parameters, so we only traverse down the base +// ex

[clang] [llvm] [HLSL] Implement '__builtin_hlsl_is_intangible' type trait (PR #104544)

2024-08-29 Thread Chris B via cfe-commits
@@ -64,6 +64,10 @@ class SemaHLSL : public SemaBase { // HLSL Type trait implementations bool IsScalarizedLayoutCompatible(QualType T1, QualType T2) const; + bool IsIntangibleType(const QualType T1); + +private: + llvm::DenseMap IsIntangibleTypeCache; ll

[clang] [llvm] [HLSL] Implement '__builtin_hlsl_is_intangible' type trait (PR #104544)

2024-08-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. I left an inline comment about this, but rather than keeping a side map in the SemaHLSL object we should take a bit in the RecordDecl bitfield to signify if the type is intangible. https://github.com/llvm/llvm-project/pull/1

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

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

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

2024-08-29 Thread Chris B via cfe-commits
@@ -414,9 +414,20 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD, void CGHLSLRuntime::setHLSLFunctionAttributes(const FunctionDecl *FD, llvm::Function *Fn) { - if (FD->isInExportDeclContext()) { -const String

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

2024-08-29 Thread Chris B via cfe-commits
@@ -290,8 +290,6 @@ struct BuiltinTypeDeclBuilder { SourceLocation())); MethodDecl->setLexicalDeclContext(Record); MethodDecl->setAccess(AccessSpecifier::AS_public); -MethodDecl->addAttr(AlwaysInlineAttr::CreateImplicit(

[clang] [HLSL] Implement TransformHLSLAttributedResourceType (PR #106673)

2024-08-30 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Tests? https://github.com/llvm/llvm-project/pull/106673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Chris B via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-pixel -x hlsl %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-vertex -x hlsl %s -verify +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.8-geometry -x hlsl %s -verify +// RUN: %clang_cc1 -triple d

[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

2024-08-30 Thread Chris B via cfe-commits
@@ -357,6 +398,74 @@ void SemaHLSL::handleNumThreadsAttr(Decl *D, const ParsedAttr &AL) { D->addAttr(NewAttr); } +static bool isValidWaveSizeValue(unsigned Value) { + return (Value >= 4 && Value <= 128 && ((Value & (Value - 1)) == 0)); llvm-beanz wrote:

<    1   2   3   4   5   6   7   8   9   10   >