Skip to content

Commit f8f6c0b

Browse files
committed
Revert "[LLVM] Add GNU make jobserver support (#145131)"
revert this patch due to failure in unittests/Support, e.g. https://lab.llvm.org/buildbot/#/builders/33/builds/24178/steps/6/logs/FAIL__LLVM-Unit__SupportTests_61 This reverts commit ffc503e.
1 parent c75ae01 commit f8f6c0b

File tree

18 files changed

+30
-1393
lines changed

18 files changed

+30
-1393
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,8 @@ def offload_compression_level_EQ : Joined<["--"], "offload-compression-level=">,
12581258
HelpText<"Compression level for offload device binaries (HIP only)">;
12591259

12601260
def offload_jobs_EQ : Joined<["--"], "offload-jobs=">,
1261-
HelpText<"Specify the number of threads to use for device offloading tasks "
1262-
"during compilation. Can be a positive integer or the string "
1263-
"'jobserver' to use the make-style jobserver from the environment.">;
1261+
HelpText<"Specify the number of threads to use for device offloading tasks"
1262+
" during compilation.">;
12641263

12651264
defm offload_via_llvm : BoolFOption<"offload-via-llvm",
12661265
LangOpts<"OffloadViaLLVM">, DefaultFalse,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9224,20 +9224,14 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
92249224
addOffloadCompressArgs(Args, CmdArgs);
92259225

92269226
if (Arg *A = Args.getLastArg(options::OPT_offload_jobs_EQ)) {
9227-
StringRef Val = A->getValue();
9228-
9229-
if (Val.equals_insensitive("jobserver"))
9230-
CmdArgs.push_back(Args.MakeArgString("--wrapper-jobs=jobserver"));
9231-
else {
9232-
int NumThreads;
9233-
if (Val.getAsInteger(10, NumThreads) || NumThreads <= 0) {
9234-
C.getDriver().Diag(diag::err_drv_invalid_int_value)
9235-
<< A->getAsString(Args) << Val;
9236-
} else {
9237-
CmdArgs.push_back(
9238-
Args.MakeArgString("--wrapper-jobs=" + Twine(NumThreads)));
9239-
}
9240-
}
9227+
int NumThreads;
9228+
if (StringRef(A->getValue()).getAsInteger(10, NumThreads) ||
9229+
NumThreads <= 0)
9230+
C.getDriver().Diag(diag::err_drv_invalid_int_value)
9231+
<< A->getAsString(Args) << A->getValue();
9232+
else
9233+
CmdArgs.push_back(
9234+
Args.MakeArgString("--wrapper-jobs=" + Twine(NumThreads)));
92419235
}
92429236

92439237
const char *Exec =

clang/test/Driver/hip-options.hip

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,3 @@
254254
// RUN: --offload-arch=gfx1100 --offload-new-driver --offload-jobs=0x4 %s 2>&1 | \
255255
// RUN: FileCheck -check-prefix=INVJOBS %s
256256
// INVJOBS: clang: error: invalid integral value '0x4' in '--offload-jobs=0x4'
257-
258-
// RUN: %clang -### -Werror --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
259-
// RUN: --offload-arch=gfx1100 --offload-new-driver --offload-jobs=jobserver %s 2>&1 | \
260-
// RUN: FileCheck -check-prefix=JOBSV %s
261-
// JOBSV: clang-linker-wrapper{{.*}} "--wrapper-jobs=jobserver"
262-

clang/test/Driver/linker-wrapper.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ __attribute__((visibility("protected"), used)) int x;
114114
// RUN: -fembed-offload-object=%t.out
115115
// RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-unknown-linux-gnu --wrapper-jobs=4 \
116116
// RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=CUDA-PAR
117-
// RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-unknown-linux-gnu --wrapper-jobs=jobserver \
118-
// RUN: --linker-path=/usr/bin/ld %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=CUDA-PAR
119117

120118
// CUDA-PAR: fatbinary{{.*}}-64 --create {{.*}}.fatbin
121119

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,18 +1295,12 @@ int main(int Argc, char **Argv) {
12951295

12961296
parallel::strategy = hardware_concurrency(1);
12971297
if (auto *Arg = Args.getLastArg(OPT_wrapper_jobs)) {
1298-
StringRef Val = Arg->getValue();
1299-
if (Val.equals_insensitive("jobserver"))
1300-
parallel::strategy = jobserver_concurrency();
1301-
else {
1302-
unsigned Threads = 0;
1303-
if (!llvm::to_integer(Val, Threads) || Threads == 0)
1304-
reportError(createStringError(
1305-
"%s: expected a positive integer or 'jobserver', got '%s'",
1306-
Arg->getSpelling().data(), Val.data()));
1307-
else
1308-
parallel::strategy = hardware_concurrency(Threads);
1309-
}
1298+
unsigned Threads = 0;
1299+
if (!llvm::to_integer(Arg->getValue(), Threads) || Threads == 0)
1300+
reportError(createStringError("%s: expected a positive integer, got '%s'",
1301+
Arg->getSpelling().data(),
1302+
Arg->getValue()));
1303+
parallel::strategy = hardware_concurrency(Threads);
13101304
}
13111305

13121306
if (Args.hasArg(OPT_wrapper_time_trace_eq)) {

clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ def wrapper_time_trace_granularity : Joined<["--"], "wrapper-time-trace-granular
5353

5454
def wrapper_jobs : Joined<["--"], "wrapper-jobs=">,
5555
Flags<[WrapperOnlyOption]>, MetaVarName<"<number>">,
56-
HelpText<"Sets the number of parallel jobs for device linking. Can be a "
57-
"positive integer or 'jobserver'.">;
56+
HelpText<"Sets the number of parallel jobs to use for device linking">;
5857

5958
def override_image : Joined<["--"], "override-image=">,
6059
Flags<[WrapperOnlyOption]>, MetaVarName<"<kind=file>">,

llvm/include/llvm/Support/Jobserver.h

Lines changed: 0 additions & 162 deletions
This file was deleted.

llvm/include/llvm/Support/ThreadPool.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "llvm/ADT/DenseMap.h"
1717
#include "llvm/Config/llvm-config.h"
1818
#include "llvm/Support/Compiler.h"
19-
#include "llvm/Support/Jobserver.h"
2019
#include "llvm/Support/RWMutex.h"
2120
#include "llvm/Support/Threading.h"
2221
#include "llvm/Support/thread.h"
@@ -181,7 +180,6 @@ class LLVM_ABI StdThreadPool : public ThreadPoolInterface {
181180
void grow(int requested);
182181

183182
void processTasks(ThreadPoolTaskGroup *WaitingForGroup);
184-
void processTasksWithJobserver();
185183

186184
/// Threads in flight
187185
std::vector<llvm::thread> Threads;
@@ -210,8 +208,6 @@ class LLVM_ABI StdThreadPool : public ThreadPoolInterface {
210208

211209
/// Maximum number of threads to potentially grow this pool to.
212210
const unsigned MaxThreadCount;
213-
214-
JobserverClient *TheJobserver = nullptr;
215211
};
216212
#endif // LLVM_ENABLE_THREADS
217213

llvm/include/llvm/Support/Threading.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,6 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
142142
/// the thread shall remain on the actual CPU socket.
143143
LLVM_ABI std::optional<unsigned>
144144
compute_cpu_socket(unsigned ThreadPoolNum) const;
145-
146-
/// If true, the thread pool will attempt to coordinate with a GNU Make
147-
/// jobserver, acquiring a job slot before processing a task. If no
148-
/// jobserver is found in the environment, this is ignored.
149-
bool UseJobserver = false;
150145
};
151146

152147
/// Build a strategy from a number of threads as a string provided in \p Num.
@@ -215,19 +210,6 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; }
215210
return S;
216211
}
217212

218-
/// Returns a thread strategy that attempts to coordinate with a GNU Make
219-
/// jobserver. The number of active threads will be limited by the number of
220-
/// available job slots. If no jobserver is detected in the environment, this
221-
/// strategy falls back to the default hardware_concurrency() behavior.
222-
inline ThreadPoolStrategy jobserver_concurrency() {
223-
ThreadPoolStrategy S;
224-
S.UseJobserver = true;
225-
// We can still request all threads be created, as they will simply
226-
// block waiting for a job slot if the jobserver is the limiting factor.
227-
S.ThreadsRequested = 0; // 0 means 'use all available'
228-
return S;
229-
}
230-
231213
/// Return the current thread id, as used in various OS system calls.
232214
/// Note that not all platforms guarantee that the value returned will be
233215
/// unique across the entire system, so portable code should not assume

llvm/lib/Support/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ add_llvm_component_library(LLVMSupport
207207
InstructionCost.cpp
208208
IntEqClasses.cpp
209209
IntervalMap.cpp
210-
Jobserver.cpp
211210
JSON.cpp
212211
KnownBits.cpp
213212
KnownFPClass.cpp

0 commit comments

Comments
 (0)