Skip to content

[HLSL] Remove old resource annotations #130338

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

Merged
merged 7 commits into from
Mar 14, 2025
Merged

Conversation

hekota
Copy link
Member

@hekota hekota commented Mar 7, 2025

Fixes #114126

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. HLSL HLSL Language Support labels Mar 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-hlsl

Author: Helena Kotas (hekota)

Changes

Fixes #114126


Full diff: https://github.com/llvm/llvm-project/pull/130338.diff

5 Files Affected:

  • (modified) clang/lib/CodeGen/CGDeclCXX.cpp (-3)
  • (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (-129)
  • (modified) clang/lib/CodeGen/CGHLSLRuntime.h (-15)
  • (modified) llvm/include/llvm/Frontend/HLSL/HLSLResource.h (-22)
  • (modified) llvm/lib/Frontend/HLSL/HLSLResource.cpp (+2-52)
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index f5950f03673a1..1ad34ae61f96a 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -1071,9 +1071,6 @@ void CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
     EmitCXXGlobalVarDeclInit(*D, Addr, PerformInit);
   }
 
-  if (getLangOpts().HLSL)
-    CGM.getHLSLRuntime().annotateHLSLResource(D, Addr);
-
   FinishFunction();
 }
 
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index dc34653e8f497..7ea23032b6519 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -260,135 +260,6 @@ void CGHLSLRuntime::finishCodeGen() {
   generateGlobalCtorDtorCalls();
 }
 
