Skip to content

Conversation

hekota
Copy link
Member

@hekota hekota commented Oct 4, 2025

Adds GetDimensions methods to all supported buffer resource classes ({RW}Buffer, *StructuredBuffer, {RW}ByteAddressBuffer) . The method is implemented by calling one of both built-in functions __building_hlsl_buffer_getdimensions and __building_hlsl_buffer_getstride as described in proposal llvm/wg-hlsl#350.

The __building_hlsl_buffer_getstride is implemented directly by Clang codegen to set the buffer stride to the output variable.

The __building_hlsl_buffer_getdimensions built-in function gets translated to LLVM intrinsic @llvm.dx.resource.getdimensions.buffer. This intrinsic is specific to buffers and is going be translated to DXIL op op.dx.getDimensions in #161753.

Depends on #163605, #161909, and #163832.

Closes #112984

hekota added 4 commits October 3, 2025 13:59
Refactoring structured buffer tests to make it clearer that
- the test functions call the buffer methods
- the buffer methods are defined after each test function
- show what the buffer methods bodies look like
- use buffers with different element types, not just `float`
- use `llvm-cxxfilt` tool to de-mangle names
Test coverage for `Buffer` resource class was not sufficient. All of the typed buffer tests were using RWBuffer.
This change adds `Buffer` tests cases to several existing `RWBuffer-*.test` files and renames them to `TypedBuffer-*.test`.
Also adds new `TypedBuffers-methods.tests`.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen IR generation bugs: mangling, exceptions, etc. backend:DirectX HLSL HLSL Language Support llvm:ir labels Oct 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 4, 2025

@llvm/pr-subscribers-hlsl
@llvm/pr-subscribers-llvm-ir
@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-clang

Author: Helena Kotas (hekota)

Changes

Adds GetDimensions methods on all supported buffer resources.


Patch is 32.14 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/161929.diff

13 Files Affected:

  • (modified) clang/include/clang/Basic/Builtins.td (+12)
  • (modified) clang/lib/CodeGen/CGHLSLBuiltins.cpp (+61)
  • (modified) clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp (+77-3)
  • (modified) clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h (+2)
  • (modified) clang/lib/Sema/HLSLExternalSemaSource.cpp (+11)
  • (modified) clang/lib/Sema/SemaHLSL.cpp (+18)
  • (modified) clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl (+14)
  • (modified) clang/test/AST/HLSL/StructuredBuffers-AST.hlsl (+22)
  • (modified) clang/test/AST/HLSL/TypedBuffers-AST.hlsl (+14)
  • (modified) clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl (+52-1)
  • (modified) clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-ps.hlsl (+37)
  • (modified) clang/test/CodeGenHLSL/resources/TypedBuffers-methods.hlsl (+34)
  • (modified) llvm/include/llvm/IR/IntrinsicsDirectX.td (+4)
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index 468121f7d20ab..0b1587be51217 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4951,6 +4951,18 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> {
   let Prototype = "uint32_t(uint32_t)";
 }
 
+def HLSLResourceGetDimensions : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_buffer_getdimensions"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(...)";
+}
+
+def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_buffer_getstride"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(...)";
+}
+
 def HLSLAll : LangBuiltin<"HLSL_LANG"> {
   let Spellings = ["__builtin_hlsl_all"];
   let Attributes = [NoThrow, Const];
diff --git a/clang/lib/CodeGen/CGHLSLBuiltins.cpp b/clang/lib/CodeGen/CGHLSLBuiltins.cpp
index 6c0fc8d7f07be..373153e01c128 100644
--- a/clang/lib/CodeGen/CGHLSLBuiltins.cpp
+++ b/clang/lib/CodeGen/CGHLSLBuiltins.cpp
@@ -160,6 +160,58 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
   return LastInst;
 }
 
