Skip to content

Conversation

mtrofin
Copy link
Member

@mtrofin mtrofin commented Aug 8, 2024

Didn't notice in #101338 that the instrumentation in llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll was actually incorrect.

Didn't notice in llvm#101338 that the instrumentation in
`llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll` was actually
incorrect.
@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms labels Aug 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 8, 2024

@llvm/pr-subscribers-pgo

@llvm/pr-subscribers-llvm-transforms

Author: Mircea Trofin (mtrofin)

Changes

Didn't notice in #101338 that the instrumentation in llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll was actually incorrect.


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

5 Files Affected:

  • (modified) llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h (+2-1)
  • (modified) llvm/lib/Passes/PassBuilderPipelines.cpp (+7-6)
  • (modified) llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp (+1-1)
  • (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+10-7)
  • (modified) llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll (+10-4)
diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h
index 5256aff56205ba..f127d16b8de124 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfLowering.h
@@ -19,7 +19,8 @@ class Type;
 class PGOCtxProfLoweringPass : public PassInfoMixin<PGOCtxProfLoweringPass> {
 public:
   explicit PGOCtxProfLoweringPass() = default;
-  static bool isContextualIRPGOEnabled();
+  // True if contextual instrumentation is enabled.
+  static bool isCtxIRPGOInstrEnabled();
 
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
 };
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index c175ee89809849..9ac84ed5dd5178 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1173,13 +1173,12 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
   const bool IsMemprofUse = IsPGOPreLink && !PGOOpt->MemoryProfile.empty();
   // We don't want to mix pgo ctx gen and pgo gen; we also don't currently
   // enable ctx profiling from the frontend.
-  assert(
-      !(IsPGOInstrGen && PGOCtxProfLoweringPass::isContextualIRPGOEnabled()) &&
-      "Enabling both instrumented FDO and contextual instrumentation is not "
-      "supported.");
+  assert(!(IsPGOInstrGen && PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled()) &&
+         "Enabling both instrumented FDO and contextual instrumentation is not "
+         "supported.");
   // Enable contextual profiling instrumentation.
   const bool IsCtxProfGen = !IsPGOInstrGen && IsPreLink &&
-                            PGOCtxProfLoweringPass::isContextualIRPGOEnabled();
+                            PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
   const bool IsCtxProfUse = !UseCtxProfile.empty() && !PGOOpt &&
                             Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
 
@@ -1670,8 +1669,10 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
   // In pre-link, for ctx prof use, we stop here with an instrumented IR. We let
   // thinlto use the contextual info to perform imports; then use the contextual
   // profile in the post-thinlink phase.
-  if (!UseCtxProfile.empty() && !PGOOpt)
+  if (!UseCtxProfile.empty() && !PGOOpt) {
+    addRequiredLTOPreLinkPasses(MPM);
     return MPM;
+  }
 
   // Run partial inlining pass to partially inline functions that have
   // large bodies.
diff --git a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
index de1d4d2381c06e..d6ba12465bb328 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
@@ -30,7 +30,7 @@ static cl::list<std::string> ContextRoots(
         "root of an interesting graph, which will be profiled independently "
         "from other similar graphs."));
 
-bool PGOCtxProfLoweringPass::isContextualIRPGOEnabled() {
+bool PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled() {
   return !ContextRoots.empty();
 }
 
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 1ce8f58c1aa140..41618194d12ed7 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -321,6 +321,7 @@ static cl::opt<unsigned> PGOFunctionCriticalEdgeThreshold(
              " greater than this threshold."));
 
 extern cl::opt<unsigned> MaxNumVTableAnnotations;
+extern cl::opt<std::string> UseCtxProfile;
 
 namespace llvm {
 // Command line option to turn on CFG dot dump after profile annotation.
@@ -338,9 +339,12 @@ extern cl::opt<bool> EnableVTableProfileUse;
 extern cl::opt<InstrProfCorrelator::ProfCorrelatorKind> ProfileCorrelate;
 } // namespace llvm
 
+bool shouldInstrumentForCtxProf() {
+  return PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled() ||
+         !UseCtxProfile.empty();
+}
 bool shouldInstrumentEntryBB() {
-  return PGOInstrumentEntry ||
-         PGOCtxProfLoweringPass::isContextualIRPGOEnabled();
+  return PGOInstrumentEntry || shouldInstrumentForCtxProf();
 }
 
 // FIXME(mtrofin): re-enable this for ctx profiling, for non-indirect calls. Ctx