-void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV,
-                                                llvm::hlsl::ResourceClass RC,
-                                                llvm::hlsl::ResourceKind RK,
-                                                bool IsROV,
-                                                llvm::hlsl::ElementType ET,
-                                                BufferResBinding &Binding) {
-  llvm::Module &M = CGM.getModule();
-
-  NamedMDNode *ResourceMD = nullptr;
-  switch (RC) {
-  case llvm::hlsl::ResourceClass::UAV:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.uavs");
-    break;
-  case llvm::hlsl::ResourceClass::SRV:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.srvs");
-    break;
-  case llvm::hlsl::ResourceClass::CBuffer:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.cbufs");
-    break;
-  default:
-    assert(false && "Unsupported buffer type!");
-    return;
-  }
-  assert(ResourceMD != nullptr &&
-         "ResourceMD must have been set by the switch above.");
-
-  llvm::hlsl::FrontendResource Res(
-      GV, RK, ET, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space);
-  ResourceMD->addOperand(Res.getMetadata());
-}
-
-static llvm::hlsl::ElementType
-calculateElementType(const ASTContext &Context, const clang::Type *ResourceTy) {
-  using llvm::hlsl::ElementType;
-
-  // TODO: We may need to update this when we add things like ByteAddressBuffer
-  // that don't have a template parameter (or, indeed, an element type).
-  const auto *TST = ResourceTy->getAs<TemplateSpecializationType>();
-  assert(TST && "Resource types must be template specializations");
-  ArrayRef<TemplateArgument> Args = TST->template_arguments();
-  assert(!Args.empty() && "Resource has no element type");
-
-  // At this point we have a resource with an element type, so we can assume
-  // that it's valid or we would have diagnosed the error earlier.
-  QualType ElTy = Args[0].getAsType();
-
-  // We should either have a basic type or a vector of a basic type.
-  if (const auto *VecTy = ElTy->getAs<clang::VectorType>())
-    ElTy = VecTy->getElementType();
-
-  if (ElTy->isSignedIntegerType()) {
-    switch (Context.getTypeSize(ElTy)) {
-    case 16:
-      return ElementType::I16;
-    case 32:
-      return ElementType::I32;
-    case 64:
-      return ElementType::I64;
-    }
-  } else if (ElTy->isUnsignedIntegerType()) {
-    switch (Context.getTypeSize(ElTy)) {
-    case 16:
-      return ElementType::U16;
-    case 32:
-      return ElementType::U32;
-    case 64:
-      return ElementType::U64;
-    }
-  } else if (ElTy->isSpecificBuiltinType(BuiltinType::Half))
-    return ElementType::F16;
-  else if (ElTy->isSpecificBuiltinType(BuiltinType::Float))
-    return ElementType::F32;
-  else if (ElTy->isSpecificBuiltinType(BuiltinType::Double))
-    return ElementType::F64;
-
-  // TODO: We need to handle unorm/snorm float types here once we support them
-  llvm_unreachable("Invalid element type for resource");
-}
-
-void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
-  const Type *Ty = D->getType()->getPointeeOrArrayElementType();
-  if (!Ty)
-    return;
-  const auto *RD = Ty->getAsCXXRecordDecl();
-  if (!RD)
-    return;
-  // the resource related attributes are on the handle member
-  // inside the record decl
-  for (auto *FD : RD->fields()) {
-    const auto *HLSLResAttr = FD->getAttr<HLSLResourceAttr>();
-    const HLSLAttributedResourceType *AttrResType =
-        dyn_cast<HLSLAttributedResourceType>(FD->getType().getTypePtr());
-    if (!HLSLResAttr || !AttrResType)
-      continue;
-
-    llvm::hlsl::ResourceClass RC = AttrResType->getAttrs().ResourceClass;
-    if (RC == llvm::hlsl::ResourceClass::UAV ||
-        RC == llvm::hlsl::ResourceClass::SRV)
-      // UAVs and SRVs have already been converted to use LLVM target types,
-      // we can disable generating of these resource annotations. This will
-      // enable progress on structured buffers with user defined types this
-      // resource annotations code does not handle and it crashes.
-      // This whole function is going to be removed as soon as cbuffers are
-      // converted to target types (llvm/llvm-project #114126).
-      return;
-
-    bool IsROV = AttrResType->getAttrs().IsROV;
-    llvm::hlsl::ResourceKind RK = HLSLResAttr->getResourceKind();
-    llvm::hlsl::ElementType ET = calculateElementType(CGM.getContext(), Ty);
-
-    BufferResBinding Binding(D->getAttr<HLSLResourceBindingAttr>());
-    addBufferResourceAnnotation(GV, RC, RK, IsROV, ET, Binding);
-  }
-}
-
-CGHLSLRuntime::BufferResBinding::BufferResBinding(
-    HLSLResourceBindingAttr *Binding) {
-  if (Binding) {
-    llvm::APInt RegInt(64, 0);
-    Binding->getSlot().substr(1).getAsInteger(10, RegInt);
-    Reg = RegInt.getLimitedValue();
-    llvm::APInt SpaceInt(64, 0);
-    Binding->getSpace().substr(5).getAsInteger(10, SpaceInt);
-    Space = SpaceInt.getLimitedValue();
-  } else {
-    Space = 0;
-  }
-}
-
 void clang::CodeGen::CGHLSLRuntime::setHLSLEntryAttributes(
     const FunctionDecl *FD, llvm::Function *Fn) {
   const auto *ShaderAttr = FD->getAttr<HLSLShaderAttr>();
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h
index a9da42324a038..717d0d294be81 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -125,15 +125,6 @@ class CGHLSLRuntime {
   // End of reserved area for HLSL intrinsic getters.
   //===----------------------------------------------------------------------===//
 
-  struct BufferResBinding {
-    // The ID like 2 in register(b2, space1).
-    std::optional<unsigned> Reg;
-    // The Space like 1 is register(b2, space1).
-    // Default value is 0.
-    unsigned Space;
-    BufferResBinding(HLSLResourceBindingAttr *Attr);
-  };
-
 protected:
   CodeGenModule &CGM;
 
@@ -148,7 +139,6 @@ class CGHLSLRuntime {
   convertHLSLSpecificType(const Type *T,
                           SmallVector<unsigned> *Packoffsets = nullptr);
 
-  void annotateHLSLResource(const VarDecl *D, llvm::GlobalVariable *GV);
   void generateGlobalCtorDtorCalls();
 
   void addBuffer(const HLSLBufferDecl *D);
@@ -169,11 +159,6 @@ class CGHLSLRuntime {
   void emitInitListOpaqueValues(CodeGenFunction &CGF, InitListExpr *E);
 
 private:
-  void addBufferResourceAnnotation(llvm::GlobalVariable *GV,
-                                   llvm::hlsl::ResourceClass RC,
-                                   llvm::hlsl::ResourceKind RK, bool IsROV,
-                                   llvm::hlsl::ElementType ET,
-                                   BufferResBinding &Binding);
   void emitBufferGlobalsAndMetadata(const HLSLBufferDecl *BufDecl,
                                     llvm::GlobalVariable *BufGV);
   llvm::Triple::ArchType getArch();
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
index 989893bcaccec..f4ed6d552899f 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -13,37 +13,15 @@
 #ifndef LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
 #define LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
 
-#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DXILABI.h"
 
 namespace llvm {
-class GlobalVariable;
-class MDNode;
-
 namespace hlsl {
 
 // For now we use DXIL ABI enum values directly. This may change in the future.
 using dxil::ResourceClass;
-using dxil::ElementType;
 using dxil::ResourceKind;
 
-class FrontendResource {
-  MDNode *Entry;
-
-public:
-  FrontendResource(MDNode *E);
-  FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy,
-                   bool IsROV, uint32_t ResIndex, uint32_t Space);
-
-  GlobalVariable *getGlobalVariable();
-  StringRef getSourceType();
-  ResourceKind getResourceKind();
-  ElementType getElementType();
-  bool getIsROV();
-  uint32_t getResourceIndex();
-  uint32_t getSpace();
-  MDNode *getMetadata() { return Entry; }
-};
 } // namespace hlsl
 } // namespace llvm
 
diff --git a/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
index 48310d4f28e67..970edb9710cb6 100644
--- a/llvm/lib/Frontend/HLSL/HLSLResource.cpp
+++ b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
@@ -11,59 +11,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Frontend/HLSL/HLSLResource.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Metadata.h"
 
 using namespace llvm;
 using namespace llvm::hlsl;
 
-GlobalVariable *FrontendResource::getGlobalVariable() {
-  return cast<GlobalVariable>(
-      cast<ConstantAsMetadata>(Entry->getOperand(0))->getValue());
-}
-
-ResourceKind FrontendResource::getResourceKind() {
-  return static_cast<ResourceKind>(
-      cast<ConstantInt>(
-          cast<ConstantAsMetadata>(Entry->getOperand(1))->getValue())
-          ->getLimitedValue());
-}
-ElementType FrontendResource::getElementType() {
-  return static_cast<ElementType>(
-      cast<ConstantInt>(
-          cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
-          ->getLimitedValue());
-}
-bool FrontendResource::getIsROV() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(3))->getValue())
-      ->getLimitedValue();
-}
-uint32_t FrontendResource::getResourceIndex() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(4))->getValue())
-      ->getLimitedValue();
-}
-uint32_t FrontendResource::getSpace() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(5))->getValue())
-      ->getLimitedValue();
-}
-
-FrontendResource::FrontendResource(MDNode *E) : Entry(E) {
-  assert(Entry->getNumOperands() == 6 && "Unexpected metadata shape");
-}
-
-FrontendResource::FrontendResource(GlobalVariable *GV, ResourceKind RK,
-                                   ElementType ElTy, bool IsROV,
-                                   uint32_t ResIndex, uint32_t Space) {
-  auto &Ctx = GV->getContext();
-  IRBuilder<> B(Ctx);
-  Entry = MDNode::get(
-      Ctx, {ValueAsMetadata::get(GV),
-            ConstantAsMetadata::get(B.getInt32(static_cast<int>(RK))),
-            ConstantAsMetadata::get(B.getInt32(static_cast<int>(ElTy))),
-            ConstantAsMetadata::get(B.getInt1(IsROV)),
-            ConstantAsMetadata::get(B.getInt32(ResIndex)),
-            ConstantAsMetadata::get(B.getInt32(Space))});
-}
+// Intentionally empty; this file can be removed when more cpp files are added
+// to the HLSLFrontend lib.

