Skip to content

Commit 9606e0a

Browse files
authored
Partially revert 53b8f12 on linux (#460) (#467)
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 cf77b19 commit 9606e0a

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
@@ -199,7 +199,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
199199
CommonClangInitialize();
200200

201201
try {
202+
#ifdef _WIN32
202203
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
204+
#endif
203205
std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());
204206

205207
// Create the clang compiler
@@ -211,6 +213,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
211213
// Prepare error log
212214
llvm::raw_string_ostream err_ostream(pResult->getLogRef());
213215
{
216+
#ifndef _WIN32
217+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
218+
#endif
214219
// Parse options
215220
optionsParser.processOptions(pszOptions, pszOptionsEx);
216221

@@ -329,6 +334,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
329334
err_ostream.flush();
330335
}
331336
{
337+
#ifndef _WIN32
338+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
339+
#endif
332340
if (pBinaryResult) {
333341
*pBinaryResult = pResult.release();
334342
}

0 commit comments

Comments
 (0)