@@ -348,8 +352,7 @@ bool shouldInstrumentEntryBB() {
 // Supporting other values is relatively straight-forward - just another counter
 // range within the context.
 bool isValueProfilingDisabled() {
-  return DisableValueProfiling ||
-         PGOCtxProfLoweringPass::isContextualIRPGOEnabled();
+  return DisableValueProfiling || shouldInstrumentForCtxProf();
 }
 
 // Return a string describing the branch condition that can be
@@ -902,7 +905,7 @@ static void instrumentOneFunc(
   unsigned NumCounters =
       InstrumentBBs.size() + FuncInfo.SIVisitor.getNumOfSelectInsts();
 
-  if (PGOCtxProfLoweringPass::isContextualIRPGOEnabled()) {
+  if (shouldInstrumentForCtxProf()) {
     auto *CSIntrinsic =
         Intrinsic::getDeclaration(M, Intrinsic::instrprof_callsite);
     // We want to count the instrumentable callsites, then instrument them. This
@@ -1861,7 +1864,7 @@ static bool InstrumentAllFunctions(
     function_ref<BlockFrequencyInfo *(Function &)> LookupBFI, bool IsCS) {
   // For the context-sensitve instrumentation, we should have a separated pass
   // (before LTO/ThinLTO linking) to create these variables.
-  if (!IsCS && !PGOCtxProfLoweringPass::isContextualIRPGOEnabled())
+  if (!IsCS && !shouldInstrumentForCtxProf())
     createIRLevelProfileFlagVar(M, /*IsCS=*/false);
 
   Triple TT(M.getTargetTriple());
@@ -2112,7 +2115,7 @@ static bool annotateAllFunctions(
   bool InstrumentFuncEntry = PGOReader->instrEntryBBEnabled();
   if (PGOInstrumentEntry.getNumOccurrences() > 0)
     InstrumentFuncEntry = PGOInstrumentEntry;
-  InstrumentFuncEntry |= PGOCtxProfLoweringPass::isContextualIRPGOEnabled();
+  InstrumentFuncEntry |= shouldInstrumentForCtxProf();
 
   bool HasSingleByteCoverage = PGOReader->hasSingleByteCoverage();
   for (auto &F : M) {
diff --git a/llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll b/llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll
index b50a815be5abf5..18ac2f92aa39d4 100644
--- a/llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll
+++ b/llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 5
 ; There is no profile, but that's OK because the prelink does not care about
 ; the content of the profile, just that we intend to use one.
 ; There is no scenario currently of doing ctx profile use without thinlto.
@@ -7,19 +7,22 @@
 
 declare void @bar()
 
+;.
+; CHECK: @__profn_foo = private constant [3 x i8] c"foo"
+;.
 define void @foo(i32 %a, ptr %fct) {
 ; CHECK-LABEL: define void @foo(
 ; CHECK-SAME: i32 [[A:%.*]], ptr [[FCT:%.*]]) local_unnamed_addr {
+; CHECK-NEXT:    call void @llvm.instrprof.increment(ptr @__profn_foo, i64 728453322856651412, i32 2, i32 0)
 ; CHECK-NEXT:    [[T:%.*]] = icmp eq i32 [[A]], 0
 ; CHECK-NEXT:    br i1 [[T]], label %[[YES:.*]], label %[[NO:.*]]
 ; CHECK:       [[YES]]:
 ; CHECK-NEXT:    call void @llvm.instrprof.increment(ptr @__profn_foo, i64 728453322856651412, i32 2, i32 1)
-; CHECK-NEXT:    [[TMP1:%.*]] = ptrtoint ptr [[FCT]] to i64
-; CHECK-NEXT:    call void @llvm.instrprof.value.profile(ptr @__profn_foo, i64 728453322856651412, i64 [[TMP1]], i32 0, i32 0)
+; CHECK-NEXT:    call void @llvm.instrprof.callsite(ptr @__profn_foo, i64 728453322856651412, i32 2, i32 0, ptr [[FCT]])
 ; CHECK-NEXT:    call void [[FCT]](i32 0)
 ; CHECK-NEXT:    br label %[[EXIT:.*]]
 ; CHECK:       [[NO]]:
-; CHECK-NEXT:    call void @llvm.instrprof.increment(ptr @__profn_foo, i64 728453322856651412, i32 2, i32 0)
+; CHECK-NEXT:    call void @llvm.instrprof.callsite(ptr @__profn_foo, i64 728453322856651412, i32 2, i32 1, ptr @bar)
 ; CHECK-NEXT:    call void @bar()
 ; CHECK-NEXT:    br label %[[EXIT]]
 ; CHECK:       [[EXIT]]:
@@ -36,3 +39,6 @@ no:
 exit:
   ret void
 }
+;.
+; CHECK: attributes #[[ATTR0:[0-9]+]] = { nounwind }
+;.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

One nit, otherwise LGTM.

define void @foo(i32 %a, ptr %fct) {
; CHECK-LABEL: define void @foo(
; CHECK-SAME: i32 [[A:%.*]], ptr [[FCT:%.*]]) local_unnamed_addr {
; CHECK-NEXT: call void @llvm.instrprof.increment(ptr @__profn_foo, i64 728453322856651412, i32 2, i32 0)

Choose a reason for hiding this comment

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

Why did this get hoisted out from the no: block? The only functional change I could find in this patch was addLTOPrelinkPasses(MPM) which adds CanonicalizeAliasesPass and NameAnonGlobalPass.

Copy link
Member Author

Choose a reason for hiding this comment

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

it's the changes in PGOInstrumentation that do that.

Copy link

@snehasish snehasish left a comment

Choose a reason for hiding this comment

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

lgtm

@mtrofin mtrofin merged commit 1a6d60e into llvm:main Aug 8, 2024
3 of 5 checks passed
@mtrofin mtrofin deleted the fix_use branch August 8, 2024 20:45
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 8, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-libcxx running on linaro-flang-aarch64-libcxx while building llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference:

Step 5 (build-unified-tree) failure: build (failure)
...
59.176 [3338/43/3732] Creating library symlink lib/libLLVMFrontendOffloading.so
59.177 [3338/42/3733] Creating library symlink lib/libLLVMLinker.so
59.179 [3338/41/3734] Creating library symlink lib/libLLVMHipStdPar.so
59.185 [3332/46/3735] Creating library symlink lib/libLLVMMCJIT.so
59.191 [3332/45/3736] Building CXX object tools/mlir/test/lib/Dialect/Affine/CMakeFiles/MLIRAffineTransformsTestPasses.dir/TestAccessAnalysis.cpp.o
59.196 [3332/44/3737] Linking CXX shared library lib/libLLVMObjCARCOpts.so.20.0git
59.203 [3328/47/3738] Creating library symlink lib/libLLVMObjCARCOpts.so
59.205 [3328/46/3739] Building CXX object tools/mlir/test/lib/Dialect/Affine/CMakeFiles/MLIRAffineTransformsTestPasses.dir/TestDecomposeAffineOps.cpp.o
59.225 [3323/50/3740] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/ModuleToBinary.cpp.o
59.242 [3323/49/3741] Linking CXX shared library lib/libLLVMInstrumentation.so.20.0git
FAILED: lib/libLLVMInstrumentation.so.20.0git 
: && /usr/local/bin/c++ -fPIC -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -stdlib=libc++ -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMInstrumentation.so.20.0git -o lib/libLLVMInstrumentation.so.20.0git lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/AddressSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/BoundsChecking.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/CGProfile.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ControlHeightReduction.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/GCOVProfiling.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/BlockCoverageInference.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/MemProfiler.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/MemorySanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/NumericalStabilitySanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/IndirectCallPromotion.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/Instrumentation.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/InstrOrderFile.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/InstrProfiling.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/KCFI.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/LowerAllowCheckPass.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOCtxProfLowering.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOForceFunctionAttrs.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOMemOPSizeOpt.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PoisonChecking.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/SanitizerCoverage.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/SanitizerBinaryMetadata.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ValueProfileCollector.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ThreadSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/HWAddressSanitizer.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/lib:"  lib/libLLVMTransformUtils.so.20.0git  lib/libLLVMAnalysis.so.20.0git  lib/libLLVMProfileData.so.20.0git  lib/libLLVMMC.so.20.0git  lib/libLLVMCore.so.20.0git  lib/libLLVMTargetParser.so.20.0git  lib/libLLVMSupport.so.20.0git  lib/libLLVMDemangle.so.20.0git  -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/lib && :
/usr/bin/ld: lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o: in function `shouldInstrumentForCtxProf()':
PGOInstrumentation.cpp:(.text._Z26shouldInstrumentForCtxProfv+0x1c): undefined reference to `UseCtxProfile'
/usr/bin/ld: PGOInstrumentation.cpp:(.text._Z26shouldInstrumentForCtxProfv+0x20): undefined reference to `UseCtxProfile'
/usr/bin/ld: lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o: in function `shouldInstrumentEntryBB()':
PGOInstrumentation.cpp:(.text._Z23shouldInstrumentEntryBBv+0x30): undefined reference to `UseCtxProfile'
/usr/bin/ld: PGOInstrumentation.cpp:(.text._Z23shouldInstrumentEntryBBv+0x34): undefined reference to `UseCtxProfile'
/usr/bin/ld: lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o: in function `isValueProfilingDisabled()':
PGOInstrumentation.cpp:(.text._Z24isValueProfilingDisabledv+0x30): undefined reference to `UseCtxProfile'
/usr/bin/ld: lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:(.text._Z24isValueProfilingDisabledv+0x34): more undefined references to `UseCtxProfile' follow
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
59.263 [3323/48/3742] Linking CXX shared library lib/libLLVMInstCombine.so.20.0git
59.278 [3323/47/3743] Linking CXX shared library lib/libLLVMVectorize.so.20.0git
59.289 [3323/46/3744] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/Utils.cpp.o
59.296 [3323/45/3745] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/ShuffleRewriter.cpp.o
59.309 [3323/44/3746] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/SubgroupReduceLowering.cpp.o
59.311 [3323/43/3747] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/SPIRVAttachTarget.cpp.o
59.314 [3323/42/3748] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/ParallelLoopMapper.cpp.o
59.337 [3323/41/3749] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/NVVMAttachTarget.cpp.o
59.338 [3323/40/3750] Building CXX object tools/mlir/lib/Dialect/GPU/CMakeFiles/obj.MLIRGPUTransforms.dir/Transforms/ROCDLAttachTarget.cpp.o
59.527 [3323/39/3751] Building CXX object tools/mlir/lib/Dialect/Index/IR/CMakeFiles/obj.MLIRIndexDialect.dir/IndexAttrs.cpp.o
59.535 [3323/38/3752] Building CXX object tools/mlir/lib/Dialect/IRDL/CMakeFiles/obj.MLIRIRDL.dir/IRDLVerifiers.cpp.o
59.538 [3323/37/3753] Building CXX object tools/mlir/lib/Dialect/IRDL/CMakeFiles/obj.MLIRIRDL.dir/IR/IRDL.cpp.o
59.539 [3323/36/3754] Building CXX object tools/mlir/lib/Dialect/Index/IR/CMakeFiles/obj.MLIRIndexDialect.dir/InferIntRangeInterfaceImpls.cpp.o
59.540 [3323/35/3755] Building CXX object tools/mlir/lib/Dialect/GPU/TransformOps/CMakeFiles/obj.MLIRGPUTransformOps.dir/Utils.cpp.o
59.542 [3323/34/3756] Building CXX object tools/mlir/lib/Dialect/Index/IR/CMakeFiles/obj.MLIRIndexDialect.dir/IndexDialect.cpp.o
59.543 [3323/33/3757] Building CXX object tools/mlir/lib/Dialect/IRDL/CMakeFiles/obj.MLIRIRDL.dir/IR/IRDLOps.cpp.o
59.544 [3323/32/3758] Building CXX object tools/mlir/lib/Dialect/IRDL/CMakeFiles/obj.MLIRIRDL.dir/IRDLSymbols.cpp.o
59.546 [3323/31/3759] Building CXX object tools/mlir/lib/Dialect/Index/IR/CMakeFiles/obj.MLIRIndexDialect.dir/IndexOps.cpp.o
59.548 [3323/30/3760] Building CXX object tools/mlir/lib/Dialect/GPU/TransformOps/CMakeFiles/obj.MLIRGPUTransformOps.dir/GPUTransformOps.cpp.o
59.549 [3323/29/3761] Building CXX object tools/mlir/lib/Dialect/IRDL/CMakeFiles/obj.MLIRIRDL.dir/IRDLLoading.cpp.o
59.550 [3323/28/3762] Building CXX object tools/mlir/lib/Dialect/Linalg/IR/CMakeFiles/obj.MLIRLinalgDialect.dir/LinalgInterfaces.cpp.o
59.561 [3323/27/3763] Building CXX object tools/mlir/lib/Dialect/Linalg/IR/CMakeFiles/obj.MLIRLinalgDialect.dir/LinalgOps.cpp.o
59.567 [3323/26/3764] Building CXX object tools/mlir/lib/Dialect/GPU/Pipelines/CMakeFiles/obj.MLIRGPUPipelines.dir/GPUToNVVMPipeline.cpp.o
59.574 [3323/25/3765] Building CXX object tools/mlir/lib/Dialect/Linalg/IR/CMakeFiles/obj.MLIRLinalgDialect.dir/LinalgDialect.cpp.o
59.664 [3323/24/3766] Building CXX object tools/mlir/lib/Dialect/Linalg/IR/CMakeFiles/obj.MLIRLinalgDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o
59.671 [3323/23/3767] Building CXX object tools/mlir/lib/Dialect/Linalg/Transforms/CMakeFiles/obj.MLIRLinalgTransforms.dir/ConvertConv2DToImg2Col.cpp.o
59.673 [3323/22/3768] Building CXX object tools/mlir/lib/Dialect/Linalg/Transforms/CMakeFiles/obj.MLIRLinalgTransforms.dir/ConvertToDestinationStyle.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 8, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference:

Step 5 (build-unified-tree) failure: build (failure)
...
48.730 [327/17/2280] Linking CXX shared library lib/libLLVMGlobalISel.so.20.0git
48.752 [326/17/2281] Creating library symlink lib/libLLVMGlobalISel.so
48.800 [326/16/2282] Building X86GenAsmWriter1.inc...
48.847 [326/15/2283] Building X86GenRegisterInfo.inc...
48.906 [326/14/2284] Building X86GenAsmWriter.inc...
49.083 [326/13/2285] Building X86GenDisassemblerTables.inc...
49.085 [326/12/2286] Building X86GenAsmMatcher.inc...
49.094 [326/11/2287] Building X86GenFoldTables.inc...
49.639 [326/10/2288] Building CXX object lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o
49.829 [325/10/2289] Linking CXX shared library lib/libLLVMInstrumentation.so.20.0git
FAILED: lib/libLLVMInstrumentation.so.20.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -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 -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold   -Wl,--gc-sections -shared -Wl,-soname,libLLVMInstrumentation.so.20.0git -o lib/libLLVMInstrumentation.so.20.0git lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/AddressSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/BoundsChecking.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/CGProfile.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ControlHeightReduction.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/GCOVProfiling.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/BlockCoverageInference.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/MemProfiler.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/MemorySanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/NumericalStabilitySanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/IndirectCallPromotion.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/Instrumentation.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/InstrOrderFile.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/InstrProfiling.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/KCFI.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/LowerAllowCheckPass.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOCtxProfLowering.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOForceFunctionAttrs.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOMemOPSizeOpt.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PoisonChecking.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/SanitizerCoverage.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/SanitizerBinaryMetadata.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ValueProfileCollector.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ThreadSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/HWAddressSanitizer.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib:"  lib/libLLVMTransformUtils.so.20.0git  lib/libLLVMAnalysis.so.20.0git  lib/libLLVMProfileData.so.20.0git  lib/libLLVMMC.so.20.0git  lib/libLLVMCore.so.20.0git  lib/libLLVMTargetParser.so.20.0git  lib/libLLVMSupport.so.20.0git  lib/libLLVMDemangle.so.20.0git  -Wl,-rpath-link,/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib && :
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function createIRLevelProfileFlagVar(llvm::Module&, bool): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function shouldInstrumentForCtxProf(): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function shouldInstrumentEntryBB(): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function isValueProfilingDisabled(): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
collect2: error: ld returned 1 exit status
50.103 [325/9/2290] Building X86GenFastISel.inc...
50.184 [325/8/2291] Building X86GenGlobalISel.inc...
50.745 [325/7/2292] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
51.146 [325/6/2293] Building X86GenDAGISel.inc...
51.996 [325/5/2294] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
52.381 [325/4/2295] Building X86GenSubtargetInfo.inc...
52.692 [325/3/2296] Building X86GenInstrInfo.inc...
53.448 [325/2/2297] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilderPipelines.cpp.o
86.541 [325/1/2298] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 8, 2024

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference:

Step 5 (build-unified-tree) failure: build (failure)
...
50.585 [329/18/2277] Building CXX object lib/Target/NVPTX/CMakeFiles/LLVMNVPTXCodeGen.dir/NVVMReflect.cpp.o
50.605 [329/17/2278] Building CXX object lib/Target/NVPTX/CMakeFiles/LLVMNVPTXCodeGen.dir/NVPTXTargetMachine.cpp.o
50.619 [329/16/2279] Linking CXX shared library lib/libLLVMNVPTXInfo.so.20.0git
50.624 [328/16/2280] Building CXX object lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o
50.641 [327/16/2281] Creating library symlink lib/libLLVMNVPTXInfo.so
50.676 [326/16/2282] Building X86GenAsmWriter1.inc...
50.702 [326/15/2283] Building X86GenDisassemblerTables.inc...
50.720 [326/14/2284] Linking CXX shared library lib/libLLVMNVPTXDesc.so.20.0git
50.731 [325/14/2285] Creating library symlink lib/libLLVMNVPTXDesc.so
50.813 [325/13/2286] Linking CXX shared library lib/libLLVMInstrumentation.so.20.0git
FAILED: lib/libLLVMInstrumentation.so.20.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -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 -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold   -Wl,--gc-sections -shared -Wl,-soname,libLLVMInstrumentation.so.20.0git -o lib/libLLVMInstrumentation.so.20.0git lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/AddressSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/BoundsChecking.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/CGProfile.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ControlHeightReduction.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/GCOVProfiling.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/BlockCoverageInference.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/MemProfiler.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/MemorySanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/NumericalStabilitySanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/IndirectCallPromotion.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/Instrumentation.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/InstrOrderFile.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/InstrProfiling.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/KCFI.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/LowerAllowCheckPass.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOCtxProfLowering.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOForceFunctionAttrs.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOMemOPSizeOpt.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PoisonChecking.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/SanitizerCoverage.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/SanitizerBinaryMetadata.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ValueProfileCollector.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/ThreadSanitizer.cpp.o lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/HWAddressSanitizer.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib:"  lib/libLLVMTransformUtils.so.20.0git  lib/libLLVMAnalysis.so.20.0git  lib/libLLVMProfileData.so.20.0git  lib/libLLVMMC.so.20.0git  lib/libLLVMCore.so.20.0git  lib/libLLVMTargetParser.so.20.0git  lib/libLLVMSupport.so.20.0git  lib/libLLVMDemangle.so.20.0git  -Wl,-rpath-link,/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib && :
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function createIRLevelProfileFlagVar(llvm::Module&, bool): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function shouldInstrumentForCtxProf(): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function shouldInstrumentEntryBB(): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/PGOInstrumentation.cpp.o:PGOInstrumentation.cpp:function isValueProfilingDisabled(): error: undefined reference to 'UseCtxProfile[abi:cxx11]'
collect2: error: ld returned 1 exit status
50.858 [325/12/2287] Building X86GenAsmMatcher.inc...
51.437 [325/11/2288] Building X86GenAsmWriter.inc...
51.599 [325/10/2289] Building X86GenFoldTables.inc...
52.729 [325/9/2290] Building X86GenFastISel.inc...
53.082 [325/8/2291] Building X86GenDAGISel.inc...
53.118 [325/7/2292] Building X86GenGlobalISel.inc...
53.402 [325/6/2293] Building X86GenSubtargetInfo.inc...
53.858 [325/5/2294] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
54.820 [325/4/2295] Building X86GenInstrInfo.inc...
55.911 [325/3/2296] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
58.573 [325/2/2297] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilderPipelines.cpp.o
87.783 [325/1/2298] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
ninja: build stopped: subcommand failed.

@klausler
Copy link
Contributor

klausler commented Aug 8, 2024

This patch broke at least one flang build bot (https://lab.llvm.org/buildbot/#/builders/89/builds/3722); please repair or revert with dispatch.

boomanaiden154 added a commit that referenced this pull request Aug 8, 2024
mtrofin added a commit that referenced this pull request Aug 9, 2024
This reverts commit 967185e.

The problem was link dependencies, moved `UseCtxProfile` to `Analysis`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:transforms PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants