llvm-project
llvm-project copied to clipboard
Imrove perfromance when user sets same number of threads
| Bugzilla Link | 39137 |
| Resolution | FIXED |
| Resolved on | Nov 14, 2018 06:07 |
| Version | unspecified |
| OS | All |
| CC | @hfinkel |
| Fixed by commit(s) | r346862 |
Extended Description
omp_set_num_threads() or num_threads() clause can set same number of threads each time. The library should do "nothing" in this case.
The function omp_set_num_threads() fixed to not write into internal structure if requested number of threads is the same as the value of internal control variable (ICV).
With num_threads() clause things are more complicated, because the write here is cheaper and this write eliminates the need to read ICV twice - here and in the following __kmp_fork_call. Attempt to avoid write op here caused some performance regressions in our testing, so I'd prefer to leave the clause implementation intact.