Skip to content

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Jul 15, 2024

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.

@llvmbot
Copy link
Member

llvmbot commented Jul 15, 2024

@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-llvm-support

@llvm/pr-subscribers-backend-directx

Author: Justin Bogner (bogner)

Changes

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.


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:

  • (modified) llvm/include/llvm/Support/DXILABI.h (+19)
  • (added) llvm/include/llvm/Transforms/Utils/DXILResource.h (+193)
  • (modified) llvm/lib/Transforms/Utils/CMakeLists.txt (+1)
  • (added) llvm/lib/Transforms/Utils/DXILResource.cpp (+372)
  • (modified) llvm/unittests/Transforms/Utils/CMakeLists.txt (+1)
  • (added) llvm/unittests/Transforms/Utils/DXILResourceTest.cpp (+303)
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]

Copy link

github-actions bot commented Jul 15, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@bogner bogner force-pushed the 2024-07-resource-md branch 2 times, most recently from b1b2aff to 84c2955 Compare July 16, 2024 03:07
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`.
@bogner bogner force-pushed the 2024-07-resource-md branch from 84c2955 to 99a2510 Compare July 16, 2024 03:09
Copy link
Contributor

@python3kgae python3kgae left a 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?

@bogner
Copy link
Contributor Author

bogner commented Jul 16, 2024

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 fromBinding and fromAnnotateProps and use those in an analysis pass to drive translating the format in DXILUpgrade.

@bogner bogner merged commit 48f55ba into llvm:main Jul 16, 2024
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder clang-ve-ninja running on hpce-ve-main while building llvm at step 4 "annotate".

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:

Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/ve-linux.py ...' (failure)
...
[607/640] Linking CXX executable unittests/TextAPI/TextAPITests
[608/640] Linking CXX executable unittests/ProfileData/ProfileDataTests
[609/640] Linking CXX executable unittests/TargetParser/TargetParserTests
[610/640] Linking CXX executable unittests/TableGen/TableGenTests
[611/640] Linking CXX executable unittests/XRay/XRayTests
[612/640] Linking CXX executable unittests/Bitcode/BitcodeTests
[613/640] Linking CXX executable unittests/DebugInfo/LogicalView/DebugInfoLogicalViewTests
[614/640] Linking CXX executable unittests/FuzzMutate/FuzzMutateTests
[615/640] Linking CXX executable unittests/Support/SupportTests
[616/640] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
/usr/bin/ccache  /home/buildbot/install/bin/clang++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/unittests/Transforms/Utils -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/unittests/Transforms/Utils -I/scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/include -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/include -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/third-party/unittest/googletest/include -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/third-party/unittest/googlemock/include -O2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
  void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
                                                   ^~~~~~~~~
                                                   std::nullptr_t
/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux/bits/c++config.h:2367:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
[617/640] Linking CXX executable unittests/Transforms/Vectorize/VectorizeTests
[618/640] Linking CXX executable unittests/Transforms/IPO/IPOTests
[619/640] Linking CXX executable unittests/MIR/MIRTests
[620/640] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
[621/640] Linking CXX executable unittests/MI/MITests
[622/640] Linking CXX executable unittests/Target/VE/VETests
[623/640] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
[624/640] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests
[625/640] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
[626/640] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[627/640] Linking CXX executable unittests/Passes/Plugins/PluginsTests
[628/640] Linking CXX executable unittests/Frontend/LLVMFrontendTests
[629/640] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
[630/640] Linking CXX executable unittests/IR/IRTests
[631/640] Linking CXX executable unittests/Target/TargetMachineCTests
[632/640] Linking CXX executable unittests/Analysis/AnalysisTests
[633/640] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
[634/640] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
[635/640] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[636/640] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
[637/640] Linking CXX executable unittests/CodeGen/CodeGenTests
[638/640] Linking CXX executable unittests/Target/X86/X86Tests
ninja: build stopped: subcommand failed.
make: *** [check-llvm] Error 1
['make', '-f', '/scratch/buildbot/bothome/clang-ve-ninja/llvm-zorg/zorg/buildbot/builders/annotated/ve-linux-steps.make', 'check-llvm', 'BUILDROOT=/scratch/buildbot/bothome/clang-ve-ninja/build'] exited with return code 2.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/ve-linux.py", line 47, in step
    yield
Step 8 (check-llvm) failure: check-llvm (failure)
...
[607/640] Linking CXX executable unittests/TextAPI/TextAPITests
[608/640] Linking CXX executable unittests/ProfileData/ProfileDataTests
[609/640] Linking CXX executable unittests/TargetParser/TargetParserTests
[610/640] Linking CXX executable unittests/TableGen/TableGenTests
[611/640] Linking CXX executable unittests/XRay/XRayTests
[612/640] Linking CXX executable unittests/Bitcode/BitcodeTests
[613/640] Linking CXX executable unittests/DebugInfo/LogicalView/DebugInfoLogicalViewTests
[614/640] Linking CXX executable unittests/FuzzMutate/FuzzMutateTests
[615/640] Linking CXX executable unittests/Support/SupportTests
[616/640] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
/usr/bin/ccache  /home/buildbot/install/bin/clang++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/unittests/Transforms/Utils -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/unittests/Transforms/Utils -I/scratch/buildbot/bothome/clang-ve-ninja/build/build_llvm/include -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/include -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/third-party/unittest/googletest/include -I/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/third-party/unittest/googlemock/include -O2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O2 -g -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/scratch/buildbot/bothome/clang-ve-ninja/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
  void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
                                                   ^~~~~~~~~
                                                   std::nullptr_t
/opt/rh/devtoolset-10/root/usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux/bits/c++config.h:2367:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
[617/640] Linking CXX executable unittests/Transforms/Vectorize/VectorizeTests
[618/640] Linking CXX executable unittests/Transforms/IPO/IPOTests
[619/640] Linking CXX executable unittests/MIR/MIRTests
[620/640] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
[621/640] Linking CXX executable unittests/MI/MITests
[622/640] Linking CXX executable unittests/Target/VE/VETests
[623/640] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
[624/640] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests
[625/640] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
[626/640] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[627/640] Linking CXX executable unittests/Passes/Plugins/PluginsTests
[628/640] Linking CXX executable unittests/Frontend/LLVMFrontendTests
[629/640] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
[630/640] Linking CXX executable unittests/IR/IRTests
[631/640] Linking CXX executable unittests/Target/TargetMachineCTests
[632/640] Linking CXX executable unittests/Analysis/AnalysisTests
[633/640] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
[634/640] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
[635/640] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[636/640] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
[637/640] Linking CXX executable unittests/CodeGen/CodeGenTests
[638/640] Linking CXX executable unittests/Target/X86/X86Tests
ninja: build stopped: subcommand failed.
make: *** [check-llvm] Error 1
['make', '-f', '/scratch/buildbot/bothome/clang-ve-ninja/llvm-zorg/zorg/buildbot/builders/annotated/ve-linux-steps.make', 'check-llvm', 'BUILDROOT=/scratch/buildbot/bothome/clang-ve-ninja/build'] exited with return code 2.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/ve-linux.py", line 47, in step
    yield

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building llvm at step 5 "ninja check 1".

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:

Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[1093/1105] Building CXX object unittests/tools/llvm-mca/CMakeFiles/LLVMMCATests.dir/MCATestBase.cpp.o
[1094/1105] Linking CXX executable unittests/tools/llvm-profgen/LLVMProfgenTests
[1095/1105] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
[1096/1105] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
[1097/1105] Linking CXX executable unittests/tools/llvm-profdata/LLVMProfdataTests
[1098/1105] Linking CXX executable unittests/Transforms/Vectorize/VectorizeTests
[1099/1105] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
[1100/1105] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[1101/1105] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[1102/1105] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Transforms/Utils -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/unittests/Transforms/Utils -I/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/third-party/unittest/googletest/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
../llvm/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
   60 |   void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
      |                                                    ^~~~~~~~~
      |                                                    std::nullptr_t
/usr/lib/gcc/aarch64-linux-gnu/10/../../../../include/aarch64-linux-gnu/c++/10/bits/c++config.h:268:29: note: 'std::nullptr_t' declared here
  268 |   typedef decltype(nullptr)     nullptr_t;
      |                                 ^
1 error generated.
[1103/1105] Linking CXX executable tools/clang/unittests/Tooling/ToolingTests
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

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:

Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[1083/1099] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[1084/1099] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
[1085/1099] Linking CXX executable unittests/tools/llvm-profdata/LLVMProfdataTests
[1086/1099] Linking CXX executable unittests/Transforms/Vectorize/VectorizeTests
[1087/1099] Linking CXX executable unittests/Transforms/IPO/IPOTests
[1088/1099] Linking CXX executable unittests/Target/ARM/ARMTests
[1089/1099] Linking CXX executable unittests/Target/TargetMachineCTests
[1090/1099] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
[1091/1099] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
[1092/1099] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Transforms/Utils -I/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/unittests/Transforms/Utils -I/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/include -I/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/include -I/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/third-party/unittest/googletest/include -I/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
../llvm/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
   60 |   void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
      |                                                    ^~~~~~~~~
      |                                                    std::nullptr_t
/usr/lib/gcc/arm-linux-gnueabihf/10/../../../../include/arm-linux-gnueabihf/c++/10/bits/c++config.h:268:29: note: 'std::nullptr_t' declared here
  268 |   typedef decltype(nullptr)     nullptr_t;
      |                                 ^
1 error generated.
[1093/1099] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[1094/1099] Linking CXX executable tools/clang/unittests/Interpreter/ExceptionTests/ClangReplInterpreterExceptionTests
[1095/1099] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/SourceCodeTest.cpp.o
[1096/1099] Linking CXX executable tools/clang/unittests/Interpreter/ClangReplInterpreterTests
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-asan running on sanitizer-buildbot2 while building llvm at step 2 "annotate".

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:

Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
[1012/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/DecomposeStackOffsetTest.cpp.o
[1013/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ThreadPool.cpp.o
[1014/1161] Building CXX object unittests/Testing/ADT/CMakeFiles/TestingADTTests.dir/StringMapEntryTest.cpp.o
[1015/1161] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/PatternMatch.cpp.o
[1016/1161] Linking CXX executable unittests/Testing/ADT/TestingADTTests
[1017/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ErrorTest.cpp.o
[1018/1161] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
[1019/1161] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/SmallVectorTest.cpp.o
[1020/1161] Linking CXX executable unittests/ADT/ADTTests
[1021/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/unittests/Transforms/Utils -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/unittests/Transforms/Utils -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/third-party/unittest/googletest/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
   60 |   void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
      |                                                    ^~~~~~~~~
      |                                                    std::nullptr_t
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include/c++/14/x86_64-linux-gnu/bits/c++config.h:314:29: note: 'std::nullptr_t' declared here
  314 |   typedef decltype(nullptr)     nullptr_t;
      |                                 ^
1 error generated.
[1022/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/CodeLayoutTest.cpp.o
[1023/1161] Building CXX object unittests/TableGen/CMakeFiles/TableGenTests.dir/AutomataTest.cpp.o
[1024/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV1Tests.cpp.o
[1025/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/ModuleUtilsTest.cpp.o
[1026/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV2Tests.cpp.o
[1027/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/CallPromotionUtilsTest.cpp.o
[1028/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/JSONTest.cpp.o
[1029/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/FunctionComparatorTest.cpp.o
[1030/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CommandLineTest.cpp.o
[1031/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/IntegerDivisionTest.cpp.o
[1032/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/Immediates.cpp.o
[1033/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/AddressingModes.cpp.o
[1034/1161] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/DwarfRegMappings.cpp.o
[1035/1161] Building CXX object unittests/Target/WebAssembly/CMakeFiles/WebAssemblyTests.dir/WebAssemblyExceptionInfoTest.cpp.o
[1036/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/ProfDataUtilTest.cpp.o
[1037/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/AArch64SVESchedPseudoTest.cpp.o
[1038/1161] Building CXX object unittests/Target/X86/CMakeFiles/X86Tests.dir/MachineSizeOptsTest.cpp.o
[1039/1161] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/CSKYTargetParserTest.cpp.o
[1040/1161] Building CXX object unittests/Target/VE/CMakeFiles/VETests.dir/MachineInstrTest.cpp.o
[1041/1161] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/AMDGPUUnitTests.cpp.o
[1042/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/MatrixRegisterAliasing.cpp.o
[1043/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV4Tests.cpp.o
[1044/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV3Tests.cpp.o
[1045/1161] Building CXX object unittests/tools/llvm-exegesis/CMakeFiles/LLVMExegesisTests.dir/ProgressMeterTest.cpp.o
[1046/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o
[1047/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/CodeExtractorTest.cpp.o
[1048/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/SizeOptsTest.cpp.o
[1049/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/LoopRotationUtilsTest.cpp.o
[1050/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/UnrollLoopTest.cpp.o
Step 13 (stage3/asan check) failure: stage3/asan check (failure)
...
[1012/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/DecomposeStackOffsetTest.cpp.o
[1013/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ThreadPool.cpp.o
[1014/1161] Building CXX object unittests/Testing/ADT/CMakeFiles/TestingADTTests.dir/StringMapEntryTest.cpp.o
[1015/1161] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/PatternMatch.cpp.o
[1016/1161] Linking CXX executable unittests/Testing/ADT/TestingADTTests
[1017/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ErrorTest.cpp.o
[1018/1161] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
[1019/1161] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/SmallVectorTest.cpp.o
[1020/1161] Linking CXX executable unittests/ADT/ADTTests
[1021/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/unittests/Transforms/Utils -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/unittests/Transforms/Utils -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build2_asan/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/third-party/unittest/googletest/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
   60 |   void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
      |                                                    ^~~~~~~~~
      |                                                    std::nullptr_t
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include/c++/14/x86_64-linux-gnu/bits/c++config.h:314:29: note: 'std::nullptr_t' declared here
  314 |   typedef decltype(nullptr)     nullptr_t;
      |                                 ^
1 error generated.
[1022/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/CodeLayoutTest.cpp.o
[1023/1161] Building CXX object unittests/TableGen/CMakeFiles/TableGenTests.dir/AutomataTest.cpp.o
[1024/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV1Tests.cpp.o
[1025/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/ModuleUtilsTest.cpp.o
[1026/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV2Tests.cpp.o
[1027/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/CallPromotionUtilsTest.cpp.o
[1028/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/JSONTest.cpp.o
[1029/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/FunctionComparatorTest.cpp.o
[1030/1161] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CommandLineTest.cpp.o
[1031/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/IntegerDivisionTest.cpp.o
[1032/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/Immediates.cpp.o
[1033/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/AddressingModes.cpp.o
[1034/1161] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/DwarfRegMappings.cpp.o
[1035/1161] Building CXX object unittests/Target/WebAssembly/CMakeFiles/WebAssemblyTests.dir/WebAssemblyExceptionInfoTest.cpp.o
[1036/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/ProfDataUtilTest.cpp.o
[1037/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/AArch64SVESchedPseudoTest.cpp.o
[1038/1161] Building CXX object unittests/Target/X86/CMakeFiles/X86Tests.dir/MachineSizeOptsTest.cpp.o
[1039/1161] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/CSKYTargetParserTest.cpp.o
[1040/1161] Building CXX object unittests/Target/VE/CMakeFiles/VETests.dir/MachineInstrTest.cpp.o
[1041/1161] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/AMDGPUUnitTests.cpp.o
[1042/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/MatrixRegisterAliasing.cpp.o
[1043/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV4Tests.cpp.o
[1044/1161] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV3Tests.cpp.o
[1045/1161] Building CXX object unittests/tools/llvm-exegesis/CMakeFiles/LLVMExegesisTests.dir/ProgressMeterTest.cpp.o
[1046/1161] Building CXX object unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o
[1047/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/CodeExtractorTest.cpp.o
[1048/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/SizeOptsTest.cpp.o
[1049/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/LoopRotationUtilsTest.cpp.o
[1050/1161] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/UnrollLoopTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building llvm at step 7 "test-build-unified-tree-check-all".

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:

Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
-- Skipping test for 'libc.src.string.memset_x86_64_opt_avx512' insufficient host cpu features 'AVX512F'
-- Compiler-RT supported architectures: x86_64
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is "asan;lsan;hwasan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against "asan;lsan;hwasan;msan;tsan;ubsan"
-- check-nsan does nothing.
-- check-shadowcallstack does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /build/buildbot/premerge-monolithic-linux/build/runtimes/runtimes-bins
116.318 [17/31/1327] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/build/buildbot/premerge-monolithic-linux/build/unittests/Transforms/Utils -I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/unittests/Transforms/Utils -I/build/buildbot/premerge-monolithic-linux/build/include -I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include -I/build/buildbot/premerge-monolithic-linux/llvm-project/third-party/unittest/googletest/include -I/build/buildbot/premerge-monolithic-linux/llvm-project/third-party/unittest/googlemock/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
  void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
                                                   ^~~~~~~~~
                                                   std::nullptr_t
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11/bits/c++config.h:284:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
124.007 [17/6/1352] Building CXX object tools/clang/unittests/Frontend/CMakeFiles/FrontendTests.dir/FrontendActionTest.cpp.o
124.623 [17/4/1354] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/RecursiveASTVisitorTestDeclVisitor.cpp.o
127.198 [17/3/1355] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/RefactoringTest.cpp.o
127.707 [17/2/1356] Building CXX object tools/clang/unittests/AST/CMakeFiles/ASTTests.dir/ASTImporterTest.cpp.o
178.791 [17/1/1357] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/SourceCodeTest.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder clang-x86_64-debian-fast running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

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:

Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
                    ^~~~~~~
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp:9:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/unittests/Tooling/TestVisitor.h:21:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/ASTUnit.h:28:
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Sema/CodeCompleteConsumer.h:338:31: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
    /// Code completion in a @class forward declaration.
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
82.641 [15/67/1090] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/1/clang-x86_64-debian-fast/llvm.obj/unittests/Transforms/Utils -I/b/1/clang-x86_64-debian-fast/llvm.src/llvm/unittests/Transforms/Utils -I/b/1/clang-x86_64-debian-fast/llvm.obj/include -I/b/1/clang-x86_64-debian-fast/llvm.src/llvm/include -I/b/1/clang-x86_64-debian-fast/llvm.src/third-party/unittest/googletest/include -I/b/1/clang-x86_64-debian-fast/llvm.src/third-party/unittest/googlemock/include -std=c++11 -Wdocumentation -Wno-documentation-deprecated-sync -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /b/1/clang-x86_64-debian-fast/llvm.src/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/b/1/clang-x86_64-debian-fast/llvm.src/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
  void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
                                                   ^~~~~~~~~
                                                   std::nullptr_t
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/c++config.h:268:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
82.780 [15/66/1091] Building CXX object tools/clang/unittests/CodeGen/CMakeFiles/ClangCodeGenTests.dir/TBAAMetadataTest.cpp.o
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/unittests/CodeGen/TBAAMetadataTest.cpp:10:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/unittests/CodeGen/TestCompiler.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/CompilerInstance.h:16:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/CompilerInvocation.h:23:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Analysis/PathDiagnostic.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Analysis/AnalysisDeclContext.h:22:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Analysis/CFG.h:18:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExprCXX.h:21:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/DeclCXX.h:22:
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/Expr.h:5152:21: warning: '@endcode' command does not terminate a verbatim text block [-Wdocumentation]
  /// literal or an @encode?
                    ^~~~~~~
1 warning generated.
82.869 [15/65/1092] Building CXX object tools/clang/unittests/Support/CMakeFiles/ClangSupportTests.dir/TimeProfilerTest.cpp.o
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/unittests/Support/TimeProfilerTest.cpp:9:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/CompilerInstance.h:16:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/CompilerInvocation.h:23:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Analysis/PathDiagnostic.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Analysis/AnalysisDeclContext.h:22:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Analysis/CFG.h:18:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExprCXX.h:21:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/DeclCXX.h:22:
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/Expr.h:5152:21: warning: '@endcode' command does not terminate a verbatim text block [-Wdocumentation]
  /// literal or an @encode?
                    ^~~~~~~
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/unittests/Support/TimeProfilerTest.cpp:10:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 17, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-debian running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

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:

Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
5.825 [2/17/690] Linking CXX executable unittests/Target/AArch64/AArch64Tests
5.864 [2/16/691] Linking CXX executable unittests/MC/AMDGPU/AMDGPUMCTests
5.886 [2/15/692] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
6.372 [2/14/693] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
6.482 [2/13/694] Linking CXX executable unittests/Target/X86/X86Tests
6.561 [2/12/695] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
6.885 [2/11/696] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
6.921 [2/10/697] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
6.992 [2/9/698] Linking CXX executable unittests/CodeGen/CodeGenTests
7.090 [2/8/699] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DEXPENSIVE_CHECKS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/1/llvm-clang-x86_64-expensive-checks-debian/build/unittests/Transforms/Utils -I/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/unittests/Transforms/Utils -I/b/1/llvm-clang-x86_64-expensive-checks-debian/build/include -I/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/include -I/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/third-party/unittest/googletest/include -I/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/third-party/unittest/googlemock/include -U_GLIBCXX_DEBUG -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
  void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
                                                   ^~~~~~~~~
                                                   std::nullptr_t
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/c++config.h:268:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
7.118 [2/7/700] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
7.398 [2/6/701] Linking CXX executable unittests/MIR/MIRTests
7.518 [2/5/702] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests
7.560 [2/4/703] Linking CXX executable unittests/MI/MITests
7.859 [2/3/704] Linking CXX executable tools/lld/unittests/AsLibELF/LLDAsLibELFTests
8.258 [2/2/705] Linking CXX executable tools/lld/unittests/AsLibAll/LLDAsLibAllTests
8.759 [2/1/706] Linking CXX executable unittests/Target/TargetMachineCTests
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 17, 2024

LLVM Buildbot has detected a new failure on builder llvm-x86_64-debian-dylib running on gribozavr4 while building llvm at step 7 "test-build-unified-tree-check-llvm".

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:

Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
...
0.876 [3/10/668] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/AMDGPUUnitTests.cpp.o
1.101 [2/10/669] Linking CXX executable unittests/Target/LoongArch/LoongArchTests
1.103 [2/9/670] Linking CXX executable unittests/Target/WebAssembly/WebAssemblyTests
1.105 [2/8/671] Linking CXX executable unittests/Target/VE/VETests
1.227 [2/7/672] Linking CXX executable unittests/Target/ARM/ARMTests
1.673 [2/6/673] Linking CXX executable unittests/Target/RISCV/RISCVTests
1.734 [2/5/674] Linking CXX executable unittests/Target/AArch64/AArch64Tests
1.773 [2/4/675] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
2.293 [2/3/676] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
2.358 [2/2/677] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o
FAILED: unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/1/llvm-x86_64-debian-dylib/build/unittests/Transforms/Utils -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/unittests/Transforms/Utils -I/b/1/llvm-x86_64-debian-dylib/build/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/third-party/unittest/googletest/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/third-party/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -MF unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o.d -o unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/DXILResourceTest.cpp.o -c /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp:60:52: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
  void appendMDs(SmallVectorImpl<Metadata *> &MDs, nullptr_t V, Ts... More) {
                                                   ^~~~~~~~~
                                                   std::nullptr_t
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/c++config.h:268:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
2.768 [2/1/678] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
ninja: build stopped: subcommand failed.

yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants