Skip to content

Commit 0d495e5

Browse files
committed
Partially revert 53b8f12 on linux (intel#460)
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.
1 parent c16a7ad commit 0d495e5

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
@@ -217,7 +217,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
217217
CommonClangInitialize();
218218

219219
try {
220+
#ifdef _WIN32
220221
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
222+
#endif
221223
std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());
222224

223225
// Create the clang compiler
@@ -229,6 +231,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
229231
// Prepare error log
230232
llvm::raw_string_ostream err_ostream(pResult->getLogRef());
231233
{
234+
#ifndef _WIN32
235+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
236+
#endif
232237
// Parse options
233238
optionsParser.processOptions(pszOptions, pszOptionsEx);
234239

@@ -357,6 +362,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
357362
err_ostream.flush();
358363
}
359364
{
365+
#ifndef _WIN32
366+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
367+
#endif
360368
if (pBinaryResult) {
361369
*pBinaryResult = pResult.release();
362370
}

0 commit comments

Comments
 (0)