Skip to content

[HLSL][RootSignature] Implement serialization of RootConstants and RootFlags #141130

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 3 commits into from
May 29, 2025

Conversation

inbelic
Copy link
Contributor

@inbelic inbelic commented May 22, 2025

  • Implements serialization of the currently completely defined RootElements, namely RootConstants and RootFlags
  • Adds unit testing for the serialization methods

Resolves: #138190 and #138192

@llvmbot llvmbot added the HLSL HLSL Language Support label May 22, 2025
@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-hlsl

Author: Finn Plummer (inbelic)

Changes
  • Implements serialization of the currently completely defined RootElements, namely RootConstants and RootFlags
  • Adds unit testing for the serialization methods

Resolves: #138190 and #138192


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

3 Files Affected:

  • (modified) llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h (+4)
  • (modified) llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp (+73)
  • (modified) llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp (+69)
diff --git a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
index 7e7eeec0deb52..dbf7adf660012 100644
--- a/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
+++ b/llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h
@@ -46,6 +46,8 @@ enum class RootFlags : uint32_t {
   ValidFlags = 0x00000fff
 };
 
+raw_ostream &operator<<(raw_ostream &OS, const RootFlags &Flags);
+
 enum class DescriptorRangeFlags : unsigned {
   None = 0,
   DescriptorsVolatile = 0x1,
@@ -85,6 +87,8 @@ struct RootConstants {
   ShaderVisibility Visibility = ShaderVisibility::All;
 };
 
+raw_ostream &operator<<(raw_ostream &OS, const RootConstants &Constants);
+
 using DescriptorType = llvm::dxil::ResourceClass;
 // Models RootDescriptor : CBV | SRV | UAV, by collecting like parameters
 struct RootDescriptor {
diff --git a/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp b/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp
index ec0d130a6767c..6e0e0cdcd5946 100644
--- a/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp
+++ b/llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp
@@ -132,6 +132,79 @@ static raw_ostream &operator<<(raw_ostream &OS,
   return OS;
 }
 
+raw_ostream &operator<<(raw_ostream &OS, const RootFlags &Flags) {
+  OS << "RootFlags(";
+  bool FlagSet = false;
+  unsigned Remaining = llvm::to_underlying(Flags);
+  while (Remaining) {
+    unsigned Bit = 1u << llvm::countr_zero(Remaining);
+    if (Remaining & Bit) {
+      if (FlagSet)
+        OS << " | ";
+
+      switch (static_cast<RootFlags>(Bit)) {
+      case RootFlags::AllowInputAssemblerInputLayout:
+        OS << "AllowInputAssemblerInputLayout";
+        break;
+      case RootFlags::DenyVertexShaderRootAccess:
+        OS << "DenyVertexShaderRootAccess";
+        break;
+      case RootFlags::DenyHullShaderRootAccess:
+        OS << "DenyHullShaderRootAccess";
+        break;
+      case RootFlags::DenyDomainShaderRootAccess:
+        OS << "DenyDomainShaderRootAccess";
+        break;
+      case RootFlags::DenyGeometryShaderRootAccess:
+        OS << "DenyGeometryShaderRootAccess";
+        break;
+      case RootFlags::DenyPixelShaderRootAccess:
+        OS << "DenyPixelShaderRootAccess";
+        break;
+      case RootFlags::AllowStreamOutput:
+        OS << "AllowStreamOutput";
+        break;
+      case RootFlags::LocalRootSignature:
+        OS << "LocalRootSignature";
+        break;
+      case RootFlags::DenyAmplificationShaderRootAccess:
+        OS << "DenyAmplificationShaderRootAccess";
+        break;
+      case RootFlags::DenyMeshShaderRootAccess:
+        OS << "DenyMeshShaderRootAccess";
+        break;
+      case RootFlags::CBVSRVUAVHeapDirectlyIndexed:
+        OS << "CBVSRVUAVHeapDirectlyIndexed";
+        break;
+      case RootFlags::SamplerHeapDirectlyIndexed:
+        OS << "SamplerHeapDirectlyIndexed";
+        break;
+      default:
+        OS << "invalid: " << Bit;
+        break;
+      }
+
+      FlagSet = true;
+    }
+    Remaining &= ~Bit;
+  }
+
+  if (!FlagSet)
+    OS << "None";
+
+  OS << ")";
+
+  return OS;
+}
+
+raw_ostream &operator<<(raw_ostream &OS, const RootConstants &Constants) {
+  OS << "RootConstants(num32BitConstants = " << Constants.Num32BitConstants
+     << ", " << Constants.Reg << ", space = " << Constants.Space
+     << ", visibility = " << Constants.Visibility << ")";
+
+  return OS;
+}
+
 raw_ostream &operator<<(raw_ostream &OS, const DescriptorTable &Table) {
   OS << "DescriptorTable(numClauses = " << Table.NumClauses
      << ", visibility = " << Table.Visibility << ")";
diff --git a/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp b/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp
index 3f92fa0f05794..8597ed78b4fbb 100644
--- a/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp
+++ b/llvm/unittests/Frontend/HLSLRootSignatureDumpTest.cpp
@@ -108,4 +108,73 @@ TEST(HLSLRootSignatureTest, DescriptorTableDump) {
   EXPECT_EQ(Out, Expected);
 }
 
+TEST(HLSLRootSignatureTest, DefaultRootConstantsDump) {
+  RootConstants Constants;
+  Constants.Num32BitConstants = 1;
+  Constants.Reg = {RegisterType::BReg, 3};
+
+  std::string Out;
+  llvm::raw_string_ostream OS(Out);
+  OS << Constants;
+  OS.flush();
+
+  std::string Expected = "RootConstants(num32BitConstants = 1, b3, space = 0, "
+                         "visibility = All)";
+  EXPECT_EQ(Out, Expected);
+}
+
+TEST(HLSLRootSignatureTest, SetRootConstantsDump) {
+  RootConstants Constants;
+  Constants.Num32BitConstants = 983;
+  Constants.Reg = {RegisterType::BReg, 34593};
+  Constants.Space = 7;
+  Constants.Visibility = ShaderVisibility::Pixel;
+
+  std::string Out;
+  llvm::raw_string_ostream OS(Out);
+  OS << Constants;
+  OS.flush();
+
+  std::string Expected = "RootConstants(num32BitConstants = 983, b34593, "
+                         "space = 7, visibility = Pixel)";
+  EXPECT_EQ(Out, Expected);
+}
+
+TEST(HLSLRootSignatureTest, NoneRootFlagsDump) {
+  RootFlags Flags = RootFlags::None;
+
+  std::string Out;
+  llvm::raw_string_ostream OS(Out);
+  OS << Flags;
+  OS.flush();
+
+  std::string Expected = "RootFlags(None)";
+  EXPECT_EQ(Out, Expected);
+}
+
+TEST(HLSLRootSignatureTest, AllRootFlagsDump) {
+  RootFlags Flags = RootFlags::ValidFlags;
+
+  std::string Out;
+  llvm::raw_string_ostream OS(Out);
+  OS << Flags;
+  OS.flush();
+
+  std::string Expected = "RootFlags("
+                         "AllowInputAssemblerInputLayout | "
+                         "DenyVertexShaderRootAccess | "
+                         "DenyHullShaderRootAccess | "
+                         "DenyDomainShaderRootAccess | "
+                         "DenyGeometryShaderRootAccess | "
+                         "DenyPixelShaderRootAccess | "
+                         "AllowStreamOutput | "
+                         "LocalRootSignature | "
+                         "DenyAmplificationShaderRootAccess | "
+                         "DenyMeshShaderRootAccess | "
+                         "CBVSRVUAVHeapDirectlyIndexed | "
+                         "SamplerHeapDirectlyIndexed)";
+
+  EXPECT_EQ(Out, Expected);
+}
+
 } // namespace

@inbelic
Copy link
Contributor Author

inbelic commented May 23, 2025

Ugh, sorry.

Day 0 since last push before changing target branch...

@inbelic inbelic merged commit 66889bf into llvm:main May 29, 2025
6 of 10 checks passed
@jplehr
Copy link
Contributor

jplehr commented May 29, 2025

I think this patch caused some issues on our buildbot: https://lab.llvm.org/buildbot/#/builders/10/builds/6308
Can you please take a look at this?

FAILED: tools/clang/unittests/AllClangUnitTests 
: && /usr/bin/c++ -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-redundant-move -Wno-pessimizing-move -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 -fno-strict-aliasing -O3 -DNDEBUG -Wl,--gc-sections tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/DependencyDirectivesScannerTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/HeaderMapTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/HeaderSearchTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/LexerTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/LexHLSLRootSignatureTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/ModuleDeclStateTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/PPCallbacksTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/PPConditionalDirectiveRecordTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/PPDependencyDirectivesTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Lex/PPMemoryAllocationsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Parse/ParseHLSLRootSignatureTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/DistroTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/DXCModeTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/GCCVersionTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/ToolChainTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/ModuleCacheTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/MultilibBuilderTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/MultilibTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Driver/SanitizerArgsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CFGDominatorTree.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CFGTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/CloneDetectionTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/ExprMutationAnalyzerTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/IntervalPartitionTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/MacroExpansionContextTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/UnsafeBufferUsageTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ArenaTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ASTOpsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/CFGMatchSwitchTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/CachedConstAccessorsLatticeTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ChromiumCheckModelTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DebugSupportTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/DeterminismTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/LoggerTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/Ma
ls/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/MultiVarConstantPropagationTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/RecordOpsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SignAnalysisTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SimplifyConstraintsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SingleVarConstantPropagationTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/SmartPointerAccessorCachingTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TestingSupport.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TestingSupportTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TransferBranchTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TransferTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/ValueTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Analysis/FlowSensitive/WatchedLiteralsSolverTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/AnalyzerOptionsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/APSIntTypeTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/BlockEntranceCallbackTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/BugReportInterestingnessTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CallDescriptionTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CallEventTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/ConflictingEvalCallsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/ExprEngineVisitTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/IsCLibraryFunctionTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/MemRegionDescriptiveNameTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/ObjcBug-124477.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/ParamRegionTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/RangeSetTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/RegisterCustomCheckersTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/StoreTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/SymbolReaperTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/SValSimplifyerTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/SValTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/TestReturnValueUnderConstruction.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/Z3CrosscheckOracleTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersInternalTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersNodeTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersNarrowingTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersTraversalTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/GtestMatch
ittests/CMakeFiles/AllClangUnitTests.dir/Tooling/FixItTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/HeaderAnalysisTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/HeaderIncludesTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/StandardLibraryTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/LookupTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/QualTypeNamesTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RangeSelectorTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/DependencyScanning/DependencyScannerTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/DependencyScanning/DependencyScanningFilesystemTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/Attr.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksLeaf.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksUnaryOperator.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksBinaryOperator.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksCompoundAssignOperator.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksCallExpr.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/Class.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/Concept.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/ConstructExpr.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CXXBoolLiteralExpr.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CXXOperatorCallExprTraverser.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/DeductionGuide.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/ImplicitCtor.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/ImplicitCtorInitializer.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/IntegerLiteral.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/LambdaDefaultCapture.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/MemberPointerTypeLoc.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/NestedNameSpecifiers.cpp.o tools/clang/unittests/CMa
.dir/CodeGen/TBAAMetadataTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/CodeGen/CheckTargetFeaturesTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/libclang/LibclangTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/DirectoryWatcher/DirectoryWatcherTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Index/IndexTests.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/InstallAPI/HeaderFileTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/InstallAPI/FileListTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/ForceCheckFileInputTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/InMemoryModuleCacheTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/ModuleCacheTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/NoCommentsTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/PreambleInNamedModulesTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/LoadSpecLazilyTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/SourceLocationEncodingTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Serialization/VarDeclConstantInitTest.cpp.o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Support/TimeProfilerTest.cpp.o -o tools/clang/unittests/AllClangUnitTests  -Wl,-rpath,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib  lib/libllvm_gtest_main.so.21.0git  lib/libLLVMTestingAnnotations.so.21.0git  lib/libclangTesting.so.21.0git  lib/libclang.so.21.0.0git  lib/libclangDirectoryWatcher.so.21.0git  lib/libLLVMTestingSupport.so.21.0git  lib/libclangAnalysisFlowSensitiveModels.so.21.0git  lib/libclangDynamicASTMatchers.so.21.0git  lib/libclangDependencyScanning.so.21.0git  lib/libclangToolingInclusionsStdlib.so.21.0git  lib/libclangTransformer.so.21.0git  lib/libclangToolingSyntax.so.21.0git  lib/libclangFrontendTool.so.21.0git  lib/libclangCodeGen.so.21.0git  lib/libclangTooling.so.21.0git  lib/libllvm_gtest.so.21.0git  lib/libLLVMX86CodeGen.so.21.0git  lib/libLLVMX86AsmParser.so.21.0git  lib/libLLVMX86Desc.so.21.0git  lib/libLLVMX86Disassembler.so.21.0git  lib/libLLVMX86Info.so.21.0git  lib/libLLVMAMDGPUCodeGen.so.21.0git  lib/libLLVMAMDGPUAsmParser.so.21.0git  lib/libLLVMAMDGPUDisassembler.so.21.0git  lib/libLLVMAMDGPUDesc.so.21.0git  lib/libLLVMAMDGPUInfo.so.21.0git  lib/libLLVMAMDGPUUtils.so.21.0git  lib/libclangAnalysisFlowSensitive.so.21.0git  lib/libclangToolingRefactoring.so.21.0git  lib/libclangStaticAnalyzerFrontend.so.21.0git  lib/libclangStaticAnalyzerCore.so.21.0git  lib/libclangCrossTU.so.21.0git  lib/libclangIndex.so.21.0git  lib/libclangFormat.so.21.0git  lib/libclangToolingInclusions.so.21.0git  lib/libclangToolingCore.so.21.0git  lib/libclangInstallAPI.so.21.0git  lib/libclangFrontend.so.21.0git  lib/libclangParse.so.21.0git  lib/libclangDriver.so.21.0git  lib/libLLVMOption.so.21.0git  lib/libclangSerialization.so.21.0git  lib/libclangSema.so.21.0git  lib/libclangAnalysis.so.21.0git  lib/libclangASTMatchers.so.21.0git  lib/libclangRewrite.so.21.0git  lib/libclangAST.so.21.0git  lib/libclangLex.so.21.0git  lib/libclangBasic.so.21.0git  lib/libLLVMFrontendOpenMP.so.21.0git  lib/libLLVMMC.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMBitstreamReader.so.21.0git  lib/libLLVMTargetParser.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib && :
/usr/bin/ld: tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Parse/ParseHLSLRootSignatureTest.cpp.o: undefined reference to symbol '_ZN4llvm4hlsl7rootsiglsERNS_11raw_ostreamERKNS1_9RootFlagsE'
/usr/bin/ld: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib/libLLVMFrontendHLSL.so.21.0git: error adding symbols: DSO missing from command line

@inbelic
Copy link
Contributor Author

inbelic commented May 29, 2025

@jplehr Thanks for letting me know. This commit is responsible. I will revert and reland with the required linking change to:
clang/unittests/Parse/CMakeLists.txt

@jplehr
Copy link
Contributor

jplehr commented May 29, 2025

Thank you. If it's just missing linker flags, I'm good if you just fix forward.

inbelic added a commit that referenced this pull request May 29, 2025
…ts` and `RootFlags`" (#142005)

The commit caused build failures,
[here](https://lab.llvm.org/buildbot/#/builders/10/builds/6308), due to
a missing linked llvm library (HLSLFrontend) into
`clang/unittests/Parse/CMakeLists.txt`.

While it seems like the fix is straightforwardly to just add this
library, I will revert now to build and verify locally it correctly
fixes it.

Reverts #141130
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 29, 2025
…RootConstants` and `RootFlags`" (#142005)

The commit caused build failures,
[here](https://lab.llvm.org/buildbot/#/builders/10/builds/6308), due to
a missing linked llvm library (HLSLFrontend) into
`clang/unittests/Parse/CMakeLists.txt`.

While it seems like the fix is straightforwardly to just add this
library, I will revert now to build and verify locally it correctly
fixes it.

Reverts llvm/llvm-project#141130
svkeerthy pushed a commit that referenced this pull request May 29, 2025
…`RootFlags` (#141130)

- Implements serialization of the currently completely defined
`RootElement`s, namely `RootConstants` and `RootFlags`

- Adds unit testing for the serialization methods

Resolves: #138190 and
#138192
svkeerthy pushed a commit that referenced this pull request May 29, 2025
…ts` and `RootFlags`" (#142005)

The commit caused build failures,
[here](https://lab.llvm.org/buildbot/#/builders/10/builds/6308), due to
a missing linked llvm library (HLSLFrontend) into
`clang/unittests/Parse/CMakeLists.txt`.

While it seems like the fix is straightforwardly to just add this
library, I will revert now to build and verify locally it correctly
fixes it.

Reverts #141130
google-yfyang pushed a commit to google-yfyang/llvm-project that referenced this pull request May 29, 2025
…`RootFlags` (llvm#141130)

- Implements serialization of the currently completely defined
`RootElement`s, namely `RootConstants` and `RootFlags`

- Adds unit testing for the serialization methods

Resolves: llvm#138190 and
llvm#138192
google-yfyang pushed a commit to google-yfyang/llvm-project that referenced this pull request May 29, 2025
…ts` and `RootFlags`" (llvm#142005)

The commit caused build failures,
[here](https://lab.llvm.org/buildbot/#/builders/10/builds/6308), due to
a missing linked llvm library (HLSLFrontend) into
`clang/unittests/Parse/CMakeLists.txt`.

While it seems like the fix is straightforwardly to just add this
library, I will revert now to build and verify locally it correctly
fixes it.

Reverts llvm#141130
@inbelic inbelic deleted the inbelic/rs-serialize-cur branch June 2, 2025 20:33
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…`RootFlags` (llvm#141130)

- Implements serialization of the currently completely defined
`RootElement`s, namely `RootConstants` and `RootFlags`

- Adds unit testing for the serialization methods

Resolves: llvm#138190 and
llvm#138192
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…ts` and `RootFlags`" (llvm#142005)

The commit caused build failures,
[here](https://lab.llvm.org/buildbot/#/builders/10/builds/6308), due to
a missing linked llvm library (HLSLFrontend) into
`clang/unittests/Parse/CMakeLists.txt`.

While it seems like the fix is straightforwardly to just add this
library, I will revert now to build and verify locally it correctly
fixes it.

Reverts llvm#141130
inbelic added a commit to inbelic/llvm-project that referenced this pull request Jun 5, 2025
…`RootFlags` (llvm#141130)

- Implements serialization of the currently completely defined
`RootElement`s, namely `RootConstants` and `RootFlags`

- Adds unit testing for the serialization methods

Resolves: llvm#138190 and
llvm#138192
inbelic added a commit to inbelic/llvm-project that referenced this pull request Jun 5, 2025
This relands llvm#141130.

The initial commit uncovered that we are missing the correct linking of
FrontendHLSL into clang/lib/Parse and clang/lib/unittests/Parse.

This change addreses this my linking them accordingly.

It was also checked and ensured that the LexHLSLRootSignature libraries
do not depend on FrontendHLSL and so we are not required to link there.

Resolves: llvm#138190 and
llvm#138192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HLSL] Implement serialization of RootFlags [HLSL] Implement serialization of Root Constants
6 participants