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

2024-03-28 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: It might be useful to have a section in this document that briefly describes what is done at each phase of the compiler and what information is passed through to the next. For example: ClangSema parses the attribute and generates . ClangCodeGen reads a

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

2024-03-28 Thread Chris B via cfe-commits
@@ -0,0 +1,432 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

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

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

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From bd74d7db681cd07fda56f26e79e047c6d1a41f6b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/5] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From bd74d7db681cd07fda56f26e79e047c6d1a41f6b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/6] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From bd74d7db681cd07fda56f26e79e047c6d1a41f6b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/7] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-29 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From bd74d7db681cd07fda56f26e79e047c6d1a41f6b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/8] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-04-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From bd74d7db681cd07fda56f26e79e047c6d1a41f6b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/9] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

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

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

2024-04-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/87270 This change implements the HLSL floating literal suffixes for half and double literals. The PR for the HLSL language specification for this behavior is https://github.com/microsoft/hlsl-specs/pull/175. The T

[clang] [HLSL] Vector standard conversions (PR #71098)

2024-02-07 Thread Chris B via cfe-commits
@@ -2466,6 +2504,15 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { case CK_IntToOCLSampler: return CGF.CGM.createOpenCLIntToSamplerConversion(E, CGF); + case CK_HLSLVectorTruncation: { +assert(DestTy->isVectorType() && "Expected dest type to be vector ty

[clang] [HLSL] Vector standard conversions (PR #71098)

2024-02-07 Thread Chris B via cfe-commits
@@ -2414,9 +2420,41 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { return EmitScalarConversion(Visit(E), E->getType(), DestTy, CE->getExprLoc(), Opts); } - case CK_IntegralToFloating: - case CK_FloatingToIntegral: - case CK_F

[clang] [HLSL] Vector standard conversions (PR #71098)

2024-02-07 Thread Chris B via cfe-commits
@@ -361,6 +361,9 @@ CAST_OPERATION(AddressSpaceConversion) // Convert an integer initializer to an OpenCL sampler. CAST_OPERATION(IntToOCLSampler) +// Truncate a vector type (HLSL only). +CAST_OPERATION(HLSLVectorTruncation) llvm-beanz wrote: Yea... HLSL has

[clang] [HLSL] Vector standard conversions (PR #71098)

2024-02-07 Thread Chris B via cfe-commits
@@ -1843,13 +1843,86 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType, return true; } +/// Determine whether the conversion from FromType to ToType is a valid +/// floating point conversion. +/// +static bool IsFloatingPointConversion(Sema &S, QualType

[clang] [NFC][HLSL][DX] Update invalid environment tests (PR #81052)

2024-02-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/81052 This updates the HLSL invalid environment tests to adapt to #78655. >From 7deda6cf14fc7f279d626a65846bd2d29e3d343d Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 7 Feb 2024 17:14:03 -0600 Subject: [

[clang] [DirectX] Fix HLSL bitshifts to leverage the OpenCL pipeline for bitshifting (PR #81030)

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

[clang] [DirectX] Fix HLSL bitshifts to leverage the OpenCL pipeline for bitshifting (PR #81030)

2024-02-08 Thread Chris B via cfe-commits
llvm-beanz wrote: The bot failure looks like an unrelated CMake issue on Windows. I think we've seen that around a few times. I'll merge this now. https://github.com/llvm/llvm-project/pull/81030 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [DirectX] Fix HLSL bitshifts to leverage the OpenCL pipeline for bitshifting (PR #81030)

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

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Super excited to see this coming along. https://github.com/llvm/llvm-project/pull/81190 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

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

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -17895,6 +17898,52 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments, return Arg; } +Value *CodeGenFunction::EmitDXILBuiltinExpr(unsigned BuiltinID, +const CallExpr *E) { + switch (BuiltinID) {

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -19,4 +19,9 @@ def int_dx_flattened_thread_id_in_group : Intrinsic<[llvm_i32_ty], [], [IntrNoMe def int_dx_create_handle : ClangBuiltin<"__builtin_hlsl_create_handle">, Intrinsic<[ llvm_ptr_ty ], [llvm_i8_ty], [IntrWillReturn]>; -} + +def int_dx_dot : +Intrinsic<[

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -17895,6 +17898,52 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments, return Arg; } +Value *CodeGenFunction::EmitDXILBuiltinExpr(unsigned BuiltinID, +const CallExpr *E) { + switch (BuiltinID) {

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -19,4 +19,9 @@ def int_dx_flattened_thread_id_in_group : Intrinsic<[llvm_i32_ty], [], [IntrNoMe def int_dx_create_handle : ClangBuiltin<"__builtin_hlsl_create_handle">, Intrinsic<[ llvm_ptr_ty ], [llvm_i8_ty], [IntrWillReturn]>; -} + +def int_dx_dot : +Intrinsic<[

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -4518,6 +4518,12 @@ def HLSLCreateHandle : LangBuiltin<"HLSL_LANG"> { let Prototype = "void*(unsigned char)"; } +def HLSLDotProduct : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_dot"]; + let Attributes = [NoThrow, Const, CustomTypeChecking]; --

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -144,6 +144,92 @@ double3 cos(double3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) double4 cos(double4); +//===--===// +// dot product builtins +//===

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-08 Thread Chris B via cfe-commits
@@ -144,6 +144,92 @@ double3 cos(double3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) double4 cos(double4); +//===--===// +// dot product builtins +//===

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-13 Thread Chris B via cfe-commits
@@ -4518,6 +4518,12 @@ def HLSLCreateHandle : LangBuiltin<"HLSL_LANG"> { let Prototype = "void*(unsigned char)"; } +def HLSLDotProduct : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_dot"]; + let Attributes = [NoThrow, Const, CustomTypeChecking]; --

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-13 Thread Chris B via cfe-commits
@@ -144,6 +144,92 @@ double3 cos(double3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) double4 cos(double4); +//===--===// +// dot product builtins +//===

[clang] [NFC] Add API documentation and annotations (PR #78635)

2024-02-13 Thread Chris B via cfe-commits
llvm-beanz wrote: @farzonl I like that idea, but I think there's a lot more work to do in order to get proper HLSL documentation coming out here. For these files should get processed as part of Clang's normal doxygen build, so they should get pulled in with the other clang API docs. https://g

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

2024-03-05 Thread Chris B via cfe-commits
@@ -0,0 +1,312 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

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

2024-03-05 Thread Chris B via cfe-commits
@@ -0,0 +1,312 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

[clang] [HLSL][docs] Document hlsl.h in the HLSL docs (PR #84081)

2024-03-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/84081 This adds a brief blurb about hlsl.h in the HLSLSupport documentation where a high level view of the architecture is explained. >From 081d397961bd19d37d957d43c67f6a419c338629 Mon Sep 17 00:00:00 2001 From: Ch

[clang] [HLSL][docs] Document hlsl.h in the HLSL docs (PR #84081)

2024-03-05 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/84081 >From 081d397961bd19d37d957d43c67f6a419c338629 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 5 Mar 2024 16:26:17 -0600 Subject: [PATCH 1/2] [HLSL][docs] Document hlsl.h in the HLSL docs This adds a

[clang] [HLSL][docs] Document hlsl.h in the HLSL docs (PR #84081)

2024-03-11 Thread Chris B via cfe-commits
@@ -114,6 +114,44 @@ not re-targetable, we want to share the Clang CodeGen implementation for HLSL with other GPU graphics targets like SPIR-V and possibly other GPU and even CPU targets. +hlsl.h +-- + +HLSL has an extensive library of functionality. This is similar to Op

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-11 Thread Chris B via cfe-commits
@@ -8545,6 +8545,11 @@ def dxc_entrypoint : Option<["--", "/", "-"], "E", KIND_JOINED_OR_SEPARATE>, Group, Visibility<[DXCOption]>, HelpText<"Entry point name">; +def dxc_hlsl_version : Option<["/", "-"], "HV", KIN

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-11 Thread Chris B via cfe-commits
@@ -8545,6 +8545,11 @@ def dxc_entrypoint : Option<["--", "/", "-"], "E", KIND_JOINED_OR_SEPARATE>, Group, Visibility<[DXCOption]>, HelpText<"Entry point name">; +def dxc_hlsl_version : Option<["/", "-"], "HV", KIN

[clang] [HLSL][docs] Document hlsl.h in the HLSL docs (PR #84081)

2024-03-11 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/84081 >From 081d397961bd19d37d957d43c67f6a419c338629 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 5 Mar 2024 16:26:17 -0600 Subject: [PATCH 1/3] [HLSL][docs] Document hlsl.h in the HLSL docs This adds a

[clang] [HLSL][docs] Document hlsl.h in the HLSL docs (PR #84081)

2024-03-11 Thread Chris B via cfe-commits
@@ -114,6 +114,54 @@ not re-targetable, we want to share the Clang CodeGen implementation for HLSL with other GPU graphics targets like SPIR-V and possibly other GPU and even CPU targets. +hlsl.h +-- + +HLSL has a library of standalone functions. This is similar to OpenCL

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-11 Thread Chris B via cfe-commits
@@ -69,6 +69,16 @@ LangStandard::Kind LangStandard::getLangKind(StringRef Name) { .Default(lang_unspecified); } +LangStandard::Kind LangStandard::getHLSLLangKind(StringRef Name) { + return llvm::StringSwitch(Name) + .Case("2016", LangStandard::lang_hlsl2016) +

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-12 Thread Chris B via cfe-commits
@@ -8549,7 +8549,10 @@ def dxc_hlsl_version : Option<["/", "-"], "HV", KIND_JOINED_OR_SEPARATE>, Group, Visibility<[DXCOption]>, HelpText<"HLSL Version">, - NormalizedValues<["2016", "2017", "20

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-12 Thread Chris B via cfe-commits
@@ -753,6 +753,9 @@ def err_drv_hlsl_bad_shader_required_in_target : Error< def err_drv_hlsl_bad_shader_unsupported : Error< "%select{shader model|Vulkan environment|shader stage}0 '%1' in target '%2' is invalid for HLSL code generation">; +def err_drv_hlsl_dxc_bad_argument

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-12 Thread Chris B via cfe-commits
@@ -139,6 +139,7 @@ struct LangStandard { bool isOpenCL() const { return Flags & OpenCL; } static Kind getLangKind(StringRef Name); + static Kind getHLSLLangKind(StringRef Name); llvm-beanz wrote: This either. https://github.com/llvm/llvm-project/pull/8

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-12 Thread Chris B via cfe-commits
@@ -226,6 +226,7 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, A->claim(); continue; } + llvm-beanz wrote: Unnecessary whitespace change. https://github.com/llvm/llvm-project/pull/83938 _

[clang] [llvm] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-12 Thread Chris B via cfe-commits
@@ -0,0 +1,18 @@ +// RUN: %clang_dxc -T lib_6_4 -HV 2016 %s 2>&1 -### | FileCheck -check-prefix=2016 %s +// RUN: %clang_dxc -T lib_6_4 -HV 2017 %s 2>&1 -### | FileCheck -check-prefix=2017 %s +// RUN: %clang_dxc -T lib_6_4 /HV 2018 %s 2>&1 -### | FileCheck -check-prefix=20

[clang] [llvm] [clang][HLSL][SPRI-V] Add convergence intrinsics (PR #80680)

2024-03-12 Thread Chris B via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: @@ -1297,5 +1297,10 @@ _HLSL_AVAILABILITY(shadermodel, 6.0) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits) uint WaveActiveCountBits(bool Val); +/// \brief Ret

[clang] [llvm] [clang][HLSL][SPRI-V] Add convergence intrinsics (PR #80680)

2024-03-12 Thread Chris B via cfe-commits
Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= , Nathan =?utf-8?q?Gauër?= Message-ID: In-Reply-To: @@ -4554,6 +4554,13 @@ def HLSLWaveActiveCountBits : LangBuiltin<"HLSL_LANG"> { let Prototype = "unsigned int(bool)"; } +// HLSL +def HLSLWaveGetLaneIndex : LangBuiltin

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-12 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From 762646ef1d95efa968199156b52a60c3472a7611 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH] [HLSL] Pass arrays by value HLSL constant sized array functi

[clang] [HLSL] Implement array temporary support (PR #79382)

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

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-12 Thread Chris B via cfe-commits
llvm-beanz wrote: I force pushed an update here because the new implementation is basically a complete rewrite based on @efriedma-quic's suggestion. I think this is a significantly cleaner approach that more accurately models the behavior of HLSL. https://github.com/llvm/llvm-project/pull/7938

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-12 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From 762646ef1d95efa968199156b52a60c3472a7611 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/2] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-12 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/79382 >From 762646ef1d95efa968199156b52a60c3472a7611 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 29 Feb 2024 15:37:50 -0600 Subject: [PATCH 1/3] [HLSL] Pass arrays by value HLSL constant sized array fu

[clang] [HLSL] Implement array temporary support (PR #79382)

2024-03-13 Thread Chris B via cfe-commits
@@ -3173,41 +3174,46 @@ class ArrayType : public Type, public llvm::FoldingSetNode { return T->getTypeClass() == ConstantArray || T->getTypeClass() == VariableArray || T->getTypeClass() == IncompleteArray || - T->getTypeClass() == DependentS

[clang] [NFC] Fix formatting so CI can continue (PR #82721)

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

[clang] [NFC] Fix formatting so CI can continue (PR #82721)

2024-02-23 Thread Chris B via cfe-commits
llvm-beanz wrote: Do you have a link to the CI that failed this? The official clang doc build succeeded and published the docs. https://github.com/llvm/llvm-project/pull/82721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -179,6 +179,98 @@ double3 cos(double3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_cos) double4 cos(double4); +//===--===// +// dot product builtins +//===

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -19594,23 +19750,45 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) { TheCall->setArg(0, A.get()); QualType TyA = A.get()->getType(); - if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA)) + if (checkMathBuiltinElementType(*th

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -19594,23 +19750,45 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) { TheCall->setArg(0, A.get()); QualType TyA = A.get()->getType(); - if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA)) + if (checkMathBuiltinElementType(*th

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -19594,23 +19750,45 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) { TheCall->setArg(0, A.get()); QualType TyA = A.get()->getType(); - if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA)) + if (checkMathBuiltinElementType(*th

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -5161,6 +5166,157 @@ bool Sema::CheckPPCMMAType(QualType Type, SourceLocation TypeLoc) { return false; } +// Helper function for CheckHLSLBuiltinFunctionCall +// Note: UsualArithmeticConversions handles the case where at least +// one arg isn't a bool +bool PromoteBoolsT

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -2961,6 +2962,10 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, } } + if (getLangOpts().HLSL && CheckHLSLBuiltinFunctionCall(BuiltinID, TheCall)) { +return ExprError(); + } llvm-beanz wrote: nit: unnecessary braces.

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -17959,6 +17964,52 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments, return Arg; } +Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, +const CallExpr *E) { + if (!getLangOpts().H

[clang] [HLSL] Fix casting asserts (PR #82827)

2024-02-23 Thread Chris B via cfe-commits
@@ -28,3 +29,43 @@ void Fn2(int16_t2 S); void Call2(int2 I) { Fn2(I); } + +void Fn3( int64_t2 p0); + +// CHECK: FunctionDecl {{.*}} Call3 'void (half2)' +// CHECK: CallExpr {{.*}} 'void' +// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' +// CHECK-NEXT: DeclRefExp

[clang] [HLSL] Fix casting asserts (PR #82827)

2024-02-23 Thread Chris B via cfe-commits
@@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.6-library -S -fnative-half-type -finclude-default-header -o - -ast-dump %s | FileCheck %s +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.6-library %s -fnative-h

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -5161,6 +5166,157 @@ bool Sema::CheckPPCMMAType(QualType Type, SourceLocation TypeLoc) { return false; } +// Helper function for CheckHLSLBuiltinFunctionCall +// Note: UsualArithmeticConversions handles the case where at least +// one arg isn't a bool +bool PromoteBoolsT

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

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

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -0,0 +1,110 @@ +// 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 + +float test_no_second_arg ( float2 p0) { + return __builtin_hlsl_dot ( p0 ); + // exp

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. A few small notes, but otherwise looks good. https://github.com/llvm/llvm-project/pull/81190 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -17959,6 +17964,54 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments, return Arg; } +Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, +const CallExpr *E) { + if (!getLangOpts().H

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -0,0 +1,110 @@ +// 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 + +float test_no_second_arg ( float2 p0) { + return __builtin_hlsl_dot ( p0 ); + // exp

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -17959,6 +17964,54 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments, return Arg; } +Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, +const CallExpr *E) { + if (!getLangOpts().H

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

2024-02-23 Thread Chris B via cfe-commits
@@ -17959,6 +17964,54 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments, return Arg; } +Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, +const CallExpr *E) { + if (!getLangOpts().H

[clang] [HLSL] Fix casting asserts (PR #82827)

2024-02-26 Thread Chris B via cfe-commits
@@ -28,3 +29,46 @@ void Fn2(int16_t2 S); void Call2(int2 I) { Fn2(I); } + +void Fn3( int64_t2 p0); + +// CHECK: FunctionDecl {{.*}} Call3 'void (half2)' +// CHECK: CallExpr {{.*}} 'void' +// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' +// CHECK-NEXT: DeclRefExp

[clang] [HLSL] Fix casting asserts (PR #82827)

2024-02-26 Thread Chris B via cfe-commits
@@ -28,3 +29,46 @@ void Fn2(int16_t2 S); void Call2(int2 I) { Fn2(I); } + +void Fn3( int64_t2 p0); + +// CHECK: FunctionDecl {{.*}} Call3 'void (half2)' +// CHECK: CallExpr {{.*}} 'void' +// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' +// CHECK-NEXT: DeclRefExp

[clang] [HLSL] Fix casting asserts (PR #82827)

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

[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

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

[clang] [HLSL] Fix casting asserts (PR #82827)

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

[clang] [llvm] [HLSL][SPIR-V] Add SV_DispatchThreadID semantic support (PR #82536)

2024-02-26 Thread Chris B via cfe-commits
@@ -0,0 +1,76 @@ +; RUN: llc -O0 -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 HLSL: +; clang -cc1 -triple spirv-vulkan-library

[clang] [llvm] [HLSL][SPIR-V] Add SV_DispatchThreadID semantic support (PR #82536)

2024-02-26 Thread Chris B via cfe-commits
@@ -27,6 +27,7 @@ #include "llvm/CodeGen/GlobalISel/InstructionSelector.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/IR/IntrinsicsDirectX.h" llvm-beanz wrote: I think this is unnecessary now. h

[clang] [NFC][HLSL] Fix broken test (PR #83062)

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

[clang] [llvm] [HLSL][SPIR-V] Add SV_DispatchThreadID semantic support (PR #82536)

2024-02-29 Thread Chris B via cfe-commits
@@ -342,8 +343,19 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B, return B.CreateCall(FunctionCallee(DxGroupIndex)); } if (D.hasAttr()) { -llvm::Function *DxThreadID = CGM.getIntrinsic(Intrinsic::dx_thread_id); -return buildVectorInput(B, DxThr

[clang] [HLSL] standardize builtin unit tests (PR #83340)

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

[clang] [llvm] [HLSL] implementation of lerp intrinsic (PR #83077)

2024-02-29 Thread Chris B via cfe-commits
@@ -10266,6 +10266,11 @@ def err_block_on_vm : Error< def err_sizeless_nonlocal : Error< "non-local variable with sizeless type %0">; +def err_vec_builtin_non_vector_all : Error< + "all arguments to %0 must be vectors">; +def err_vec_builtin_incompatible_vector_all : Error<

[clang] [clang][sema] consolidate diags for incompatible_vector_* (PR #83609)

2024-03-01 Thread Chris B via cfe-commits
@@ -38,70 +38,70 @@ float test_dot_element_type_mismatch(int2 p0, float2 p1) { //NOTE: for all the *_promotion we are intentionally not handling type promotion in builtins float test_builtin_dot_vec_int_to_float_promotion(int2 p0, float2 p1) { return __builtin_hlsl_dot(p0, p

[clang] [clang][sema] consolidate diags for incompatible_vector_* (PR #83609)

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

[clang] [HLSL] Add HLSLRootSignatureAttr. (PR #83630)

2024-03-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. We need to discuss the design and implementation approach for this before we write any code for this feature. https://github.com/llvm/llvm-project/pull/83630 ___ cfe-commits mailing

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

2024-03-04 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: What about Sema-level diagnostics? How do we expect to handle and surface parsing errors in the root signature? https://github.com/llvm/llvm-project/pull/83933 ___ cfe-commits mailing list cfe-commits@lists.llv

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

2024-03-04 Thread Chris B via cfe-commits
@@ -0,0 +1,210 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

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

2024-03-04 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/83933 ___ 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-03-04 Thread Chris B via cfe-commits
@@ -0,0 +1,210 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

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

2024-03-04 Thread Chris B via cfe-commits
@@ -0,0 +1,210 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

[clang] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-04 Thread Chris B via cfe-commits
@@ -226,6 +226,28 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, A->claim(); continue; } +if (A->getOption().getID() == options::OPT_dxc_hlsl_version) { + // Translate -HV into -std for llvm + // depending on the

[clang] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-04 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I worry this pattern will also lend to us having multiple places that parse and translate HLSL versions. Can you look at other places in Clang where we handle these numbers and see if there is a good way to unify the string handling? It would be ideal f

[clang] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

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

[clang] [HLSL] Add -HV option translation to clang-dxc.exe (PR #83938)

2024-03-04 Thread Chris B via cfe-commits
@@ -226,6 +226,28 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch, A->claim(); continue; } +if (A->getOption().getID() == options::OPT_dxc_hlsl_version) { + // Translate -HV into -std for llvm + // depending on the

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

2024-03-04 Thread Chris B via cfe-commits
@@ -0,0 +1,210 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are bo

[llvm] [clang] [clang-tools-extra] [DirectX][docs] Architecture and design philosophy of DXIL support (PR #78221)

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

[clang-tools-extra] [llvm] [libc] [flang] [clang] [compiler-rt] [DirectX][docs] Architecture and design philosophy of DXIL support (PR #78221)

2024-01-31 Thread Chris B via cfe-commits
@@ -0,0 +1,102 @@ +=== +Architecture and Design of DXIL Support in LLVM +=== + +.. contents:: + :local: + +.. toctree:: + :hidden: + +Introduction + + +LLVM supports reading and

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2024-02-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Sounds like this is all good from the C++ side. I'm fine with this bleeding into HLSL while we figure out what we need to do. It would be super nice if we can just leave this enabled for HLSL as an extension. A lot of our users want it,

[clang] [clang] Accept lambdas in C++03 as an extensions (PR #73376)

2024-02-01 Thread Chris B via cfe-commits
@@ -3,8 +3,8 @@ extern groupshared float f; extern float groupshared f; // Ok, redeclaration? -// NOTE:lambda is not enabled except for hlsl202x. -// expected-error@+2 {{expected expression}} +// expected-warning@+3 {{lambdas are a C++11 extension}} +// expected-error@+2 {{

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