Skip to content

Commit d43d054

Browse files
authored
Partially revert 53b8f12 on linux (#460) (#466)
The issue in 53b8f12 isn't observed on linux. This allows parallel execution of clang::ExecuteCompilerInvocation and parallel execution of llvm::writeSpirv. This improves performance of multi-threaded OpenCL tests on linux. (cherry picked from commit cf95b33)
1 parent b72f84d commit d43d054

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common_clang.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
213213
CommonClangInitialize();
214214

215215
try {
216+
#ifdef _WIN32
216217
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
218+
#endif
217219
std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());
218220

219221
// Create the clang compiler
@@ -225,6 +227,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
225227
// Prepare error log
226228
llvm::raw_string_ostream err_ostream(pResult->getLogRef());
227229
{
230+
#ifndef _WIN32
231+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
232+
#endif
228233
// Parse options
229234
optionsParser.processOptions(pszOptions, pszOptionsEx);
230235

@@ -342,6 +347,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
342347
err_ostream.flush();
343348
}
344349
{
350+
#ifndef _WIN32
351+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
352+
#endif
345353
if (pBinaryResult) {
346354
*pBinaryResult = pResult.release();
347355
}

0 commit comments

Comments
 (0)