llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Imrove perfromance when user sets same number of threads

Open AndreyChurbanov opened this issue 8 years ago • 1 comments

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.

AndreyChurbanov avatar Oct 01 '18 10:10 AndreyChurbanov

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.

AndreyChurbanov avatar Nov 14 '18 14:11 AndreyChurbanov