Skip to content

Commit b92fa41

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. (cherry picked from commit cf95b33)
1 parent fe06526 commit b92fa41

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

opencl_clang.cpp

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

210210
try {
211+
#ifdef _WIN32
211212
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
213+
#endif
212214
std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());
213215

214216
// Create the clang compiler
@@ -220,6 +222,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
220222
// Prepare error log
221223
llvm::raw_string_ostream err_ostream(pResult->getLogRef());
222224
{
225+
#ifndef _WIN32
226+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
227+
#endif
223228
// Parse options
224229
optionsParser.processOptions(pszOptions, pszOptionsEx);
225230

@@ -336,6 +341,9 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
336341
err_ostream.flush();
337342
}
338343
{
344+
#ifndef _WIN32
345+
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
346+
#endif
339347
if (pBinaryResult) {
340348
*pBinaryResult = pResult.release();
341349
}

0 commit comments

Comments
 (0)