[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

2024-08-28 Thread David Peixotto via cfe-commits
@@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -x hlsl -triple dxil-pc-shadermodel6.3-library -finclude-default-header %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s +// RUN: %clang_cc1 -x hlsl -triple dxil-pc-shadermodel6.0-compute -finclude-default-header %s -emit-llvm -disabl

[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

2024-08-28 Thread David Peixotto via cfe-commits
@@ -1064,13 +1064,17 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // OpenCL C 2.0 v2.2-11 s6.9.i: // Recursion is not supported. // + // HLSL + // Recursion is not supported. + // // SYCL v1.2.1 s3.10: // kernels cannot inclu

[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

2024-08-28 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. Overall, LGTM. https://github.com/llvm/llvm-project/pull/105907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

2024-08-28 Thread David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/105907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/106096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread David Peixotto via cfe-commits
@@ -94,6 +94,13 @@ class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo { BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::VoidPtrBuiltinVaList; } + + void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override { --

[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)

2024-08-28 Thread David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/106096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Move ResourceClass enum into DXILABI. NFC (PR #96335)

2024-06-21 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/96335 ___ 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 David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. LGTM 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] Fix FileCheck annotation typos (PR #95155)

2024-06-11 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/95155 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix FileCheck annotation typos (PR #95155)

2024-06-11 Thread David Peixotto via cfe-commits
@@ -4,9 +4,8 @@ void test() { // CHECK: VarDecl {{.*}} used f3 'vector':'float __attribute__((ext_vector_type(3)))' cinit - // CHECK-NEXt: ImplicitCastExpr {{.*}} 'vector':'float __attribute__((ext_vector_type(3)))' - // CHECK-NEXt: ImplicitCastExpr {{.*}} 'float' -

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

2024-06-03 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/93879 ___ 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 David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/93879 ___ 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 David Peixotto via cfe-commits
@@ -635,6 +635,17 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx, Option = LoopHintAttr::UnrollCount; State = LoopHintAttr::Numeric; } +} else if (HLSLLoopHint) { + ValueInt = HLSLLoopHint->getDirective(); + if (HLSLL

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

2024-06-03 Thread David Peixotto via cfe-commits
@@ -0,0 +1,99 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -o - | FileCheck %s + +/*** for ***/ +void for_count() +{ +// CHECK-LABEL: for_count dmpots wrote: We are not actua

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

2024-06-03 Thread David Peixotto via cfe-commits
@@ -635,6 +635,17 @@ void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx, Option = LoopHintAttr::UnrollCount; State = LoopHintAttr::Numeric; } +} else if (HLSLLoopHint) { + ValueInt = HLSLLoopHint->getDirective(); + if (HLSLL

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

2024-06-03 Thread David Peixotto via cfe-commits
@@ -584,6 +585,32 @@ static Attr *handleOpenCLUnrollHint(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) OpenCLUnrollHintAttr(S.Context, A, UnrollFactor); } +static Attr *handleHLSLLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A, +

[clang] [llvm] [DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #91407)

2024-05-08 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. It would be nice to mention in the description what the sanitizer fix was compared to the original PR. https://github.com/llvm/llvm-project/pull/91407 ___ cfe-commits mailing list cfe-commits@lists

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

2024-04-05 Thread David Peixotto via cfe-commits
@@ -0,0 +1,426 @@ + +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-29 Thread David Peixotto via cfe-commits
dmpots wrote: I did not see any discussion of local root signatures here. It is probably good to consider those as well when thinking about this design. There is alternate syntax for specifying both local root signatues and global root signatures starting in SM 6.3 https://learn.microsoft.com

[clang] [HLSL][Doc] Add doc about expected differences (PR #82395)

2024-02-20 Thread David Peixotto via cfe-commits
@@ -0,0 +1,108 @@ + +Expected Differences vs DXC and FXC +=== + +.. contents:: + :local: + +Introduction + + +HLSL currently has two reference compilers, the `DirectX Shader Compiler (DXC) +

[clang] [HLSL][Doc] Add doc about expected differences (PR #82395)

2024-02-20 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/82395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][Doc] Add doc about expected differences (PR #82395)

2024-02-20 Thread David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/82395 ___ 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-16 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. LGTM 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-15 Thread David Peixotto 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-15 Thread David Peixotto via cfe-commits
@@ -0,0 +1,202 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-h

[clang] [HLSL] Expose `half` types and intrinsics always (PR #81782)

2024-02-15 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/81782 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Expose `half` types and intrinsics always (PR #81782)

2024-02-15 Thread David Peixotto via cfe-commits
@@ -42,20 +49,20 @@ int16_t3 abs(int16_t3); _HLSL_AVAILABILITY(shadermodel, 6.2) _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) int16_t4 abs(int16_t4); +#endif -_HLSL_AVAILABILITY(shadermodel, 6.2) +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) dmpots wrote: Ah

[clang] [HLSL] Expose `half` types and intrinsics always (PR #81782)

2024-02-15 Thread David Peixotto via cfe-commits
@@ -42,20 +49,20 @@ int16_t3 abs(int16_t3); _HLSL_AVAILABILITY(shadermodel, 6.2) _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) int16_t4 abs(int16_t4); +#endif -_HLSL_AVAILABILITY(shadermodel, 6.2) +_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2) dmpots wrote: Cu

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

2024-02-13 Thread David Peixotto via cfe-commits
@@ -0,0 +1,202 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-h

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

2024-02-13 Thread David Peixotto 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 David Peixotto via cfe-commits
@@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -verify -verify-ignore-unexpected + +float test_first_arg_is_not_vector ( floa

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

2024-02-13 Thread David Peixotto via cfe-commits
@@ -0,0 +1,202 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-h

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

2024-02-08 Thread David Peixotto 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 David Peixotto 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 David Peixotto via cfe-commits
https://github.com/dmpots 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 David Peixotto 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 David Peixotto 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] [NFC][HLSL][DX] Update invalid environment tests (PR #81052)

2024-02-07 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/81052 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][DirectX] Move handling of resource element types into the frontend (PR #75674)

2023-12-15 Thread David Peixotto via cfe-commits
@@ -216,15 +214,62 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, assert(false && "Unsupported buffer type!"); return; } - assert(ResourceMD != nullptr && "ResourceMD must have been set by the switch above."); llvm::hls

[llvm] [clang] [HLSL][DirectX] Move handling of resource element types into the frontend (PR #75674)

2023-12-15 Thread David Peixotto via cfe-commits
@@ -253,35 +246,6 @@ void UAVResource::print(raw_ostream &OS) const { ResourceBase::print(OS, "U", "u"); } -// FIXME: Capture this in HLSL source. I would go do this right now, but I want -// to get this in first so that I can make sure to capture all the extra -// informati

[clang] [llvm] [HLSL][DirectX] Move handling of resource element types into the frontend (PR #75674)

2023-12-15 Thread David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/75674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [HLSL][DirectX] Move handling of resource element types into the frontend (PR #75674)

2023-12-15 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/75674 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)

2023-12-08 Thread David Peixotto via cfe-commits
@@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV,

[clang] [llvm] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)

2023-12-08 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)

2023-12-08 Thread David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)

2023-12-08 Thread David Peixotto via cfe-commits
@@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV,

[clang] [NFC] Cleanup and sort hlsl_intrinsics.h (PR #72414)

2023-11-15 Thread David Peixotto via cfe-commits
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/72414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Cleanup and sort hlsl_intrinsics.h (PR #72414)

2023-11-15 Thread David Peixotto via cfe-commits
@@ -11,557 +11,614 @@ namespace hlsl { -__attribute__((availability(shadermodel, introduced = 6.0))) -__attribute__((clang_builtin_alias(__builtin_hlsl_wave_active_count_bits))) uint -WaveActiveCountBits(bool bBit); +// Note: Functions in this file are sorted alphabetically,

[clang] [NFC] Cleanup and sort hlsl_intrinsics.h (PR #72414)

2023-11-15 Thread David Peixotto via cfe-commits
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/72414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits