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

2024-05-14 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/88918 ___ 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 convergence intrinsics (PR #88918)

2024-05-14 Thread Nathan Gauër via cfe-commits
Keenuts wrote: rebased on main, local tests are passing, waiting on CI to merge. https://github.com/llvm/llvm-project/pull/88918 ___ 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 convergence intrinsics (PR #88918)

2024-05-14 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/88918 From 440cdfa4132a969702348c32f2810924012c5ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 15 Apr 2024 17:05:40 +0200 Subject: [PATCH 1/6] [clang][SPIR-V] Always add convervence

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

2024-05-13 Thread Nathan Gauër via cfe-commits
@@ -1586,6 +1586,12 @@ class CodeGenModule : public CodeGenTypeCache { void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535, bool IsDtorAttrFunc = false); + // Return whether structured convergence intrinsics should be generated for + // this

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

2024-05-13 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/88918 From a8bf6fe83a1c145ef81ee30471dc51de1b5354ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 15 Apr 2024 17:05:40 +0200 Subject: [PATCH 1/6] [clang][SPIR-V] Always add convervence

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

2024-05-13 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Thanks for the reviews. Waiting for 1 approval from MS and I'll merge https://github.com/llvm/llvm-project/pull/88918 ___ 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 convergence intrinsics (PR #88918)

2024-05-13 Thread Nathan Gauër via cfe-commits
@@ -1586,6 +1586,12 @@ class CodeGenModule : public CodeGenTypeCache { void AddGlobalDtor(llvm::Function *Dtor, int Priority = 65535, bool IsDtorAttrFunc = false); + // Return whether structured convergence intrinsics should be generated for + // this

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

2024-05-07 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Hi all, rebased on main, and addressed the comments. This commits changes the register order on SPIR-V vs DXIL, which required me to fix the mad+lerp intrinsic tests. Should be NFC, just storing the register name in a CHECK variable.

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

2024-05-07 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/88918 From a8bf6fe83a1c145ef81ee30471dc51de1b5354ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 15 Apr 2024 17:05:40 +0200 Subject: [PATCH 1/5] [clang][SPIR-V] Always add convervence

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

2024-05-07 Thread Nathan Gauër via cfe-commits
@@ -3101,3 +3130,68 @@ CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt ) { return F; } + +namespace { +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullptr otherwise. +llvm::IntrinsicInst

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

2024-05-07 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/88918 From 94d76dcdfac88d1d50fe705406c0280c33766e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 15 Apr 2024 17:05:40 +0200 Subject: [PATCH 1/4] [clang][SPIR-V] Always add convervence

[clang] [llvm] [SPIRV] Add tan intrinsic part 3 (PR #90278)

2024-05-06 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/90278 ___ 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-17 Thread Nathan Gauër via cfe-commits
@@ -1109,6 +1124,10 @@ void CodeGenFunction::EmitForStmt(const ForStmt , llvm::BasicBlock *CondBlock = CondDest.getBlock(); EmitBlock(CondBlock); + if (getTarget().getTriple().isSPIRVLogical()) Keenuts wrote: Changed those for a module-level function

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

2024-04-17 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/88918 From 94d76dcdfac88d1d50fe705406c0280c33766e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 15 Apr 2024 17:05:40 +0200 Subject: [PATCH 1/3] [clang][SPIR-V] Always add convervence

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

2024-04-17 Thread Nathan Gauër via cfe-commits
@@ -1109,6 +1124,10 @@ void CodeGenFunction::EmitForStmt(const ForStmt , llvm::BasicBlock *CondBlock = CondDest.getBlock(); EmitBlock(CondBlock); + if (getTarget().getTriple().isSPIRVLogical()) Keenuts wrote: Right, something at the module level, which

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

2024-04-17 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Thanks all! Agree with Bogner, let's unblock the tests first. As for the address space for globals, this isn't something we have looked into yet, so I'd be in favor of keeping the same behavior as the SPIRN flavor until we have a reason to diverge (as in "thought about this

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

2024-04-16 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/88918 From 94d76dcdfac88d1d50fe705406c0280c33766e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 15 Apr 2024 17:05:40 +0200 Subject: [PATCH 1/2] [clang][SPIR-V] Always add convervence

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

2024-04-16 Thread Nathan Gauër via cfe-commits
@@ -4987,7 +4990,11 @@ class CodeGenFunction : public CodeGenTypeCache { const llvm::Twine = ""); // Adds a convergence_ctrl token to |Input| and emits the required parent // convergence instructions. - llvm::CallBase

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

2024-04-16 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/88918 PR #80680 added bits in the codegen to lazily add convergence intrinsics when required. This logic relied on the LoopStack. The issue is when parsing the condition, the loopstack doesn't yet reflect the correct

[clang] [llvm] [HLSL][SPIRV] Add any intrinsic lowering (PR #88325)

2024-04-15 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/88325 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CodeGen] Add AS for Globals to SPIR & SPIRV datalayouts (PR #88455)

2024-04-15 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/88455 ___ 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-02 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/87171 ___ 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-02 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/87171 ___ 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-02 Thread Nathan Gauër via cfe-commits
@@ -0,0 +1,44 @@ + +//===- CGHLSLUtils.h - Utility functions for HLSL CodeGen ---*- 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:

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

2024-04-02 Thread Nathan Gauër via cfe-commits
@@ -100,6 +100,118 @@ double3 abs(double3); _HLSL_BUILTIN_ALIAS(__builtin_elementwise_abs) double4 abs(double4); +//===--===// +// all builtins

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

2024-04-02 Thread Nathan Gauër via cfe-commits
@@ -0,0 +1,44 @@ + +//===- CGHLSLUtils.h - Utility functions for HLSL CodeGen ---*- 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:

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

2024-04-02 Thread Nathan Gauër via cfe-commits
@@ -0,0 +1,95 @@ +; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s +; Note: The validator is wrong it wants the return to be a bool vector when it is bool scalar return Keenuts wrote: AFAIK the validator is not wrong, it complains for 2

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

2024-04-02 Thread Nathan Gauër via cfe-commits
@@ -0,0 +1,44 @@ + +//===- CGHLSLUtils.h - Utility functions for HLSL CodeGen ---*- 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:

[clang] [HLSL][clang] Move hlsl_wave_get_lane_index to EmitHLSLBuiltinExpr (PR #87131)

2024-04-02 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Hi! Thanks @farzonl and @marcauberer for making sure SPIR-V backend didn't break, really appreciate it!  https://github.com/llvm/llvm-project/pull/87131 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-03-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-28 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Local tests for SPIR-V & DXIL pass https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From dc008167980ca0a479d2cdceeeb1ab6cd4983ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/9] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-28 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Thanks all the the reviews! We have 3 LGTMs and an ack from Arsenm, so I'm going to rebase on main, wait for the bots & tests, and if all is green, merge this. https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing

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

2024-03-28 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,92 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullptr otherwise. +llvm::IntrinsicInst *getConvergenceToken(llvm::BasicBlock *BB) {

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

2024-03-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From afbe709931942b3970f92884022e250c1e7eb84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/9] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-26 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-26 Thread Nathan Gauër via cfe-commits
Keenuts wrote: @ssahasra it is up to you then  https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-26 Thread Nathan Gauër via cfe-commits
Keenuts wrote: @arsenm would you be fine with those codegen changes as-is? Given that the convergent/no-convergent switch will be done later, depending on when the required IR change is merged? https://github.com/llvm/llvm-project/pull/80680 ___

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

2024-03-25 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Rebases on main (almost, HEAD is slightly broken), and added back the convergence attribute. The backend changes are ready for this intrinsic. https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing list

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

2024-03-25 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From afbe709931942b3970f92884022e250c1e7eb84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/8] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-25 Thread Nathan Gauër via cfe-commits
@@ -1295,11 +1295,13 @@ double4 trunc(double4); /// true, across all active lanes in the current wave. _HLSL_AVAILABILITY(shadermodel, 6.0) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits) +__attribute__((convergent)) Keenuts wrote: Right, so in

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

2024-03-15 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From 818ccfd0258602fdd0630823bb2b8af0507749d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/7] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-15 Thread Nathan Gauër via cfe-commits
@@ -1295,11 +1295,13 @@ double4 trunc(double4); /// true, across all active lanes in the current wave. _HLSL_AVAILABILITY(shadermodel, 6.0) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits) +__attribute__((convergent)) Keenuts wrote: @llvm-beanz FYI.

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

2024-03-14 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From 818ccfd0258602fdd0630823bb2b8af0507749d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/6] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-13 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,96 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) { +

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -1297,5 +1297,10 @@ _HLSL_AVAILABILITY(shadermodel, 6.0) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_count_bits) uint WaveActiveCountBits(bool Val); +/// \brief Returns the index of the current lane within the current wave. +_HLSL_AVAILABILITY(shadermodel, 6.0)

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

2024-03-12 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From 818ccfd0258602fdd0630823bb2b8af0507749d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/5] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -4554,6 +4554,13 @@ def HLSLWaveActiveCountBits : LangBuiltin<"HLSL_LANG"> { let Prototype = "unsigned int(bool)"; } +// HLSL +def HLSLWaveGetLaneIndex : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_wave_get_lane_index"]; + let Attributes = [NoThrow,

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

2024-03-12 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From 818ccfd0258602fdd0630823bb2b8af0507749d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/4] [clang][HLSL][SPRI-V] Add convergence

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -5686,6 +5686,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo , if (!CI->getType()->isVoidTy()) CI->setName("call"); + if (getTarget().getTriple().isSPIRVLogical() && + CI->getCalledFunction()->isConvergent()) Keenuts wrote: Yes,

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,96 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) { +

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,96 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) { +

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,96 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) { +

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,96 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) { +

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

2024-03-12 Thread Nathan Gauër via cfe-commits
@@ -1130,8 +1130,96 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) {

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

2024-03-11 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Hi, thanks for the reviews so far! I believe we are ready to move forward on our side. Adding @llvm-beanz for the HLSL part. The builtin I added is mostly to get something we can generate those intrinsics for. I am fine changing the name, or the implementation around it, it's

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

2024-03-11 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts ready_for_review https://github.com/llvm/llvm-project/pull/80680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-11 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From 818ccfd0258602fdd0630823bb2b8af0507749d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/3] [clang][HLSL][SPRI-V] Add convergence

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

2024-02-22 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From f43134787dc5b1120e3722e03028d0071de22331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/2] [clang][HLSL][SPRI-V] Add convergence

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

2024-02-22 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/80680 From f43134787dc5b1120e3722e03028d0071de22331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 2 Feb 2024 16:38:46 +0100 Subject: [PATCH 1/2] [clang][HLSL][SPRI-V] Add convergence

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

2024-02-22 Thread Nathan Gauër via cfe-commits
@@ -1129,8 +1129,97 @@ struct BitTest { static BitTest decodeBitTestBuiltin(unsigned BuiltinID); }; + +// Returns the first convergence entry/loop/anchor instruction found in |BB|. +// std::nullopt otherwise. +std::optional getConvergenceToken(llvm::BasicBlock *BB) { +

[clang] [llvm] [HLSL][SPIR-V] Add create.handle intrinsic (PR #81038)

2024-02-08 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/81038 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-02-05 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/80680 HLSL has wave operations and other kind of function which required the control flow to either be converged, or respect certain constraints as where and how to re-converge. At the HLSL level, the convergence

[clang] [HLSL][SPIR-V] Add support -fspv-target-env opt (PR #78611)

2024-01-19 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/78611 ___ 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 Vulkan to target triple (PR #76749)

2024-01-04 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/76749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [HLSL][SPIR-V] Add Vulkan to target triple (PR #76749)

2024-01-03 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts commented: LGTM for the logic, and choices. Just some small nits https://github.com/llvm/llvm-project/pull/76749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [HLSL][SPIR-V] Add Vulkan to target triple (PR #76749)

2024-01-03 Thread Nathan Gauër via cfe-commits
@@ -3,29 +3,39 @@ // Supported targets // // RUN: %clang -target dxil-unknown-shadermodel6.2-compute %s -S -o /dev/null 2>&1 | FileCheck --allow-empty --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-shadermodel6.2-compute %s -S -o /dev/null 2>&1 |

[clang] [llvm] [HLSL][SPIR-V] Add Vulkan to target triple (PR #76749)

2024-01-03 Thread Nathan Gauër via cfe-commits
@@ -4236,20 +4236,35 @@ bool CompilerInvocation::ParseLangArgs(LangOptions , ArgList , // TODO: Revisit restricting SPIR-V to logical once we've figured out how to // handle PhysicalStorageBuffer64 memory model if (T.isDXIL() || T.isSPIRVLogical()) { - enum

[llvm] [clang] [HLSL][SPIR-V] Add Vulkan to target triple (PR #76749)

2024-01-03 Thread Nathan Gauër via cfe-commits
@@ -1328,6 +1331,31 @@ VersionTuple Triple::getDriverKitVersion() const { } } +VersionTuple Triple::getVulkanVersion() const { + if (getArch() != spirv || getOS() != Vulkan) +llvm_unreachable("invalid Vulkan SPIR-V triple"); + + VersionTuple VulkanVersion =

[llvm] [clang] [HLSL][SPIR-V] Add Vulkan to target triple (PR #76749)

2024-01-03 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/76749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-11-13 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/70193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-11-13 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/70193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-11-13 Thread Nathan Gauër via cfe-commits
@@ -65,7 +65,7 @@ class CXXFieldCollector { /// getCurFields - Pointer to array of fields added to the currently parsed /// class. - FieldDecl **getCurFields() { return &*(Fields.end() - getCurNumFields()); } Keenuts wrote: Thanks for the review and

[clang] [SPIRV] Add -spirv option to DXC driver (PR #65989)

2023-10-26 Thread Nathan Gauër via cfe-commits
@@ -2,8 +2,8 @@ // Supported targets // -// RUN: %clang -target dxil-unknown-shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-shadermodel6.2-library %s -S -o /dev/null 2>&1 | FileCheck

[clang] [HLSL][SPIR-V] Fix clang driver lang target test (PR #70330)

2023-10-26 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/70330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIR-V] Fix clang driver lang target test (PR #70330)

2023-10-26 Thread Nathan Gauër via cfe-commits
@@ -2,8 +2,8 @@ // Supported targets // -// RUN: %clang -target dxil-unknown-shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-shadermodel6.2-library %s -S -o /dev/null 2>&1 | FileCheck

[clang] [HLSL][SPIR-V] Fix clang driver lang target test (PR #70330)

2023-10-26 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts commented: One question, otherwise LGTM, thanks for this! https://github.com/llvm/llvm-project/pull/70330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIR-V] Fix clang driver lang target test (PR #70330)

2023-10-26 Thread Nathan Gauër via cfe-commits
@@ -2,8 +2,8 @@ // Supported targets // -// RUN: %clang -target dxil-unknown-shadermodel6.2-pixel %s -S -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK-VALID %s -// RUN: %clang -target spirv-unknown-shadermodel6.2-library %s -S -o /dev/null 2>&1 | FileCheck

[clang] [HLSL][SPIR-V] Fix clang driver lang target test (PR #70330)

2023-10-26 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/70330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-10-26 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/70193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-10-26 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts ready_for_review https://github.com/llvm/llvm-project/pull/70193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-10-26 Thread Nathan Gauër via cfe-commits
Keenuts wrote: CI seems OK, except clang format which complains about an unrelated line. Marking as ready. https://github.com/llvm/llvm-project/pull/70193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

2023-10-25 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/70193 This was found by doing bound-checking on SmallVector iterator usage. When the count is 0, the end iterator is dereferenced to get its address. This doesn't seem to be an issue in practice as most of the time,

[clang] [SPIRV] Add -spirv option to DXC driver (PR #65989)

2023-09-12 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts review_requested https://github.com/llvm/llvm-project/pull/65989 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 53b6a16 - [SPIR-V] Add SPIR-V logical triple.

2023-09-11 Thread Nathan Gauër via cfe-commits
Author: Nathan Gauër Date: 2023-09-11T10:15:24+02:00 New Revision: 53b6a169e453a2a91d3713ca16fa089853c670a8 URL: https://github.com/llvm/llvm-project/commit/53b6a169e453a2a91d3713ca16fa089853c670a8 DIFF: https://github.com/llvm/llvm-project/commit/53b6a169e453a2a91d3713ca16fa089853c670a8.diff