@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-clang-codegen

Author: Helena Kotas (hekota)

Changes

Fixes #114126


Full diff: https://github.com/llvm/llvm-project/pull/130338.diff

5 Files Affected:

  • (modified) clang/lib/CodeGen/CGDeclCXX.cpp (-3)
  • (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (-129)
  • (modified) clang/lib/CodeGen/CGHLSLRuntime.h (-15)
  • (modified) llvm/include/llvm/Frontend/HLSL/HLSLResource.h (-22)
  • (modified) llvm/lib/Frontend/HLSL/HLSLResource.cpp (+2-52)
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index f5950f03673a1..1ad34ae61f96a 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -1071,9 +1071,6 @@ void CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
     EmitCXXGlobalVarDeclInit(*D, Addr, PerformInit);
   }
 
-  if (getLangOpts().HLSL)
-    CGM.getHLSLRuntime().annotateHLSLResource(D, Addr);
-
   FinishFunction();
 }
 
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index dc34653e8f497..7ea23032b6519 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -260,135 +260,6 @@ void CGHLSLRuntime::finishCodeGen() {
   generateGlobalCtorDtorCalls();
 }
 
-void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV,
-                                                llvm::hlsl::ResourceClass RC,
-                                                llvm::hlsl::ResourceKind RK,
-                                                bool IsROV,
-                                                llvm::hlsl::ElementType ET,
-                                                BufferResBinding &Binding) {
-  llvm::Module &M = CGM.getModule();
-
-  NamedMDNode *ResourceMD = nullptr;
-  switch (RC) {
-  case llvm::hlsl::ResourceClass::UAV:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.uavs");
-    break;
-  case llvm::hlsl::ResourceClass::SRV:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.srvs");
-    break;
-  case llvm::hlsl::ResourceClass::CBuffer:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.cbufs");
-    break;
-  default:
-    assert(false && "Unsupported buffer type!");
-    return;
-  }
-  assert(ResourceMD != nullptr &&
-         "ResourceMD must have been set by the switch above.");
-
-  llvm::hlsl::FrontendResource Res(
-      GV, RK, ET, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space);
-  ResourceMD->addOperand(Res.getMetadata());
-}
-
-static llvm::hlsl::ElementType
-calculateElementType(const ASTContext &Context, const clang::Type *ResourceTy) {
-  using llvm::hlsl::ElementType;
-
-  // TODO: We may need to update this when we add things like ByteAddressBuffer
-  // that don't have a template parameter (or, indeed, an element type).
-  const auto *TST = ResourceTy->getAs<TemplateSpecializationType>();
-  assert(TST && "Resource types must be template specializations");
-  ArrayRef<TemplateArgument> Args = TST->template_arguments();
-  assert(!Args.empty() && "Resource has no element type");
-
-  // At this point we have a resource with an element type, so we can assume
-  // that it's valid or we would have diagnosed the error earlier.
-  QualType ElTy = Args[0].getAsType();
-
-  // We should either have a basic type or a vector of a basic type.
-  if (const auto *VecTy = ElTy->getAs<clang::VectorType>())
-    ElTy = VecTy->getElementType();
-
-  if (ElTy->isSignedIntegerType()) {
-    switch (Context.getTypeSize(ElTy)) {
-    case 16:
-      return ElementType::I16;
-    case 32:
-      return ElementType::I32;
-    case 64:
-      return ElementType::I64;
-    }
-  } else if (ElTy->isUnsignedIntegerType()) {
-    switch (Context.getTypeSize(ElTy)) {
-    case 16:
-      return ElementType::U16;
-    case 32:
-      return ElementType::U32;
-    case 64:
-      return ElementType::U64;
-    }
-  } else if (ElTy->isSpecificBuiltinType(BuiltinType::Half))
-    return ElementType::F16;
-  else if (ElTy->isSpecificBuiltinType(BuiltinType::Float))
-    return ElementType::F32;
-  else if (ElTy->isSpecificBuiltinType(BuiltinType::Double))
-    return ElementType::F64;
-
-  // TODO: We need to handle unorm/snorm float types here once we support them
-  llvm_unreachable("Invalid element type for resource");
-}
-
-void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
-  const Type *Ty = D->getType()->getPointeeOrArrayElementType();
-  if (!Ty)
-    return;
-  const auto *RD = Ty->getAsCXXRecordDecl();
-  if (!RD)
-    return;
-  // the resource related attributes are on the handle member
-  // inside the record decl
-  for (auto *FD : RD->fields()) {
-    const auto *HLSLResAttr = FD->getAttr<HLSLResourceAttr>();
-    const HLSLAttributedResourceType *AttrResType =
-        dyn_cast<HLSLAttributedResourceType>(FD->getType().getTypePtr());
-    if (!HLSLResAttr || !AttrResType)
-      continue;
-
-    llvm::hlsl::ResourceClass RC = AttrResType->getAttrs().ResourceClass;
-    if (RC == llvm::hlsl::ResourceClass::UAV ||
-        RC == llvm::hlsl::ResourceClass::SRV)
-      // UAVs and SRVs have already been converted to use LLVM target types,
-      // we can disable generating of these resource annotations. This will
-      // enable progress on structured buffers with user defined types this
-      // resource annotations code does not handle and it crashes.
-      // This whole function is going to be removed as soon as cbuffers are
-      // converted to target types (llvm/llvm-project #114126).
-      return;
-
-    bool IsROV = AttrResType->getAttrs().IsROV;
-    llvm::hlsl::ResourceKind RK = HLSLResAttr->getResourceKind();
-    llvm::hlsl::ElementType ET = calculateElementType(CGM.getContext(), Ty);
-
-    BufferResBinding Binding(D->getAttr<HLSLResourceBindingAttr>());
-    addBufferResourceAnnotation(GV, RC, RK, IsROV, ET, Binding);
-  }
-}
-
-CGHLSLRuntime::BufferResBinding::BufferResBinding(
-    HLSLResourceBindingAttr *Binding) {
-  if (Binding) {
-    llvm::APInt RegInt(64, 0);
-    Binding->getSlot().substr(1).getAsInteger(10, RegInt);
-    Reg = RegInt.getLimitedValue();
-    llvm::APInt SpaceInt(64, 0);
-    Binding->getSpace().substr(5).getAsInteger(10, SpaceInt);
-    Space = SpaceInt.getLimitedValue();
-  } else {
-    Space = 0;
-  }
-}
-
 void clang::CodeGen::CGHLSLRuntime::setHLSLEntryAttributes(
     const FunctionDecl *FD, llvm::Function *Fn) {
   const auto *ShaderAttr = FD->getAttr<HLSLShaderAttr>();
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h
index a9da42324a038..717d0d294be81 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -125,15 +125,6 @@ class CGHLSLRuntime {
   // End of reserved area for HLSL intrinsic getters.
   //===----------------------------------------------------------------------===//
 
-  struct BufferResBinding {
-    // The ID like 2 in register(b2, space1).
-    std::optional<unsigned> Reg;
-    // The Space like 1 is register(b2, space1).
-    // Default value is 0.
-    unsigned Space;
-    BufferResBinding(HLSLResourceBindingAttr *Attr);
-  };
-
 protected:
   CodeGenModule &CGM;
 
@@ -148,7 +139,6 @@ class CGHLSLRuntime {
   convertHLSLSpecificType(const Type *T,
                           SmallVector<unsigned> *Packoffsets = nullptr);
 
-  void annotateHLSLResource(const VarDecl *D, llvm::GlobalVariable *GV);
   void generateGlobalCtorDtorCalls();
 
   void addBuffer(const HLSLBufferDecl *D);
@@ -169,11 +159,6 @@ class CGHLSLRuntime {
   void emitInitListOpaqueValues(CodeGenFunction &CGF, InitListExpr *E);
 
 private:
-  void addBufferResourceAnnotation(llvm::GlobalVariable *GV,
-                                   llvm::hlsl::ResourceClass RC,
-                                   llvm::hlsl::ResourceKind RK, bool IsROV,
-                                   llvm::hlsl::ElementType ET,
-                                   BufferResBinding &Binding);
   void emitBufferGlobalsAndMetadata(const HLSLBufferDecl *BufDecl,
                                     llvm::GlobalVariable *BufGV);
   llvm::Triple::ArchType getArch();
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
index 989893bcaccec..f4ed6d552899f 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -13,37 +13,15 @@
 #ifndef LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
 #define LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
 
-#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DXILABI.h"
 
 namespace llvm {
-class GlobalVariable;
-class MDNode;
-
 namespace hlsl {
 
 // For now we use DXIL ABI enum values directly. This may change in the future.
 using dxil::ResourceClass;
-using dxil::ElementType;
 using dxil::ResourceKind;
 
-class FrontendResource {
-  MDNode *Entry;
-
-public:
-  FrontendResource(MDNode *E);
-  FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy,
-                   bool IsROV, uint32_t ResIndex, uint32_t Space);
-
-  GlobalVariable *getGlobalVariable();
-  StringRef getSourceType();
-  ResourceKind getResourceKind();
-  ElementType getElementType();
-  bool getIsROV();
-  uint32_t getResourceIndex();
-  uint32_t getSpace();
-  MDNode *getMetadata() { return Entry; }
-};
 } // namespace hlsl
 } // namespace llvm
 
diff --git a/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
index 48310d4f28e67..970edb9710cb6 100644
--- a/llvm/lib/Frontend/HLSL/HLSLResource.cpp
+++ b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
@@ -11,59 +11,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Frontend/HLSL/HLSLResource.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Metadata.h"
 
 using namespace llvm;
 using namespace llvm::hlsl;
 
-GlobalVariable *FrontendResource::getGlobalVariable() {
-  return cast<GlobalVariable>(
-      cast<ConstantAsMetadata>(Entry->getOperand(0))->getValue());
-}
-
-ResourceKind FrontendResource::getResourceKind() {
-  return static_cast<ResourceKind>(
-      cast<ConstantInt>(
-          cast<ConstantAsMetadata>(Entry->getOperand(1))->getValue())
-          ->getLimitedValue());
-}
-ElementType FrontendResource::getElementType() {
-  return static_cast<ElementType>(
-      cast<ConstantInt>(
-          cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
-          ->getLimitedValue());
-}
-bool FrontendResource::getIsROV() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(3))->getValue())
-      ->getLimitedValue();
-}
-uint32_t FrontendResource::getResourceIndex() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(4))->getValue())
-      ->getLimitedValue();
-}
-uint32_t FrontendResource::getSpace() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(5))->getValue())
-      ->getLimitedValue();
-}
-
-FrontendResource::FrontendResource(MDNode *E) : Entry(E) {
-  assert(Entry->getNumOperands() == 6 && "Unexpected metadata shape");
-}
-
-FrontendResource::FrontendResource(GlobalVariable *GV, ResourceKind RK,
-                                   ElementType ElTy, bool IsROV,
-                                   uint32_t ResIndex, uint32_t Space) {
-  auto &Ctx = GV->getContext();
-  IRBuilder<> B(Ctx);
-  Entry = MDNode::get(
-      Ctx, {ValueAsMetadata::get(GV),
-            ConstantAsMetadata::get(B.getInt32(static_cast<int>(RK))),
-            ConstantAsMetadata::get(B.getInt32(static_cast<int>(ElTy))),
-            ConstantAsMetadata::get(B.getInt1(IsROV)),
-            ConstantAsMetadata::get(B.getInt32(ResIndex)),
-            ConstantAsMetadata::get(B.getInt32(Space))});
-}
+// Intentionally empty; this file can be removed when more cpp files are added
+// to the HLSLFrontend lib.

