[Openmp-commits] [PATCH] D154547: [OpenMP] Introduce hybrid core attributes to OMP_PLACES and KMP_AFFINITY

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jul 5 14:41:01 PDT 2023


jlpeyton created this revision.
jlpeyton added reviewers: tlwilmar, hbae, Nawrin.
jlpeyton added a project: OpenMP.
Herald added subscribers: sunshaoce, guansong, yaxunl.
Herald added a project: All.
jlpeyton requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: jplehr, sstefan1.

- Add `KMP_CPU_EQUAL` and `KMP_CPU_ISEMPTY` to affinity mask API
- Add printout of `leader` to hardware thread dump
- Allow `OMP_PLACES` to restrict `__kmp_affin_fullMask`

  This change fixes an issue with the `OMP_PLACES=resource(#)` syntax. Before this change, specifying the number of resources did NOT change the default number of threads created by the runtime. e.g., `OMP_PLACES=cores(2)` would still create `__kmp_avail_proc` number of threads. After this change, the `__kmp_affin_fullMask` and `__kmp_avail_proc` are modified if necessary so that the final place list dictates which resources are available and how thus, how many threads are created by default.

- Introduce hybrid core attributes to `OMP_PLACES` and `KMP_AFFINITY`

  For `OMP_PLACES`, two new features are added:
  1. `OMP_PLACES=cores:<attribute>` where <attribute> is either `intel_atom`, `intel_core`, or `eff#` where `#` is 0 - number of core efficiencies-1. This syntax also supports the optional (#) number selection of resources.
  2. `OMP_PLACES=core_types|core_effs` where this setting will create the number of `core_types` (or `core_effs|core_efficiencies`).

    For `KMP_AFFINITY`, the granularity setting is expanded to include two new keywords: `core_type`, and `core_eff` (or `core_efficiency`). This will set the granularity to include all cores with a particular core type (or efficiency). e.g., `KMP_AFFINITY=granularity=core_type,compact` will create threads which can float across a single core type.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154547

Files:
  openmp/runtime/src/i18n/en_US.txt
  openmp/runtime/src/kmp.h
  openmp/runtime/src/kmp_affinity.cpp
  openmp/runtime/src/kmp_affinity.h
  openmp/runtime/src/kmp_settings.cpp
  openmp/runtime/src/z_Linux_util.cpp
  openmp/runtime/test/affinity/omp-places-invalid-syntax.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154547.537502.patch
Type: text/x-patch
Size: 40700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230705/430d6d47/attachment-0001.bin>


More information about the Openmp-commits mailing list