[clang] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/104656 >From 9aff63478b76f042c05b7ae3dd1a2c099dc615de Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Fri, 2 Aug 2024 20:10:04 -0600 Subject: [PATCH 1/7] Add SPIRV generation for HLSL dot This adds the SPIRV fdot, sdot

[clang] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-20 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/104656 >From 9aff63478b76f042c05b7ae3dd1a2c099dc615de Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Fri, 2 Aug 2024 20:10:04 -0600 Subject: [PATCH 1/7] Add SPIRV generation for HLSL dot This adds the SPIRV fdot, sdot

[clang] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-22 Thread Greg Roth via cfe-commits
@@ -363,9 +382,13 @@ static bool expandIntrinsic(Function &F, CallInst *Orig) { case Intrinsic::dx_normalize: Result = expandNormalizeIntrinsic(Orig); break; + case Intrinsic::dx_fdot: +Result = +expandFloatDotIntrinsic(Orig, Orig->getOperand(0), Orig->g

[clang] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-22 Thread Greg Roth via cfe-commits
@@ -1446,6 +1452,90 @@ bool SPIRVInstructionSelector::selectRsqrt(Register ResVReg, .constrainAllUses(TII, TRI, RBI); } +// Select the OpDot instruction for the given float dot +bool SPIRVInstructionSelector::selectFloatDot(Register ResVReg, +

[clang] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-22 Thread Greg Roth via cfe-commits
https://github.com/pow2clk closed https://github.com/llvm/llvm-project/pull/104656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIRV]Add SPIRV generation for HLSL dot (PR #104656)

2024-08-22 Thread Greg Roth via cfe-commits
@@ -1,161 +1,172 @@ // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,NATIVE_HALF +// RUN: --check-pr

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

2024-08-23 Thread Greg Roth via cfe-commits
https://github.com/pow2clk created https://github.com/llvm/llvm-project/pull/105907 Previously, functions named "main" got the NoRecurse attribute consistent with the behavior of C++, which HLSL largely follows. However, standard recursion is not allowed in HLSL, so all functions should really

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

2024-08-26 Thread Greg Roth via cfe-commits
https://github.com/pow2clk created https://github.com/llvm/llvm-project/pull/106096 Thread init guards are generated for local static variables when using the Microsoft CXX ABI. This ABI is also used for HLSL generation, but DXIL doesn't need the corresponding _Init_thread_header/footer calls

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-26 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: Thanks @AmrDeveloper ! Really appreciate your initiative to take this on! I think it might be helpful to use this excellent documentation resource https://github.com/llvm/llvm-project/blob/main/llvm/docs/CommandGuide/FileCheck.rst#filecheck-string-substitut

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-26 Thread Greg Roth via cfe-commits
@@ -15,70 +15,70 @@ // DXIL_NATIVE_HALF: define noundef half @ // SPIR_NATIVE_HALF: define spir_func noundef half @ -// DXIL_NATIVE_HALF: %hlsl.frac = call half @llvm.dx.frac.f16( -// SPIR_NATIVE_HALF: %hlsl.frac = call half @llvm.spv.frac.f16( +// DXIL_NATIVE_HALF: %hlsl.frac

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-26 Thread Greg Roth via cfe-commits
@@ -25,7 +25,7 @@ void main(unsigned GI : SV_GroupIndex) {} //CHECK-NEXT: entry: //CHECK-NEXT: call void @"?call_me_first@@YAXXZ"() //CHECK-NEXT: call void @"?then_call_me@@YAXXZ"() -//CHECK-NEXT: %0 = call i32 @llvm.dx.flattened.thread.id.in.group() +//CHECK-NEXT: %0 =

[clang] [clang][HLSL] Update DXIL/SPIRV hybird CodeGen tests to use temp var (PR #105930)

2024-08-26 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/105930 ___ 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-09-13 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106588 >From 12253818bd47aa8c324f6222586965f356b11c90 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Wed, 24 Jul 2024 16:49:19 -0600 Subject: [PATCH 01/12] [HLSL] set alwaysinline on HLSL functions HLSL inlines all it

[clang] [HLSL] Align language modes on 202x as default (PR #108662)

2024-09-16 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/108662 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Align language modes on 202x as default (PR #108662)

2024-09-16 Thread Greg Roth via cfe-commits
https://github.com/pow2clk approved this pull request. I'm not objecting to anything, but I made a few comments out of interest https://github.com/llvm/llvm-project/pull/108662 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [HLSL] Align language modes on 202x as default (PR #108662)

2024-09-16 Thread Greg Roth via cfe-commits
@@ -12,7 +12,7 @@ // HALF: #define __HLSL_ENABLE_16_BIT 1 // NOHALF-NOT: __HLSL_ENABLE_16_BIT -// CHECK: #define __HLSL_VERSION 2021 +// CHECK: #define __HLSL_VERSION 2028 pow2clk wrote: 2028 == 202x and 2029 == 202y I expect? https://github.com/llvm/llvm-p

[clang] [HLSL] Align language modes on 202x as default (PR #108662)

2024-09-16 Thread Greg Roth via cfe-commits
@@ -37,7 +37,7 @@ _Static_assert(is_same<__decltype(4294967296), int64_t>::value, "4294967296 is i // Clang emits a warning that it is interpreting it as unsigned because that is // not conforming to the C standard. -// expected-warning@+1{{integer literal is too large to be

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -1,35 +1,66 @@ -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: dxil-pc-shadermodel6.3-library %s \ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: Just a few comments to explain the changes that aren't just mangling style changes. https://github.com/llvm/llvm-project/pull/111632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -1,93 +1,96 @@ -// 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 -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,NATIVE_HALF -// RUN:

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=CS,NOINLINE,CHECK -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -emit-llvm -disable-llvm-p

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -56,14 +55,12 @@ void main() { // CHECK-LABEL: define {{.*}}DoSilly // CHECK-NEXT:entry: -// CHECK-NEXT: [[ResPtr:%.*]] = alloca ptr // CHECK-NEXT: [[ThisPtrAddr:%.*]] = alloca ptr -// CHECK-NEXT: store ptr [[AggRes:%.*]], ptr [[ResPtr]] // CHECK-NEXT: store ptr {{.*}

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -289,17 +289,19 @@ void setFour(inout int I) { // CHECK: [[B:%.*]] = alloca %struct.B // CHECK: [[Tmp:%.*]] = alloca i32 -// CHECK: [[BFLoad:%.*]] = load i32, ptr [[B]] -// CHECK: [[BFshl:%.*]] = shl i32 [[BFLoad]], 24 -// CHECK: [[BFashr:%.*]] = ashr i32 [[BFshl]], 24 -//

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -13,16 +13,16 @@ void InitBuf(RWBuffer buf) { } // CHECK-NOT: _Init_thread_epoch -// CHECK: define internal void @"?main@@YAXXZ" +// CHECK: define internal void @_Z4mainv // CHECK-NEXT: entry: // CHECK-NEXT: [[Tmp1:%.*]] = alloca %"class.hlsl::RWBuffer" -// CHECK-NEXT: [[

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -260,10 +260,10 @@ void order_matters(inout int X, inout int Y) { // CHECK: store i32 [[VVal]], ptr [[Tmp0]] // CHECK: [[VVal:%.*]] = load i32, ptr [[V]] // CHECK: store i32 [[VVal]], ptr [[Tmp1]] -// CHECK: call void {{.*}}order_matters{{.*}}(ptr noalias noundef nonnull al

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-08 Thread Greg Roth via cfe-commits
@@ -1,93 +1,96 @@ -// 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 -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,NATIVE_HALF -// RUN:

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-15 Thread Greg Roth via cfe-commits
@@ -0,0 +1,222 @@ +; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s +; RUN: llc %s --filetype=asm -o - | FileCheck %s pow2clk wrote: Yes, and this test expects them to. The exported functions start at line 137

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ +// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ +// RUN: --check-prefixes=CHECK,NATIVE_HALF \ +// RUN: -DFNATTRS=n

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected pow2clk wrote: I'll copy my comment from elsewhere here: Are you

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,68 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450"

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,54 @@ +; RUN: opt -S -dxil-intrinsic-expansion -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; Make sure dxil op function calls for degrees are expanded and lowered as fmul for float and half. + +define noundef half @degrees_h

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: None of my suggestions are essential, but I'll give you a chance to consider them even if you reject them all before I approve. https://github.com/llvm/llvm-project/pull/111209 ___ cfe-commits mailing list cfe-com

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,54 @@ +; RUN: opt -S -dxil-intrinsic-expansion -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s + +; Make sure dxil op function calls for degrees are expanded and lowered as fmul for float and half. + +define noundef half @degrees_h

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][DXIL] Implement WaveGetLaneIndex Intrinsic (PR #111576)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: Small typo in description: "IntrinscsDirectX" Looks good, but I have a question about the SPIRV part. https://github.com/llvm/llvm-project/pull/111576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [llvm] [HLSL][DXIL] Implement WaveGetLaneIndex Intrinsic (PR #111576)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][DXIL] Implement WaveGetLaneIndex Intrinsic (PR #111576)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -18827,9 +18827,21 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { ArrayRef{Op0, Op1}, nullptr, "hlsl.step"); } case Builtin::BI__builtin_hlsl_wave_get_lane_index: { -return EmitRuntimeCall(CGM.CreateRuntimeFunction( -llvm::FunctionType::get(In

[clang] [llvm] [HLSL][DXIL] Implement WaveGetLaneIndex Intrinsic (PR #111576)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected pow2clk wrote: Are you getting unexpected diagnostics? If so, I'd li

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Implement the `degrees` intrinsic (PR #111209)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -0,0 +1,50 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: I'm a bit out of my depth here, but I've been trying to understand Itanium mangling better and I think my suggestion to coalesce the vendor mangled portions is valid at least. https://github.com/llvm/llvm-project/pull/110327 ___

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -4493,28 +4493,34 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) { } void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) { - mangleType(T->getWrappedType()); + llvm::SmallString<64> Str("_Res"); const HLSLAttributedResourceType::Attri

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -4493,28 +4493,34 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) { } void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) { - mangleType(T->getWrappedType()); + llvm::SmallString<64> Str("_Res"); const HLSLAttributedResourceType::Attri

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -11533,6 +11539,18 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType RHS, bool OfBlockPointer, return {}; return LHS; } + case Type::HLSLAttributedResource: { +const HLSLAttributedResourceType *LHSTy = +LHS->castAs(); +const HLSLAttribut

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-09 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/110327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-09 Thread Greg Roth via cfe-commits
@@ -4492,6 +4492,37 @@ void CXXNameMangler::mangleType(const ArrayParameterType *T) { mangleType(cast(T)); } +void CXXNameMangler::mangleType(const HLSLAttributedResourceType *T) { + llvm::SmallString<64> Str("_Res"); + const HLSLAttributedResourceType::Attributes &Attrs

[clang] Enable matrices in HLSL (PR #111415)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -17,12 +17,12 @@ void add(sx10x10_t a, sx5x10_t b, sx10x5_t c) { // expected-error@-1 {{assigning to 'sx10x10_t' (aka 'float __attribute__((matrix_type(10, 10)))') from incompatible type 'sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))')}} a = b + &c; - //

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-11 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/5] [DirectX] Remove trivially dead functions at linkage finalize

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-11 Thread Greg Roth via cfe-commits
@@ -0,0 +1,222 @@ +; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s +; RUN: llc %s --filetype=asm -o - | FileCheck %s pow2clk wrote: Done! https://github.com/llvm/llvm-project/pull/106146 __

[clang] Enable matrices in HLSL (PR #111415)

2024-10-11 Thread Greg Roth via cfe-commits
@@ -17,12 +17,12 @@ void add(sx10x10_t a, sx5x10_t b, sx10x5_t c) { // expected-error@-1 {{assigning to 'sx10x10_t' (aka 'float __attribute__((matrix_type(10, 10)))') from incompatible type 'sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))')}} a = b + &c; - //

[clang] Enable matrices in HLSL (PR #111415)

2024-10-11 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable matrices in HLSL (PR #111415)

2024-10-07 Thread Greg Roth via cfe-commits
@@ -852,34 +852,50 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) { void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) +OS <

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-07 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/4] [DirectX] Remove trivially dead functions at linkage finalize

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-16 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH 1/6] [DirectX] Remove trivially dead functions at linkage finalize

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-17 Thread Greg Roth via cfe-commits
https://github.com/pow2clk closed https://github.com/llvm/llvm-project/pull/106146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-10-17 Thread Greg Roth via cfe-commits
@@ -356,6 +426,9 @@ struct TemplateParameterListBuilder { QualType T = Builder.Template->getInjectedClassNameSpecialization(); T = S.Context.getInjectedClassNameType(Builder.Record, T); +ArrayRef TempArgs = +Builder.Template->getInjectedTemplateArgs();

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -48,11 +48,13 @@ define <4 x i32> @load_static_array_of_vec_test(i32 %index) { } ; CHECK-LABEL: multid_load_test -define <4 x i32> @multid_load_test() { +define <4 x i32> @multid_load_test() #0 { ; CHECK-COUNT-8: load i32, ptr addrspace(3) {{(.*@groushared2dArrayofVec

[clang] Switch DirectX Target to use the Itanium ABI (PR #111632)

2024-10-10 Thread Greg Roth via cfe-commits
https://github.com/pow2clk closed https://github.com/llvm/llvm-project/pull/111632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -S -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -S -o - %s | FileCheck %s + +// Verify that internal linkage unused functions are removed + +RWBuffer buf; + +// Never

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -19,20 +19,20 @@ using namespace llvm; static bool finalizeLinkage(Module &M) { - SmallPtrSet EntriesAndExports; + SmallPtrSet Funcs; // Find all entry points and export functions for (Function &EF : M.functions()) { -if (!EF.hasFnAttribute("hlsl.shader") && !

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -0,0 +1,80 @@ +; RUN: opt -S -dxil-finalize-linkage -mtriple=dxil-unknown-shadermodel6.5-compute %s | FileCheck %s +; RUN: llc %s --filetype=asm -o - | FileCheck %s + +target triple = "dxilv1.5-pc-shadermodel6.5-compute" + +; Confirm that DXILFinalizeLinkage will remove functi

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -19,20 +19,20 @@ using namespace llvm; static bool finalizeLinkage(Module &M) { - SmallPtrSet EntriesAndExports; + SmallPtrSet Funcs; // Find all entry points and export functions pow2clk wrote: Updated https://github.com/llvm/llvm-project/pull/106

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -disable-llvm-passes -emit-llvm -finclude-default-header -o - %s | FileCheck %s + +// CHECK-LABEL: increment +void increment(inout int Arr[2]) { + for (int I = 0; I < 2; I++) +Arr[0] += 2; +} + +// C

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-10-10 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-10-10 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: Just a drive by review with one additional note while searching for changes that will be disrupted by the mangling shift. https://github.com/llvm/llvm-project/pull/111047 ___ cfe-commits mailing list cfe-commits@l

[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -1,9 +1,53 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -O1 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -finclude-default-header -x hlsl -emit-llvm -o - %s | FileCheck %s -void foo(__hlsl_resource_t r

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -disable-llvm-passes -emit-llvm -finclude-default-header -o - %s | FileCheck %s + +// CHECK-LABEL: increment +void increment(inout int Arr[2]) { + for (int I = 0; I < 2; I++) +Arr[0] += 2; +} + +// C

[clang] [llvm] [HLSL] Add handle initialization for simple resource declarations (PR #111207)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -1,19 +1,20 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple spirv-vulkan-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s --check-prefix=CHECK-SPIRV

[clang] Enable matrices in HLSL (PR #111415)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -17,12 +17,12 @@ void add(sx10x10_t a, sx5x10_t b, sx10x5_t c) { // expected-error@-1 {{assigning to 'sx10x10_t' (aka 'float __attribute__((matrix_type(10, 10)))') from incompatible type 'sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))')}} a = b + &c; - //

[clang] Enable matrices in HLSL (PR #111415)

2024-10-10 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable matrices in HLSL (PR #111415)

2024-10-10 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/111415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Enable matrices in HLSL (PR #111415)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -1381,7 +1381,7 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, if (LangOpts.OpenACC && !LangOpts.OpenMP) { InitBuiltinType(ArraySectionTy, BuiltinType::ArraySection); } - if (LangOpts.MatrixTypes) + if (LangOpts.MatrixTypes || LangOpts.HLSL) --

[clang] Enable matrices in HLSL (PR #111415)

2024-10-10 Thread Greg Roth via cfe-commits
@@ -852,34 +852,50 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) { void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) +OS <

[clang] Enable matrices in HLSL (PR #111415)

2024-10-14 Thread Greg Roth via cfe-commits
@@ -1381,7 +1381,7 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target, if (LangOpts.OpenACC && !LangOpts.OpenMP) { InitBuiltinType(ArraySectionTy, BuiltinType::ArraySection); } - if (LangOpts.MatrixTypes) + if (LangOpts.MatrixTypes || LangOpts.HLSL) --

[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

2024-10-24 Thread Greg Roth via cfe-commits
@@ -1762,6 +1765,36 @@ bool SPIRVInstructionSelector::selectSign(Register ResVReg, return Result; } +bool SPIRVInstructionSelector::selectWaveActiveCountBits( +Register ResVReg, const SPIRVType *ResType, MachineInstr &I) const { + assert(I.getNumOperands() == 3); + as

[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

2024-10-24 Thread Greg Roth via cfe-commits
@@ -1762,6 +1765,36 @@ bool SPIRVInstructionSelector::selectSign(Register ResVReg, return Result; } +bool SPIRVInstructionSelector::selectWaveActiveCountBits( +Register ResVReg, const SPIRVType *ResType, MachineInstr &I) const { + assert(I.getNumOperands() == 3); + as

[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

2024-10-24 Thread Greg Roth via cfe-commits
@@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK,CHECK-DXIL +// RUN: %clang_cc1 -std=hlsl2021 -finclude-defaul

[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

2024-10-24 Thread Greg Roth via cfe-commits
https://github.com/pow2clk commented: Looks good! The only change I think is essential is the missing `constrainAllUses` https://github.com/llvm/llvm-project/pull/113382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

[clang] Enable matrices in HLSL (PR #111415)

2024-11-04 Thread Greg Roth via cfe-commits
@@ -17,12 +17,12 @@ void add(sx10x10_t a, sx5x10_t b, sx10x5_t c) { // expected-error@-1 {{assigning to 'sx10x10_t' (aka 'float __attribute__((matrix_type(10, 10)))') from incompatible type 'sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))')}} a = b + &c; - //

[clang] Enable matrices in HLSL (PR #111415)

2024-11-05 Thread Greg Roth via cfe-commits
@@ -852,34 +852,51 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) { void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) +OS <

[clang] Enable matrices in HLSL (PR #111415)

2024-11-05 Thread Greg Roth via cfe-commits
@@ -1,7 +1,5 @@ // RUN: %clang_cc1 -O0 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++11 | FileCheck --check-prefixes=CHECK,NOOPT %s // RUN: %clang_cc1 -O1 -fenable-matrix -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-pas

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_i8packed` intrinsic (PR #113623)

2024-11-01 Thread Greg Roth via cfe-commits
@@ -2527,6 +2640,11 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, case Intrinsic::spv_udot: case Intrinsic::spv_sdot: return selectIntegerDot(ResVReg, ResType, I); + case Intrinsic::spv_dot4add_i8packed: +if (STI.canUseExtension(SPIRV::Extens

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_i8packed` intrinsic (PR #113623)

2024-11-01 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/113623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_i8packed` intrinsic (PR #113623)

2024-11-01 Thread Greg Roth via cfe-commits
https://github.com/pow2clk approved this pull request. Looks good! I learned a couple things about SPIR-V by verifying this. Just one quibble about the language version and a suggested followup. https://github.com/llvm/llvm-project/pull/113623 ___ cf

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_i8packed` intrinsic (PR #113623)

2024-11-01 Thread Greg Roth via cfe-commits
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -triple \ pow2clk wrote: 202x is the default. Is there a reason this requires 2021? https://github.com/llvm/llvm-project/pull/113623 ___ cfe-c

[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

2024-10-25 Thread Greg Roth via cfe-commits
https://github.com/pow2clk edited https://github.com/llvm/llvm-project/pull/113382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DXIL][SPIRV] Lower WaveActiveCountBits intrinsic (PR #113382)

2024-10-24 Thread Greg Roth via cfe-commits
@@ -820,3 +820,12 @@ def WaveGetLaneIndex : DXILOp<111, waveGetLaneIndex> { let stages = [Stages]; let attributes = [Attributes]; } + +def WaveAllBitCount : DXILOp<135, waveAllOp> { pow2clk wrote: Initially, I thought this couldn't be right since the latte

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

2024-11-08 Thread Greg Roth via cfe-commits
@@ -1880,6 +1880,31 @@ static bool CheckVectorSelect(Sema *S, CallExpr *TheCall) { return false; } +static bool CheckResourceHandle(Sema *S, CallExpr *TheCall, unsigned ArgIndex) { + assert(TheCall->getNumArgs() >= ArgIndex); + QualType ArgType = TheCall->getArg(ArgIndex

[clang] [HLSL] Add Append/ConsumeStructuredBuffer definitions to HLSLExternalSemaSource (PR #113643)

2024-11-08 Thread Greg Roth via cfe-commits
https://github.com/pow2clk approved this pull request. Thanks for indulging me! https://github.com/llvm/llvm-project/pull/113643 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Tentative fix for not removing newly internal functions (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 1e39029007dee5825810965fa39f26996ec9b7aa Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH] [DirectX] Remove trivially dead functions at linkage finalize Funct

[clang] [llvm] Tentative fix for not removing newly internal functions (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 70d4b5de3e9a214d50560f047b334de7f0818167 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH] [DirectX] Remove trivially dead functions at linkage finalize Funct

[clang] [llvm] [DirectX] Remove trivially dead functions at linkage finalize (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
@@ -19,20 +19,20 @@ using namespace llvm; static bool finalizeLinkage(Module &M) { - SmallPtrSet EntriesAndExports; + SmallPtrSet Funcs; // Find all entry points and export functions for (Function &EF : M.functions()) { -if (!EF.hasFnAttribute("hlsl.shader") && !

[clang] [llvm] Tentative fix for not removing newly internal functions (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk updated https://github.com/llvm/llvm-project/pull/106146 >From 40224473a7b43bc4ffe2024ab51196c2130bedc7 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Sun, 25 Aug 2024 12:00:03 -0600 Subject: [PATCH] [DirectX] Remove trivially dead functions at linkage finalize Funct

[clang] [llvm] Tentative fix for not removing newly internal functions (PR #106146)

2024-09-19 Thread Greg Roth via cfe-commits
https://github.com/pow2clk ready_for_review https://github.com/llvm/llvm-project/pull/106146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   >