@llvmbot
Copy link
Member

llvmbot commented Mar 7, 2025

@llvm/pr-subscribers-clang

Author: Helena Kotas (hekota)

Changes

Fixes #114126


Full diff: https://github.com/llvm/llvm-project/pull/130338.diff

5 Files Affected:

  • (modified) clang/lib/CodeGen/CGDeclCXX.cpp (-3)
  • (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (-129)
  • (modified) clang/lib/CodeGen/CGHLSLRuntime.h (-15)
  • (modified) llvm/include/llvm/Frontend/HLSL/HLSLResource.h (-22)
  • (modified) llvm/lib/Frontend/HLSL/HLSLResource.cpp (+2-52)
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index f5950f03673a1..1ad34ae61f96a 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -1071,9 +1071,6 @@ void CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
     EmitCXXGlobalVarDeclInit(*D, Addr, PerformInit);
   }
 
-  if (getLangOpts().HLSL)
-    CGM.getHLSLRuntime().annotateHLSLResource(D, Addr);
-
   FinishFunction();
 }
 
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index dc34653e8f497..7ea23032b6519 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -260,135 +260,6 @@ void CGHLSLRuntime::finishCodeGen() {
   generateGlobalCtorDtorCalls();
 }
 
-void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV,
-                                                llvm::hlsl::ResourceClass RC,
-                                                llvm::hlsl::ResourceKind RK,
-                                                bool IsROV,
-                                                llvm::hlsl::ElementType ET,
-                                                BufferResBinding &Binding) {
-  llvm::Module &M = CGM.getModule();
-
-  NamedMDNode *ResourceMD = nullptr;
-  switch (RC) {
-  case llvm::hlsl::ResourceClass::UAV:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.uavs");
-    break;
-  case llvm::hlsl::ResourceClass::SRV:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.srvs");
-    break;
-  case llvm::hlsl::ResourceClass::CBuffer:
-    ResourceMD = M.getOrInsertNamedMetadata("hlsl.cbufs");
-    break;
-  default:
-    assert(false && "Unsupported buffer type!");
-    return;
-  }
-  assert(ResourceMD != nullptr &&
-         "ResourceMD must have been set by the switch above.");
-
-  llvm::hlsl::FrontendResource Res(
-      GV, RK, ET, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space);
-  ResourceMD->addOperand(Res.getMetadata());
-}
-
-static llvm::hlsl::ElementType
-calculateElementType(const ASTContext &Context, const clang::Type *ResourceTy) {
-  using llvm::hlsl::ElementType;
-
-  // TODO: We may need to update this when we add things like ByteAddressBuffer
-  // that don't have a template parameter (or, indeed, an element type).
-  const auto *TST = ResourceTy->getAs<TemplateSpecializationType>();
-  assert(TST && "Resource types must be template specializations");
-  ArrayRef<TemplateArgument> Args = TST->template_arguments();
-  assert(!Args.empty() && "Resource has no element type");
-
-  // At this point we have a resource with an element type, so we can assume
-  // that it's valid or we would have diagnosed the error earlier.
-  QualType ElTy = Args[0].getAsType();
-
-  // We should either have a basic type or a vector of a basic type.
-  if (const auto *VecTy = ElTy->getAs<clang::VectorType>())
-    ElTy = VecTy->getElementType();
-
-  if (ElTy->isSignedIntegerType()) {
-    switch (Context.getTypeSize(ElTy)) {
-    case 16:
-      return ElementType::I16;
-    case 32:
-      return ElementType::I32;
-    case 64:
-      return ElementType::I64;
-    }
-  } else if (ElTy->isUnsignedIntegerType()) {
-    switch (Context.getTypeSize(ElTy)) {
-    case 16:
-      return ElementType::U16;
-    case 32:
-      return ElementType::U32;
-    case 64:
-      return ElementType::U64;
-    }
-  } else if (ElTy->isSpecificBuiltinType(BuiltinType::Half))
-    return ElementType::F16;
-  else if (ElTy->isSpecificBuiltinType(BuiltinType::Float))
-    return ElementType::F32;
-  else if (ElTy->isSpecificBuiltinType(BuiltinType::Double))
-    return ElementType::F64;
-
-  // TODO: We need to handle unorm/snorm float types here once we support them
-  llvm_unreachable("Invalid element type for resource");
-}
-
-void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
-  const Type *Ty = D->getType()->getPointeeOrArrayElementType();
-  if (!Ty)
-    return;
-  const auto *RD = Ty->getAsCXXRecordDecl();
-  if (!RD)
-    return;
-  // the resource related attributes are on the handle member
-  // inside the record decl
-  for (auto *FD : RD->fields()) {
-    const auto *HLSLResAttr = FD->getAttr<HLSLResourceAttr>();
-    const HLSLAttributedResourceType *AttrResType =
-        dyn_cast<HLSLAttributedResourceType>(FD->getType().getTypePtr());
-    if (!HLSLResAttr || !AttrResType)
-      continue;
-
-    llvm::hlsl::ResourceClass RC = AttrResType->getAttrs().ResourceClass;
-    if (RC == llvm::hlsl::ResourceClass::UAV ||
-        RC == llvm::hlsl::ResourceClass::SRV)
-      // UAVs and SRVs have already been converted to use LLVM target types,
-      // we can disable generating of these resource annotations. This will
-      // enable progress on structured buffers with user defined types this
-      // resource annotations code does not handle and it crashes.
-      // This whole function is going to be removed as soon as cbuffers are
-      // converted to target types (llvm/llvm-project #114126).
-      return;
-
-    bool IsROV = AttrResType->getAttrs().IsROV;
-    llvm::hlsl::ResourceKind RK = HLSLResAttr->getResourceKind();
-    llvm::hlsl::ElementType ET = calculateElementType(CGM.getContext(), Ty);
-
-    BufferResBinding Binding(D->getAttr<HLSLResourceBindingAttr>());
-    addBufferResourceAnnotation(GV, RC, RK, IsROV, ET, Binding);
-  }
-}
-
-CGHLSLRuntime::BufferResBinding::BufferResBinding(
-    HLSLResourceBindingAttr *Binding) {
-  if (Binding) {
-    llvm::APInt RegInt(64, 0);
-    Binding->getSlot().substr(1).getAsInteger(10, RegInt);
-    Reg = RegInt.getLimitedValue();
-    llvm::APInt SpaceInt(64, 0);
-    Binding->getSpace().substr(5).getAsInteger(10, SpaceInt);
-    Space = SpaceInt.getLimitedValue();
-  } else {
-    Space = 0;
-  }
-}
-
 void clang::CodeGen::CGHLSLRuntime::setHLSLEntryAttributes(
     const FunctionDecl *FD, llvm::Function *Fn) {
   const auto *ShaderAttr = FD->getAttr<HLSLShaderAttr>();
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h
index a9da42324a038..717d0d294be81 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -125,15 +125,6 @@ class CGHLSLRuntime {
   // End of reserved area for HLSL intrinsic getters.
   //===----------------------------------------------------------------------===//
 
-  struct BufferResBinding {
-    // The ID like 2 in register(b2, space1).
-    std::optional<unsigned> Reg;
-    // The Space like 1 is register(b2, space1).
-    // Default value is 0.
-    unsigned Space;
-    BufferResBinding(HLSLResourceBindingAttr *Attr);
-  };
-
 protected:
   CodeGenModule &CGM;
 
@@ -148,7 +139,6 @@ class CGHLSLRuntime {
   convertHLSLSpecificType(const Type *T,
                           SmallVector<unsigned> *Packoffsets = nullptr);
 
-  void annotateHLSLResource(const VarDecl *D, llvm::GlobalVariable *GV);
   void generateGlobalCtorDtorCalls();
 
   void addBuffer(const HLSLBufferDecl *D);
@@ -169,11 +159,6 @@ class CGHLSLRuntime {
   void emitInitListOpaqueValues(CodeGenFunction &CGF, InitListExpr *E);
 
 private:
-  void addBufferResourceAnnotation(llvm::GlobalVariable *GV,
-                                   llvm::hlsl::ResourceClass RC,
-                                   llvm::hlsl::ResourceKind RK, bool IsROV,
-                                   llvm::hlsl::ElementType ET,
-                                   BufferResBinding &Binding);
   void emitBufferGlobalsAndMetadata(const HLSLBufferDecl *BufDecl,
                                     llvm::GlobalVariable *BufGV);
   llvm::Triple::ArchType getArch();
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
index 989893bcaccec..f4ed6d552899f 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLResource.h
@@ -13,37 +13,15 @@
 #ifndef LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
 #define LLVM_FRONTEND_HLSL_HLSLRESOURCE_H
 
-#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DXILABI.h"
 
 namespace llvm {
-class GlobalVariable;
-class MDNode;
-
 namespace hlsl {
 
 // For now we use DXIL ABI enum values directly. This may change in the future.
 using dxil::ResourceClass;
-using dxil::ElementType;
 using dxil::ResourceKind;
 
-class FrontendResource {
-  MDNode *Entry;
-
-public:
-  FrontendResource(MDNode *E);
-  FrontendResource(GlobalVariable *GV, ResourceKind RK, ElementType ElTy,
-                   bool IsROV, uint32_t ResIndex, uint32_t Space);
-
-  GlobalVariable *getGlobalVariable();
-  StringRef getSourceType();
-  ResourceKind getResourceKind();
-  ElementType getElementType();
-  bool getIsROV();
-  uint32_t getResourceIndex();
-  uint32_t getSpace();
-  MDNode *getMetadata() { return Entry; }
-};
 } // namespace hlsl
 } // namespace llvm
 
diff --git a/llvm/lib/Frontend/HLSL/HLSLResource.cpp b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
index 48310d4f28e67..970edb9710cb6 100644
--- a/llvm/lib/Frontend/HLSL/HLSLResource.cpp
+++ b/llvm/lib/Frontend/HLSL/HLSLResource.cpp
@@ -11,59 +11,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Frontend/HLSL/HLSLResource.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Metadata.h"
 
 using namespace llvm;
 using namespace llvm::hlsl;
 
-GlobalVariable *FrontendResource::getGlobalVariable() {
-  return cast<GlobalVariable>(
-      cast<ConstantAsMetadata>(Entry->getOperand(0))->getValue());
-}
-
-ResourceKind FrontendResource::getResourceKind() {
-  return static_cast<ResourceKind>(
-      cast<ConstantInt>(
-          cast<ConstantAsMetadata>(Entry->getOperand(1))->getValue())
-          ->getLimitedValue());
-}
-ElementType FrontendResource::getElementType() {
-  return static_cast<ElementType>(
-      cast<ConstantInt>(
-          cast<ConstantAsMetadata>(Entry->getOperand(2))->getValue())
-          ->getLimitedValue());
-}
-bool FrontendResource::getIsROV() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(3))->getValue())
-      ->getLimitedValue();
-}
-uint32_t FrontendResource::getResourceIndex() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(4))->getValue())
-      ->getLimitedValue();
-}
-uint32_t FrontendResource::getSpace() {
-  return cast<ConstantInt>(
-             cast<ConstantAsMetadata>(Entry->getOperand(5))->getValue())
-      ->getLimitedValue();
-}
-
-FrontendResource::FrontendResource(MDNode *E) : Entry(E) {
-  assert(Entry->getNumOperands() == 6 && "Unexpected metadata shape");
-}
-
-FrontendResource::FrontendResource(GlobalVariable *GV, ResourceKind RK,
-                                   ElementType ElTy, bool IsROV,
-                                   uint32_t ResIndex, uint32_t Space) {
-  auto &Ctx = GV->getContext();
-  IRBuilder<> B(Ctx);
-  Entry = MDNode::get(
-      Ctx, {ValueAsMetadata::get(GV),
-            ConstantAsMetadata::get(B.getInt32(static_cast<int>(RK))),
-            ConstantAsMetadata::get(B.getInt32(static_cast<int>(ElTy))),
-            ConstantAsMetadata::get(B.getInt1(IsROV)),
-            ConstantAsMetadata::get(B.getInt32(ResIndex)),
-            ConstantAsMetadata::get(B.getInt32(Space))});
-}
+// Intentionally empty; this file can be removed when more cpp files are added
+// to the HLSLFrontend lib.