+static Value *emitDXILGetDimensions(CodeGenFunction *CGF, Value *Handle,
+                                    Value *MipLevel, LValue *OutArg0,
+                                    LValue *OutArg1 = nullptr,
+                                    LValue *OutArg2 = nullptr,
+                                    LValue *OutArg3 = nullptr) {
+  assert(OutArg0 && "first output argument is required");
+
+  llvm::Type *I32 = CGF->Int32Ty;
+  StructType *RetTy = llvm::StructType::get(I32, I32, I32, I32);
+
+  CallInst *CI = CGF->Builder.CreateIntrinsic(
+      RetTy, llvm::Intrinsic::dx_resource_getdimensions,
+      ArrayRef<Value *>{Handle, MipLevel});
+
+  Value *LastInst = nullptr;
+  unsigned OutArgIndex = 0;
+  for (LValue *OutArg : {OutArg0, OutArg1, OutArg2, OutArg3}) {
+    if (OutArg) {
+      Value *OutArgVal = CGF->Builder.CreateExtractValue(CI, OutArgIndex);
+      LastInst = CGF->Builder.CreateStore(OutArgVal, OutArg->getAddress());
+    }
+    ++OutArgIndex;
+  }
+  assert(LastInst && "no output argument stored?");
+  return LastInst;
+}
+
+static Value *emitBufferGetDimensions(CodeGenFunction *CGF, Value *Handle,
+                                      LValue &Dim) {
+  // Generate the call to get the buffer dimension.
+  switch (CGF->CGM.getTarget().getTriple().getArch()) {
+  case llvm::Triple::dxil:
+    return emitDXILGetDimensions(CGF, Handle, PoisonValue::get(CGF->Int32Ty),
+                                 &Dim);
+    break;
+  case llvm::Triple::spirv:
+    llvm_unreachable("SPIR-V GetDimensions codegen not implemented yet.");
+  default:
+    llvm_unreachable("GetDimensions not supported by target architecture");
+  }
+}
+
+static Value *emitBufferStride(CodeGenFunction *CGF, const Expr *HandleExpr,
+                               LValue &Stride) {
+  // Figure out the stride of the buffer elements from the handle type.
+  auto *HandleTy =
+      cast<HLSLAttributedResourceType>(HandleExpr->getType().getTypePtr());
+  QualType ElementTy = HandleTy->getContainedType();
+  Value *StrideValue = CGF->getTypeSize(ElementTy);
+  return CGF->Builder.CreateStore(StrideValue, Stride.getAddress());
+}
+
 // Return dot product intrinsic that corresponds to the QT scalar type
 static Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
   if (QT->isFloatingType())
@@ -359,6 +411,15 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
         RetTy, CGM.getHLSLRuntime().getNonUniformResourceIndexIntrinsic(),
         ArrayRef<Value *>{IndexOp});
   }
+  case Builtin::BI__builtin_hlsl_buffer_getdimensions: {
+    Value *Handle = EmitScalarExpr(E->getArg(0));
+    LValue Dim = EmitLValue(E->getArg(1));
+    return emitBufferGetDimensions(this, Handle, Dim);
+  }
+  case Builtin::BI__builtin_hlsl_buffer_getstride: {
+    LValue Stride = EmitLValue(E->getArg(1));
+    return emitBufferStride(this, E->getArg(0), Stride);
+  }
   case Builtin::BI__builtin_hlsl_all: {
     Value *Op0 = EmitScalarExpr(E->getArg(0));
     return Builder.CreateIntrinsic(
diff --git a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
index 3c20ccd799b2d..7c7c1e94dc1fe 100644
--- a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
+++ b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
@@ -57,6 +57,28 @@ CXXConstructorDecl *lookupCopyConstructor(QualType ResTy) {
       return CD;
   return nullptr;
 }
+
+ParameterABI convertParamModifierToParamABI(HLSLParamModifierAttr::Spelling Modifier) {
+  assert(Modifier != HLSLParamModifierAttr::Spelling::Keyword_in &&
+         "HLSL 'in' parameters modifier cannot be converted to ParameterABI");
+  switch (Modifier) {
+  case HLSLParamModifierAttr::Spelling::Keyword_out:
+    return ParameterABI::HLSLOut;
+  case HLSLParamModifierAttr::Spelling::Keyword_inout:
+    return ParameterABI::HLSLInOut;
+  default:
+    llvm_unreachable("Invalid HLSL parameter modifier");
+  }
+}
+
+QualType getInoutParameterType(ASTContext &AST, QualType Ty) {
+  assert(!Ty->isReferenceType() &&
+         "Pointer and reference types cannot be inout or out parameters");
+  Ty = AST.getLValueReferenceType(Ty);
+  Ty.addRestrict();
+  return Ty;
+}
+
 } // namespace
 
 // Builder for template arguments of builtin types. Used internally
@@ -421,13 +443,31 @@ BuiltinTypeMethodBuilder::addParam(StringRef Name, QualType Ty,
 void BuiltinTypeMethodBuilder::createDecl() {
   assert(Method == nullptr && "Method or constructor is already created");
 
-  // create method or constructor type
+  // create function prototype
   ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
   SmallVector<QualType> ParamTypes;
-  for (Param &MP : Params)
-    ParamTypes.emplace_back(MP.Ty);
+  SmallVector<FunctionType::ExtParameterInfo> ParamExtInfos(Params.size());
+  uint32_t ArgIndex = 0;
+  bool IsTemplate = DeclBuilder.Template != nullptr;
+  bool UseParamExtInfo = false;
+  for (Param &MP : Params) {
+    QualType Ty = MP.Ty;
+    if (MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
+      UseParamExtInfo = true;
+      ParamExtInfos[ArgIndex].withABI(convertParamModifierToParamABI(MP.Modifier));
+      // Only update types on inout and out parameters for non-templated
+      // methods. Templated types will have their inout/out parameters
+      // converted to references during template instantiation.
+      if (!IsTemplate)
+        Ty = getInoutParameterType(AST, Ty);
+    }
+    ParamTypes.emplace_back(Ty);
+    ++ArgIndex;
+  }
 
   FunctionProtoType::ExtProtoInfo ExtInfo;
+  if (UseParamExtInfo)
+    ExtInfo.ExtParameterInfos = ParamExtInfos.data();
   if (IsConst)
     ExtInfo.TypeQuals.addConst();
 
@@ -459,8 +499,10 @@ void BuiltinTypeMethodBuilder::createDecl() {
         AST.getTrivialTypeSourceInfo(MP.Ty, SourceLocation()), SC_None,
         nullptr);
     if (MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
+      //Parm->setType(getInoutParameterType(AST, Parm->getType()));
       auto *Mod =
           HLSLParamModifierAttr::Create(AST, SourceRange(), MP.Modifier);
+      Parm->setType(getInoutParameterType(AST, Parm->getType()));
       Parm->addAttr(Mod);
     }
     Parm->setScopeInfo(CurScopeDepth, I);
@@ -1127,5 +1169,37 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addConsumeMethod() {
       .finalize();
 }
 
+BuiltinTypeDeclBuilder &
+BuiltinTypeDeclBuilder::addGetDimensionsMethodForBuffer() {
+  using PH = BuiltinTypeMethodBuilder::PlaceHolder;
+  ASTContext &AST = SemaRef.getASTContext();
+  QualType UIntTy = AST.UnsignedIntTy;
+
+  QualType HandleTy = getResourceHandleField()->getType();
+  auto *AttrResTy = cast<HLSLAttributedResourceType>(HandleTy.getTypePtr());
+
+  // Structured buffers except {RW}ByteAddressBuffer have overload
+  // GetDimensions(out uint numStructs, out uint stride).
+  if (AttrResTy->getAttrs().RawBuffer &&
+      AttrResTy->getContainedType() != AST.Char8Ty) {
+    return BuiltinTypeMethodBuilder(*this, "GetDimensions", AST.VoidTy)
+        .addParam("numStructs", UIntTy, HLSLParamModifierAttr::Keyword_out)
+        .addParam("stride", UIntTy, HLSLParamModifierAttr::Keyword_out)
+        .callBuiltin("__builtin_hlsl_buffer_getdimensions", QualType(),
+                     PH::Handle, PH::_0)
+        .callBuiltin("__builtin_hlsl_buffer_getstride", QualType(), PH::Handle,
+                     PH::_1)
+        .finalize();
+  }
+
+  // Typed buffers and {RW}ByteAddressBuffer have overload
+  // GetDimensions(out uint dim).
+  return BuiltinTypeMethodBuilder(*this, "GetDimensions", AST.VoidTy)
+      .addParam("dim", UIntTy, HLSLParamModifierAttr::Keyword_out)
+      .callBuiltin("__builtin_hlsl_buffer_getdimensions", QualType(),
+                   PH::Handle, PH::_0)
+      .finalize();
+}
+
 } // namespace hlsl
 } // namespace clang
diff --git a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
index a981602a50461..920a2f07a16ad 100644
--- a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
+++ b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
@@ -95,6 +95,8 @@ class BuiltinTypeDeclBuilder {
   BuiltinTypeDeclBuilder &addAppendMethod();
   BuiltinTypeDeclBuilder &addConsumeMethod();
 
+  BuiltinTypeDeclBuilder &addGetDimensionsMethodForBuffer();
+
 private:
   BuiltinTypeDeclBuilder &addResourceMember(StringRef MemberName,
                                             ResourceClass RC, bool IsROV,
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index cc43e9474ea79..ce69e4987d6cd 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -380,6 +380,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
                     /*RawBuffer=*/false, /*HasCounter=*/false)
         .addArraySubscriptOperators()
         .addLoadMethods()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -392,6 +393,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
                     /*RawBuffer=*/false, /*HasCounter=*/false)
         .addArraySubscriptOperators()
         .addLoadMethods()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -404,6 +406,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
                     /*RawBuffer=*/false, /*HasCounter=*/false)
         .addArraySubscriptOperators()
         .addLoadMethods()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -415,6 +418,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
                     /*RawBuffer=*/true, /*HasCounter=*/false)
         .addArraySubscriptOperators()
         .addLoadMethods()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -428,6 +432,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
         .addLoadMethods()
         .addIncrementCounterMethod()
         .addDecrementCounterMethod()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -439,6 +444,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
     setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
                     /*RawBuffer=*/true, /*HasCounter=*/true)
         .addAppendMethod()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -450,6 +456,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
     setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
                     /*RawBuffer=*/true, /*HasCounter=*/true)
         .addConsumeMethod()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -464,6 +471,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
         .addLoadMethods()
         .addIncrementCounterMethod()
         .addDecrementCounterMethod()
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 
@@ -472,6 +480,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
   onCompletion(Decl, [this](CXXRecordDecl *Decl) {
     setupBufferType(Decl, *SemaPtr, ResourceClass::SRV, /*IsROV=*/false,
                     /*RawBuffer=*/true, /*HasCounter=*/false)
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
   Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "RWByteAddressBuffer")
@@ -479,6 +488,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
   onCompletion(Decl, [this](CXXRecordDecl *Decl) {
     setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/false,
                     /*RawBuffer=*/true, /*HasCounter=*/false)
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
   Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace,
@@ -487,6 +497,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() {
   onCompletion(Decl, [this](CXXRecordDecl *Decl) {
     setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, /*IsROV=*/true,
                     /*RawBuffer=*/true, /*HasCounter=*/false)
+        .addGetDimensionsMethodForBuffer()
         .completeDefinition();
   });
 }
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index fa30c66b62684..e3281c493da50 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -2978,6 +2978,24 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
     TheCall->setType(ResourceTy);
     break;
   }
