Page MenuHomePhabricator

[OpenMP][libomp] Add hidden helper affinity
ClosedPublic

Authored by jlpeyton on Oct 3 2022, 3:07 PM.

Details

Summary

Add new hidden helper affinity via the environment variable,
KMP_HIDDEN_HELPER_AFFINITY, which allows users to assign thread
affinity to hidden helper threads using the same syntax as
KMP_AFFINITY. OMP_PLACES/OMP_PROC_BIND have no interaction with
KMP_HIDDEN_HELPER_AFFINITY.

Diff Detail

Event Timeline

jlpeyton created this revision.Oct 3 2022, 3:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2022, 3:07 PM
jlpeyton requested review of this revision.Oct 3 2022, 3:07 PM

LG, let's see if someone else wants to chime in, otherwise this can be merged. (@tianshilei1992)

ping. This is the third patch set in a series of three to introduce hidden helper affinity.

This revision is now accepted and ready to land.Oct 25 2022, 2:38 PM
tianshilei1992 accepted this revision.Oct 25 2022, 3:14 PM

Sorry for the late response. This is a long-wanted feature. Thanks for it!

This revision was landed with ongoing or failed builds.Oct 28 2022, 1:21 PM
This revision was automatically updated to reflect the committed changes.
mgorny added a subscriber: mgorny.Oct 30 2022, 1:46 AM

I'm seeing test failures on Gentoo due to this change (both on amd64 and i386):

FAIL: libomp :: env/kmp_aff_disable_hwloc.c (54 of 301)
******************** TEST 'libomp :: env/kmp_aff_disable_hwloc.c' FAILED ********************
Script:
--
: 'RUN: at line 1';   /usr/lib/ccache/bin/x86_64-pc-linux-gnu-clang -fno-experimental-isel -fopenmp   -I /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/src -I /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp/runtime/test -L /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/src  -fno-omit-frame-pointer -I /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp/runtime/test/ompt /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp/runtime/test/env/kmp_aff_disable_hwloc.c -o /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/test/env/Output/kmp_aff_disable_hwloc.c.tmp -lm -latomic && env KMP_AFFINITY=disabled KMP_TOPOLOGY_METHOD=hwloc /tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/test/env/Output/kmp_aff_disable_hwloc.c.tmp
--
Exit Code: -6

Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "/usr/lib/ccache/bin/x86_64-pc-linux-gnu-clang" "-fno-experimental-isel" "-fopenmp" "-I" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/src" "-I" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp/runtime/test" "-L" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/src" "-fno-omit-frame-pointer" "-I" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp/runtime/test/ompt" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp/runtime/test/env/kmp_aff_disable_hwloc.c" "-o" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/test/env/Output/kmp_aff_disable_hwloc.c.tmp" "-lm" "-latomic"
$ "env" "KMP_AFFINITY=disabled" "KMP_TOPOLOGY_METHOD=hwloc" "/tmp/portage/sys-libs/libomp-16.0.0_pre20221029/work/openmp_build-abi_x86_64.amd64/runtime/test/env/Output/kmp_aff_disable_hwloc.c.tmp"
# command stderr:
OMP: Warning #264: KMP_AFFINITY: Ignoring hwloc mechanism.
Assertion failure at kmp_settings.cpp(5926): affinity->type != affinity_default.
OMP: Error #13: Assertion failure at kmp_settings.cpp(5926).
OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see https://bugs.llvm.org/.

error: command failed with exit status: -6

--

********************

If that's of any relevance, I'm testing in a systemd-nspawn container.