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.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
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 | ||
---|---|---|
322–326 | 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.
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.
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.
Why are you making this dynamic? How could this end up needing more than 7?