[all-commits] [llvm/llvm-project] f4cce0: [OpenMP][libomp] Add topology information to threa...

Jonathan Peyton via All-commits all-commits at lists.llvm.org
Mon Jan 16 21:04:58 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f4cce0f47b3e720cc6c7210b345690de210d015d
      https://github.com/llvm/llvm-project/commit/f4cce0f47b3e720cc6c7210b345690de210d015d
  Author: Jonathan Peyton <jonathan.l.peyton at intel.com>
  Date:   2023-01-16 (Mon, 16 Jan 2023)

  Changed paths:
    M openmp/runtime/src/kmp.h
    M openmp/runtime/src/kmp_affinity.cpp
    M openmp/runtime/src/kmp_affinity.h

  Log Message:
  -----------
  [OpenMP][libomp] Add topology information to thread structure

Each time a thread gets a new affinity assigned, it will not
only assign its mask, but also topology information including
which socket, core, thread and core-attributes (if available)
it is now assigned. This occurs for all non-disabled KMP_AFFINITY
values as well as OMP_PLACES/OMP_PROC_BIND.

The information regarding which socket, core, etc. can take on three
values:
  1) The actual ID of the unit (0 - (N-1)), given N units
  2) UNKNOWN_ID (-1) which indicates it does not know which ID
  3) MULTIPLE_ID (-2) which indicates the thread is spread across
     multiple of this unit (e.g., affinity mask is spread across
     multiple hardware threads)
This new information is stored in th_topology_ids[] array. An example
how to get the socket Id, one would read th_topology_ids[KMP_HW_SOCKET].
This could be expanded in the future to something more descriptive for
the "multiple" case, like a range of values. For now, the single
value suffices.

The information regarding the core attributes can take on two values:
  1) The actual core-type or core-eff
  2) KMP_HW_CORE_TYPE_UNKNOWN if the core type is unknown, and
     UNKNOWN_CORE_EFF (-1) if the core eff is unknown.
This new information is stored in th_topology_attrs. An example
how to get the core type, one would read
th_topology_attrs.core_type.

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




More information about the All-commits mailing list