@@ -125,15 +125,6 @@ class CGHLSLRuntime {
// End of reserved area for HLSL intrinsic getters.
//===----------------------------------------------------------------------===//

struct BufferResBinding {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask how the buffer register number 2 is being stored when this goes away?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The register number and space are used in the llvm.dx.resource.handlefrombinding intrinsic call when the code to initialize the resource is generated. Then in the LLVM backed the DXILResourceBindingAnalysis analyzes the code and collects information about all the shader resources and their bindings based on these calls. This info is then used by other LLVM passes to make sure we generate the correct "dx.resources" metadata in the DXIL container.

ConstantAsMetadata::get(B.getInt32(ResIndex)),
ConstantAsMetadata::get(B.getInt32(Space))});
}
// Intentionally empty; this file can be removed when more cpp files are added
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind explaining why more cpp files being added later justifies the removal of this file later instead of now?
Is it because it's more convenient to unlink this file from the cmakelists when adding new cpp files and the cmakelists needs to be updated anyways?

Copy link
Member Author

@hekota hekota Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HLSLResource.cpp is currently the only file in the FrontendHLSL library. If I remove it the library does not have any source files, and the compiler/linker is not happy about that. I don't want to remove the whole library because I know more changes are coming in here soon (#125131), so I have decided to just leave it in with a comment.

