Skip to content

Commit bc1d13e

Browse files
authored
Partially revert 53b8f12 on linux (#460) (#461)
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 4d064e2 commit bc1d13e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common_clang.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
212212
CommonClangInitialize();
213213

214214
try {
215+
#ifdef _WIN32
215216
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
217+
#endif
216218
std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());
217219

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

@@ -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)