Skip to content

Conversation

yxsamliu
Copy link
Collaborator

This patch introduces support for the jobserver protocol to control parallelism for device offloading tasks.

When running a parallel build with a modern build system like make -jN or ninja -jN, each Clang process might also be configured to use multiple threads for its own tasks (e.g., via --offload-jobs=4). This can lead to an explosion of threads (N * 4), causing heavy system load, CPU contention, and ultimately slowing down the entire build.

This patch allows Clang to act as a cooperative client of the build system's jobserver. It extends the --offload-jobs option to accept the value 'jobserver'. With the recent addition of jobserver support to the Ninja build system, this functionality now benefits users of both Make and Ninja.

When --offload-jobs=jobserver is specified, Clang's thread pool will:

  1. Parse the MAKEFLAGS environment variable to find the jobserver details.
  2. Before dispatching a task, acquire a job slot from the jobserver. If none are available, the worker thread will block.
  3. Release the job slot once the task is complete.

This ensures that the total number of active offload tasks across all Clang processes does not exceed the limit defined by the parent build system, leading to more efficient and controlled parallel builds.

Implementation:

  • A new library, llvm/Support/Jobserver, is added to provide a platform-agnostic client for the jobserver protocol, with backends for Unix (FIFO) and Windows (semaphores).
  • llvm/Support/ThreadPool and llvm/Support/Parallel are updated with a jobserver_concurrency strategy to integrate this logic.
  • The Clang driver and linker-wrapper are modified to recognize the 'jobserver' argument and enable the new thread pool strategy.
  • New unit and integration tests are added to validate the feature.

@yxsamliu yxsamliu requested review from MaskRay, Artem-B and jhuber6 June 21, 2025 01:54
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' platform:windows llvm:support labels Jun 21, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 21, 2025

@llvm/pr-subscribers-platform-windows
@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-llvm-support

Author: Yaxun (Sam) Liu (yxsamliu)

Changes

This patch introduces support for the jobserver protocol to control parallelism for device offloading tasks.

When running a parallel build with a modern build system like make -jN or ninja -jN, each Clang process might also be configured to use multiple threads for its own tasks (e.g., via --offload-jobs=4). This can lead to an explosion of threads (N * 4), causing heavy system load, CPU contention, and ultimately slowing down the entire build.

This patch allows Clang to act as a cooperative client of the build system's jobserver. It extends the --offload-jobs option to accept the value 'jobserver'. With the recent addition of jobserver support to the Ninja build system, this functionality now benefits users of both Make and Ninja.

When --offload-jobs=jobserver is specified, Clang's thread pool will:

  1. Parse the MAKEFLAGS environment variable to find the jobserver details.
  2. Before dispatching a task, acquire a job slot from the jobserver. If none are available, the worker thread will block.
  3. Release the job slot once the task is complete.

This ensures that the total number of active offload tasks across all Clang processes does not exceed the limit defined by the parent build system, leading to more efficient and controlled parallel builds.

Implementation:

  • A new library, llvm/Support/Jobserver, is added to provide a platform-agnostic client for the jobserver protocol, with backends for Unix (FIFO) and Windows (semaphores).
  • llvm/Support/ThreadPool and llvm/Support/Parallel are updated with a jobserver_concurrency strategy to integrate this logic.
  • The Clang driver and linker-wrapper are modified to recognize the 'jobserver' argument and enable the new thread pool strategy.
  • New unit and integration tests are added to validate the feature.

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

18 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+3-2)
  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+14-8)
  • (modified) clang/test/Driver/hip-options.hip (+6)
  • (modified) clang/test/Driver/linker-wrapper.c (+2)
  • (modified) clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp (+12-6)
  • (modified) clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td (+2-1)
  • (added) llvm/include/llvm/Support/Jobserver.h (+141)
  • (modified) llvm/include/llvm/Support/ThreadPool.h (+4)
  • (modified) llvm/include/llvm/Support/Threading.h (+18)
  • (modified) llvm/lib/Support/CMakeLists.txt (+1)
  • (added) llvm/lib/Support/Jobserver.cpp (+257)
  • (modified) llvm/lib/Support/Parallel.cpp (+50-4)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+89-3)
  • (modified) llvm/lib/Support/Threading.cpp (+5)
  • (added) llvm/lib/Support/Unix/Jobserver.inc (+195)
  • (added) llvm/lib/Support/Windows/Jobserver.inc (+75)
  • (modified) llvm/unittests/Support/CMakeLists.txt (+1)
  • (added) llvm/unittests/Support/JobserverTest.cpp (+436)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 0ffd8c40da7da..771b336b5585f 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1243,8 +1243,9 @@ def offload_compression_level_EQ : Joined<["--"], "offload-compression-level=">,
   HelpText<"Compression level for offload device binaries (HIP only)">;
 
 def offload_jobs_EQ : Joined<["--"], "offload-jobs=">,
-  HelpText<"Specify the number of threads to use for device offloading tasks"
-           " during compilation.">;
+  HelpText<"Specify the number of threads to use for device offloading tasks "
+           "during compilation. Can be a positive integer or the string "
+           "'jobserver' to use the make-style jobserver from the environment.">;
 
 defm offload_via_llvm : BoolFOption<"offload-via-llvm",
   LangOpts<"OffloadViaLLVM">, DefaultFalse,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 2bb42a319eccf..a2a206eec700f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9293,14 +9293,20 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
   addOffloadCompressArgs(Args, CmdArgs);
 
   if (Arg *A = Args.getLastArg(options::OPT_offload_jobs_EQ)) {
-    int NumThreads;
-    if (StringRef(A->getValue()).getAsInteger(10, NumThreads) ||
-        NumThreads <= 0)
-      C.getDriver().Diag(diag::err_drv_invalid_int_value)
-          << A->getAsString(Args) << A->getValue();
-    else
-      CmdArgs.push_back(
-          Args.MakeArgString("--wrapper-jobs=" + Twine(NumThreads)));
+    StringRef Val = A->getValue();
+
+    if (Val.equals_insensitive("jobserver"))
+      CmdArgs.push_back(Args.MakeArgString("--wrapper-jobs=jobserver"));
+    else {
+      int NumThreads;
+      if (Val.getAsInteger(10, NumThreads) || NumThreads <= 0) {
+        C.getDriver().Diag(diag::err_drv_invalid_int_value)
+            << A->getAsString(Args) << Val;
+      } else {
+        CmdArgs.push_back(
+            Args.MakeArgString("--wrapper-jobs=" + Twine(NumThreads)));
+      }
+    }
   }
 
   const char *Exec =
diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip
index a07dca3638565..1f2b1b4858b02 100644
--- a/clang/test/Driver/hip-options.hip
+++ b/clang/test/Driver/hip-options.hip
@@ -259,3 +259,9 @@
 // RUN:   --offload-arch=gfx1100 --offload-new-driver --offload-jobs=0x4 %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=INVJOBS %s
 // INVJOBS: clang: error: invalid integral value '0x4' in '--offload-jobs=0x4'
+
+// RUN: %clang -### -Werror --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
+// RUN:   --offload-arch=gfx1100 --offload-new-driver --offload-jobs=jobserver %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=JOBSV %s
+// JOBSV: clang-linker-wrapper{{.*}} "--wrapper-jobs=jobserver"
+
diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c
index 80b1a5745a123..de14f8cd29a13 100644
--- a/clang/test/Driver/linker-wrapper.c
+++ b/clang/test/Driver/linker-wrapper.c
@@ -114,6 +114,8 @@ __attribute__((visibility("protected"), used)) int x;
 // RUN:   -fembed-offload-object=%t.out
 // RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-unknown-linux-gnu --wrapper-jobs=4 \
 // RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=CUDA-PAR
+// RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-unknown-linux-gnu --wrapper-jobs=jobserver \
+// RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=CUDA-PAR
 
 // CUDA-PAR: fatbinary{{.*}}-64 --create {{.*}}.fatbin
 
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 0f1fa8b329fd6..fffbe054c1ca1 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -1420,12 +1420,18 @@ int main(int Argc, char **Argv) {
 
   parallel::strategy = hardware_concurrency(1);
   if (auto *Arg = Args.getLastArg(OPT_wrapper_jobs)) {
-    unsigned Threads = 0;
-    if (!llvm::to_integer(Arg->getValue(), Threads) || Threads == 0)
-      reportError(createStringError("%s: expected a positive integer, got '%s'",
-                                    Arg->getSpelling().data(),
-                                    Arg->getValue()));
-    parallel::strategy = hardware_concurrency(Threads);
+    StringRef Val = Arg->getValue();
+    if (Val.equals_insensitive("jobserver"))
+      parallel::strategy = jobserver_concurrency();
+    else {
+      unsigned Threads = 0;
+      if (!llvm::to_integer(Val, Threads) || Threads == 0) {
+        reportError(createStringError(
+            "%s: expected a positive integer or 'jobserver', got '%s'",
+            Arg->getSpelling().data(), Val.data()));
+      } else
+        parallel::strategy = hardware_concurrency(Threads);
+    }
   }
 
   if (Args.hasArg(OPT_wrapper_time_trace_eq)) {
diff --git a/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td b/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
index 17fb9db35fe39..7b3f632e25a6a 100644
--- a/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
+++ b/clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td
@@ -53,7 +53,8 @@ def wrapper_time_trace_granularity : Joined<["--"], "wrapper-time-trace-granular
 
 def wrapper_jobs : Joined<["--"], "wrapper-jobs=">,
   Flags<[WrapperOnlyOption]>, MetaVarName<"<number>">,
-  HelpText<"Sets the number of parallel jobs to use for device linking">;
+  HelpText<"Sets the number of parallel jobs for device linking. Can be a "
+            "positive integer or 'jobserver'.">;
 
 def override_image : Joined<["--"], "override-image=">,
   Flags<[WrapperOnlyOption]>, MetaVarName<"<kind=file>">,
diff --git a/llvm/include/llvm/Support/Jobserver.h b/llvm/include/llvm/Support/Jobserver.h
new file mode 100644
index 0000000000000..0ddcc9bc7e472
--- /dev/null
+++ b/llvm/include/llvm/Support/Jobserver.h
@@ -0,0 +1,141 @@
+//===- llvm/Support/Jobserver.h - Jobserver Client --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines a client for the GNU Make jobserver protocol. This allows
+// LLVM tools to coordinate parallel execution with a parent `make` process.
+//
+// The jobserver protocol is a mechanism for GNU Make to share its pool of
+// available "job slots" with the subprocesses it invokes. This is particularly
+// useful for tools that can perform parallel operations themselves (e.g., a
+// multi-threaded linker or compiler). By participating in this protocol, a
+// tool can ensure the total number of concurrent jobs does not exceed the
+// limit specified by the user (e.g., `make -j8`).
+//
+// How it works:
+//
+// 1. Establishment:
+//    A child process discovers the jobserver by inspecting the `MAKEFLAGS`
+//    environment variable. If a jobserver is active, this variable will
+//    contain a `--jobserver-auth=<value>` argument. The format of `<value>`
+//    determines how to communicate with the server.
+//
+// 2. The Implicit Slot:
+//    Every command invoked by `make` is granted one "implicit" job slot. This
+//    means a tool can always perform at least one unit of work without needing
+//    to communicate with the jobserver. This implicit slot should NEVER be
+//    released back to the jobserver.
+//
+// 3. Acquiring and Releasing Slots:
+//    On POSIX systems, the jobserver is implemented as a pipe. The
+//    `--jobserver-auth` value specifies either a path to a named pipe
+//    (`fifo:PATH`) or a pair of file descriptors (`R,W`). The pipe is
+//    pre-loaded with single-character tokens, one for each available job slot.
+//
+//    - To acquire an additional slot, a client reads a single-character token
+//      from the pipe.
+//    - To release a slot, the client must write the *exact same* character
+//      token back to the pipe.
+//
+//    It is critical that a client releases all acquired slots before it exits,
+//    even in cases of error, to avoid deadlocking the build.
+//
+// Example:
+//    A multi-threaded linker invoked by `make -j8` wants to use multiple
+//    threads. It first checks for the jobserver. It knows it has one implicit
+//    slot, so it can use one thread. It then tries to acquire 7 more slots by
+//    reading 7 tokens from the jobserver pipe. If it only receives 3 tokens,
+//    it knows it can use a total of 1 (implicit) + 3 (acquired) = 4 threads.
+//    Before exiting, it must write the 3 tokens it read back to the pipe.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_JOBSERVER_H
+#define LLVM_SUPPORT_JOBSERVER_H
+
+#include "llvm/ADT/StringRef.h"
+#include <memory>
+#include <string>
+
+namespace llvm {
+
+/// A JobSlot represents a single job slot that can be acquired from or released
+/// to a jobserver pool. This class is move-only.
+class JobSlot {
+public:
+  /// Default constructor creates an invalid instance.
+  JobSlot() = default;
+
+  // Move operations are allowed.
+  JobSlot(JobSlot &&Other) noexcept : Value(Other.Value) { Other.Value = -1; }
+  JobSlot &operator=(JobSlot &&Other) noexcept {
+    if (this != &Other) {
+      this->Value = Other.Value;
+      Other.Value = -1;
+    }
+    return *this;
+  }
+
+  // Copy operations are disallowed.
+  JobSlot(const JobSlot &) = delete;
+  JobSlot &operator=(const JobSlot &) = delete;
+
+  /// Returns true if this instance is valid (either implicit or explicit).
+  bool isValid() const { return Value >= 0; }
+
+  /// Returns true if this instance represents the implicit job slot.
+  bool isImplicit() const { return Value == kImplicitValue; }
+
+  static JobSlot createExplicit(uint8_t V) {
+    return JobSlot(static_cast<int16_t>(V));
+  }
+
+  static JobSlot createImplicit() { return JobSlot(kImplicitValue); }
+
+  uint8_t getExplicitValue() const;
+  bool isExplicit() const { return isValid() && !isImplicit(); }
+
+private:
+  friend class JobserverClient;
+  friend class JobserverClientImpl;
+
+  JobSlot(int16_t V) : Value(V) {}
+
+  static constexpr int16_t kImplicitValue = 256;
+  int16_t Value = -1;
+};
+
+/// The public interface for a jobserver client.
+/// This client is a lazy-initialized singleton that is created on first use.
+class JobserverClient {
+public:
+  virtual ~JobserverClient();
+
+  /// Tries to acquire a job slot from the pool. On failure (e.g., if the pool
+  /// is empty), this returns an invalid JobSlot instance. The first successful
+  /// call will always return the implicit slot.
+  virtual JobSlot tryAcquire() = 0;
+
+  /// Releases a job slot back to the pool.
+  virtual void release(JobSlot Slot) = 0;
+
+  /// Returns the number of job slots available, as determined on first use.
+  /// This value is cached. Returns 0 if no jobserver is active.
+  virtual unsigned getNumJobs() const = 0;
+
+  /// Returns the singleton instance of the JobserverClient.
+  /// The instance is created on the first call to this function.
+  /// Returns a nullptr if no jobserver is configured or an error occurs.
+  static JobserverClient *getInstance();
+
+  /// Resets the singleton instance. For testing purposes only.
+  static void resetForTesting();
+};
+
+} // end namespace llvm
+
+#endif // LLVM_SUPPORT_JOBSERVER_H
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 9272760fc140a..3f0013700392d 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -16,6 +16,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/Support/Jobserver.h"
 #include "llvm/Support/RWMutex.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/thread.h"
@@ -184,6 +185,7 @@ class LLVM_ABI StdThreadPool : public ThreadPoolInterface {
   void grow(int requested);
 
   void processTasks(ThreadPoolTaskGroup *WaitingForGroup);
+  void processTasksWithJobserver();
 
   /// Threads in flight
   std::vector<llvm::thread> Threads;
@@ -212,6 +214,8 @@ class LLVM_ABI StdThreadPool : public ThreadPoolInterface {
 
   /// Maximum number of threads to potentially grow this pool to.
   const unsigned MaxThreadCount;
+
+  JobserverClient *TheJobserver = nullptr;
 };
 #endif // LLVM_ENABLE_THREADS
 
diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h
index d3fe0a57ee44e..88846807f111a 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -142,6 +142,11 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
     /// the thread shall remain on the actual CPU socket.
     LLVM_ABI std::optional<unsigned>
     compute_cpu_socket(unsigned ThreadPoolNum) const;
+
+    /// If true, the thread pool will attempt to coordinate with a GNU Make
+    /// jobserver, acquiring a job slot before processing a task. If no
+    /// jobserver is found in the environment, this is ignored.
+    bool UseJobserver = false;
   };
 
   /// Build a strategy from a number of threads as a string provided in \p Num.
@@ -210,6 +215,19 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
     return S;
   }
 
+  /// Returns a thread strategy that attempts to coordinate with a GNU Make
+  /// jobserver. The number of active threads will be limited by the number of
+  /// available job slots. If no jobserver is detected in the environment, this
+  /// strategy falls back to the default hardware_concurrency() behavior.
+  inline ThreadPoolStrategy jobserver_concurrency() {
+    ThreadPoolStrategy S;
+    S.UseJobserver = true;
+    // We can still request all threads be created, as they will simply
+    // block waiting for a job slot if the jobserver is the limiting factor.
+    S.ThreadsRequested = 0; // 0 means 'use all available'
+    return S;
+  }
+
   /// Return the current thread id, as used in various OS system calls.
   /// Note that not all platforms guarantee that the value returned will be
   /// unique across the entire system, so portable code should not assume
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 45d961e994a1a..daacab128b498 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -205,6 +205,7 @@ add_llvm_component_library(LLVMSupport
   InstructionCost.cpp
   IntEqClasses.cpp
   IntervalMap.cpp
+  Jobserver.cpp
   JSON.cpp
   KnownBits.cpp
   KnownFPClass.cpp
diff --git a/llvm/lib/Support/Jobserver.cpp b/llvm/lib/Support/Jobserver.cpp
new file mode 100644
index 0000000000000..a0a3eeb64be28
--- /dev/null
+++ b/llvm/lib/Support/Jobserver.cpp
@@ -0,0 +1,257 @@
+//===- llvm/Support/Jobserver.cpp - Jobserver Client Implementation -------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/Jobserver.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <atomic>
+#include <memory>
+#include <mutex>
+#include <new>
+
+#define DEBUG_TYPE "jobserver"
+
+using namespace llvm;
+
+namespace {
+struct JobserverConfig {
+  enum Mode {
+    None,
+    PosixFifo,
+    PosixPipe,
+    Win32Semaphore,
+  };
+  Mode TheMode = None;
+  std::string Path;
+  int ReadFD = -1;
+  int WriteFD = -1;
+};
+} // namespace
+
+namespace {
+Expected<JobserverConfig> parseNativeMakeFlags(StringRef MakeFlags);
+} // namespace
+
+class JobserverClientImpl : public JobserverClient {
+  bool IsInitialized = false;
+  std::atomic<bool> HasImplicitSlot{true};
+  unsigned NumJobs = 0;
+
+public:
+  JobserverClientImpl(const JobserverConfig &Config);
+  ~JobserverClientImpl() override;
+
+  JobSlot tryAcquire() override;
+  void release(JobSlot Slot) override;
+  unsigned getNumJobs() const override { return NumJobs; }
+
+  bool isValid() const { return IsInitialized; }
+
+private:
+#if defined(LLVM_ON_UNIX)
+  int ReadFD = -1;
+  int WriteFD = -1;
+  std::string FifoPath;
+#elif defined(_WIN32)
+  void *Semaphore = nullptr;
+#endif
+};
+
+// Include the platform-specific parts of the class.
+#if defined(LLVM_ON_UNIX)
+#include "Unix/Jobserver.inc"
+#elif defined(_WIN32)
+#include "Windows/Jobserver.inc"
+#endif
+
+JobserverClient::~JobserverClient() = default;
+
+uint8_t JobSlot::getExplicitValue() const {
+  assert(isExplicit() && "Cannot get value of implicit or invalid slot");
+  return static_cast<uint8_t>(Value);
+}
+
+static std::once_flag GJobserverOnceFlag;
+static std::unique_ptr<JobserverClient> GJobserver;
+
+/// This is the main entry point for acquiring a jobserver client. It uses a
+/// std::call_once to ensure the singleton `GJobserver` instance is created
+/// safely in a multi-threaded environment. On first call, it reads the
+/// `MAKEFLAGS` environment variable, parses it, and attempts to construct and
+/// initialize a `JobserverClientImpl`. If successful, the global instance is
+/// stored in `GJobserver`. Subsequent calls will return the existing instance.
+JobserverClient *JobserverClient::getInstance() {
+  std::call_once(GJobserverOnceFlag, []() {
+    LLVM_DEBUG(
+        dbgs()
+        << "JobserverClient::getInstance() called for the first time.\n");
+    const char *MakeFlagsEnv = getenv("MAKEFLAGS");
+    if (!MakeFlagsEnv) {
+      errs() << "Warning: failed to create jobserver client due to MAKEFLAGS "
+                "environment variable not found\n";
+      return;
+    }
+
+    LLVM_DEBUG(dbgs() << "Found MAKEFLAGS = \"" << MakeFlagsEnv << "\"\n");
+
+    auto ConfigOrErr = parseNativeMakeFlags(MakeFlagsEnv);
+    if (Error Err = ConfigOrErr.takeError()) {
+      errs() << "Warning: failed to create jobserver client due to invalid "
+                "MAKEFLAGS environment variable: "
+             << toString(std::move(Err)) << "\n";
+      return;
+    }
+
+    JobserverConfig Config = *ConfigOrErr;
+    if (Config.TheMode == JobserverConfig::None) {
+      errs() << "Warning: failed to create jobserver client due to jobserver "
+                "mode missing in MAKEFLAGS environment variable\n";
+      return;
+    }
+
+    if (Config.TheMode == JobserverConfig::PosixPipe) {
+#if defined(LLVM_ON_UNIX)
+      if (!areFdsValid(Config.ReadFD, Config.WriteFD)) {
+        errs() << "Warning: failed to create jobserver client due to invalid "
+                  "Pipe FDs in MAKEFLAGS environment variable\n";
+        return;
+      }
+#endif
+    }
+
+    auto Client = std::make_unique<JobserverClientImpl>(Config);
+    if (Client->isValid()) {
+      LLVM_DEBUG(dbgs() << "Jobserver client created successfully!\n");
+      GJobserver = std::move(Client);
+    } else
+      errs() << "Warning: jobserver client initialization failed.\n";
+  });
+  return GJobserver.get();
+}
+
+/// For testing purposes only. This function resets the singleton instance by
+/// destroying the existing client and re-initializing the `std::once_flag`.
+/// This allows tests to simulate the first-time initialization of the
+/// jobserver client multiple times.
+void JobserverClient::resetForTesting() {
+  GJobserver.reset();
+  // Re-construct the std::once_flag in place to reset the singleton state.
+  new (&GJobserverOnceFlag) std::once_flag();
+}
+
+namespace {
+/// A helper function that checks if `Input` starts with `Prefix`.
+/// If it does, it removes the prefix from `Input`, assigns the remainder to
+/// `Value`, and returns true. Otherwise, it returns false.
+bool getPrefixedValue(StringRef Input, StringRef Prefix, StringRef &Value) {
+  if (Input.consume_front(Prefix)) {
+    Value = Input;
+    return true;
+  }
+  return false;
+}
+
+/// A helper function to parse a string in the format "R,W" where R and W are
+/// ...
[truncated]

Copy link

github-actions bot commented Jun 21, 2025

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

Copy link
Member

@Artem-B Artem-B left a comment

Choose a reason for hiding this comment

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

I think this may need to be discussed in a wider forum.

While I do not think that build job management is compiler's job, cooperation with the outer build system may be useful. I may be persuaded that it's worth it.

The question is -- is that useful enough to warrant feature creep in clang driver? Perhaps it may be better to give external tools a way to manage offloading compilation sub-jobs. E.g. we could produce a json with the actions and input/output dependencies and let the build tool schedule them.

It's certainly feasible for a "classic" CUDA compilation before the new driver, but I can see that it may be problematic for a more complicated new-driver offloading machinery that does a lot more under the hood. Integration with the build tools will also be an issue. Given that the build server does exist, cooperating with it may be a relatively easy compromise.

@jhuber6
Copy link
Contributor

jhuber6 commented Jun 23, 2025

Yeah, I think overall it might be better to have a way to split up these offload compilations more discretely. Likely we'd want the ability to compile the device code portion independently and then bundle it back together or something. The changes here seem really invasion for such a niche application.

@yxsamliu
Copy link
Collaborator Author

GNU make jobserver support is not limited to offload parallel jobs, it can also be used by LTO in lld.

Currently LLVM has parallel and thread pool support but lack a mechanism to coordinate with the build system (make, ninja, msbuild), which cause them to overload the system when enabled with the build systems. The issue with --offload-jobs is just a demonstration of the generic limitation of the LLVM parallel support.

I will open an RFC at LLVM discourse about whether LLVM needs GNU make jobserver support.

@yxsamliu yxsamliu changed the title [Clang][Driver] Add jobserver support for --offload-jobs [LLVM] Add GNU make jobserver support Jun 24, 2025
@yxsamliu
Copy link
Collaborator Author

@yxsamliu yxsamliu force-pushed the jobserver branch 4 times, most recently from de90c70 to 0492b8d Compare July 7, 2025 03:23
@yxsamliu
Copy link
Collaborator Author

ping

Copy link
Member

@Artem-B Artem-B left a comment

Choose a reason for hiding this comment

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

Few comments on syntax/style. I didn't look at the job management logic itself.

Copy link
Member

@Artem-B Artem-B left a comment

Choose a reason for hiding this comment

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

LGTM syntax/style-wise. Looks reasonable on the functionality side, but we could use a second opinion on that.

@yxsamliu
Copy link
Collaborator Author

yxsamliu commented Aug 5, 2025

ping. any further comments or concerns? thanks

Copy link
Collaborator

@rnk rnk left a comment

Choose a reason for hiding this comment

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

I didn't read the code here in detail, but I know this has been a long-standing request (I think @aganea thought we should have this). I assumed the complexity of implementing this would be much more than the implementation you have here. I haven't started at the code and dug around for errors, but paging through the source gives me the feeling that the additional support burden of the code is going to be manageable.

Which is all to say, I'm supportive.

@nga888
Copy link
Collaborator

nga888 commented Aug 27, 2025

Sorry that I haven't commented earlier but I have only just got around to looking at this in more detail. Although, the parallel functions for Parallel.cpp already "batch", I would still be a bit concerned about the overhead for obtaining the job slot. Perhaps like in ThreadPool.cpp it should hold onto the job slot whilst there are jobs to be processed? I also see that an exponential back-off is used in ThreadPool.cpp. Could this be applicable also to Parallel.cpp?

@yxsamliu
Copy link
Collaborator Author

yxsamliu commented Oct 2, 2025

I didn't read the code here in detail, but I know this has been a long-standing request (I think @aganea thought we should have this). I assumed the complexity of implementing this would be much more than the implementation you have here. I haven't started at the code and dug around for errors, but paging through the source gives me the feeling that the additional support burden of the code is going to be manageable.

Which is all to say, I'm supportive.

Thanks for supporting this PR. This could be a start point of iterations to make it better.

@yxsamliu
Copy link
Collaborator Author

yxsamliu commented Oct 2, 2025

Sorry that I haven't commented earlier but I have only just got around to looking at this in more detail. Although, the parallel functions for Parallel.cpp already "batch", I would still be a bit concerned about the overhead for obtaining the job slot. Perhaps like in ThreadPool.cpp it should hold onto the job slot whilst there are jobs to be processed? I also see that an exponential back-off is used in ThreadPool.cpp. Could this be applicable also to Parallel.cpp?

Thanks for the detailed read. You're right. Per-task acquire adds overhead. I'll change Parallel.cpp to hold a job slot while there is work. Like ThreadPool.cpp does. We'll process tasks in a loop and release the slot when the queue is empty. I'll also add exponential backoff when no slot is available. That will avoid busy requeue and yield. This keeps behavior the same, but cuts overhead.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang,llvm at step 8 "Add check check-llvm".

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

Here is the relevant piece of the build log for the reference
Step 8 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/165/208' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/unittests/Support/./SupportTests-LLVM-Unit-924570-165-208.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=208 GTEST_SHARD_INDEX=165 /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/unittests/Support/./SupportTests
--


Note: This is test shard 166 of 208.
[==========] Running 8 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (51 ms)
[----------] 1 test from JobserverStrategyTest (51 ms total)

[----------] 1 test from MustacheInterpolation
[ RUN      ] MustacheInterpolation.StandaloneAmpersandWithWhitespace
[       OK ] MustacheInterpolation.StandaloneAmpersandWithWhitespace (0 ms)
[----------] 1 test from MustacheInterpolation (0 ms total)

[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestExecuteEmptyEnvironment
Note: Google Test filter = 
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.
[       OK ] ProgramEnvTest.TestExecuteEmptyEnvironment (5 ms)
[----------] 1 test from ProgramEnvTest (5 ms total)

[----------] 1 test from TimeProfiler
[ RUN      ] TimeProfiler.Begin_End_Smoke
[       OK ] TimeProfiler.Begin_End_Smoke (0 ms)
[----------] 1 test from TimeProfiler (0 ms total)

[----------] 1 test from YAMLIO
[ RUN      ] YAMLIO.TestReadBuiltInTypesint16OverError
[       OK ] YAMLIO.TestReadBuiltInTypesint16OverError (0 ms)
[----------] 1 test from YAMLIO (0 ms total)

[----------] 1 test from VirtualOutput/BackendTest
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-ubuntu running on as-builder-4 while building clang,llvm at step 7 "test-check-all".

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

Here is the relevant piece of the build log for the reference
Step 7 (test-check-all) failure: Test just built components: check-all completed (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/62/104' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/unittests/Support/./SupportTests-LLVM-Unit-102668-62-104.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=104 GTEST_SHARD_INDEX=62 /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/unittests/Support/./SupportTests
--


Note: This is test shard 63 of 104.
[==========] Running 16 tests from 16 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignPreservedBuildAttr
[ RUN      ] AlignPreservedBuildAttr.testBuildAttr
[       OK ] AlignPreservedBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignPreservedBuildAttr (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedMulUnsigned
[       OK ] CheckedArithmetic.CheckedMulUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from ArchName
[ RUN      ] ArchName.testAttribute
[       OK ] ArchName.testAttribute (0 ms)
[----------] 1 test from ArchName (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from HashBuilderTest/1, where TypeParam = <type>
[ RUN      ] HashBuilderTest/1.HashStdPair
[       OK ] HashBuilderTest/1.HashStdPair (0 ms)
[----------] 1 test from HashBuilderTest/1 (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (52 ms)
[----------] 1 test from JobserverStrategyTest (52 ms total)

[----------] 1 test from OverflowTest/0, where TypeParam = <type>
[ RUN      ] OverflowTest/0.MulResultZero
[       OK ] OverflowTest/0.MulResultZero (0 ms)
[----------] 1 test from OverflowTest/0 (0 ms total)

[----------] 1 test from MustacheInterpolation
[ RUN      ] MustacheInterpolation.StandaloneAmpersandWithWhitespace
[       OK ] MustacheInterpolation.StandaloneAmpersandWithWhitespace (0 ms)
[----------] 1 test from MustacheInterpolation (0 ms total)

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/8/52' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/unittests/Support/./SupportTests-LLVM-Unit-1027112-8-52.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=52 GTEST_SHARD_INDEX=8 /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/unittests/Support/./SupportTests
--


Note: This is test shard 9 of 52.
[==========] Running 32 tests from 32 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AddressRangeTest
[ RUN      ] AddressRangeTest.TestRangesMapRandom
[       OK ] AddressRangeTest.TestRangesMapRandom (0 ms)
[----------] 1 test from AddressRangeTest (0 ms total)

[----------] 1 test from EnumSizeBuildAttr
[ RUN      ] EnumSizeBuildAttr.testBuildAttr
[       OK ] EnumSizeBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from EnumSizeBuildAttr (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.Large
[       OK ] BalancedPartitioningTest.Large (322 ms)
[----------] 1 test from BalancedPartitioningTest (322 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedMulAddSmall
[       OK ] CheckedArithmetic.CheckedMulAddSmall (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from CommandLineTest
[ RUN      ] CommandLineTest.SetDefaultValue
[       OK ] CommandLineTest.SetDefaultValue (0 ms)
[----------] 1 test from CommandLineTest (0 ms total)

[----------] 1 test from CRCTest
[ RUN      ] CRCTest.CRC32
[       OK ] CRCTest.CRC32 (0 ms)
[----------] 1 test from CRCTest (0 ms total)

[----------] 1 test from EndianStream
[ RUN      ] EndianStream.WriteDoubleBE
[       OK ] EndianStream.WriteDoubleBE (0 ms)
[----------] 1 test from EndianStream (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.ExpectedCovariance
[       OK ] Error.ExpectedCovariance (0 ms)
[----------] 1 test from Error (0 ms total)

...

{
std::unique_lock<std::mutex> Lock(Mutex);
Cond.wait(Lock, [&] { return Stop || !WorkStack.empty(); });
if (Stop && WorkStack.empty())
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a difference in behaviour here compared to the non job server code below. In the code below, the "exit" condition is just if (Stop). I think it would be best if the code here matched.

Looks like I'm too late, as this PR is now merged, so will need a follow-up PR if you agree with this change.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-rel-x86-64 running on ml-opt-rel-x86-64-b1 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/26' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/b/ml-opt-rel-x86-64-b1/build/unittests/Support/./SupportTests-LLVM-Unit-1505418-9-26.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=26 GTEST_SHARD_INDEX=9 /b/ml-opt-rel-x86-64-b1/build/unittests/Support/./SupportTests
--


Note: This is test shard 10 of 26.
[==========] Running 64 tests from 54 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestFasterSlabGrowthDelay
[       OK ] AllocatorTest.TestFasterSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderIntegerArray
[       OK ] BinaryStreamTest.StreamReaderIntegerArray (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
[----------] 1 test from BalancedPartitioningTest (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_and_nonnull
Classof: 0x56183719a461
Classof: 0x56183719a461
[       OK ] CastingTest.isa_and_nonnull (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 2 tests from CommandLineTest
[ RUN      ] CommandLineTest.TokenizeConfigFile11
[       OK ] CommandLineTest.TokenizeConfigFile11 (0 ms)
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-dev-x86-64 running on ml-opt-dev-x86-64-b1 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/26' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/b/ml-opt-dev-x86-64-b1/build/unittests/Support/./SupportTests-LLVM-Unit-3678334-9-26.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=26 GTEST_SHARD_INDEX=9 /b/ml-opt-dev-x86-64-b1/build/unittests/Support/./SupportTests
--


Note: This is test shard 10 of 26.
[==========] Running 64 tests from 54 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestFasterSlabGrowthDelay
[       OK ] AllocatorTest.TestFasterSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderIntegerArray
[       OK ] BinaryStreamTest.StreamReaderIntegerArray (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
[----------] 1 test from BalancedPartitioningTest (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_and_nonnull
Classof: 0x55bf900f7461
Classof: 0x55bf900f7461
[       OK ] CastingTest.isa_and_nonnull (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 2 tests from CommandLineTest
[ RUN      ] CommandLineTest.TokenizeConfigFile11
[       OK ] CommandLineTest.TokenizeConfigFile11 (0 ms)
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-devrel-x86-64 running on ml-opt-devrel-x86-64-b2 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/26' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/b/ml-opt-devrel-x86-64-b1/build/unittests/Support/./SupportTests-LLVM-Unit-3066831-9-26.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=26 GTEST_SHARD_INDEX=9 /b/ml-opt-devrel-x86-64-b1/build/unittests/Support/./SupportTests
--

Note: This is test shard 10 of 26.
[==========] Running 64 tests from 54 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestFasterSlabGrowthDelay
[       OK ] AllocatorTest.TestFasterSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderIntegerArray
[       OK ] BinaryStreamTest.StreamReaderIntegerArray (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
[----------] 1 test from BalancedPartitioningTest (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_and_nonnull
Classof: 0x564005f48421
Classof: 0x564005f48421
[       OK ] CastingTest.isa_and_nonnull (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 2 tests from CommandLineTest
[ RUN      ] CommandLineTest.TokenizeConfigFile11
[       OK ] CommandLineTest.TokenizeConfigFile11 (0 ms)
[ RUN      ] CommandLineTest.ReadConfigFile
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/61/104' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/unittests/Support/./SupportTests-LLVM-Unit-612863-61-104.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=104 GTEST_SHARD_INDEX=61 /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/unittests/Support/./SupportTests
--


Note: This is test shard 62 of 104.
[==========] Running 16 tests from 16 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from ArchName
[ RUN      ] ArchName.testAttribute
[       OK ] ArchName.testAttribute (0 ms)
[----------] 1 test from ArchName (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from HashBuilderTest/1, where TypeParam = <type>
[ RUN      ] HashBuilderTest/1.HashStdPair
[       OK ] HashBuilderTest/1.HashStdPair (0 ms)
[----------] 1 test from HashBuilderTest/1 (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (51 ms)
[----------] 1 test from JobserverStrategyTest (51 ms total)

[----------] 1 test from OverflowTest/0, where TypeParam = <type>
[ RUN      ] OverflowTest/0.MulResultZero
[       OK ] OverflowTest/0.MulResultZero (0 ms)
[----------] 1 test from OverflowTest/0 (0 ms total)

[----------] 1 test from MustacheInterpolation
[ RUN      ] MustacheInterpolation.StandaloneAmpersandWithWhitespace
[       OK ] MustacheInterpolation.StandaloneAmpersandWithWhitespace (0 ms)
[----------] 1 test from MustacheInterpolation (0 ms total)

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-a-1 while building clang,llvm at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
      |                  ~~^
1 warning generated.
[1434/1436] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[1435/1436] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/wasm-ld
-- Testing: 61393 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
FAIL: LLVM-Unit :: Support/./SupportTests/40/102 (61379 of 61393)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/40/102' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/unittests/Support/./SupportTests-LLVM-Unit-2056078-40-102.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=102 GTEST_SHARD_INDEX=40 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/unittests/Support/./SupportTests
--


Note: This is test shard 41 of 102.
[==========] Running 16 tests from 16 test suites.
[----------] Global test environment set-up.
[----------] 1 test from FPArchBuildAttr
[ RUN      ] FPArchBuildAttr.testBuildAttr
[       OK ] FPArchBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from FPArchBuildAttr (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_check_predicates
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
[       OK ] CastingTest.isa_check_predicates (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from ConverterEBCDIC
[ RUN      ] ConverterEBCDIC.convertToEBCDIC
[       OK ] ConverterEBCDIC.convertToEBCDIC (0 ms)
[----------] 1 test from ConverterEBCDIC (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.ErrorCodeConversions
[       OK ] Error.ErrorCodeConversions (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from HashBuilderTest/1, where TypeParam = <type>
Step 7 (check) failure: check (failure)
...
      |                  ~~^
1 warning generated.
[1434/1436] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[1435/1436] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/bin/wasm-ld
-- Testing: 61393 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
FAIL: LLVM-Unit :: Support/./SupportTests/40/102 (61379 of 61393)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/40/102' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/unittests/Support/./SupportTests-LLVM-Unit-2056078-40-102.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=102 GTEST_SHARD_INDEX=40 /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-7wh3q2op/unittests/Support/./SupportTests
--


Note: This is test shard 41 of 102.
[==========] Running 16 tests from 16 test suites.
[----------] Global test environment set-up.
[----------] 1 test from FPArchBuildAttr
[ RUN      ] FPArchBuildAttr.testBuildAttr
[       OK ] FPArchBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from FPArchBuildAttr (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_check_predicates
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
Classof: 0x55dfd3dc0361
[       OK ] CastingTest.isa_check_predicates (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from ConverterEBCDIC
[ RUN      ] ConverterEBCDIC.convertToEBCDIC
[       OK ] ConverterEBCDIC.convertToEBCDIC (0 ms)
[----------] 1 test from ConverterEBCDIC (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.ErrorCodeConversions
[       OK ] Error.ErrorCodeConversions (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from HashBuilderTest/1, where TypeParam = <type>

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang,llvm at step 9 "Add check check-llvm".

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

Here is the relevant piece of the build log for the reference
Step 9 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/10/52' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/unittests/Support/./SupportTests-LLVM-Unit-973152-10-52.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=52 GTEST_SHARD_INDEX=10 /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/unittests/Support/./SupportTests
--

Note: This is test shard 11 of 52.
[==========] Running 32 tests from 32 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignConstant
[       OK ] AlignmentTest.AlignConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AlignPreservedBuildAttr
[ RUN      ] AlignPreservedBuildAttr.testBuildAttr
[       OK ] AlignPreservedBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignPreservedBuildAttr (0 ms total)

[----------] 1 test from BranchProbabilityTest
[ RUN      ] BranchProbabilityTest.Accessors
[       OK ] BranchProbabilityTest.Accessors (0 ms)
[----------] 1 test from BranchProbabilityTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedMulUnsigned
[       OK ] CheckedArithmetic.CheckedMulUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from CommandLineTest
[ RUN      ] CommandLineTest.PositionalEatArgsError
[       OK ] CommandLineTest.PositionalEatArgsError (0 ms)
[----------] 1 test from CommandLineTest (0 ms total)

[----------] 1 test from ArchName
[ RUN      ] ArchName.testAttribute
[       OK ] ArchName.testAttribute (0 ms)
[----------] 1 test from ArchName (0 ms total)

[----------] 1 test from EndianStream
[ RUN      ] EndianStream.WriteArrayLE
[       OK ] EndianStream.WriteArrayLE (0 ms)
[----------] 1 test from EndianStream (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from FormatVariadicTest
...

MixedMatched pushed a commit to MixedMatched/llvm-project that referenced this pull request Oct 3, 2025
This patch introduces support for the jobserver protocol to control
parallelism for device offloading tasks.

When running a parallel build with a modern build system like `make -jN`
or `ninja -jN`, each Clang process might also be configured to use
multiple threads for its own tasks (e.g., via `--offload-jobs=4`). This
can lead to an explosion of threads (N * 4), causing heavy system load,
CPU contention, and ultimately slowing down the entire build.

This patch allows Clang to act as a cooperative client of the build
system's jobserver. It extends the `--offload-jobs` option to accept the
value 'jobserver'. With the recent addition of jobserver support to the
Ninja build system, this functionality now benefits users of both Make
and Ninja.

When `--offload-jobs=jobserver` is specified, Clang's thread pool will:
1. Parse the MAKEFLAGS environment variable to find the jobserver
details.
2. Before dispatching a task, acquire a job slot from the jobserver. If
none are available, the worker thread will block.
3. Release the job slot once the task is complete.

This ensures that the total number of active offload tasks across all
Clang processes does not exceed the limit defined by the parent build
system, leading to more efficient and controlled parallel builds.

Implementation:
- A new library, `llvm/Support/Jobserver`, is added to provide a
platform-agnostic client for the jobserver protocol, with backends for
Unix (FIFO) and Windows (semaphores).
- `llvm/Support/ThreadPool` and `llvm/Support/Parallel` are updated with
a `jobserver_concurrency` strategy to integrate this logic.
- The Clang driver and linker-wrapper are modified to recognize the
'jobserver' argument and enable the new thread pool strategy.
- New unit and integration tests are added to validate the feature.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-5 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/13' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/Volumes/ExternalSSD/buildbot-root/aarch64-darwin/build/unittests/Support/./SupportTests-LLVM-Unit-67681-9-13.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=13 GTEST_SHARD_INDEX=9 /Volumes/ExternalSSD/buildbot-root/aarch64-darwin/build/unittests/Support/./SupportTests
--


Note: This is test shard 10 of 13.
[==========] Running 127 tests from 88 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[ RUN      ] AlignmentTest.isAligned_isAddrAligned
[       OK ] AlignmentTest.isAligned_isAddrAligned (0 ms)
[----------] 2 tests from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestFasterSlabGrowthDelay
[       OK ] AllocatorTest.TestFasterSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from MVEBuildAttr
[ RUN      ] MVEBuildAttr.testBuildAttr
[       OK ] MVEBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from MVEBuildAttr (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from Base64Test
[ RUN      ] Base64Test.Base64
[       OK ] Base64Test.Base64 (0 ms)
[----------] 1 test from Base64Test (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderIntegerArray
[       OK ] BinaryStreamTest.StreamReaderIntegerArray (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BLAKE3Test
[ RUN      ] BLAKE3Test.SmallerHashSize
[       OK ] BLAKE3Test.SmallerHashSize (0 ms)
[----------] 1 test from BLAKE3Test (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/166/415' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/./SupportTests-LLVM-Unit-893862-166-415.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=415 GTEST_SHARD_INDEX=166 /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/./SupportTests
--


Note: This is test shard 167 of 415.
[==========] Running 4 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedMulUnsigned
[       OK ] CheckedArithmetic.CheckedMulUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (88 ms)
[----------] 1 test from JobserverStrategyTest (88 ms total)

[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestExecuteWithNoStacktraceHandler
Note: Google Test filter = ProgramEnvTest.TestExecuteWithNoStacktraceHandler
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestExecuteWithNoStacktraceHandler
 #0 0x0000b0b4d2f4aba4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x64aba4)
 #1 0x0000b0b4d2cea2a8 (anonymous namespace)::ProgramEnvTest_TestExecuteWithNoStacktraceHandler_Test::TestBody() ProgramTest.cpp:0:0
 #2 0x0000b0b4d2f6fc08 testing::Test::Run() (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x66fc08)
 #3 0x0000b0b4d2f70f2c testing::TestInfo::Run() (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x670f2c)
 #4 0x0000b0b4d2f71b68 testing::TestSuite::Run() (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x671b68)
 #5 0x0000b0b4d2f81ee8 testing::internal::UnitTestImpl::RunAllTests() (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x681ee8)
 #6 0x0000b0b4d2f81834 testing::UnitTest::Run() (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x681834)
 #7 0x0000b0b4d2f5c11c main (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x65c11c)
 #8 0x0000ed6c3f0773fc __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
 #9 0x0000ed6c3f0774cc call_init ./csu/../csu/libc-start.c:128:20
#10 0x0000ed6c3f0774cc __libc_start_main ./csu/../csu/libc-start.c:379:5
#11 0x0000b0b4d2a16770 _start (/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/unittests/Support/SupportTests+0x116770)
[       OK ] ProgramEnvTest.TestExecuteWithNoStacktraceHandler (468 ms)
[----------] 1 test from ProgramEnvTest (468 ms total)

[----------] 1 test from YAMLIO
[ RUN      ] YAMLIO.TestReadBuiltInTypesint8UnderError
[       OK ] YAMLIO.TestReadBuiltInTypesint8UnderError (0 ms)
[----------] 1 test from YAMLIO (0 ms total)

[----------] Global test environment tear-down
[==========] 4 tests from 4 test suites ran. (557 ms total)
[  PASSED  ] 4 tests.
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu running on sie-linux-worker3 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/52' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/unittests/Support/./SupportTests-LLVM-Unit-557-9-52.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=52 GTEST_SHARD_INDEX=9 /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/unittests/Support/./SupportTests
--


Note: This is test shard 10 of 52.
[==========] Running 32 tests from 32 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
[----------] 1 test from BalancedPartitioningTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from CommandLineTest
[ RUN      ] CommandLineTest.ReadConfigFile
[       OK ] CommandLineTest.ReadConfigFile (0 ms)
[----------] 1 test from CommandLineTest (0 ms total)

[----------] 1 test from ArchName
[ RUN      ] ArchName.testAttribute
[       OK ] ArchName.testAttribute (0 ms)
[----------] 1 test from ArchName (0 ms total)

[----------] 1 test from EndianStream
[ RUN      ] EndianStream.WriteArrayLE
[       OK ] EndianStream.WriteArrayLE (0 ms)
[----------] 1 test from EndianStream (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/165/415' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Support/./SupportTests-LLVM-Unit-1361811-165-415.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=415 GTEST_SHARD_INDEX=165 /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/unittests/Support/./SupportTests
--


Note: This is test shard 166 of 415.
[==========] Running 4 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelForIsLimited
[       OK ] JobserverStrategyTest.ParallelForIsLimited (214 ms)
[----------] 1 test from JobserverStrategyTest (214 ms total)

[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestLockFileExclusive
Note: Google Test filter = ProgramEnvTest.TestLockFileExclusive
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestLockFileExclusive
../llvm/llvm/unittests/Support/ProgramTest.cpp:594: Failure
Value of: fs::tryLockFile(FD2, std::chrono::seconds(0), fs::LockKind::Shared)
  Actual: true
Expected: false

[       OK ] ProgramEnvTest.TestLockFileExclusive (55 ms)
[----------] 1 test from ProgramEnvTest (55 ms total)

[----------] 1 test from YAMLIO
[ RUN      ] YAMLIO.TestReadBuiltInTypesint8OverError
[       OK ] YAMLIO.TestReadBuiltInTypesint8OverError (0 ms)
[----------] 1 test from YAMLIO (0 ms total)

[----------] Global test environment tear-down
[==========] 4 tests from 4 test suites ran. (270 ms total)
[  PASSED  ] 4 tests.

--
exit: -11
--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/26' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/buildbot/worker/arc-folder/build/unittests/Support/./SupportTests-LLVM-Unit-881-9-26.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=26 GTEST_SHARD_INDEX=9 /buildbot/worker/arc-folder/build/unittests/Support/./SupportTests
--

Note: This is test shard 10 of 26.
[==========] Running 64 tests from 54 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestFasterSlabGrowthDelay
[       OK ] AllocatorTest.TestFasterSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderIntegerArray
[       OK ] BinaryStreamTest.StreamReaderIntegerArray (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
[----------] 1 test from BalancedPartitioningTest (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_and_nonnull
Classof: 0xf3eae0
Classof: 0xf3eae0
[       OK ] CastingTest.isa_and_nonnull (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 2 tests from CommandLineTest
[ RUN      ] CommandLineTest.TokenizeConfigFile11
[       OK ] CommandLineTest.TokenizeConfigFile11 (0 ms)
[ RUN      ] CommandLineTest.ReadConfigFile
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/10/52' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/unittests/Support/./SupportTests-LLVM-Unit-653666-10-52.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=52 GTEST_SHARD_INDEX=10 /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/unittests/Support/./SupportTests
--


Note: This is test shard 11 of 52.
[==========] Running 32 tests from 32 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignConstant
[       OK ] AlignmentTest.AlignConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AlignPreservedBuildAttr
[ RUN      ] AlignPreservedBuildAttr.testBuildAttr
[       OK ] AlignPreservedBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignPreservedBuildAttr (0 ms total)

[----------] 1 test from BranchProbabilityTest
[ RUN      ] BranchProbabilityTest.Accessors
[       OK ] BranchProbabilityTest.Accessors (0 ms)
[----------] 1 test from BranchProbabilityTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedMulUnsigned
[       OK ] CheckedArithmetic.CheckedMulUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from CommandLineTest
[ RUN      ] CommandLineTest.PositionalEatArgsError
[       OK ] CommandLineTest.PositionalEatArgsError (0 ms)
[----------] 1 test from CommandLineTest (0 ms total)

[----------] 1 test from ArchName
[ RUN      ] ArchName.testAttribute
[       OK ] ArchName.testAttribute (0 ms)
[----------] 1 test from ArchName (0 ms total)

[----------] 1 test from EndianStream
[ RUN      ] EndianStream.WriteArrayLE
[       OK ] EndianStream.WriteArrayLE (0 ms)
[----------] 1 test from EndianStream (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

...

yxsamliu added a commit that referenced this pull request Oct 3, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/165/208' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/unittests/Support/./SupportTests-LLVM-Unit-2726597-165-208.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=208 GTEST_SHARD_INDEX=165 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/unittests/Support/./SupportTests
--


Note: This is test shard 166 of 208.
[==========] Running 8 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (51 ms)
[----------] 1 test from JobserverStrategyTest (51 ms total)

[----------] 1 test from MustacheInterpolation
[ RUN      ] MustacheInterpolation.StandaloneAmpersandWithWhitespace
[       OK ] MustacheInterpolation.StandaloneAmpersandWithWhitespace (0 ms)
[----------] 1 test from MustacheInterpolation (0 ms total)

[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestExecuteEmptyEnvironment
Note: Google Test filter = 
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.
[       OK ] ProgramEnvTest.TestExecuteEmptyEnvironment (13 ms)
[----------] 1 test from ProgramEnvTest (13 ms total)

[----------] 1 test from TimeProfiler
[ RUN      ] TimeProfiler.Begin_End_Smoke
[       OK ] TimeProfiler.Begin_End_Smoke (0 ms)
[----------] 1 test from TimeProfiler (0 ms total)

[----------] 1 test from YAMLIO
[ RUN      ] YAMLIO.TestReadBuiltInTypesint16OverError
[       OK ] YAMLIO.TestReadBuiltInTypesint16OverError (0 ms)
[----------] 1 test from YAMLIO (0 ms total)

[----------] 1 test from VirtualOutput/BackendTest
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/165/208' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/unittests/Support/./SupportTests-LLVM-Unit-1726605-165-208.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=208 GTEST_SHARD_INDEX=165 /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/unittests/Support/./SupportTests
--


Note: This is test shard 166 of 208.
[==========] Running 8 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (52 ms)
[----------] 1 test from JobserverStrategyTest (52 ms total)

[----------] 1 test from MustacheInterpolation
[ RUN      ] MustacheInterpolation.StandaloneAmpersandWithWhitespace
[       OK ] MustacheInterpolation.StandaloneAmpersandWithWhitespace (0 ms)
[----------] 1 test from MustacheInterpolation (0 ms total)

[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestExecuteEmptyEnvironment
Note: Google Test filter = 
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.
[       OK ] ProgramEnvTest.TestExecuteEmptyEnvironment (31 ms)
[----------] 1 test from ProgramEnvTest (31 ms total)

[----------] 1 test from TimeProfiler
[ RUN      ] TimeProfiler.Begin_End_Smoke
[       OK ] TimeProfiler.Begin_End_Smoke (0 ms)
[----------] 1 test from TimeProfiler (0 ms total)

[----------] 1 test from YAMLIO
[ RUN      ] YAMLIO.TestReadBuiltInTypesint16OverError
[       OK ] YAMLIO.TestReadBuiltInTypesint16OverError (0 ms)
[----------] 1 test from YAMLIO (0 ms total)

[----------] 1 test from VirtualOutput/BackendTest
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/165/208' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/unittests/Support/./SupportTests-LLVM-Unit-1892456-165-208.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=208 GTEST_SHARD_INDEX=165 /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/unittests/Support/./SupportTests
--


Note: This is test shard 166 of 208.
[==========] Running 8 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (52 ms)
[----------] 1 test from JobserverStrategyTest (52 ms total)

[----------] 1 test from MustacheInterpolation
[ RUN      ] MustacheInterpolation.StandaloneAmpersandWithWhitespace
[       OK ] MustacheInterpolation.StandaloneAmpersandWithWhitespace (0 ms)
[----------] 1 test from MustacheInterpolation (0 ms total)

[----------] 1 test from ProgramEnvTest
[ RUN      ] ProgramEnvTest.TestExecuteEmptyEnvironment
Note: Google Test filter = 
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.
[       OK ] ProgramEnvTest.TestExecuteEmptyEnvironment (29 ms)
[----------] 1 test from ProgramEnvTest (29 ms total)

[----------] 1 test from TimeProfiler
[ RUN      ] TimeProfiler.Begin_End_Smoke
[       OK ] TimeProfiler.Begin_End_Smoke (0 ms)
[----------] 1 test from TimeProfiler (0 ms total)

[----------] 1 test from YAMLIO
[ RUN      ] YAMLIO.TestReadBuiltInTypesint16OverError
[       OK ] YAMLIO.TestReadBuiltInTypesint16OverError (0 ms)
[----------] 1 test from YAMLIO (0 ms total)

[----------] 1 test from VirtualOutput/BackendTest
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/9/26' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/unittests/Support/./SupportTests-LLVM-Unit-29916-9-26.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=26 GTEST_SHARD_INDEX=9 /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/unittests/Support/./SupportTests
--


Note: This is test shard 10 of 26.
[==========] Running 64 tests from 54 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignOfConstant
[       OK ] AlignmentTest.AlignOfConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestFasterSlabGrowthDelay
[       OK ] AllocatorTest.TestFasterSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from AlignNeededBuildAttr
[ RUN      ] AlignNeededBuildAttr.testBuildAttr
[       OK ] AlignNeededBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignNeededBuildAttr (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderIntegerArray
[       OK ] BinaryStreamTest.StreamReaderIntegerArray (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BalancedPartitioningTest
[ RUN      ] BalancedPartitioningTest.MoveGain
[       OK ] BalancedPartitioningTest.MoveGain (0 ms)
[----------] 1 test from BalancedPartitioningTest (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_and_nonnull
Classof: 0x5bf858d233b0
Classof: 0x5bf858d233b0
[       OK ] CastingTest.isa_and_nonnull (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedAddUnsigned
[       OK ] CheckedArithmetic.CheckedAddUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 2 tests from CommandLineTest
[ RUN      ] CommandLineTest.TokenizeConfigFile11
[       OK ] CommandLineTest.TokenizeConfigFile11 (0 ms)
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/582/1661' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/unittests/Support/./SupportTests-LLVM-Unit-3588664-582-1661.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1661 GTEST_SHARD_INDEX=582 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/unittests/Support/./SupportTests
--


Note: This is test shard 583 of 1661.
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (118 ms)
[----------] 1 test from JobserverStrategyTest (118 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (118 ms total)
[  PASSED  ] 1 test.

--
exit: -11
--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu-no-asserts running on doug-worker-6 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/6/13' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/buildbot-root/gcc-no-asserts/build/unittests/Support/./SupportTests-LLVM-Unit-1843134-6-13.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=13 GTEST_SHARD_INDEX=6 /home/buildbot/buildbot-root/gcc-no-asserts/build/unittests/Support/./SupportTests
--


Note: This is test shard 7 of 13.
[==========] Running 125 tests from 88 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from AlignmentTest
[ RUN      ] AlignmentTest.AlignConstant
[       OK ] AlignmentTest.AlignConstant (0 ms)
[ RUN      ] AlignmentTest.offsetToAlignment
[       OK ] AlignmentTest.offsetToAlignment (0 ms)
[----------] 2 tests from AlignmentTest (0 ms total)

[----------] 1 test from AllocatorTest
[ RUN      ] AllocatorTest.TestSlowerSlabGrowthDelay
[       OK ] AllocatorTest.TestSlowerSlabGrowthDelay (0 ms)
[----------] 1 test from AllocatorTest (0 ms total)

[----------] 1 test from CPUAlignBuildAttr
[ RUN      ] CPUAlignBuildAttr.testBuildAttr
[       OK ] CPUAlignBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from CPUAlignBuildAttr (0 ms total)

[----------] 1 test from AlignPreservedBuildAttr
[ RUN      ] AlignPreservedBuildAttr.testBuildAttr
[       OK ] AlignPreservedBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignPreservedBuildAttr (0 ms total)

[----------] 1 test from Base64Test
[ RUN      ] Base64Test.DecodeBase64
[       OK ] Base64Test.DecodeBase64 (0 ms)
[----------] 1 test from Base64Test (0 ms total)

[----------] 1 test from BinaryStreamTest
[ RUN      ] BinaryStreamTest.StreamReaderEnum
[       OK ] BinaryStreamTest.StreamReaderEnum (0 ms)
[----------] 1 test from BinaryStreamTest (0 ms total)

[----------] 1 test from BlockFrequencyTest
[ RUN      ] BlockFrequencyTest.OneToZero
[       OK ] BlockFrequencyTest.OneToZero (0 ms)
[----------] 1 test from BlockFrequencyTest (0 ms total)

[----------] 1 test from BranchProbabilityTest
[ RUN      ] BranchProbabilityTest.Accessors
[       OK ] BranchProbabilityTest.Accessors (0 ms)
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building clang,llvm at step 6 "build-stage1-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 6 (build-stage1-unified-tree) failure: build (failure) (timed out)
...
2361.236 [6265/11/444] Linking CXX executable unittests/DebugInfo/CodeView/DebugInfoCodeViewTests
2363.225 [6265/10/445] Linking CXX executable unittests/Support/LSP/LLVMSupportLSPTests
2366.198 [6265/9/446] Linking CXX executable unittests/LineEditor/LineEditorTests
2367.708 [6265/8/447] Linking CXX executable unittests/Testing/ADT/TestingADTTests
2373.906 [6265/7/448] Linking CXX executable unittests/FileCheck/FileCheckTests
2377.904 [6265/6/449] Linking CXX executable unittests/Demangle/DemangleTests
2385.997 [6265/5/450] Linking CXX executable unittests/CAS/CASTests
2399.154 [6265/4/451] Linking CXX executable bin/llvm-min-tblgen
2402.412 [6265/3/452] Linking CXX executable bin/clang-tblgen
2492.475 [6265/2/453] Linking CXX executable unittests/Support/DynamicLibrary/DynamicLibraryTests
command timed out: 1200 seconds without output running [b'ninja'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=3693.295799

yxsamliu added a commit that referenced this pull request Oct 3, 2025
With fix for JobServerTest where default parallel scheduling
strategy is saved/restored.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/10/52' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/unittests/Support/./SupportTests-LLVM-Unit-13154-10-52.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=52 GTEST_SHARD_INDEX=10 /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/unittests/Support/./SupportTests
--


Note: This is test shard 11 of 52.
[==========] Running 32 tests from 32 test suites.
[----------] Global test environment set-up.
[----------] 1 test from AlignmentTest
[ RUN      ] AlignmentTest.AlignConstant
[       OK ] AlignmentTest.AlignConstant (0 ms)
[----------] 1 test from AlignmentTest (0 ms total)

[----------] 1 test from AlignPreservedBuildAttr
[ RUN      ] AlignPreservedBuildAttr.testBuildAttr
[       OK ] AlignPreservedBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from AlignPreservedBuildAttr (0 ms total)

[----------] 1 test from BranchProbabilityTest
[ RUN      ] BranchProbabilityTest.Accessors
[       OK ] BranchProbabilityTest.Accessors (0 ms)
[----------] 1 test from BranchProbabilityTest (0 ms total)

[----------] 1 test from CheckedArithmetic
[ RUN      ] CheckedArithmetic.CheckedMulUnsigned
[       OK ] CheckedArithmetic.CheckedMulUnsigned (0 ms)
[----------] 1 test from CheckedArithmetic (0 ms total)

[----------] 1 test from CommandLineTest
[ RUN      ] CommandLineTest.PositionalEatArgsError
[       OK ] CommandLineTest.PositionalEatArgsError (0 ms)
[----------] 1 test from CommandLineTest (0 ms total)

[----------] 1 test from ArchName
[ RUN      ] ArchName.testAttribute
[       OK ] ArchName.testAttribute (0 ms)
[----------] 1 test from ArchName (0 ms total)

[----------] 1 test from EndianStream
[ RUN      ] EndianStream.WriteArrayLE
[       OK ] EndianStream.WriteArrayLE (0 ms)
[----------] 1 test from EndianStream (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.HandleExpectedSuccess
[       OK ] Error.HandleExpectedSuccess (0 ms)
[----------] 1 test from Error (0 ms total)

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2025

LLVM Buildbot has detected a new failure on builder clang-with-thin-lto-ubuntu running on as-worker-92 while building clang,llvm at step 7 "test-stage1-compiler".

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

Here is the relevant piece of the build log for the reference
Step 7 (test-stage1-compiler) failure: build (failure)
...
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/utils/lit/tests/lit.cfg:111: warning: Setting a timeout per test not supported. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
 Some tests will be skipped and the --timeout command line argument will not work.
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using lld-link: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/lld-link
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using ld64.lld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/ld64.lld
llvm-lit: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:530: note: using wasm-ld: /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/wasm-ld
-- Testing: 87737 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM-Unit :: Support/./SupportTests/40/102 (84427 of 87737)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/40/102' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/unittests/Support/./SupportTests-LLVM-Unit-1056820-40-102.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=102 GTEST_SHARD_INDEX=40 /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/unittests/Support/./SupportTests
--


Note: This is test shard 41 of 102.
[==========] Running 16 tests from 16 test suites.
[----------] Global test environment set-up.
[----------] 1 test from FPArchBuildAttr
[ RUN      ] FPArchBuildAttr.testBuildAttr
[       OK ] FPArchBuildAttr.testBuildAttr (0 ms)
[----------] 1 test from FPArchBuildAttr (0 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.isa_check_predicates
Classof: 0x5579e2488ff8
Classof: 0x5579e2488ff8
Classof: 0x5579e2488ff8
Classof: 0x5579e2488ff8
Classof: 0x5579e2488ff8
Classof: 0x5579e2488ff8
Classof: 0x5579e2488ff8
[       OK ] CastingTest.isa_check_predicates (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from ConverterEBCDIC
[ RUN      ] ConverterEBCDIC.convertToEBCDIC
[       OK ] ConverterEBCDIC.convertToEBCDIC (0 ms)
[----------] 1 test from ConverterEBCDIC (0 ms total)

[----------] 1 test from Error
[ RUN      ] Error.ErrorCodeConversions
[       OK ] Error.ErrorCodeConversions (0 ms)
[----------] 1 test from Error (0 ms total)

[----------] 1 test from HashBuilderTest/1, where TypeParam = <type>

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 4, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/33/208' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/unittests/Support/./SupportTests-LLVM-Unit-35652262-33-208.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=208 GTEST_SHARD_INDEX=33 /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/unittests/Support/./SupportTests
--


Note: This is test shard 34 of 208.
[==========] Running 8 tests from 8 test suites.
[----------] Global test environment set-up.
[----------] 1 test from raw_ostreamTest
[ RUN      ] raw_ostreamTest.writeToDevNull
[       OK ] raw_ostreamTest.writeToDevNull (0 ms)
[----------] 1 test from raw_ostreamTest (0 ms total)

[----------] 1 test from FileSystemTest
[ RUN      ] FileSystemTest.OpenAlways
Test Directory: /tmp/lit-tmp-p8tpsdxb/file-system-test-53c510
[       OK ] FileSystemTest.OpenAlways (5858 ms)
[----------] 1 test from FileSystemTest (5858 ms total)

[----------] 1 test from CastingTest
[ RUN      ] CastingTest.dyn_cast_if_present
[       OK ] CastingTest.dyn_cast_if_present (0 ms)
[----------] 1 test from CastingTest (0 ms total)

[----------] 1 test from MustacheDelimiters
[ RUN      ] MustacheDelimiters.PartialInheritence
[       OK ] MustacheDelimiters.PartialInheritence (0 ms)
[----------] 1 test from MustacheDelimiters (0 ms total)

[----------] 1 test from HashBuilderTest/7, where TypeParam = <type>
[ RUN      ] HashBuilderTest/7.HashStringRef
[       OK ] HashBuilderTest/7.HashStringRef (0 ms)
[----------] 1 test from HashBuilderTest/7 (0 ms total)

[----------] 1 test from OverflowTest/1, where TypeParam = <type>
[ RUN      ] OverflowTest/1.SubOverflowToPositive
[       OK ] OverflowTest/1.SubOverflowToPositive (0 ms)
[----------] 1 test from OverflowTest/1 (0 ms total)

[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelForIsLimited
[       OK ] JobserverStrategyTest.ParallelForIsLimited (1898 ms)
[----------] 1 test from JobserverStrategyTest (1898 ms total)

[----------] 1 test from SpecialCaseListTest
[ RUN      ] SpecialCaseListTest.InvalidSpecialCaseList
[       OK ] SpecialCaseListTest.InvalidSpecialCaseList (0 ms)
[----------] 1 test from SpecialCaseListTest (0 ms total)
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 4, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building clang,llvm at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/582/1661' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/unittests/Support/./SupportTests-LLVM-Unit-845834-582-1661.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1661 GTEST_SHARD_INDEX=582 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/unittests/Support/./SupportTests
--


Note: This is test shard 583 of 1661.
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (146 ms)
[----------] 1 test from JobserverStrategyTest (146 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (148 ms total)
[  PASSED  ] 1 test.
#0 0x00007fffab872e70 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib/libLLVMSupport.so.22.0git+0x272e70)
#1 0x00007fffab86eef4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x00007fffabbc04d8 (linux-vdso64.so.1+0x4d8)
#3 0x00007fffab77595c llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::work(llvm::ThreadPoolStrategy, unsigned int) Parallel.cpp:0:0
#4 0x00007fffab775f18 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::ThreadPoolExecutor(llvm::ThreadPoolStrategy)::'lambda'()>>>::_M_run() Parallel.cpp:0:0
#5 0x00007fffab4c5f74 (/lib64/libstdc++.so.6+0xf5f74)
#6 0x00007fffabaa9718 start_thread (/lib64/libpthread.so.0+0x9718)
#7 0x00007fffab16b298 clone (/lib64/libc.so.6+0x13b298)

--
exit: -11
--

********************

Step 11 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/582/1661' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/unittests/Support/./SupportTests-LLVM-Unit-593863-582-1661.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=1661 GTEST_SHARD_INDEX=582 /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/unittests/Support/./SupportTests
--


Note: This is test shard 583 of 1661.
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from JobserverStrategyTest
[ RUN      ] JobserverStrategyTest.ParallelSortIsLimited
[       OK ] JobserverStrategyTest.ParallelSortIsLimited (9279 ms)
[----------] 1 test from JobserverStrategyTest (9279 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (9280 ms total)
[  PASSED  ] 1 test.

--
exit: -11
--

********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category llvm:support platform:windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants