[clang] [HLSL][SPIR-V] Add support for HLSL semantics (PR #149363)

2025-07-17 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/149363 WIP PR for the WG-HLSL semantic proposal TODO: validate DXIL packing and SPIR-V location assignment. From 8eb96a452cacee0e2284b6466351758db2bf3a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?=

[clang] [llvm] [SPIRV] Add more id and range builtIns (PR #143909)

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

[clang] [HLSL][SPIRV] Add option to add all KHR extensions (PR #145536)

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

[clang] [HLSL][SPIRV] Handle `uint` type for spec constant (PR #145577)

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

[clang] [HLSL] Add option for VK layouts (PR #145327)

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

[clang] [llvm] [SPIRV] Add more id and range builtIns (PR #143909)

2025-06-24 Thread Nathan Gauër via cfe-commits
Keenuts wrote: > For the HLSL FE, there are already a few ids represented using intrinsics > (unfortunately they use the DXIL naming rather than the SPIR-V but that's > another point). I extended on that, were there reasons to not pursue this ? The main reason was simplicity: we had many thing

[clang] [llvm] [SPIRV] Add more id and range builtIns (PR #143909)

2025-06-24 Thread Nathan Gauër via cfe-commits
Keenuts wrote: > The advantage of intrinsics is they can be understood better by passes, it > also creates an easier way for passes to introduce them (and less error > prone). It's kinda pedantic TBH and I don't have strong opinions about them > (it just feels cleaner to me). For the frontend

[clang] [HLSL] Don't use CreateRuntimeFunction for intrinsics (PR #145334)

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

[clang] [HLSL][SPIRV] Allow large z value in numthreads (PR #144934)

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

[clang] [HLSL][SPIRV] Allow large z value in numthreads (PR #144934)

2025-06-23 Thread Nathan Gauër via cfe-commits
@@ -1033,12 +1033,15 @@ void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) { void SemaHLSL::handleNumThreadsAttr(Decl *D, const ParsedAttr &AL) { llvm::VersionTuple SMVersion = getASTContext().getTargetInfo().getTriple().getOSVersion(); + bool IsDXI

[clang] [llvm] [HLSL][SPRIV] Handle signed RWBuffer correctly (PR #144774)

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

[clang] [HLSL][SPIRV] Allow large z value in numthreads (PR #144934)

2025-06-20 Thread Nathan Gauër via cfe-commits
@@ -1033,12 +1033,15 @@ void SemaHLSL::handleRootSignatureAttr(Decl *D, const ParsedAttr &AL) { void SemaHLSL::handleNumThreadsAttr(Decl *D, const ParsedAttr &AL) { llvm::VersionTuple SMVersion = getASTContext().getTargetInfo().getTriple().getOSVersion(); + bool IsDXI

[clang] [llvm] [HLSL][SPRIV] Handle signed RWBuffer correctly (PR #144774)

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

[clang] [llvm] [HLSL][SPRIV] Handle signed RWBuffer correctly (PR #144774)

2025-06-19 Thread Nathan Gauër via cfe-commits
@@ -346,8 +346,9 @@ bool sampledTypeIsSignedInteger(const llvm::Type *HandleType) { if (TET->getTargetExtName() == "spirv.Image") { return false; } - return TET->getTypeParameter(0)->isIntegerTy(); -} + assert(TET->getTargetExtName() == "spirv.SignedImage") { +re

[clang] [llvm] [HLSL][SPRIV] Handle signed RWBuffer correctly (PR #144774)

2025-06-19 Thread Nathan Gauër via cfe-commits
Keenuts wrote: This is not supposed to be merged no? https://github.com/llvm/llvm-project/pull/144774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPRIV] Handle signed RWBuffer correctly (PR #144774)

2025-06-19 Thread Nathan Gauër via cfe-commits
@@ -341,6 +341,13 @@ class SPIRVInstructionSelector : public InstructionSelector { GIntrinsic &HandleDef, MachineInstr &Pos) const; }; +bool sampledTypeIsSignedInteger(const llvm::Type *HandleType) { + const TargetExtType *TET = cast(HandleTy

[clang] spec constant (PR #144902)

2025-06-19 Thread Nathan Gauër via cfe-commits
Keenuts wrote: You might want to change the PR title to add the tags etc https://github.com/llvm/llvm-project/pull/144902 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] spec constant (PR #144902)

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

[clang] [llvm] [HLSL][SPIR-V] Fix LinkageAttribute emission for BuiltIn (PR #144701)

2025-06-18 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/144701 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Use hidden visibility for external linkage. (PR #140292)

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

[clang] [llvm] [HLSL] Use hidden visibility for external linkage. (PR #140292)

2025-06-16 Thread Nathan Gauër via cfe-commits
@@ -1661,6 +1661,11 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV, return; } + if (Context.getLangOpts().HLSL && !D->isInExportDeclContext()) { +GV->setVisibility(llvm::GlobalValue::HiddenVisibility); Keenuts wrote: GV at line 3

[clang] [HLSL][SPIRV] Add vk::constant_id attribute. (PR #143544)

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

[clang] [HLSL][SPIRV] Add vk::constant_id attribute. (PR #143544)

2025-06-16 Thread Nathan Gauër via cfe-commits
@@ -12919,6 +12919,18 @@ def err_spirv_enum_not_int : Error< def err_spirv_enum_not_valid : Error< "invalid value for %select{storage class}0 argument">; +def err_specialization_const_lit_init +: Error<"variable with 'vk::constant_id' attribute cannot have an " +

[clang] [llvm] [SPIRV] Add more id and range builtIns (PR #143909)

2025-06-12 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Hi, question, why did you prefer passing an new intrinsic to the SPIR-V backend vs loading a global variable with the BuiltIn decoration? For example, when building `SV_Position` semantic in HLSL, we emit a global variable in the FE in the `Input` SC, along with the correct `spi

[clang] [HLSL][SPIR-V] Change SPV AS map for groupshared (PR #143519)

2025-06-11 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/143519 From 9eb9d28d844e4427da5c9cc4f13b9263aae48ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Tue, 10 Jun 2025 14:33:20 +0200 Subject: [PATCH] [HLSL][SPIR-V] Change SPV AS map for groupshare

[clang] [HLSL][SPIR-V] Handle SV_Position builtin in PS (PR #141759)

2025-06-11 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/141759 From 84fd2cd7f42a3087b3807628d020189bf8b3cc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 5 May 2025 18:01:17 +0200 Subject: [PATCH 1/7] [HLSL][SPIR-V] Handle SV_Postion builtin in

[clang] [HLSL][SPIR-V] Handle SV_Position builtin in PS (PR #141759)

2025-06-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/141759 From 84fd2cd7f42a3087b3807628d020189bf8b3cc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 5 May 2025 18:01:17 +0200 Subject: [PATCH 1/7] [HLSL][SPIR-V] Handle SV_Postion builtin in

[clang] [HLSL][SPIR-V] Handle SV_Position builtin in PS (PR #141759)

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

[clang] [HLSL][SPIR-V] Change SPV AS map for groupshared (PR #143519)

2025-06-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/143519 From 9eb9d28d844e4427da5c9cc4f13b9263aae48ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Tue, 10 Jun 2025 14:33:20 +0200 Subject: [PATCH] [HLSL][SPIR-V] Change SPV AS map for groupshare

[clang] [HLSL][Driver] Make vk1.3 the default. (PR #143384)

2025-06-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. a nit, otherwise LGTM https://github.com/llvm/llvm-project/pull/143384 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][Driver] Make vk1.3 the default. (PR #143384)

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

[clang] [HLSL][Driver] Make vk1.3 the default. (PR #143384)

2025-06-10 Thread Nathan Gauër via cfe-commits
@@ -1596,28 +1596,26 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) { A->claim(); if (Args.hasArg(options::OPT_spirv)) { +const llvm::StringMap ValidTargets = { +{"vulkan1.2", llvm::Triple::SPIRVSubArch_v15}, +{"vulkan1.3

[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-06-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/141759 From 84fd2cd7f42a3087b3807628d020189bf8b3cc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 5 May 2025 18:01:17 +0200 Subject: [PATCH 1/6] [HLSL][SPIR-V] Handle SV_Postion builtin in

[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-06-10 Thread Nathan Gauër via cfe-commits
@@ -1147,6 +1154,26 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) { HLSLSV_DispatchThreadIDAttr(getASTContext(), AL)); } +bool SemaHLSL::diagnosePositionType(QualType T, const ParsedAttr &AL) { + const auto *VT = T->getAs();

[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-06-10 Thread Nathan Gauër via cfe-commits
@@ -764,6 +764,13 @@ void SemaHLSL::CheckSemanticAnnotation( return; DiagnoseAttrStageMismatch(AnnotationAttr, ST, {llvm::Triple::Compute}); break; + case attr::HLSLSV_Position: +// TODO: allow use on other shader types & output once the overall semantic

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/143127 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-06-10 Thread Nathan Gauër via cfe-commits
@@ -407,6 +429,13 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B, llvm::Function *GroupIDIntrinsic = CGM.getIntrinsic(getGroupIdIntrinsic()); return buildVectorInput(B, GroupIDIntrinsic, Ty); } + if (D.hasAttr()) { +if (getArch() == llvm::Triple

[clang] [llvm] [HLSL][SPIRV] Use resource names (PR #143412)

2025-06-10 Thread Nathan Gauër via cfe-commits
@@ -243,7 +243,7 @@ CGHLSLRuntime::getCreateHandleFromBindingIntrinsic() { case llvm::Triple::dxil: return std::pair(llvm::Intrinsic::dx_resource_handlefrombinding, true); case llvm::Triple::spirv: -return std::pair(llvm::Intrinsic::spv_resource_handlefrombinding, f

[clang] [llvm] [HLSL][SPIRV] Use resource names (PR #143412)

2025-06-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. LGTM, just a small cleanup to do https://github.com/llvm/llvm-project/pull/143412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIRV] Use resource names (PR #143412)

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

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-06 Thread Nathan Gauër via cfe-commits
@@ -4909,6 +4909,12 @@ def HLSLWaveReadLaneAt : LangBuiltin<"HLSL_LANG"> { let Prototype = "void(...)"; } +def HLSLWaveGetLaneCount : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_wave_get_lane_count"]; + let Attributes = [NoThrow, Const]; + let Prototype

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-06 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/143127 From d47adb2f82940abcab87428f7ef09b326bfb42e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 6 Jun 2025 14:00:49 +0200 Subject: [PATCH 1/2] [HLSL] Add WaveGetLaneCount() intrinsic to F

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-06 Thread Nathan Gauër via cfe-commits
@@ -2350,6 +2350,10 @@ _HLSL_AVAILABILITY(shadermodel, 6.0) _HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_is_first_lane) __attribute__((convergent)) bool WaveIsFirstLane(); +_HLSL_AVAILABILITY(shadermodel, 6.0) +_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_get_lane_count) +__attribute__(

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-06 Thread Nathan Gauër via cfe-commits
@@ -691,6 +691,11 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, return EmitRuntimeCall( Intrinsic::getOrInsertDeclaration(&CGM.getModule(), ID)); } + case Builtin::BI__builtin_hlsl_wave_get_lane_count: { +Intrinsic::ID ID = CGM.getHLSLRu

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-06 Thread Nathan Gauër via cfe-commits
@@ -4909,6 +4909,12 @@ def HLSLWaveReadLaneAt : LangBuiltin<"HLSL_LANG"> { let Prototype = "void(...)"; } +def HLSLWaveGetLaneCount : LangBuiltin<"HLSL_LANG"> { + let Spellings = ["__builtin_hlsl_wave_get_lane_count"]; + let Attributes = [NoThrow, Const]; + let Prototype

[clang] [llvm] [HLSL] Add WaveGetLaneCount() intrinsic to FE (PR #143127)

2025-06-06 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/143127 This commit adds code to lower WaveGetLaneCount() into the SPV or DXIL intrinsic. The backends will then need to lower the intrinsic into proper SPIR-V/DXIL. Related to #99159 From d47adb2f82940abcab87428f7ef

[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-06-04 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/141759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-06-04 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/141759 From 4653aca0444c9ce14893e877eeb88241c9b01934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Mon, 5 May 2025 18:01:17 +0200 Subject: [PATCH] [HLSL][SPIR-V] Handle SV_Postion builtin in PS

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-06-04 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-06-04 Thread Nathan Gauër via cfe-commits
Keenuts wrote: There is one failure on the CI, in lldb, an unrelated timeout https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-06-04 Thread Nathan Gauër via cfe-commits
@@ -140,6 +140,11 @@ def SharedVar : SubsetSubjecthasGlobalStorage() && !S->getTLSKind()}], "global variables">; +def HLSLInputBuiltin : SubsetSubjecthasGlobalStorage() && +S->getStorageClass()==StorageClass::SC_Static && +

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-06-04 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/138530 From 8c405fefdb31200930b9a690df635aff7775f602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/8] [HLSL] Implement vk::ext_builtin_input attr

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-06-03 Thread Nathan Gauër via cfe-commits
@@ -554,6 +554,19 @@ static void initializeBufferFromBinding(CodeGenModule &CGM, Args); } +void CGHLSLRuntime::handleGlobalVarDefinition(const VarDecl *VD, + llvm::GlobalVariable *GV) { + if (auto Attr = VD->getA

[clang] [SPIR-V] Only emit __spirv__ when targeting HLSL (PR #142401)

2025-06-02 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts edited https://github.com/llvm/llvm-project/pull/142401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Add __spirv__ macro (PR #132848)

2025-06-02 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Hi, I don't think there is an issue with only emitting the `__spirv__` macro with HLSL. Sent out https://github.com/llvm/llvm-project/pull/142401 https://github.com/llvm/llvm-project/pull/132848 ___ cfe-commits mailing list cfe-commits@

[clang] [SPIR-V] Only emit __spirv__ when targeting HLSL (PR #142401)

2025-06-02 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/142401 OpenCL translator had a __spirv namespace, and defining the __spirv__ macro causes issues downstream on the OpenCL side. This macro is needed to keep compatibility with HLSL/DXC, but can be avoided for other ta

[clang] [clang][SPIRV] Fix build issue after c474f8f (PR #141954)

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

[clang] [clang][SPIRV] Fix build issue after c474f8f (PR #141954)

2025-05-30 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/141954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][SPIRV] Fix build issue after c474f8f (PR #141954)

2025-05-30 Thread Nathan Gauër via cfe-commits
Keenuts wrote: thanks! https://github.com/llvm/llvm-project/pull/141954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-05-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/141759 From 085154ddedf3b0789a3908231d04f997e9e66ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/8] [HLSL] Implement vk::ext_builtin_input attr

[clang] [llvm] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-05-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/141759 From 085154ddedf3b0789a3908231d04f997e9e66ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/8] [HLSL] Implement vk::ext_builtin_input attr

[clang] [llvm] [HLSL][SPIR-V] Handle SV_Postion builtin in PS (PR #141759)

2025-05-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/141759 This PR goes on top of #138530 This commit is using the same mechanism as vk::ext_builtin_input to implement the SV_Position semantic input. The HLSL signature is not yet ready for DXIL, hence this commit only i

[clang] [clang][SPIRV] Add builtin for OpGenericCastToPtrExplicit and its SPIR-V friendly binding (PR #137805)

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

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-26 Thread Nathan Gauër via cfe-commits
Keenuts wrote: @llvm-beanz are you OK with the HLSL-side of the change? https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-07 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Rebased, tests not pass (HLSL, and locally for the rest). The CI is quite busy today so the rest is still pending. Adding more reviewers for the final round @llvm-beanz for the Microsoft side @arsenm for the AMDGPU address space bit https://github.com/llvm/llvm-project/pull/138

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-07 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/138530 From 085154ddedf3b0789a3908231d04f997e9e66ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/7] [HLSL] Implement vk::ext_builtin_input attr

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-06 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/138530 From 04cabdd5cb1400ea6fe4e92cf99a44e3004f04c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/7] [HLSL] Implement vk::ext_builtin_input attr

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-06 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Regarding the HLSL tests: I cannot reproduce the broken test on my branch (the file was not in main yet), so seems like the HLSL test is pulling main and doing something different. Rebased on main and the test passes locally, weird. https://github.com/llvm/llvm-project/pull/13853

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Yes, I need to https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
@@ -5759,9 +5761,18 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, getCUDARuntime().internalizeDeviceSideVar(D, Linkage); } getCUDARuntime().handleVarRegistration(D, *GV); + } else if (LangOpts.HLSL && + GetGlobalVarAddressSpace(D)

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
@@ -5636,6 +5636,8 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, Init = llvm::UndefValue::get(getTypes().ConvertTypeForMem(ASTTy)); else if (D->hasAttr()) Init = llvm::UndefValue::get(getTypes().ConvertTypeForMem(ASTTy)); + else if (GetGlobalVarAd

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/138530 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] [llvm] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/138530 From 8971ce70badbf1a7bdbe04f4ba94b03b56adacf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/4] [HLSL] Implement vk::ext_builtin_input attr

[clang] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/138530 From 8971ce70badbf1a7bdbe04f4ba94b03b56adacf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Wed, 30 Apr 2025 11:06:55 +0200 Subject: [PATCH 1/2] [HLSL] Implement vk::ext_builtin_input attr

[clang] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Adding Steven for an initial review before bothering more people https://github.com/llvm/llvm-project/pull/138530 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (PR #138530)

2025-05-05 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/138530 This variable attribute is used in HLSL to add Vulkan specific builtins in a shader. The attribute is documented here: https://github.com/microsoft/hlsl-specs/blob/17727e88fd1cb09013cb3a144110826af05f4dd5/propos

[clang] [HLSL][SPIRV] Add CLI option `-fspv-extension` (PR #137985)

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

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-05-02 Thread Nathan Gauër via cfe-commits
Keenuts wrote: Closed in favor of https://github.com/llvm/llvm-project/pull/135794 https://github.com/llvm/llvm-project/pull/134844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-05-02 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/134844 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

2025-04-16 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. https://github.com/llvm/llvm-project/pull/127675 ___ 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 hlsl_private address space for SPIR-V (PR #133464)

2025-04-10 Thread Nathan Gauër via cfe-commits
@@ -6888,6 +6888,42 @@ static void SetNestedNameSpecifier(Sema &S, DeclaratorDecl *DD, Declarator &D) { DD->setQualifierInfo(SS.getWithLocInContext(S.Context)); } +void Sema::deduceHLSLAddressSpace(VarDecl *Decl) { + // The variable already has an address space (groupshare

[clang] [llvm] [HLSL][SPIR-V] Add hlsl_private address space for SPIR-V (PR #133464)

2025-04-10 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts closed https://github.com/llvm/llvm-project/pull/133464 ___ 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 hlsl_private address space for SPIR-V (PR #133464)

2025-04-09 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/133464 From 12524667594d413c93a2c88a206a930cff638da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Thu, 28 Nov 2024 15:00:56 +0100 Subject: [PATCH 1/5] [SPIR-V] Add hlsl_private address space for

[clang] [llvm] [HLSL][SPIR-V] Add hlsl_private address space for SPIR-V (PR #133464)

2025-04-09 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/133464 From 12524667594d413c93a2c88a206a930cff638da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Thu, 28 Nov 2024 15:00:56 +0100 Subject: [PATCH 1/3] [SPIR-V] Add hlsl_private address space for

[clang] [llvm] [HLSL][SPIR-V] Add hlsl_private address space for SPIR-V (PR #133464)

2025-04-09 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/133464 From 12524667594d413c93a2c88a206a930cff638da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Thu, 28 Nov 2024 15:00:56 +0100 Subject: [PATCH 1/6] [SPIR-V] Add hlsl_private address space for

[clang] [llvm] [HLSL][SPIR-V] Add hlsl_private address space for SPIR-V (PR #133464)

2025-04-09 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts updated https://github.com/llvm/llvm-project/pull/133464 From 12524667594d413c93a2c88a206a930cff638da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Thu, 28 Nov 2024 15:00:56 +0100 Subject: [PATCH 1/4] [SPIR-V] Add hlsl_private address space for

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-04-09 Thread Nathan Gauër via cfe-commits
Keenuts wrote: miss-typed enter, sent the comment above too early. There are multiple ways to solve this issue: - fix the FunctionAttr to run DCE again once the `convergent` attribute is removed to make sure those invalid cases don't happen. - fix the FunctionAttr to not remove `convergent` i

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-04-09 Thread Nathan Gauër via cfe-commits
Keenuts wrote: FYI: there is this PR which I think will replace this one: https://github.com/llvm/llvm-project/pull/134863 > I didn't understand the validity part. Why is the caller required to be > convergent in order to add a token to a callsite? Given this example: ```llvm declare i32 @fo

[clang] [llvm] [HLSL][SPIR-V] Add hlsl_private address space for SPIR-V (PR #133464)

2025-04-08 Thread Nathan Gauër via cfe-commits
Keenuts wrote: rebased on main, no change since the last review. https://github.com/llvm/llvm-project/pull/133464 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-04-08 Thread Nathan Gauër via cfe-commits
Keenuts wrote: > Turns out not really, I ran spec with this about 2 years ago and the only > non-noise change was a mild improvement Looking at the PR you linked, seems like there was still not a clear consensus on the default change no? (And I'd assume consumers like llvm-translator won't be

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-04-08 Thread Nathan Gauër via cfe-commits
Keenuts wrote: > These should not have side effects. I agree I'm stretching the "hasSideEffect" definition here. > Whatever is removing the convergent needs to consider the uses (or more > likely, just leave it alone) I suspect the long-term change to change the default IR to assume convergen

[clang] [llvm] [IR] Mark convergence intrins as has-side-effect (PR #134844)

2025-04-08 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/134844 When a callee is marked as `convergent`, some targets like HLSL/SPIR-V add a convergent token to the call. This is valid if both functions are marked as `convergent`. ADCE/BDCE and other DCE passes were allowed

[clang] [llvm] [HLSL] Add SPIR-V target type for StructuredBuffers (PR #132027)

2025-04-05 Thread Nathan Gauër via cfe-commits
@@ -386,13 +386,29 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType( if (ContainedTy.isNull()) return nullptr; -assert(!ResAttrs.RawBuffer && - "Raw buffers handles are not implemented for SPIR-V yet"); assert(!ResAttrs.IsROV &&

[clang] [llvm] [HLSL] Add SPIR-V target type for StructuredBuffers (PR #132027)

2025-04-05 Thread Nathan Gauër via cfe-commits
@@ -711,13 +711,14 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name, using PH = BuiltinTypeMethodBuilder::PlaceHolder; QualType ElemTy = getHandleElementType(); - // TODO: Map to an hlsl_device address space. - QualType ElemPtrTy = AST.getPointer

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-04-05 Thread Nathan Gauër via cfe-commits
@@ -386,13 +386,22 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType( if (ContainedTy.isNull()) return nullptr; -assert(!ResAttrs.RawBuffer && - "Raw buffers handles are not implemented for SPIR-V yet"); assert(!ResAttrs.IsROV &&

[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

2025-03-31 Thread Nathan Gauër via cfe-commits
@@ -57,22 +58,37 @@ void main(unsigned GI : SV_GroupIndex) { // CHECK: define void @main() // CHECK-NEXT: entry: // Verify destructor is emitted -// NOINLINE-NEXT: call void @_GLOBAL__sub_I_GlobalDestructors.hlsl() -// NOINLINE-NEXT: %0 = call i32 @llvm.dx.flattened.th

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

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

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Nathan Gauër via cfe-commits
@@ -386,13 +386,22 @@ llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType( if (ContainedTy.isNull()) return nullptr; -assert(!ResAttrs.RawBuffer && - "Raw buffers handles are not implemented for SPIR-V yet"); assert(!ResAttrs.IsROV &&

[clang] [HLSL] Add SPIR-V target type for RWStructuredBuffers (PR #133468)

2025-03-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts approved this pull request. minor comments, otherwise OK https://github.com/llvm/llvm-project/pull/133468 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][SPIR-V] Fix convergence tokens for dtor (PR #133469)

2025-03-28 Thread Nathan Gauër via cfe-commits
https://github.com/Keenuts created https://github.com/llvm/llvm-project/pull/133469 Destructor calls were emitted without convergence intrinsics when building for SPIR-V, which means invalid IR since we mixed controlled and non-controlled convergence. From 339d410e981b5172c57d9802e0a0fcc117575

  1   2   3   4   >