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

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,13 @@ +// 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

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

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -8545,6 +8545,10 @@ def dxc_entrypoint : Option<["--", "/", "-"], "E", KIND_JOINED_OR_SEPARATE>, Group, Visibility<[DXCOption]>, HelpText<"Entry point name">; +def dxc_hlsl_version : Option<["--", "/", "-"],

[clang] [llvm] [HLSL] implement `mad` intrinsic (PR #83826)

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

[clang] [llvm] [HLSL] implement exp intrinsic (PR #83832)

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

[clang] [llvm] [HLSL] implement the rcp intrinsic (PR #83857)

2024-03-04 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/83857 ___ 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-03-04 Thread Justin Bogner via cfe-commits
@@ -342,8 +343,19 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> , return B.CreateCall(FunctionCallee(DxGroupIndex)); } if (D.hasAttr()) { -llvm::Function *DxThreadID = CGM.getIntrinsic(Intrinsic::dx_thread_id); -return buildVectorInput(B,

[clang] [llvm] [HLSL] implement `mad` intrinsic (PR #83826)

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -19812,11 +19821,13 @@ bool Sema::SemaBuiltinElementwiseTernaryMath(CallExpr *TheCall) { Args[I] = Converted.get(); } - int ArgOrdinal = 1; - for (Expr *Arg : Args) { -if (checkFPMathBuiltinElementType(*this, Arg->getBeginLoc(), Arg->getType(), -

[clang] [llvm] [HLSL] implement `mad` intrinsic (PR #83826)

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -5298,6 +5298,14 @@ bool Sema::CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_mad: { +if (checkArgCount(*this, TheCall, 3)) + return true; +if

[clang] [llvm] [HLSL] implement `mad` intrinsic (PR #83826)

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -19800,7 +19808,8 @@ bool Sema::SemaBuiltinVectorMath(CallExpr *TheCall, QualType ) { return false; } -bool Sema::SemaBuiltinElementwiseTernaryMath(CallExpr *TheCall) { +bool Sema::SemaBuiltinElementwiseTernaryMath(CallExpr *TheCall, +

[clang] [llvm] [HLSL] implement the rcp intrinsic (PR #83857)

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,27 @@ + +// 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 bogner wrote: While it's certainly worth exploring the options here I

[clang] [llvm] [HLSL] implement `mad` intrinsic (PR #83826)

2024-03-04 Thread Justin Bogner via cfe-commits
@@ -19812,11 +19821,13 @@ bool Sema::SemaBuiltinElementwiseTernaryMath(CallExpr *TheCall) { Args[I] = Converted.get(); } - int ArgOrdinal = 1; - for (Expr *Arg : Args) { -if (checkFPMathBuiltinElementType(*this, Arg->getBeginLoc(), Arg->getType(), -

[clang] [llvm] [HLSL] implement the `isinf` intrinsic (PR #84927)

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

[clang] [llvm] [HLSL] implement the `isinf` intrinsic (PR #84927)

2024-03-14 Thread Justin Bogner via cfe-commits
@@ -18050,6 +18050,21 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, /*ReturnType=*/Op0->getType(), Intrinsic::dx_frac, ArrayRef{Op0}, nullptr, "dx.frac"); } + case Builtin::BI__builtin_hlsl_elementwise_isinf: { +Value *Op0 =

[clang] [llvm] [HLSL] implement the `isinf` intrinsic (PR #84927)

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

[clang] [llvm] [HLSL] Implement `rsqrt` intrinsic (PR #84820)

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

[clang] [llvm] [HLSL] Implement `rsqrt` intrinsic (PR #84820)

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

[clang] [llvm] [HLSL] Implement `rsqrt` intrinsic (PR #84820)

2024-03-14 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,26 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for rsqrt are generated for float and half. +; CHECK:call float @dx.op.unary.f32(i32 25, float %{{.*}}) +; CHECK:call half @dx.op.unary.f16(i32 25, half %{{.*}})

[clang] [llvm] [HLSL] implement `clamp` intrinsic (PR #85424)

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

[clang] [llvm] [HLSL] implement `clamp` intrinsic (PR #85424)

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

[clang] [llvm] [HLSL] implement `clamp` intrinsic (PR #85424)

2024-03-15 Thread Justin Bogner via cfe-commits
@@ -252,6 +252,116 @@ double3 ceil(double3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_ceil) double4 ceil(double4); +//===--===// +// clamp builtins

[clang] [llvm] [HLSL] implement `clamp` intrinsic (PR #85424)

2024-03-15 Thread Justin Bogner via cfe-commits
@@ -132,12 +134,60 @@ static bool expandRcpIntrinsic(CallInst *Orig) { return true; } +static Intrinsic::ID getCorrectMaxIntrinsic(Type *elemTy, +Intrinsic::ID clampIntrinsic) { bogner wrote: I could see us

[clang] [HLSL] Fix for build break introduced by #85662 (PR #85839)

2024-03-19 Thread Justin Bogner via cfe-commits
bogner wrote: I've gone ahead and merged this since it fixes the build break. In the future when you see a build break, please just revert the breaking change to get the build green again and then work on the fixed patch. It's unfair to others using trunk to have to wait on a fix for an

[clang] [HLSL] Fix for build break introduced by #85662 (PR #85839)

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

[clang] [HLSL] Fix for build break introduced by #85662 (PR #85839)

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

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

2024-03-05 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. https://github.com/llvm/llvm-project/pull/84081 ___ 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-11 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,258 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-11 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,258 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-11 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,258 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,187 @@ +//===- DXILIntrinsicExpansion.cpp - Prepare LLVM Module for DXIL encoding--===// +// +// 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:

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,187 @@ +//===- DXILIntrinsicExpansion.cpp - Prepare LLVM Module for DXIL encoding--===// +// +// 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:

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -18015,38 +18015,11 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, Value *X = EmitScalarExpr(E->getArg(0)); Value *Y = EmitScalarExpr(E->getArg(1)); Value *S = EmitScalarExpr(E->getArg(2)); -llvm::Type *Xty = X->getType(); -

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -5254,7 +5250,11 @@ bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) { QualType ExpectedType = S->Context.FloatTy; for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) { QualType PassedType = TheCall->getArg(i)->getType(); -if

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,187 @@ +//===- DXILIntrinsicExpansion.cpp - Prepare LLVM Module for DXIL encoding--===// +// +// 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:

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,133 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for any are generated for float and half. + + +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" +target triple =

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,133 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for any are generated for float and half. + + +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" +target triple =

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,133 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for any are generated for float and half. + + +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" +target triple =

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,187 @@ +//===- DXILIntrinsicExpansion.cpp - Prepare LLVM Module for DXIL encoding--===// +// +// 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:

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,187 @@ +//===- DXILIntrinsicExpansion.cpp - Prepare LLVM Module for DXIL encoding--===// +// +// 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:

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-12 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,133 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for any are generated for float and half. + + +target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64" +target triple =

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-13 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. A couple more very minor notes on the tests, then this LGTM https://github.com/llvm/llvm-project/pull/84526 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-13 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,105 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for any are generated for float and half. + +; CHECK:icmp ne i1 %{{.*}}, false bogner wrote: Folks usually put a space between `CHECK:` and the

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

2024-03-13 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,105 @@ +; RUN: opt -S -dxil-op-lower < %s | FileCheck %s + +; Make sure dxil operation function calls for any are generated for float and half. + +; CHECK:icmp ne i1 %{{.*}}, false +define noundef i1 @any_bool(i1 noundef %p0) { bogner wrote: Probably

[clang] [llvm] [DXIL] `exp`, `any`, `lerp`, & `rcp` Intrinsic Lowering (PR #84526)

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

[clang] [HLSL] enforce unsigned types for reversebits (PR #86720)

2024-03-26 Thread Justin Bogner via cfe-commits
@@ -54,31 +29,6 @@ uint16_t4 test_bitreverse_ushort4(uint16_t4 p0) } #endif -// CHECK: define noundef i32 @ -// CHECK: call i32 @llvm.bitreverse.i32( -int test_bitreverse_int(int p0) -{ - return reversebits(p0); -} bogner wrote: In that case we might

[clang] [HLSL] enforce unsigned types for reversebits (PR #86720)

2024-03-26 Thread Justin Bogner via cfe-commits
@@ -54,31 +29,6 @@ uint16_t4 test_bitreverse_ushort4(uint16_t4 p0) } #endif -// CHECK: define noundef i32 @ -// CHECK: call i32 @llvm.bitreverse.i32( -int test_bitreverse_int(int p0) -{ - return reversebits(p0); -} bogner wrote: Will these implicitly

[clang] [HLSL] enforce unsigned types for reversebits (PR #86720)

2024-03-26 Thread Justin Bogner via cfe-commits
@@ -54,31 +29,6 @@ uint16_t4 test_bitreverse_ushort4(uint16_t4 p0) } #endif -// CHECK: define noundef i32 @ -// CHECK: call i32 @llvm.bitreverse.i32( -int test_bitreverse_int(int p0) -{ - return reversebits(p0); -} bogner wrote: Alright, let's get this

[clang] [HLSL] enforce unsigned types for reversebits (PR #86720)

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

[clang] [HLSL] Add validation for the -enable-16bit-types option (PR #85340)

2024-03-26 Thread Justin Bogner via cfe-commits
@@ -753,7 +753,10 @@ def err_drv_hlsl_unsupported_target : Error< "HLSL code generation is unsupported for target '%0'">; def err_drv_hlsl_bad_shader_required_in_target : Error< "%select{shader model|Vulkan environment|shader stage}0 is required as

[clang] [HLSL] Add validation for the -enable-16bit-types option (PR #85340)

2024-03-26 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: not %clang_dxc -enable-16bit-types -T cs_6_0 -HV 2016 %s 2>&1 | FileCheck -check-prefix=both_invalid %s +// RUN: not %clang_dxc -enable-16bit-types -T lib_6_4 -HV 2017 %s 2>&1 | FileCheck -check-prefix=HV_invalid %s +// RUN: not %clang_dxc

[clang] [llvm] [HLSL][DXIL][SPIRV] Intrinsic unification PR (PR #87034)

2024-03-29 Thread Justin Bogner via cfe-commits
bogner wrote: I have some misgivings about abusing the target intrinsic infrastructure like this to create "target" intrinsics for a non-existent target. IMO this is morally equivalent to just putting all of these intrinsics as generic llvm intrinsics (`llvm.thread_id` or `llvm.all`), just

[clang] [llvm] [HLSL][DXIL] HLSL's `round` should follow `roundeven` behavior (PR #87078)

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

[clang] [llvm] [HLSL][DXIL][SPIRV] Implementation of an abstraction for intrinsic selection of HLSL backends (PR #87171)

2024-04-04 Thread Justin Bogner via cfe-commits
bogner wrote: The `GENERATE_HLSL_INTRINSIC_FUNCTION` abstraction parts of this look fairly reasonable, but do we really want/need dx and spirv intrinsics for the "all" function? This is trivial to generate pretty generic IR for and I don't really see the value of maintaining that the user

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

2024-04-01 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited 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] [HLSL] Implement floating literal suffixes (PR #87270)

2024-04-01 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. 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] [HLSL] Implement floating literal suffixes (PR #87270)

2024-04-01 Thread Justin Bogner via cfe-commits
@@ -4117,14 +4117,17 @@ ExprResult Sema::ActOnNumericConstant(const Token , Scope *UDLScope) { } else if (Literal.isFloatingLiteral()) { QualType Ty; if (Literal.isHalf){ - if (getOpenCLOptions().isAvailableOption("cl_khr_fp16", getLangOpts())) + if

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

2024-03-28 Thread Justin Bogner via cfe-commits
bogner wrote: I think it would be helpful to add a section between the usage part and the grammar that discusses where and why in the compiler we need access to the parsed root signature (ie, in Sema for diagnostics, in the backend to verify resource usage matches, and also in the backend to

[clang] Add clang_elementwise_builtin_alias (PR #86175)

2024-03-28 Thread Justin Bogner via cfe-commits
bogner wrote: Thanks for working on this, but I think that what this shows is that the complexity of adding this elementwise alias builtin isn't quite justified by the utility. It's certainly convenient to be able to specify the builtins this way, but validation is a lot more complicated and

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

2024-03-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner 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-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
https://github.com/bogner commented: Ran into some problems when building `clang-docs-html` to look at this, so here are some notes on fixing those issues. I'll do another pass on the content next. https://github.com/llvm/llvm-project/pull/83933 ___

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

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

2024-03-27 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,426 @@ + +HLSL Root Signatures + + +.. contents:: + :local: + +Usage += + +In HLSL, the `root signature +`_ +defines what types of resources are

[clang] [clang][NFC] Move more functions to `SemaHLSL` (PR #88354)

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

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7367,8 +7367,72 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, return; } - // FIXME: check reg type match decl. Issue - // https://github.com/llvm/llvm-project/issues/57886. + VarDecl *VD = dyn_cast(D); + HLSLBufferDecl *BD = dyn_cast(D); + + if

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7367,8 +7367,72 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, return; } - // FIXME: check reg type match decl. Issue - // https://github.com/llvm/llvm-project/issues/57886. + VarDecl *VD = dyn_cast(D); + HLSLBufferDecl *BD = dyn_cast(D); + + if

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7367,8 +7367,72 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, return; } - // FIXME: check reg type match decl. Issue - // https://github.com/llvm/llvm-project/issues/57886. + VarDecl *VD = dyn_cast(D); + HLSLBufferDecl *BD = dyn_cast(D); + + if

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7367,8 +7367,72 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, return; } - // FIXME: check reg type match decl. Issue - // https://github.com/llvm/llvm-project/issues/57886. + VarDecl *VD = dyn_cast(D); + HLSLBufferDecl *BD = dyn_cast(D); + + if

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7367,8 +7367,72 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, return; } - // FIXME: check reg type match decl. Issue - // https://github.com/llvm/llvm-project/issues/57886. + VarDecl *VD = dyn_cast(D); + HLSLBufferDecl *BD = dyn_cast(D); + + if

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7367,8 +7367,72 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, return; } - // FIXME: check reg type match decl. Issue - // https://github.com/llvm/llvm-project/issues/57886. + VarDecl *VD = dyn_cast(D); + HLSLBufferDecl *BD = dyn_cast(D); + + if

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -482,15 +484,18 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema , bool IsROV) { return BuiltinTypeDeclBuilder(Decl) .addHandleMember() - .addDefaultHandleConstructor(S, RC) -

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -7333,12 +7333,12 @@ static void handleHLSLResourceBindingAttr(Sema , Decl *D, } else { Slot = Str; } - + QualType Ty = ((clang::ValueDecl *)D)->getType(); bogner wrote: LLVM avoids C-style casting. This would normally be spelled `QualType QT =

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-10 Thread Justin Bogner via cfe-commits
@@ -119,8 +119,10 @@ struct BuiltinTypeDeclBuilder { ResourceKind RK, bool IsROV) { if (Record->isCompleteDefinition()) return *this; -Record->addAttr(HLSLResourceAttr::CreateImplicit(Record->getASTContext(), -

[clang] [HLSL] Remove an unnecessary .ll file in clang/test/SemaHLSL/. (PR #87346)

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

[clang] [clang][SPIR-V] Set AS for the SPIR-V logical triple (PR #88939)

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

[clang] [clang][SPIR-V] Set AS for the SPIR-V logical triple (PR #88939)

2024-04-16 Thread Justin Bogner via cfe-commits
bogner wrote: > a) Thanks!; b) apologies for the noise; c) this was actually done on purpose, > I actively eschewed changing Logical SPIRV because it wasn't actually clear > to me if in the long run it'd have the same AS map / would use numerical 1 > for globals. If Logical SPIRV is going to

[clang] [llvm] [SPIRV][HLSL] Add mad intrinsic lowering for spirv (PR #89130)

2024-04-18 Thread Justin Bogner via cfe-commits
bogner wrote: This feels complicated and not very scalable. I don't think we should be implementing ad-hoc vtables via a map of function pointers. It might be worth sketching out a design for an API that can handle the various cases we're running into here. We need to be able to handle (1)

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

2024-04-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner 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] [llvm] [SPIRV][HLSL] Add mad intrinsic lowering for spirv (PR #89130)

2024-04-18 Thread Justin Bogner via cfe-commits
https://github.com/bogner approved this pull request. Yeah, this is definitely better. https://github.com/llvm/llvm-project/pull/89130 ___ 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 Justin Bogner 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 ) { return F; } + +namespace { +// Returns the first convergence entry/loop/anchor instruction found in

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

2024-04-22 Thread Justin Bogner 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 ) { return F; } + +namespace { +// Returns the first convergence entry/loop/anchor instruction found in

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-22 Thread Justin Bogner via cfe-commits
@@ -7334,6 +7334,81 @@ static void handleHLSLShaderAttr(Sema , Decl *D, const ParsedAttr ) { D->addAttr(NewAttr); } +static void DiagnoseHLSLResourceRegType(Sema , SourceLocation , +Decl *D, StringRef ) { + // Samplers, UAVs, and

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-22 Thread Justin Bogner via cfe-commits
@@ -7334,6 +7334,81 @@ static void handleHLSLShaderAttr(Sema , Decl *D, const ParsedAttr ) { D->addAttr(NewAttr); } +static void DiagnoseHLSLResourceRegType(Sema , SourceLocation , +Decl *D, StringRef ) { + // Samplers, UAVs, and

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-22 Thread Justin Bogner via cfe-commits
@@ -0,0 +1,74 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify + +// the below will cause an llvm unreachable, because RWBuffers don't have resource attributes yet +// NOT YET IMPLEMENTED : {{invalid register name prefix 'b'

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-22 Thread Justin Bogner via cfe-commits
@@ -478,33 +478,35 @@ void HLSLExternalSemaSource::defineTrivialHLSLTypes() { /// Set up common members and attributes for buffer types static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema , - ResourceClass RC,

[clang] Implement resource binding type prefix mismatch errors (PR #87578)

2024-04-22 Thread Justin Bogner via cfe-commits
@@ -45,7 +45,7 @@ void foo2() { extern RWBuffer U2 : register(u5); } // FIXME: expect-error once fix https://github.com/llvm/llvm-project/issues/57886. -float b : register(u0, space1); +// float b : register(u0, space1) {} bogner wrote: Shouldn't we be

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

2024-04-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner requested changes to this pull request. There's a lot of churn here so I'm not 100% sure I saw all of the real changes, but I think I got them all. It might be nice to move the NFC parts into their own commit (if we actually need them, see my other comments). I don't

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

2024-04-26 Thread Justin Bogner via cfe-commits
@@ -1171,18 +1181,27 @@ TEST(TripleTest, Normalization) { Triple::getOSTypeName(FirstOSType), Triple::getEnvironmentTypeName(FirstEnvType)}; for (int Arch = FirstArchType; Arch <= Triple::LastArchType; ++Arch) { -

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

2024-04-26 Thread Justin Bogner via cfe-commits
https://github.com/bogner edited 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] [llvm] [DirectX] Set DXIL Version using shader model version in compilation target profile (PR #89823)

2024-04-26 Thread Justin Bogner via cfe-commits
@@ -115,6 +115,30 @@ StringRef Triple::getArchName(ArchType Kind, SubArchType SubArch) { if (SubArch == AArch64SubArch_arm64e) return "arm64e"; break; + case Triple::dxil: +switch (SubArch) { +case Triple::DXILSubArch_v1_0: + return "dxilv1.0"; +

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

2024-04-26 Thread Justin Bogner via cfe-commits
@@ -98,9 +103,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 + //

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

2024-04-26 Thread Justin Bogner via cfe-commits
@@ -2,39 +2,45 @@ // Supported targets // -// RUN: %clang -target dxil--shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-VALID %s -// RUN: %clang -target dxil-unknown-shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck

<    1   2   3   4   >