Copy link
Contributor

@bob80905 bob80905 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hekota hekota changed the base branch from users/hekotas/pr-130323-remove-old-res-backend to main March 12, 2025 15:45
@hekota hekota merged commit 86329ba into llvm:main Mar 14, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 14, 2025

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

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/13788

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'lit :: googletest-timeout.py' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 9
not env -u FILECHECK_OPTS "/usr/bin/python3.10" /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit.py -j1 --order=lexical -v Inputs/googletest-timeout    --param gtest_filter=InfiniteLoopSubTest --timeout=1 > /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/Output/googletest-timeout.py.tmp.cmd.out
# executed command: not env -u FILECHECK_OPTS /usr/bin/python3.10 /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit.py -j1 --order=lexical -v Inputs/googletest-timeout --param gtest_filter=InfiniteLoopSubTest --timeout=1
# .---command stderr------------
# | lit.py: /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1 seconds was requested on the command line. Forcing timeout to be 1 seconds.
# `-----------------------------
# RUN: at line 11
FileCheck --check-prefix=CHECK-INF < /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/Output/googletest-timeout.py.tmp.cmd.out /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# executed command: FileCheck --check-prefix=CHECK-INF /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# RUN: at line 16
not env -u FILECHECK_OPTS "/usr/bin/python3.10" /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit.py -j1 --order=lexical -v Inputs/googletest-timeout   --param gtest_filter=InfiniteLoopSubTest  --param set_timeout=1   > /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/Output/googletest-timeout.py.tmp.cfgset.out
# executed command: not env -u FILECHECK_OPTS /usr/bin/python3.10 /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/utils/lit/lit.py -j1 --order=lexical -v Inputs/googletest-timeout --param gtest_filter=InfiniteLoopSubTest --param set_timeout=1
# RUN: at line 19
FileCheck --check-prefix=CHECK-INF < /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/Output/googletest-timeout.py.tmp.cfgset.out /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# executed command: FileCheck --check-prefix=CHECK-INF /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# .---command stderr------------
# | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py:34:14: error: CHECK-INF: expected string not found in input
# | # CHECK-INF: Timed Out: 1
# |              ^
# | <stdin>:13:29: note: scanning from here
# | Reached timeout of 1 seconds
# |                             ^
# | <stdin>:37:2: note: possible intended match here
# |  Timed Out: 2 (100.00%)
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/utils/lit/tests/googletest-timeout.py
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |             8:  
# |             9:  
# |            10: -- 
# |            11: exit: -9 
# |            12: -- 
# |            13: Reached timeout of 1 seconds 
# | check:34'0                                 X error: no match found
# |            14: ******************** 
# | check:34'0     ~~~~~~~~~~~~~~~~~~~~~
...

@damyanp damyanp moved this to Closed in HLSL Support Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category HLSL HLSL Language Support
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

[HLSL] Remove old resource annotations
5 participants