This is an archive of the discontinued LLVM Phabricator instance.

Enable thread affinity for Power
ClosedPublic

Authored by Hahnfeld on Nov 22 2017, 7:40 AM.

Details

Summary

To make this work according to the OpenMP spec, the runtime needs
information about the hardware topology. On Linux the default way
is to parse /proc/cpuinfo which contains this information for x86
machines but (at least) not for Power architectures.

Fortunately, there is a different code path which is able to get
that data from sysfs. The needed patch has landed in 2006 for
Linux 2.6.16 which is safe to assume nowadays (even RHEL 5 had
a kernel version derived from 2.6.18, and we are now at RHEL 7!).

Diff Detail

Repository
rL LLVM

Event Timeline

Hahnfeld created this revision.Nov 22 2017, 7:40 AM
Hahnfeld added inline comments.
runtime/src/kmp_affinity.cpp
1839 ↗(On Diff #123944)

I thought about switching the default for x86 as well because virtually every Linux system should support these sysfs nodes nowadays, but in the end decided to keep the current code path...

AndreyChurbanov accepted this revision.Dec 1 2017, 2:28 AM

LGTM

Though not tested as I don't have access to power machine...

This revision is now accepted and ready to land.Dec 1 2017, 2:28 AM
This revision was automatically updated to reflect the committed changes.