[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/107408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. This looks good. No major issue. There are a few typos, and a couple smaller issues that we can follow up on in another PR. https://github.com/llvm/llvm-project/pull/107408 ___ cfe-commits mailin

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -744,79 +744,139 @@ static void insertSpirvDecorations(MachineFunction &MF, MachineIRBuilder MIB) { MI->eraseFromParent(); } -// Find basic blocks of the switch and replace registers in spv_switch() by its -// MBB equivalent. -static void processSwitches(MachineFunctio

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -744,79 +744,139 @@ static void insertSpirvDecorations(MachineFunction &MF, MachineIRBuilder MIB) { MI->eraseFromParent(); } -// Find basic blocks of the switch and replace registers in spv_switch() by its -// MBB equivalent. -static void processSwitches(MachineFunctio

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [SPIR-V] Add SPIR-V structurizer (PR #107408)

2024-09-06 Thread Steven Perron via cfe-commits
@@ -0,0 +1,1410 @@ +//===-- SPIRVStructurizer.cpp --*- C++ -*-===// +// +// 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: Apache-2.0 WITH

[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)

2024-10-09 Thread Steven Perron via cfe-commits
@@ -428,6 +431,7 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg, case TargetOpcode::G_INTRINSIC: case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS: + case TargetOpcode::G_INTRINSIC_CONVERGENT: s-perron wrote: The extra convergence information i

[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)

2024-10-04 Thread Steven Perron via cfe-commits
@@ -0,0 +1,28 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %} + +; Test lowering to spir-v backend + +; CHECK-DAG: %[[#uint

[clang] [llvm] [HLSL] implement elementwise firstbithigh hlsl builtin (PR #111082)

2024-10-04 Thread Steven Perron via cfe-commits
@@ -0,0 +1,37 @@ +; 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 %} s-perron wrote: If you look at FindSMsb and FindU

[clang] [llvm] [HLSL] implement elementwise firstbithigh hlsl builtin (PR #111082)

2024-10-04 Thread Steven Perron via cfe-commits
@@ -0,0 +1,37 @@ +; 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: OpMemoryModel Logical GLSL450 + +define noundef i32 @fi

[clang] [HLSL][SPIRV] Use Spirv target codegen (PR #112573)

2024-10-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/112573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Use Spirv target codegen (PR #112573)

2024-10-16 Thread Steven Perron via cfe-commits
s-perron wrote: I messed up. I the button to merge before the tests finished. If any tests fail, I'll revert immediately. https://github.com/llvm/llvm-project/pull/112573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang] [HLSL][SPIRV] Use Spirv target codegen (PR #112573)

2024-10-16 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/112573 When the arch in the triple in "spirv", the default target codegen is currently used. We should be using the spir-v target codegen. This will be used to have SPIR-V specific lowering of the HLSL types. >From a

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
@@ -469,14 +480,21 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() { for (auto &F : M.functions()) { if (!F.hasFnAttribute("hlsl.shader")) continue; -IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin()); +auto* Token = getConvergenceToken(F.getE

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/2] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/5] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron ready_for_review https://github.com/llvm/llvm-project/pull/112757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
@@ -469,14 +480,21 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() { for (auto &F : M.functions()) { if (!F.hasFnAttribute("hlsl.shader")) continue; -IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin()); +auto* Token = getConvergenceToken(F.getE

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/3] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/4] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/5] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron converted_to_draft https://github.com/llvm/llvm-project/pull/112757 ___ 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-10-29 Thread Steven Perron via cfe-commits
@@ -1,48 +1,59 @@ -; RUN: llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: llc -O0 -mtriple=spirv32v1.6-vulkan-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DOT +; RUN: llc -O0 -mtriple=spirv32-vulkan-unknown -spirv-ext=+SPV_KHR_integer_do

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

2024-10-29 Thread Steven Perron via cfe-commits
@@ -1,48 +1,59 @@ -; RUN: llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: llc -O0 -mtriple=spirv32v1.6-vulkan-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DOT +; RUN: llc -O0 -mtriple=spirv32-vulkan-unknown -spirv-ext=+SPV_KHR_integer_do

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

2024-10-29 Thread Steven Perron via cfe-commits
@@ -1694,6 +1701,110 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +template +bool SPIRVInstructionSelector::selectDot4AddPacked(Register ResVReg, + const SPIRVType *ResType, +

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

2024-10-29 Thread Steven Perron via cfe-commits
@@ -1694,6 +1698,84 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +// Since pre-1.6 SPIRV has no DotProductInput4x8BitPacked implementation, +// extract the elements of the packed inputs, multiply them and add the result +// to the ac

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

2024-10-29 Thread Steven Perron via cfe-commits
@@ -1694,6 +1698,84 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +// Since pre-1.6 SPIRV has no DotProductInput4x8BitPacked implementation, +// extract the elements of the packed inputs, multiply them and add the result +// to the ac

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

2024-10-29 Thread Steven Perron via cfe-commits
@@ -1694,6 +1698,84 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +// Since pre-1.6 SPIRV has no DotProductInput4x8BitPacked implementation, +// extract the elements of the packed inputs, multiply them and add the result +// to the ac

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

2024-10-29 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: Thanks for checking with me. To generate better SPIR-V, we should try to use the `OpSDot` instruction when possible. Please use the capability when tageting SPIR-V 1.6 or the extension is available. Thanks. https://github.com/llvm/llvm-project/pull/113623

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

2024-10-29 Thread Steven Perron via cfe-commits
https://github.com/s-perron 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-10-29 Thread Steven Perron via cfe-commits
@@ -0,0 +1,48 @@ +; RUN: llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - -filetype=obj | spirv-val %} s-perron wrote: You should be using `-mtriple=spirv-vulkan-unk

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

2024-10-29 Thread Steven Perron via cfe-commits
@@ -1694,6 +1698,84 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +// Since pre-1.6 SPIRV has no DotProductInput4x8BitPacked implementation, +// extract the elements of the packed inputs, multiply them and add the result +// to the ac

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

2024-11-04 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. LGTM. I just want someone on the OpenCL side to make sure they are okay with the changes for OpenCL. https://github.com/llvm/llvm-project/pull/113623 ___ cfe-commits mailing list cfe-commits@list

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-11-04 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/114273 >From 215a3427acd5f5ab5fc5fb889a235c3ac7abcdfb Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 1 Oct 2024 09:56:20 -0400 Subject: [PATCH 1/5] [HLSL][SPIRV] Add HLSL type translation for spirv. This com

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-11-04 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/114273 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-11-04 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/114273 >From 215a3427acd5f5ab5fc5fb889a235c3ac7abcdfb Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 1 Oct 2024 09:56:20 -0400 Subject: [PATCH 1/4] [HLSL][SPIRV] Add HLSL type translation for spirv. This com

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

2024-11-05 Thread Steven Perron via cfe-commits
@@ -1694,6 +1701,112 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +template +bool SPIRVInstructionSelector::selectDot4AddPacked(Register ResVReg, + const SPIRVType *ResType, +

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

2024-11-05 Thread Steven Perron via cfe-commits
s-perron wrote: > Regarding the comments about differentiating between `OpSDot/DotProduct` and > `OpSDotKHR/DotProductKHR`: > > I agree that these are different ops/capabilities in the SPIR-V spec. > > However from a quick attempt to implement this, I found that since the > Capabilities share

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/114273 >From 689f8d6be270321ffc1930162b318c134c9bb7f4 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 1 Oct 2024 09:56:20 -0400 Subject: [PATCH] [HLSL][SPIRV] Add HLSL type translation for spirv. This commit

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/114273 This commit partially implements SPIRTargetCodeGenInfo::getHLSLType. It can now generate the spirv type for the following HLSL types: 1. RWBuffer 2. Buffer 3. Sampler >From 916fdfdf871fcfe5fe7e43126ad2442a726

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

2024-10-31 Thread Steven Perron via cfe-commits
@@ -1,48 +1,59 @@ -; RUN: llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: llc -O0 -mtriple=spirv32v1.6-vulkan-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DOT +; RUN: llc -O0 -mtriple=spirv32-vulkan-unknown -spirv-ext=+SPV_KHR_integer_do

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

2024-10-31 Thread Steven Perron via cfe-commits
@@ -1694,6 +1701,110 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg, return Result; } +template +bool SPIRVInstructionSelector::selectDot4AddPacked(Register ResVReg, + const SPIRVType *ResType, +

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

2024-10-31 Thread Steven Perron via cfe-commits
@@ -1,48 +1,59 @@ -; RUN: llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: llc -O0 -mtriple=spirv32v1.6-vulkan-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-DOT +; RUN: llc -O0 -mtriple=spirv32-vulkan-unknown -spirv-ext=+SPV_KHR_integer_do

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-11-01 Thread Steven Perron via cfe-commits
https://github.com/s-perron ready_for_review https://github.com/llvm/llvm-project/pull/114273 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/112757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-28 Thread Steven Perron via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple spirv-pc-vulkan-compute -finclude-default-header -fnative-half-type -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s s-perron wrote: I copied from another test. I have removed it. https://github.com/llvm/llvm-p

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-28 Thread Steven Perron via cfe-commits
@@ -469,14 +479,22 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() { for (auto &F : M.functions()) { if (!F.hasFnAttribute("hlsl.shader")) continue; -IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin()); +auto *Token = getConvergenceToken(F.getE

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/6] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From 24e84865fe8cd9684c6e5b2763970ba278038039 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/2] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-28 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/112757 >From f113230de7412cc2440a800be6d3d3640742adbe Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Wed, 16 Oct 2024 13:20:29 -0400 Subject: [PATCH 1/2] [HLSL][SPIRV] Add convergence tokens to entry point wrappe

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-31 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/114273 >From 215a3427acd5f5ab5fc5fb889a235c3ac7abcdfb Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 1 Oct 2024 09:56:20 -0400 Subject: [PATCH 1/3] [HLSL][SPIRV] Add HLSL type translation for spirv. This com

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-31 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/114273 >From 689f8d6be270321ffc1930162b318c134c9bb7f4 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 1 Oct 2024 09:56:20 -0400 Subject: [PATCH 1/3] [HLSL][SPIRV] Add HLSL type translation for spirv. This com

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-31 Thread Steven Perron via cfe-commits
@@ -323,6 +327,83 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getOpenCLType(CodeGenModule &CGM, return nullptr; } +llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType(CodeGenModule &CGM, + const Type *Ty) const { + auto

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-31 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/114273 >From 689f8d6be270321ffc1930162b318c134c9bb7f4 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 1 Oct 2024 09:56:20 -0400 Subject: [PATCH 1/2] [HLSL][SPIRV] Add HLSL type translation for spirv. This com

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-31 Thread Steven Perron via cfe-commits
@@ -323,6 +327,83 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getOpenCLType(CodeGenModule &CGM, return nullptr; } +llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType(CodeGenModule &CGM, + const Type *Ty) const { + auto

[clang] [HLSL][SPIRV] Add HLSL type translation for spirv. (PR #114273)

2024-10-31 Thread Steven Perron via cfe-commits
https://github.com/s-perron converted_to_draft https://github.com/llvm/llvm-project/pull/114273 ___ 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-10-31 Thread Steven Perron via cfe-commits
@@ -0,0 +1,48 @@ +; RUN: llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - -filetype=obj | spirv-val %} s-perron wrote: You should be using `spirv`. You probably need

[clang] [HLSL] Use HLSLToolChain for Vulkan (PR #110306)

2024-09-27 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/110306 The options are not translated correctly when targeting Vulkan using the dxc driver mode. Resuing the translator used for HLSL. Fixes problem 2 in https://github.com/llvm/llvm-project/issues/108567. >From bbd

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-27 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/110275 - Fix the calling convention used for the call in the entry point wrapper. No calling convention is currently set. I can easily use the calling convention of the function that is being called. - Use the Mic

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
s-perron wrote: This PR does 2 things, so I will close this one and split it up. There is also some concern about adopting the Microsoft ABI, which needs to be discussed. https://github.com/llvm/llvm-project/pull/110275 ___ cfe-commits mailing list cf

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/110275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] [llvm] [mlir] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
Andrzej =?utf-8?q?WarzyƄski?= ,Steven Perron Message-ID: In-Reply-To: https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/110275 >From 906a7bc775f1d22b642c1157c424a55b686cb46a Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 17 Sep 2024 16:22:57 -0400 Subjec

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/110275 >From 1c2aab054266196844f3e67d4740292a2cf7 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 17 Sep 2024 16:22:57 -0400 Subject: [PATCH 1/2] [HLSL][SPIRV] Fix calling convention for call in entry fun

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
s-perron wrote: > LGTM! I think changing the mangling for Vulkan is the best solution here. > > One small comment, later on if/when you decide to use SPIRVBuiltins.cpp/.td > for lowering builtins, there might be additional changes needed. The lookup > function expects Itanium demangled strings

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/110275 >From 906a7bc775f1d22b642c1157c424a55b686cb46a Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 17 Sep 2024 16:22:57 -0400 Subject: [PATCH] [HLSL][SPIRV] Fix calling convention for call in entry functio

[clang] [HLSL] Use HLSLToolChain for Vulkan (PR #110306)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/110306 >From bbdbc42f10a2c4f4e265610f325177ccf764cb83 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Fri, 27 Sep 2024 12:49:34 -0400 Subject: [PATCH] [HLSL] Use HLSLToolChain for Vulkan The options are not transl

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110542)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/110542 Fix the calling convention used for the call in the entry point wrapper. No calling convention is currently set. It can easily use the calling convention of the function that is being called. Without this, ther

[clang] [HLSL] Use HLSLToolChain for Vulkan (PR #110306)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/110306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron updated https://github.com/llvm/llvm-project/pull/110275 >From 1c2aab054266196844f3e67d4740292a2cf7 Mon Sep 17 00:00:00 2001 From: Steven Perron Date: Tue, 17 Sep 2024 16:22:57 -0400 Subject: [PATCH 1/3] [HLSL][SPIRV] Fix calling convention for call in entry fun

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
@@ -415,6 +415,7 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD, } CallInst *CI = B.CreateCall(FunctionCallee(Fn), Args); + CI->setCallingConv(Fn->getCallingConv()); (void)CI; s-perron wrote: Done. https://github.com/llvm/llvm-proje

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110275)

2024-09-30 Thread Steven Perron via cfe-commits
@@ -316,6 +316,11 @@ class LLVM_LIBRARY_VISIBILITY SPIRVTargetInfo : public BaseSPIRVTargetInfo { SizeType = TargetInfo::UnsignedInt; resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-" "v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"); + +

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110542)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron ready_for_review https://github.com/llvm/llvm-project/pull/110542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Treat `main` as any other function (PR #110546)

2024-09-30 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. This fixes the problem in #108567 https://github.com/llvm/llvm-project/pull/110546 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [HLSL][SPIRV] Fix calling convention for call in entry function. (PR #110542)

2024-10-01 Thread Steven Perron via cfe-commits
https://github.com/s-perron closed https://github.com/llvm/llvm-project/pull/110542 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)

2024-10-17 Thread Steven Perron via cfe-commits
https://github.com/s-perron created https://github.com/llvm/llvm-project/pull/112757 Inlining currently assumes that either all function use controled convergence or none of them do. This is why we need to have the entry point wrapper use controled convergence. https://github.com/llvm/llvm-proj

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: LGTM. I have not done enough in LLVM to know the etiquette yet. I wonder if the bug fix should be it own PR. https://github.com/llvm/llvm-project/pull/115068 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_u8packed` intrinsic (PR #115068)

2024-11-06 Thread Steven Perron via cfe-commits
@@ -1743,7 +1743,7 @@ bool SPIRVInstructionSelector::selectDot4AddPackedExpansion( assert(I.getOperand(4).isReg()); MachineBasicBlock &BB = *I.getParent(); - bool Result = false; + bool Result = true; s-perron wrote: Should this be part of it own PR si

[clang] [llvm] [HLSL] Adding HLSL `clip` function. (PR #114588)

2024-11-07 Thread Steven Perron via cfe-commits
https://github.com/s-perron commented: LGTM, just need to fix up the misunderstanding about how the spirv version and the extension interact. https://github.com/llvm/llvm-project/pull/114588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang] [llvm] [HLSL] Adding HLSL `clip` function. (PR #114588)

2024-11-07 Thread Steven Perron via cfe-commits
@@ -1407,6 +1407,15 @@ void addInstrRequirements(const MachineInstr &MI, Reqs.addCapability(SPIRV::Capability::SplitBarrierINTEL); } break; + case SPIRV::OpKill: { +Reqs.addCapability(SPIRV::Capability::Shader) ; + } break; + case SPIRV::OpDemoteToHelperInv

[clang] [llvm] [HLSL] Adding HLSL `clip` function. (PR #114588)

2024-11-07 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/114588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Adding HLSL `clip` function. (PR #114588)

2024-11-07 Thread Steven Perron via cfe-commits
@@ -0,0 +1,77 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,SPIRV15 +; RUN: llc -verify-machineinstrs -spirv-ext=+SPV_EXT_demote_to_helper_invocation -O0 -mtriple=spirv32v1.6-unknown-unknown %s -o - | FileC

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

2024-11-07 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. 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] [HLSL][SPIRV] Added clamp intrinsic (PR #113394)

2024-11-07 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. https://github.com/llvm/llvm-project/pull/113394 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX] Calculate resource binding offsets using the lower bound (PR #117303)

2024-11-25 Thread Steven Perron via cfe-commits
https://github.com/s-perron approved this pull request. https://github.com/llvm/llvm-project/pull/117303 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SPIR-V] Fixup storage class for global private (PR #116636)

2024-11-29 Thread Steven Perron via cfe-commits
@@ -0,0 +1,17 @@ +; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %} + +@PrivInternal = internal addrspace(10) global i32 456 +; CHE

[clang] [llvm] [SPIR-V] Fixup storage class for global private (PR #116636)

2024-11-29 Thread Steven Perron via cfe-commits
https://github.com/s-perron edited https://github.com/llvm/llvm-project/pull/116636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   >