+  case Builtin::BI__builtin_hlsl_buffer_getdimensions: {
+    ASTContext &AST = SemaRef.getASTContext();
+    if (SemaRef.checkArgCount(TheCall, 2) ||
+        CheckResourceHandle(&SemaRef, TheCall, 0) ||
+        CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
+        CheckModifiableLValue(&SemaRef, TheCall, 1))
+      return true;
+    break;
+  }
+  case Builtin::BI__builtin_hlsl_buffer_getstride: {
+    ASTContext &AST = SemaRef.getASTContext();
+    if (SemaRef.checkArgCount(TheCall, 2) ||
+        CheckResourceHandle(&SemaRef, TheCall, 0) ||
+        CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
+        CheckModifiableLValue(&SemaRef, TheCall, 1))
+      return true;
+    break;
+  }
   case Builtin::BI__builtin_hlsl_and:
   case Builtin::BI__builtin_hlsl_or: {
     if (SemaRef.checkArgCount(TheCall, 2))
diff --git a/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl b/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
index 43d8ddee6ccad..a2058b29401c0 100644
--- a/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
+++ b/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl
@@ -142,5 +142,19 @@ RESOURCE Buffer;
 // CHECK-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]'
 // CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
 
+// GetDimensions method
+
+// CHECK-NEXT: CXXMethodDecl {{.*}} GetDimensions 'void (unsigned int &__restrict)'
+// CHECK-NEXT: ParmVarDecl {{.*}} dim 'unsigned int &__restrict'
+// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CallExpr {{.*}} 'void'
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
+// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_buffer_getdimensions' 'void (...) noexcept'
+// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
+// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue implicit this
+// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}}  'dim' 'unsigned int &__restrict'
+// CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
+
 // CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'const char8_t &(unsigned int) const'
 // CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'char8_t &(unsigned int)'
diff --git a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
index 6779abb10bec4..e5f4b22fe2a10 100644
--- a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
+++ b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl
@@ -334,6 +334,28 @@ RESOURCE<float> Buffer;
 // CHECK-CONSUME-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
 // CHECK-CONSUME-NEXT: IntegerLiteral {{.*}} 'int' -1
 
+// GetDimensions method
+
+// CHECK: CXXMethodDecl {{.*}} GetDimensions 'void (unsigned int, unsigned int)'
+// CHECK-NEXT: ParmVarDecl {{.*}} numStructs 'unsigned int &__restrict'
+// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
+// CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int &__restrict'
+// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CallExpr {{.*}} 'void'
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
+// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_buffer_getdimensions' 'void (...) noexcept'
+// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
+// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
+// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}}  'numStructs' 'unsigned int &__restrict'
+// CHECK-NEXT: CallExpr {{.*}} 'void'
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
+// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_buffer_getstride' 'void (...) noexcept'
+// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
+// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
+// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}}  'stride' 'unsigned int &__restrict'
+// CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
+
 // CHECK: ClassTemplateSpecializationDecl {{.*}} class [[RESOURCE]] definition
 // CHECK: TemplateArgument type 'float'
 // CHECK-NEXT: BuiltinType {{.*}} 'float'
diff --git a/clang/test/AST/HLSL/TypedBuffers-AST.hlsl b/clang/test/AST/HLSL/TypedBuffers-AST.hlsl
index 5182ce194cfb0..07f04001a58ae 100644
--- a/clang/test/AST/HLSL/TypedBuffers-AST.hlsl
+++ b/clang/test/AST/HLSL/TypedBuffers-AST.hlsl
@@ -214,6 +214,20 @@ RESOURCE<float> Buffer;
 // CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}}  'Index' 'unsigned int'
 // CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
 
+// GetDimensions method
+
+// CHECK-NEXT: CXXMethodDecl {{.*}} GetDimensions 'void (unsigned int)'
+// CHECK-NEXT: ParmVarDecl {{.*}} dim 'unsigned int &__restrict'
+// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CallExpr {{.*}} 'void'
+// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
+// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_buffer_getdimensions' 'void (...) noexcept'
+// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
+// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
+// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}}  'dim' 'unsigned int &__restrict'
+// CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
+
 // CHECK: ClassTemplateSpecializationDecl {{.*}} class [[RESOURCE]] definition
 
 // CHECK: TemplateArgument type 'float'
diff --git a/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl b/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl
index a506c2b50b1dc..c3bb147ad4a53 100644
--- a/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl
+++ b/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl
@@ -82,7 +82,7 @@ export float TestLoad() {
     return RWSB1.Load(1) + SB1.Load(2);
 }
 
-// CHECK: define noundef nofpclass(nan inf) float @TestLoad()()
+// CHECK: define {{.*}} float @TestLoad()()
 // CHECK: call {{.*}} float @hlsl::RWStructuredBuffer<float>::Load(unsigned int)(ptr {{.*}} @RWSB1, i32 noundef 1)
 // CHECK: call {{.*}} float @hlsl::StructuredBuffer<float>::Load(unsigned int)(ptr ...
[truncated]

Copy link

github-actions bot commented Oct 4, 2025

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

Adds GetDimensions methods on all supported buffer resources.
@hekota hekota force-pushed the buffers-get-dimensions branch from 63dcefa to e509189 Compare October 4, 2025 00:49
@hekota hekota linked an issue Oct 7, 2025 that may be closed by this pull request
@hekota
Copy link
Member Author

hekota commented Oct 9, 2025

After conversation with @bogner and some testing I have realized it is better to have multiple LLVM intrinsic to implement the GetDimensions. I have updated this PR to use a getdimensions intrinsic specific just for buffers.

@hekota hekota requested a review from bogner October 9, 2025 05:45
}
ParamTypes.emplace_back(Ty);
++ArgIndex;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of doing this on the params here, could put the attributes on the ParmVarDecls in the loop over Params below?

