This is an archive of the discontinued LLVM Phabricator instance.

Allow machine hierarchy expansion
ClosedPublic

Authored by jlpeyton on May 20 2015, 3:51 PM.

Details

Summary

This fix allows the machine hierarchy to be expanded in case it needs to handle more threads. It adds a resize function to accomplish this.

Diff Detail

Repository
rL LLVM

Event Timeline

jlpeyton updated this revision to Diff 26191.May 20 2015, 3:51 PM
jlpeyton retitled this revision from to Allow machine hierarchy expansion.
jlpeyton updated this object.
jlpeyton edited the test plan for this revision. (Show Details)
jlpeyton added a reviewer: hfinkel.
jlpeyton set the repository for this revision to rL LLVM.
jlpeyton added subscribers: Unknown Object (MLST), Unknown Object (MLST).
jlpeyton added a subscriber: tlwilmar.
hfinkel edited edge metadata.May 23 2015, 5:56 PM

I don't understand this patch; can you please explain more?

Is the idea that if, at runtime, someone adds more CPUs, the hierarchy will resize itself?

runtime/src/kmp_affinity.cpp
320 ↗(On Diff #26191)

Why are you making this dynamic? How could this end up needing more than 7?

Oversubscription. There's nothing to prevent the user from requesting an arbitrarily large number of threads.

So, yes, this allows the hierarchy to resize itself in the oversubscription case.

Oversubscription. There's nothing to prevent the user from requesting an arbitrarily large number of threads.

But I thought that the machine hierarchy information represented the physical properties of the machine (cpus, cores, sockets, etc.). How does oversubscription factor into this? And how does that affect the number of levels?

It does represent the machine hierarchy, when there is no oversubscription, but it is actually used as a way to map existing threads to the machine hierarchy for the purpose of performing a barrier. Adding a level when oversubscribed simply adds more tree structure for all the additional threads to communicate along. One additional level duplicates the existing hierarchy as a second child of a new root, doubling the number of threads that the barrier can handle.

jlpeyton updated this revision to Diff 27392.Jun 9 2015, 12:55 PM
jlpeyton edited edge metadata.

Added comments to clarify

Okay; please add a comment explaining this; the current definition of maxLevels says:
and this gives no indication at all of how this might need to be set to handle oversubscription. There are a few ...
but that does not really explain what is going on.

This revision was automatically updated to reflect the committed changes.