[all-commits] [llvm/llvm-project] f0221f: [OpenMP] Add option to use different units for blo...

Terry Wilmarth via All-commits all-commits at lists.llvm.org
Fri Aug 18 12:01:31 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0221fb1d7a9dd9af67018494db1999d251be067
  Author: Terry Wilmarth <terry.l.wilmarth at intel.com>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    M openmp/docs/design/Runtimes.rst
    M openmp/runtime/src/kmp.h
    M openmp/runtime/src/kmp_csupport.cpp
    M openmp/runtime/src/kmp_ftn_entry.h
    M openmp/runtime/src/kmp_global.cpp
    M openmp/runtime/src/kmp_runtime.cpp
    M openmp/runtime/src/kmp_settings.cpp
    M openmp/runtime/src/kmp_settings.h
    M openmp/runtime/src/kmp_str.cpp
    M openmp/runtime/src/kmp_str.h
    M openmp/runtime/src/z_Linux_util.cpp

  Log Message:
  [OpenMP] Add option to use different units for blocktime

This change adds the option of using different units for blocktimes specified via the KMP_BLOCKTIME environment variable. The parsing of the environment now recognizes units suffixes: ms and us. If a units suffix is not specified, the default unit is ms. Thus default behavior is still the same, and any previous usage still works the same. Internally, blocktime is now converted to microseconds everywhere, so settings that exceed INT_MAX in microseconds are considered "infinite".

kmp_set/get_blocktime are updated to use the units the user specified with KMP_BLOCKTIME, and if not specified, ms are used.

Added better range checking and inform messages for the two time units. Large values of blocktime for default (ms) case (beyond INT_MAX/1000) are no longer allowed, but will autocorrect with an INFORM message.

The delay for determining ticks per usec was lowered.  It is now 1 million ticks which was calculated as ~450us based on 2.2GHz clock which is pretty typical base clock frequency on X86:
(1e6 Ticks)  /  (2.2e9 Ticks/sec)  *  (1e6 usec/sec)  =  454 usec
Really short benchmarks can be affected by longer delay.

Update KMP_BLOCKTIME docs.

Portions of this commit were authored by Johnny Peyton.

Differential Revision: https://reviews.llvm.org/D157646

More information about the All-commits mailing list