At a minimum that would ensure that the AST for these functions matches the AST for user-written code, but it may also remove the need for the convertParamModifierToParamABI function since you'll have a created ParameterABI attribute in the AST.

Copy link
Member Author

@hekota hekota Oct 15, 2025

Choose a reason for hiding this comment

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

I tried different combinations of the out attribute, ABI param and when to add restrict & on the function prototype or the method decl - this is the variation that works and does not have to 'coerce' the arguments. However, I did some testing now and found a bug in with out parameters and templates:

https://godbolt.org/z/dKn1r4v4E

I'll file an issue #163648. We'll need to fix this bug first before revisiting this.

Copy link
Member Author

@hekota hekota Oct 16, 2025

Choose a reason for hiding this comment

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

Bug fix in review: #163832

I have updated createDecl code always change the type of inout and out parameter to a reference - unless the parameter type is dependent on the template instantiation. It turns out it is needed for both the function prototype (ABI params & type) and for the param list on the decl.

I also had a bug in how the ABI params were set (or not set, actually), which is why the function prototype string did not include the out modifier in the AST dump. This is now fixed.

@hekota
Copy link
Member Author

hekota commented Oct 15, 2025

Changing to draft until #163648 is resolved.

@hekota hekota marked this pull request as draft October 15, 2025 22:10
@hekota hekota marked this pull request as ready for review October 16, 2025 21:22
@hekota hekota changed the base branch from users/hekota/pr161909+pr161908 to main October 17, 2025 16:28
@hekota hekota merged commit 024dd56 into llvm:main Oct 17, 2025
10 of 11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 17, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building clang at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[275/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/TreeTest.cpp.o
[276/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/ASTUnitTest.cpp.o
[277/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/FixedPointString.cpp.o
[278/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/SourceCodeBuildersTest.cpp.o
[279/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/ToolingTest.cpp.o
[280/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RefactoringCallbacksTest.cpp.o
[281/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RefactoringTest.cpp.o
[282/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/CodeGen/CheckTargetFeaturesTest.cpp.o
[283/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/BuildTreeTest.cpp.o
[284/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o
FAILED: tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Tooling -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o -MF tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o.d -o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/AST/ASTImporterTest.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[285/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/CompilerInstanceTest.cpp.o
[286/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/CodeGenActionTest.cpp.o
[287/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/PCHPreambleTest.cpp.o
[288/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/ReparseWorkingDirTest.cpp.o
[289/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/OutputStreamTest.cpp.o
[290/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/SearchPathTest.cpp.o
[291/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/UtilsTest.cpp.o
[292/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Rewrite/RewriterTest.cpp.o
[293/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/SourceCodeTest.cpp.o
[294/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/CompilerInvocationTest.cpp.o
[295/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTestPostOrderVisitor.cpp.o
[296/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/TokensTest.cpp.o
[297/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/StencilTest.cpp.o
[298/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/ModuleCacheTest.cpp.o
[299/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/PreambleInNamedModulesTest.cpp.o
[300/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/FrontendActionTest.cpp.o
[301/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/LoadSpecLazilyTest.cpp.o
[302/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/CodeGen/TBAAMetadataTest.cpp.o
[303/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksCompoundAssignOperator.cpp.o
[304/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Index/IndexTests.cpp.o
[305/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksBinaryOperator.cpp.o
[306/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksLeaf.cpp.o
[307/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/CodeGen/CodeGenExternalTest.cpp.o
[308/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/CodeGen/BufferSourceTest.cpp.o
[309/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksCallExpr.cpp.o
[310/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/NoCommentsTest.cpp.o
[311/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersNarrowingTest.cpp.o
[312/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/ForceCheckFileInputTest.cpp.o
[313/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/TransformerTest.cpp.o
[314/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersTraversalTest.cpp.o
[315/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/VarDeclConstantInitTest.cpp.o
[316/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Frontend/NoAlterCodeGenActionTest.cpp.o
[317/404] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksUnaryOperator.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 17, 2025

LLVM Buildbot has detected a new failure on builder hip-third-party-libs-test running on ext_buildbot_hw_05-hip-docker while building clang at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/hip-tpl.py --jobs=32' (failure)
...
-- Kokkos Backends: SERIAL;HIP
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build
[4/8] Performing build step for 'TestKokkosHIP'
[1/3] cd /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build && /usr/bin/cmake -DRUN_CHECK_GIT_VERSION=1 -DKOKKOS_SOURCE_DIR=/opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP -P /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP/cmake/build_env_info.cmake
[5/8] No install step for 'TestKokkosHIP'
[6/8] No test step for 'TestKokkosHIP'
[7/8] Completed 'TestKokkosHIP'
[8/8] cd /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build && /usr/bin/cmake -E env GTEST_FILTER=-hip.atomics:hip.bit_manip_bit_ceil ctest
FAILED: External/HIP/CMakeFiles/test-kokkos /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/CMakeFiles/test-kokkos 
cd /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build && /usr/bin/cmake -E env GTEST_FILTER=-hip.atomics:hip.bit_manip_bit_ceil ctest
Test project /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build
      Start  1: Kokkos_CoreUnitTest_Serial_ViewSupport
 1/54 Test  #1: Kokkos_CoreUnitTest_Serial_ViewSupport .....................   Passed    0.39 sec
      Start  2: Kokkos_CoreUnitTest_HIP_ViewSupport
 2/54 Test  #2: Kokkos_CoreUnitTest_HIP_ViewSupport ........................   Passed    0.40 sec
      Start  3: Kokkos_CoreUnitTest_Serial1
 3/54 Test  #3: Kokkos_CoreUnitTest_Serial1 ................................   Passed   13.68 sec
      Start  4: Kokkos_CoreUnitTest_Serial2
 4/54 Test  #4: Kokkos_CoreUnitTest_Serial2 ................................   Passed   17.53 sec
      Start  5: Kokkos_CoreUnitTest_HIP
 5/54 Test  #5: Kokkos_CoreUnitTest_HIP ....................................   Passed  269.39 sec
      Start  6: Kokkos_CoreUnitTest_HIPInterOpInit
 6/54 Test  #6: Kokkos_CoreUnitTest_HIPInterOpInit .........................   Passed    0.34 sec
      Start  7: Kokkos_CoreUnitTest_HIPInterOpStreams
 7/54 Test  #7: Kokkos_CoreUnitTest_HIPInterOpStreams ......................   Passed    0.71 sec
      Start  8: Kokkos_CoreUnitTest_HIPInterOpGraph
 8/54 Test  #8: Kokkos_CoreUnitTest_HIPInterOpGraph ........................   Passed    0.35 sec
      Start  9: Kokkos_CoreUnitTest_Default
 9/54 Test  #9: Kokkos_CoreUnitTest_Default ................................   Passed    0.53 sec
      Start 10: Kokkos_CoreUnitTest_LegionInitialization
10/54 Test #10: Kokkos_CoreUnitTest_LegionInitialization ...................   Passed    0.34 sec
      Start 11: Kokkos_CoreUnitTest_PushFinalizeHook
11/54 Test #11: Kokkos_CoreUnitTest_PushFinalizeHook .......................   Passed    0.33 sec
      Start 12: Kokkos_CoreUnitTest_ScopeGuard
12/54 Test #12: Kokkos_CoreUnitTest_ScopeGuard .............................   Passed   16.70 sec
      Start 13: Kokkos_CoreUnitTest_Develop
13/54 Test #13: Kokkos_CoreUnitTest_Develop ................................   Passed    4.08 sec
      Start 14: Kokkos_CoreUnitTest_PushFinalizeHookTerminateRegex
14/54 Test #14: Kokkos_CoreUnitTest_PushFinalizeHookTerminateRegex .........   Passed    0.51 sec
      Start 15: Kokkos_CoreUnitTest_PushFinalizeHookTerminateFails
15/54 Test #15: Kokkos_CoreUnitTest_PushFinalizeHookTerminateFails .........   Passed    0.74 sec
      Start 16: Kokkos_CoreUnitTest_KokkosP
16/54 Test #16: Kokkos_CoreUnitTest_KokkosP ................................   Passed    0.80 sec
      Start 17: Kokkos_CoreUnitTest_ToolIndependence
17/54 Test #17: Kokkos_CoreUnitTest_ToolIndependence .......................   Passed    0.03 sec
      Start 18: Kokkos_ProfilingTestLibraryLoadHelp
18/54 Test #18: Kokkos_ProfilingTestLibraryLoadHelp ........................   Passed    0.82 sec
Step 11 (run kokkos test suite) failure: run kokkos test suite (failure)
...
-- Kokkos Backends: SERIAL;HIP
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build
[4/8] Performing build step for 'TestKokkosHIP'
[1/3] cd /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build && /usr/bin/cmake -DRUN_CHECK_GIT_VERSION=1 -DKOKKOS_SOURCE_DIR=/opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP -P /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP/cmake/build_env_info.cmake
[5/8] No install step for 'TestKokkosHIP'
[6/8] No test step for 'TestKokkosHIP'
[7/8] Completed 'TestKokkosHIP'
[8/8] cd /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build && /usr/bin/cmake -E env GTEST_FILTER=-hip.atomics:hip.bit_manip_bit_ceil ctest
FAILED: External/HIP/CMakeFiles/test-kokkos /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/CMakeFiles/test-kokkos 
cd /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build && /usr/bin/cmake -E env GTEST_FILTER=-hip.atomics:hip.bit_manip_bit_ceil ctest
Test project /opt/botworker/llvm/llvm-test-suite/TS-build/External/HIP/TestKokkosHIP-prefix/src/TestKokkosHIP-build
      Start  1: Kokkos_CoreUnitTest_Serial_ViewSupport
 1/54 Test  #1: Kokkos_CoreUnitTest_Serial_ViewSupport .....................   Passed    0.39 sec
      Start  2: Kokkos_CoreUnitTest_HIP_ViewSupport
 2/54 Test  #2: Kokkos_CoreUnitTest_HIP_ViewSupport ........................   Passed    0.40 sec
      Start  3: Kokkos_CoreUnitTest_Serial1
 3/54 Test  #3: Kokkos_CoreUnitTest_Serial1 ................................   Passed   13.68 sec
      Start  4: Kokkos_CoreUnitTest_Serial2
 4/54 Test  #4: Kokkos_CoreUnitTest_Serial2 ................................   Passed   17.53 sec
      Start  5: Kokkos_CoreUnitTest_HIP
 5/54 Test  #5: Kokkos_CoreUnitTest_HIP ....................................   Passed  269.39 sec
      Start  6: Kokkos_CoreUnitTest_HIPInterOpInit
 6/54 Test  #6: Kokkos_CoreUnitTest_HIPInterOpInit .........................   Passed    0.34 sec
      Start  7: Kokkos_CoreUnitTest_HIPInterOpStreams
 7/54 Test  #7: Kokkos_CoreUnitTest_HIPInterOpStreams ......................   Passed    0.71 sec
      Start  8: Kokkos_CoreUnitTest_HIPInterOpGraph
 8/54 Test  #8: Kokkos_CoreUnitTest_HIPInterOpGraph ........................   Passed    0.35 sec
      Start  9: Kokkos_CoreUnitTest_Default
 9/54 Test  #9: Kokkos_CoreUnitTest_Default ................................   Passed    0.53 sec
      Start 10: Kokkos_CoreUnitTest_LegionInitialization
10/54 Test #10: Kokkos_CoreUnitTest_LegionInitialization ...................   Passed    0.34 sec
      Start 11: Kokkos_CoreUnitTest_PushFinalizeHook
11/54 Test #11: Kokkos_CoreUnitTest_PushFinalizeHook .......................   Passed    0.33 sec
      Start 12: Kokkos_CoreUnitTest_ScopeGuard
12/54 Test #12: Kokkos_CoreUnitTest_ScopeGuard .............................   Passed   16.70 sec
      Start 13: Kokkos_CoreUnitTest_Develop
13/54 Test #13: Kokkos_CoreUnitTest_Develop ................................   Passed    4.08 sec
      Start 14: Kokkos_CoreUnitTest_PushFinalizeHookTerminateRegex
14/54 Test #14: Kokkos_CoreUnitTest_PushFinalizeHookTerminateRegex .........   Passed    0.51 sec
      Start 15: Kokkos_CoreUnitTest_PushFinalizeHookTerminateFails
15/54 Test #15: Kokkos_CoreUnitTest_PushFinalizeHookTerminateFails .........   Passed    0.74 sec
      Start 16: Kokkos_CoreUnitTest_KokkosP
16/54 Test #16: Kokkos_CoreUnitTest_KokkosP ................................   Passed    0.80 sec
      Start 17: Kokkos_CoreUnitTest_ToolIndependence
17/54 Test #17: Kokkos_CoreUnitTest_ToolIndependence .......................   Passed    0.03 sec
      Start 18: Kokkos_ProfilingTestLibraryLoadHelp
18/54 Test #18: Kokkos_ProfilingTestLibraryLoadHelp ........................   Passed    0.82 sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:DirectX clang:codegen IR generation bugs: mangling, exceptions, etc. clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category HLSL HLSL Language Support llvm:ir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HLSL] Implement GetDimensions methods for buffer resources

6 participants