https://github.com/cassiebeckley edited
https://github.com/llvm/llvm-project/pull/130672
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
cassiebeckley wrote:
@s-perron @Keenuts
https://github.com/llvm/llvm-project/pull/134034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/cassiebeckley created
https://github.com/llvm/llvm-project/pull/134034
This implements the design proposed by [Representing SpirvType in Clang's Type
System](https://github.com/llvm/wg-hlsl/pull/181). It creates
`HLSLInlineSpirvType` as a new `Type` subclass, and `__hlsl_spi
https://github.com/cassiebeckley updated
https://github.com/llvm/llvm-project/pull/134034
>From 78ac1bc4225b41bc4b9fbd9fd9ab9dc82a2953ca Mon Sep 17 00:00:00 2001
From: Cassandra Beckley
Date: Tue, 1 Apr 2025 23:12:02 -0700
Subject: [PATCH 1/2] [HLSL] Implement `SpirvType` and `SpirvOpaqueType`
@@ -9213,6 +9213,11 @@ def metal : DXCFlag<"metal">, HelpText<"Generate Metal
library">;
def fspv_target_env_EQ : Joined<["-"], "fspv-target-env=">, Group,
HelpText<"Specify the target environment">,
Values<"vulkan1.2, vulkan1.3">;
+def fspv_extension_EQ
+: Joined<["-"
https://github.com/cassiebeckley 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
https://github.com/cassiebeckley updated
https://github.com/llvm/llvm-project/pull/132848
>From 959f0374df39a97d22740ae81d132bed300159ea Mon Sep 17 00:00:00 2001
From: Cassandra Beckley
Date: Mon, 24 Mar 2025 17:36:46 -0700
Subject: [PATCH 1/2] [HLSL] Add __spirv__ macro
This macro can be used
https://github.com/cassiebeckley updated
https://github.com/llvm/llvm-project/pull/134034
>From 78ac1bc4225b41bc4b9fbd9fd9ab9dc82a2953ca Mon Sep 17 00:00:00 2001
From: Cassandra Beckley
Date: Tue, 1 Apr 2025 23:12:02 -0700
Subject: [PATCH 1/3] [HLSL] Implement `SpirvType` and `SpirvOpaqueType`
cassiebeckley wrote:
@philnik777 fyi for the changes to builtin templates
https://github.com/llvm/llvm-project/pull/134034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/cassiebeckley updated
https://github.com/llvm/llvm-project/pull/134034
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,
cassiebeckley wrote:
Done.
https://github.com/llvm/llvm-project/pull/134034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3332,6 +3388,39 @@ checkBuiltinTemplateIdType(Sema &SemaRef,
BuiltinTemplateDecl *BTD,
}
return HasNoTypeMember;
}
+
+ case BTK__hlsl_spirv_type: {
+assert(Converted.size() == 4);
+
+if (!Context.getTargetInfo().getTriple().isSPIRV()) {
+ SemaRef.Di
@@ -6330,6 +6331,140 @@ class HLSLAttributedResourceType : public Type, public
llvm::FoldingSetNode {
findHandleTypeOnResource(const Type *RT);
};
+/// Instances of this class represent operands to a SPIR-V type instruction.
+class SpirvOperand {
+public:
+ enum SpirvOpera
@@ -6165,6 +6254,18 @@ bool
UnnamedLocalNoLinkageFinder::VisitHLSLAttributedResourceType(
return Visit(T->getWrappedType());
}
+bool UnnamedLocalNoLinkageFinder::VisitHLSLInlineSpirvType(
+const HLSLInlineSpirvType *T) {
+ for (auto &Operand : T->getOperands()) {
+
@@ -0,0 +1,28 @@
+//===- hlsl_spirv.h - HLSL definitions for SPIR-V target
--===//
+//
+// 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: Apa
@@ -6330,6 +6331,140 @@ class HLSLAttributedResourceType : public Type, public
llvm::FoldingSetNode {
findHandleTypeOnResource(const Type *RT);
};
+/// Instances of this class represent operands to a SPIR-V type instruction.
+class SpirvOperand {
+public:
+ enum SpirvOpera
@@ -6330,6 +6331,140 @@ class HLSLAttributedResourceType : public Type, public
llvm::FoldingSetNode {
findHandleTypeOnResource(const Type *RT);
};
+/// Instances of this class represent operands to a SPIR-V type instruction.
+class SpirvOperand {
+public:
+ enum SpirvOpera
https://github.com/cassiebeckley updated
https://github.com/llvm/llvm-project/pull/134034
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,
@@ -5444,6 +5459,31 @@ QualType ASTContext::getHLSLAttributedResourceType(
return QualType(Ty, 0);
}
+
+QualType ASTContext::getHLSLInlineSpirvType(uint32_t Opcode, uint32_t Size,
+uint32_t Alignment,
+
@@ -3228,6 +3228,62 @@ static QualType builtinCommonTypeImpl(Sema &S,
TemplateName BaseTemplate,
}
}
+static bool isInVkNamespace(const RecordType *RT) {
+ DeclContext *DC = RT->getDecl()->getDeclContext();
+ if (!DC)
+return false;
+
+ NamespaceDecl *ND = dyn_cast(D
@@ -3228,6 +3228,62 @@ static QualType builtinCommonTypeImpl(Sema &S,
TemplateName BaseTemplate,
}
}
+static bool isInVkNamespace(const RecordType *RT) {
+ DeclContext *DC = RT->getDecl()->getDeclContext();
+ if (!DC)
+return false;
+
+ NamespaceDecl *ND = dyn_cast(D
@@ -369,14 +369,102 @@ llvm::Type
*CommonSPIRTargetCodeGenInfo::getOpenCLType(CodeGenModule &CGM,
return nullptr;
}
+// Gets a spirv.IntegralConstant or spirv.Literal. If IntegralType is present,
+// returns an IntegralConstant, otherwise returns a Literal.
+static llvm::Ty
@@ -11763,6 +11804,22 @@ QualType ASTContext::mergeTypes(QualType LHS, QualType
RHS, bool OfBlockPointer,
return LHS;
return {};
}
+ case Type::HLSLInlineSpirv:
+const HLSLInlineSpirvType *LHSTy = LHS->castAs();
+const HLSLInlineSpirvType *RHSTy = RHS->cas
@@ -1832,6 +1832,48 @@ ExpectedType
clang::ASTNodeImporter::VisitHLSLAttributedResourceType(
ToWrappedType, ToContainedType, ToAttrs);
}
+ExpectedType clang::ASTNodeImporter::VisitHLSLInlineSpirvType(
+const clang::HLSLInlineSpirvType *T) {
+ Error Err = Error::suc
@@ -369,14 +369,102 @@ llvm::Type
*CommonSPIRTargetCodeGenInfo::getOpenCLType(CodeGenModule &CGM,
return nullptr;
}
+// Gets a spirv.IntegralConstant or spirv.Literal. If IntegralType is present,
+// returns an IntegralConstant, otherwise returns a Literal.
+static llvm::Ty
@@ -877,6 +878,11 @@ bool CodeGenTypes::isZeroInitializable(QualType T) {
if (const MemberPointerType *MPT = T->getAs())
return getCXXABI().isZeroInitializable(MPT);
+ // HLSL Inline SPIR-V types are non-zero-initializable.
+ if (T->getAs()) {
+return false;
+ }
-
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: dxil-pc-shadermodel6.0-compute %s \
+// RUN: -fsyntax-only -verify
+
+typedef vk::SpirvType<12, 2, 4, float> InvalidType1; // expected-error {{use
of undeclared identifier 'vk'}}
+vk::Li
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
+// RUN: -o - | FileCheck %s
+
+template
+using Array = vk::SpirvOpaqueType>;
+
+template
+using ArrayBuffer = Array, Size
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: dxil-pc-shadermodel6.0-compute %s \
+// RUN: -fsyntax-only -verify
+
+typedef vk::SpirvType<12, 2, 4, float> InvalidType1; // expected-error {{use
of undeclared identifier 'vk'}}
+vk::Li
cassiebeckley wrote:
Done.
https://github.com/llvm/llvm-project/pull/134034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
cassiebeckley wrote:
Done.
https://github.com/llvm/llvm-project/pull/134034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3332,6 +3388,39 @@ checkBuiltinTemplateIdType(Sema &SemaRef,
BuiltinTemplateDecl *BTD,
}
return HasNoTypeMember;
}
+
+ case BTK__hlsl_spirv_type: {
+assert(Converted.size() == 4);
+
+if (!Context.getTargetInfo().getTriple().isSPIRV()) {
+ SemaRef.Di
https://github.com/cassiebeckley updated
https://github.com/llvm/llvm-project/pull/134034
Rate limit · GitHub
body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe
UI,Helvetica,Arial,
https://github.com/cassiebeckley approved this pull request.
https://github.com/llvm/llvm-project/pull/140120
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
cassiebeckley wrote:
@llvm-beanz I believe I've addressed all of your feedback; let me know if
there's anything else I should do
https://github.com/llvm/llvm-project/pull/134034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llv
35 matches
Mail list logo