-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Transforms][DXIL] Tool to generate resource metadata and annotations #98939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-backend-directx Author: Justin Bogner (bogner) ChangesThis introduces dxil::ResourceInfo, which can generate DXIL-style metadata for resources and the constants for the DXIL 6.6+ annotateResource operation. These are done together so that it's easier to see all of the information the ResourceInfo class needs to store. This will be used for lowering resource in the DirectX backend and is intended to help with the translation in the other direction as well. To do that, we'll need the inverse functions of Patch is 36.82 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98939.diff 6 Files Affected:
diff --git a/llvm/include/llvm/Support/DXILABI.h b/llvm/include/llvm/Support/DXILABI.h
index 78099ae0daeca..d0bed4d5cf383 100644
--- a/llvm/include/llvm/Support/DXILABI.h
+++ b/llvm/include/llvm/Support/DXILABI.h
@@ -94,6 +94,25 @@ enum class ElementType : uint32_t {
PackedU8x32,
};
+/// Metadata tags for extra resource properties.
+enum class ExtPropTags : uint32_t {
+ ElementType = 0,
+ StructuredBufferStride = 1,
+ SamplerFeedbackKind = 2,
+ Atomic64Use = 3,
+};
+
+enum class SamplerType : uint32_t {
+ Default = 0,
+ Comparison = 1,
+ Mono = 2, // Note: Seems to be unused.
+};
+
+enum class SamplerFeedbackType : uint32_t {
+ MinMip = 0,
+ MipRegionUsed = 1,
+};
+
} // namespace dxil
} // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Utils/DXILResource.h b/llvm/include/llvm/Transforms/Utils/DXILResource.h
new file mode 100644
index 0000000000000..e6e6e2d1c36a2
--- /dev/null
+++ b/llvm/include/llvm/Transforms/Utils/DXILResource.h
@@ -0,0 +1,193 @@
+//===- DXILResource.h - Tools to translate DXIL resources -------*- 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 LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_UTILS_DXILRESOURCE_H
+#define LLVM_TRANSFORMS_UTILS_DXILRESOURCE_H
+
+#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Support/DXILABI.h"
+
+namespace llvm {
+namespace dxil {
+
+struct ResourceBinding {
+ uint32_t Space;
+ uint32_t LowerBound;
+ uint32_t Size;
+
+ bool operator==(const ResourceBinding &RHS) const {
+ return std::tie(Space, LowerBound, Size) ==
+ std::tie(RHS.Space, RHS.LowerBound, RHS.Size);
+ }
+ bool operator!=(const ResourceBinding &RHS) const { return !(*this == RHS); }
+};
+
+class ResourceInfo {
+ struct UAVInfo {
+ bool GloballyCoherent;
+ bool HasCounter;
+ bool IsROV;
+
+ bool operator==(const UAVInfo &RHS) const {
+ return std::tie(GloballyCoherent, HasCounter, IsROV) ==
+ std::tie(RHS.GloballyCoherent, RHS.HasCounter, RHS.IsROV);
+ }
+ bool operator!=(const UAVInfo &RHS) const { return !(*this == RHS); }
+ };
+
+ struct StructInfo {
+ uint32_t Stride;
+ Align Alignment;
+
+ bool operator==(const StructInfo &RHS) const {
+ return std::tie(Stride, Alignment) == std::tie(RHS.Stride, RHS.Alignment);
+ }
+ bool operator!=(const StructInfo &RHS) const { return !(*this == RHS); }
+ };
+
+ struct TypedInfo {
+ dxil::ElementType ElementTy;
+ uint32_t ElementCount;
+
+ bool operator==(const TypedInfo &RHS) const {
+ return std::tie(ElementTy, ElementCount) ==
+ std::tie(RHS.ElementTy, RHS.ElementCount);
+ }
+ bool operator!=(const TypedInfo &RHS) const { return !(*this == RHS); }
+ };
+
+ struct MSInfo {
+ uint32_t Count;
+
+ bool operator==(const MSInfo &RHS) const { return Count == RHS.Count; }
+ bool operator!=(const MSInfo &RHS) const { return !(*this == RHS); }
+ };
+
+ struct FeedbackInfo {
+ dxil::SamplerFeedbackType Type;
+
+ bool operator==(const FeedbackInfo &RHS) const { return Type == RHS.Type; }
+ bool operator!=(const FeedbackInfo &RHS) const { return !(*this == RHS); }
+ };
+
+ // Universal properties.
+ Value *Symbol;
+ StringRef Name;
+
+ ResourceBinding Binding;
+ uint32_t UniqueID;
+
+ dxil::ResourceClass RC;
+ dxil::ResourceKind Kind;
+
+ // Resource class dependent properties.
+ // CBuffer, Sampler, and RawBuffer end here.
+ union {
+ UAVInfo UAVFlags; // UAV
+ uint32_t CBufferSize; // CBuffer
+ dxil::SamplerType SamplerTy; // Sampler
+ };
+
+ // Resource kind dependent properties.
+ union {
+ StructInfo Struct; // StructuredBuffer
+ TypedInfo Typed; // All SRV/UAV except Raw/StructuredBuffer
+ FeedbackInfo Feedback; // FeedbackTexture
+ };
+
+ MSInfo MultiSample;
+
+ // Conditions to check before accessing union members.
+ bool isUAV() const;
+ bool isCBuffer() const;
+ bool isSampler() const;
+ bool isStruct() const;
+ bool isTyped() const;
+ bool isFeedback() const;
+ bool isMultiSample() const;
+
+ ResourceInfo(dxil::ResourceClass RC, dxil::ResourceKind Kind, Value *Symbol,
+ StringRef Name, ResourceBinding Binding, uint32_t UniqueID)
+ : Symbol(Symbol), Name(Name), Binding(Binding), UniqueID(UniqueID),
+ RC(RC), Kind(Kind) {}
+
+public:
+ static ResourceInfo SRV(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ dxil::ElementType ElementTy, uint32_t ElementCount,
+ dxil::ResourceKind Kind);
+ static ResourceInfo RawBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID);
+ static ResourceInfo StructuredBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID, uint32_t Stride,
+ Align Alignment);
+ static ResourceInfo Texture2DMS(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ dxil::ElementType ElementTy,
+ uint32_t ElementCount, uint32_t SampleCount);
+ static ResourceInfo
+ Texture2DMSArray(Value *Symbol, StringRef Name, ResourceBinding Binding,
+ uint32_t UniqueID, dxil::ElementType ElementTy,
+ uint32_t ElementCount, uint32_t SampleCount);
+
+ static ResourceInfo UAV(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ dxil::ElementType ElementTy, uint32_t ElementCount,
+ bool GloballyCoherent, bool IsROV,
+ dxil::ResourceKind Kind);
+ static ResourceInfo RWRawBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ bool GloballyCoherent, bool IsROV);
+ static ResourceInfo RWStructuredBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID, uint32_t Stride,
+ Align Alignment, bool GloballyCoherent,
+ bool IsROV, bool HasCounter);
+ static ResourceInfo RWTexture2DMS(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ dxil::ElementType ElementTy,
+ uint32_t ElementCount, uint32_t SampleCount,
+ bool GloballyCoherent);
+ static ResourceInfo
+ RWTexture2DMSArray(Value *Symbol, StringRef Name, ResourceBinding Binding,
+ uint32_t UniqueID, dxil::ElementType ElementTy,
+ uint32_t ElementCount, uint32_t SampleCount,
+ bool GloballyCoherent);
+ static ResourceInfo FeedbackTexture2D(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID,
+ dxil::SamplerFeedbackType FeedbackTy);
+ static ResourceInfo
+ FeedbackTexture2DArray(Value *Symbol, StringRef Name, ResourceBinding Binding,
+ uint32_t UniqueID,
+ dxil::SamplerFeedbackType FeedbackTy);
+
+ static ResourceInfo CBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ uint32_t Size);
+
+ static ResourceInfo Sampler(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ dxil::SamplerType SamplerTy);
+
+ bool operator==(const ResourceInfo &RHS) const;
+
+ MDTuple *getAsMetadata(LLVMContext &Ctx) const;
+
+ ResourceBinding getBinding() const { return Binding; }
+ std::pair<uint32_t, uint32_t> getAnnotateProps() const;
+};
+
+
+
+} // namespace dxil
+} // namespace llvm
+
+#endif // LLVM_TRANSFORMS_UTILS_DXILRESOURCE_H
diff --git a/llvm/lib/Transforms/Utils/CMakeLists.txt b/llvm/lib/Transforms/Utils/CMakeLists.txt
index 51e8821773c3a..1b811c7cebef9 100644
--- a/llvm/lib/Transforms/Utils/CMakeLists.txt
+++ b/llvm/lib/Transforms/Utils/CMakeLists.txt
@@ -20,6 +20,7 @@ add_llvm_component_library(LLVMTransformUtils
CountVisits.cpp
Debugify.cpp
DemoteRegToStack.cpp
+ DXILResource.cpp
DXILUpgrade.cpp
EntryExitInstrumenter.cpp
EscapeEnumerator.cpp
diff --git a/llvm/lib/Transforms/Utils/DXILResource.cpp b/llvm/lib/Transforms/Utils/DXILResource.cpp
new file mode 100644
index 0000000000000..46e6599627afa
--- /dev/null
+++ b/llvm/lib/Transforms/Utils/DXILResource.cpp
@@ -0,0 +1,372 @@
+//===- DXILResource.cpp - Tools to translate DXIL resources ---------------===//
+//
+// 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 LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Transforms/Utils/DXILResource.h"
+#include "llvm/ADT/APInt.h"
+#include "llvm/IR/DerivedTypes.h"
+
+using namespace llvm;
+using namespace dxil;
+
+bool ResourceInfo::isUAV() const { return RC == ResourceClass::UAV; }
+
+bool ResourceInfo::isCBuffer() const {
+ return RC == ResourceClass::CBuffer;
+}
+
+bool ResourceInfo::isSampler() const {
+ return RC == ResourceClass::Sampler;
+}
+
+bool ResourceInfo::isStruct() const {
+ return Kind == ResourceKind::StructuredBuffer;
+}
+
+bool ResourceInfo::isTyped() const {
+ switch (Kind) {
+ case ResourceKind::Texture1D:
+ case ResourceKind::Texture2D:
+ case ResourceKind::Texture2DMS:
+ case ResourceKind::Texture3D:
+ case ResourceKind::TextureCube:
+ case ResourceKind::Texture1DArray:
+ case ResourceKind::Texture2DArray:
+ case ResourceKind::Texture2DMSArray:
+ case ResourceKind::TextureCubeArray:
+ case ResourceKind::TypedBuffer:
+ return true;
+ case ResourceKind::RawBuffer:
+ case ResourceKind::StructuredBuffer:
+ case ResourceKind::FeedbackTexture2D:
+ case ResourceKind::FeedbackTexture2DArray:
+ case ResourceKind::CBuffer:
+ case ResourceKind::Sampler:
+ case ResourceKind::TBuffer:
+ case ResourceKind::RTAccelerationStructure:
+ return false;
+ case ResourceKind::Invalid:
+ case ResourceKind::NumEntries:
+ llvm_unreachable("Invalid resource kind");
+ }
+}
+
+bool ResourceInfo::isFeedback() const {
+ return Kind == ResourceKind::FeedbackTexture2D ||
+ Kind == ResourceKind::FeedbackTexture2DArray;
+}
+
+bool ResourceInfo::isMultiSample() const {
+ return Kind == ResourceKind::Texture2DMS ||
+ Kind == ResourceKind::Texture2DMSArray;
+}
+
+ResourceInfo ResourceInfo::SRV(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ ElementType ElementTy, uint32_t ElementCount,
+ ResourceKind Kind) {
+ ResourceInfo RI(ResourceClass::SRV, Kind, Symbol, Name, Binding, UniqueID);
+ assert(RI.isTyped() && !(RI.isStruct() || RI.isMultiSample()) &&
+ "Invalid ResourceKind for SRV constructor.");
+ RI.Typed.ElementTy = ElementTy;
+ RI.Typed.ElementCount = ElementCount;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::RawBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID) {
+ ResourceInfo RI(ResourceClass::SRV, ResourceKind::RawBuffer, Symbol, Name,
+ Binding, UniqueID);
+ return RI;
+}
+
+ResourceInfo ResourceInfo::StructuredBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID, uint32_t Stride,
+ Align Alignment) {
+ ResourceInfo RI(ResourceClass::SRV, ResourceKind::StructuredBuffer, Symbol,
+ Name, Binding, UniqueID);
+ RI.Struct.Stride = Stride;
+ RI.Struct.Alignment = Alignment;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::Texture2DMS(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID, ElementType ElementTy,
+ uint32_t ElementCount,
+ uint32_t SampleCount) {
+ ResourceInfo RI(ResourceClass::SRV, ResourceKind::Texture2DMS, Symbol, Name,
+ Binding, UniqueID);
+ RI.Typed.ElementTy = ElementTy;
+ RI.Typed.ElementCount = ElementCount;
+ RI.MultiSample.Count = SampleCount;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::Texture2DMSArray(
+ Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID,
+ ElementType ElementTy, uint32_t ElementCount, uint32_t SampleCount) {
+ ResourceInfo RI(ResourceClass::SRV, ResourceKind::Texture2DMSArray, Symbol,
+ Name, Binding, UniqueID);
+ RI.Typed.ElementTy = ElementTy;
+ RI.Typed.ElementCount = ElementCount;
+ RI.MultiSample.Count = SampleCount;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::UAV(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ ElementType ElementTy, uint32_t ElementCount,
+ bool GloballyCoherent, bool IsROV,
+ ResourceKind Kind) {
+ ResourceInfo RI(ResourceClass::UAV, Kind, Symbol, Name, Binding, UniqueID);
+ assert(RI.isTyped() && !(RI.isStruct() || RI.isMultiSample()) &&
+ "Invalid ResourceKind for UAV constructor.");
+ RI.Typed.ElementTy = ElementTy;
+ RI.Typed.ElementCount = ElementCount;
+ RI.UAVFlags.GloballyCoherent = GloballyCoherent;
+ RI.UAVFlags.IsROV = IsROV;
+ RI.UAVFlags.HasCounter = false;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::RWRawBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID, bool GloballyCoherent,
+ bool IsROV) {
+ ResourceInfo RI(ResourceClass::UAV, ResourceKind::RawBuffer, Symbol, Name,
+ Binding, UniqueID);
+ RI.UAVFlags.GloballyCoherent = GloballyCoherent;
+ RI.UAVFlags.IsROV = IsROV;
+ RI.UAVFlags.HasCounter = false;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::RWStructuredBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID,
+ uint32_t Stride, Align Alignment,
+ bool GloballyCoherent, bool IsROV,
+ bool HasCounter) {
+ ResourceInfo RI(ResourceClass::UAV, ResourceKind::StructuredBuffer, Symbol,
+ Name, Binding, UniqueID);
+ RI.Struct.Stride = Stride;
+ RI.Struct.Alignment = Alignment;
+ RI.UAVFlags.GloballyCoherent = GloballyCoherent;
+ RI.UAVFlags.IsROV = IsROV;
+ RI.UAVFlags.HasCounter = HasCounter;
+ return RI;
+}
+
+ResourceInfo
+ResourceInfo::RWTexture2DMS(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ ElementType ElementTy, uint32_t ElementCount,
+ uint32_t SampleCount, bool GloballyCoherent) {
+ ResourceInfo RI(ResourceClass::UAV, ResourceKind::Texture2DMS, Symbol, Name,
+ Binding, UniqueID);
+ RI.Typed.ElementTy = ElementTy;
+ RI.Typed.ElementCount = ElementCount;
+ RI.UAVFlags.GloballyCoherent = GloballyCoherent;
+ RI.UAVFlags.IsROV = false;
+ RI.UAVFlags.HasCounter = false;
+ RI.MultiSample.Count = SampleCount;
+ return RI;
+}
+
+ResourceInfo
+ResourceInfo::RWTexture2DMSArray(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ ElementType ElementTy, uint32_t ElementCount,
+ uint32_t SampleCount, bool GloballyCoherent) {
+ ResourceInfo RI(ResourceClass::UAV, ResourceKind::Texture2DMSArray, Symbol,
+ Name, Binding, UniqueID);
+ RI.Typed.ElementTy = ElementTy;
+ RI.Typed.ElementCount = ElementCount;
+ RI.UAVFlags.GloballyCoherent = GloballyCoherent;
+ RI.UAVFlags.IsROV = false;
+ RI.UAVFlags.HasCounter = false;
+ RI.MultiSample.Count = SampleCount;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::FeedbackTexture2D(Value *Symbol, StringRef Name,
+ ResourceBinding Binding,
+ uint32_t UniqueID,
+ SamplerFeedbackType FeedbackTy) {
+ ResourceInfo RI(ResourceClass::UAV, ResourceKind::FeedbackTexture2D, Symbol,
+ Name, Binding, UniqueID);
+ RI.UAVFlags.GloballyCoherent = false;
+ RI.UAVFlags.IsROV = false;
+ RI.UAVFlags.HasCounter = false;
+ RI.Feedback.Type = FeedbackTy;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::FeedbackTexture2DArray(
+ Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID,
+ SamplerFeedbackType FeedbackTy) {
+ ResourceInfo RI(ResourceClass::UAV, ResourceKind::FeedbackTexture2DArray,
+ Symbol, Name, Binding, UniqueID);
+ RI.UAVFlags.GloballyCoherent = false;
+ RI.UAVFlags.IsROV = false;
+ RI.UAVFlags.HasCounter = false;
+ RI.Feedback.Type = FeedbackTy;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::CBuffer(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ uint32_t Size) {
+ ResourceInfo RI(ResourceClass::CBuffer, ResourceKind::CBuffer, Symbol, Name,
+ Binding, UniqueID);
+ RI.CBufferSize = Size;
+ return RI;
+}
+
+ResourceInfo ResourceInfo::Sampler(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ SamplerType SamplerTy) {
+ ResourceInfo RI(ResourceClass::Sampler, ResourceKind::Sampler, Symbol, Name,
+ Binding, UniqueID);
+ RI.SamplerTy = SamplerTy;
+ return RI;
+}
+
+bool ResourceInfo::operator==(const ResourceInfo &RHS) const {
+ if (std::tie(Symbol, Name, Binding, UniqueID, RC, Kind) !=
+ std::tie(RHS.Symbol, RHS.Name, RHS.Binding, RHS.UniqueID, RHS.RC,
+ RHS.Kind))
+ return false;
+ if (isCBuffer())
+ return CBufferSize == RHS.CBufferSize;
+ if (isSampler())
+ return SamplerTy == RHS.SamplerTy;
+ if (isUAV() && UAVFlags != RHS.UAVFlags)
+ return false;
+
+ if (isStruct())
+ return Struct == RHS.Struct;
+ if (isFeedback())
+ return Feedback == RHS.Feedback;
+ if (isTyped() && Typed != RHS.Typed)
+ return false;
+
+ if (isMultiSample())
+ return MultiSample == RHS.MultiSample;
+
+ assert((Kind == ResourceKind::RawBuffer) && "Unhandled resource kind");
+ return true;
+}
+
+MDTuple *ResourceInfo::getAsMetadata(LLVMContext &Ctx) const {
+ SmallVector<Metadata *, 11> MDVals;
+
+ Type *I32Ty = Type::getInt32Ty(Ctx);
+ Type *I1Ty = Type::getInt1Ty(Ctx);
+ auto getIntMD = [&I32Ty](uint32_t V) {
+ return ConstantAsMetadata::get(
+ Constant::getIntegerValue(I32Ty, APInt(32, V)));
+ };
+ auto getBoolMD = [&I1Ty](uint32_t V) {
+ return ConstantAsMetadata::get(
+ Constant::getIntegerValue(I1Ty, APInt(1, V)));
+ };
+
+ MDVals.push_back(getIntMD(UniqueID));
+ MDVals.push_back(ValueAsMetadata::get(Symbol));
+ MDVals.push_back(MDString::get(Ctx, Name));
+ MDVals.push_back(getIntMD(Binding.Space));
+ MDVals.push_back(getIntMD(Binding.LowerBound));
+ MDVals.push_back(getIntMD(Binding.Size));
+
+ if (isCBuffer()) {
+ MD...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
b1b2aff
to
84c2955
Compare
This introduces dxil::ResourceInfo, which can generate DXIL-style metadata for resources and the constants for the DXIL 6.6+ annotateResource operation. These are done together so that it's easier to see all of the information the ResourceInfo class needs to store. This will be used for lowering resource in the DirectX backend and is intended to help with the translation in the other direction as well. To do that, we'll need the inverse functions of `getAsMetadata` and `getAnnotateProps`.
84c2955
to
99a2510
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
One question, why does DXILResource.cpp live in lib/Transforms/Utils instead of lib/Targets/DirectX?
The intention is that this will be used for bidirectional translation. We can add the inverse functions |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/12/builds/1994 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/1486 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/1479 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/914 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/3160 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/2525 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/1851 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/2632 Here is the relevant piece of the build log for the reference:
|
…#98939) Summary: This introduces dxil::ResourceInfo, which can generate DXIL-style metadata for resources and the constants for the DXIL 6.6+ annotateResource operation. These are done together so that it's easier to see all of the information the ResourceInfo class needs to store. This will be used for lowering resource in the DirectX backend and is intended to help with the translation in the other direction as well. To do that, we'll need the inverse functions of `getAsMetadata` and `getAnnotateProps`. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251519
This introduces dxil::ResourceInfo, which can generate DXIL-style metadata for resources and the constants for the DXIL 6.6+ annotateResource operation. These are done together so that it's easier to see all of the information the ResourceInfo class needs to store.
This will be used for lowering resource in the DirectX backend and is intended to help with the translation in the other direction as well. To do that, we'll need the inverse functions of
getAsMetadata
andgetAnnotateProps
.