Commit 3e4e50d5 authored by Nathan Bronson's avatar Nathan Bronson Committed by facebook-github-bot-0

clang-format some code in preparation for real changes

Reviewed By: djwatson

Differential Revision: D2945770

fb-gh-sync-id: 9e4ee3b052b0bbb33ef796b8070edd24c6942589
shipit-source-id: 9e4ee3b052b0bbb33ef796b8070edd24c6942589
parent 13de7740
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
namespace folly { namespace detail { namespace folly {
namespace detail {
///////////// CacheLocality ///////////// CacheLocality
...@@ -84,11 +85,11 @@ const CacheLocality& CacheLocality::system<std::atomic>() { ...@@ -84,11 +85,11 @@ const CacheLocality& CacheLocality::system<std::atomic>() {
/// '\n', or eos. /// '\n', or eos.
static size_t parseLeadingNumber(const std::string& line) { static size_t parseLeadingNumber(const std::string& line) {
auto raw = line.c_str(); auto raw = line.c_str();
char *end; char* end;
unsigned long val = strtoul(raw, &end, 10); unsigned long val = strtoul(raw, &end, 10);
if (end == raw || (*end != ',' && *end != '-' && *end != '\n' && *end != 0)) { if (end == raw || (*end != ',' && *end != '-' && *end != '\n' && *end != 0)) {
throw std::runtime_error(to<std::string>( throw std::runtime_error(
"error parsing list '", line, "'").c_str()); to<std::string>("error parsing list '", line, "'").c_str());
} }
return val; return val;
} }
...@@ -107,9 +108,10 @@ CacheLocality CacheLocality::readFromSysfsTree( ...@@ -107,9 +108,10 @@ CacheLocality CacheLocality::readFromSysfsTree(
while (true) { while (true) {
auto cpu = cpus.size(); auto cpu = cpus.size();
std::vector<size_t> levels; std::vector<size_t> levels;
for (size_t index = 0; ; ++index) { for (size_t index = 0;; ++index) {
auto dir = format("/sys/devices/system/cpu/cpu{}/cache/index{}/", auto dir =
cpu, index).str(); format("/sys/devices/system/cpu/cpu{}/cache/index{}/", cpu, index)
.str();
auto cacheType = mapping(dir + "type"); auto cacheType = mapping(dir + "type");
auto equivStr = mapping(dir + "shared_cpu_list"); auto equivStr = mapping(dir + "shared_cpu_list");
if (cacheType.size() == 0 || equivStr.size() == 0) { if (cacheType.size() == 0 || equivStr.size() == 0) {
...@@ -146,14 +148,18 @@ CacheLocality CacheLocality::readFromSysfsTree( ...@@ -146,14 +148,18 @@ CacheLocality CacheLocality::readFromSysfsTree(
throw std::runtime_error("unable to load cache sharing info"); throw std::runtime_error("unable to load cache sharing info");
} }
std::sort(cpus.begin(), cpus.end(), [&](size_t lhs, size_t rhs) -> bool { std::sort(cpus.begin(),
// sort first by equiv class of cache with highest index, direction cpus.end(),
// doesn't matter. If different cpus have different numbers of [&](size_t lhs, size_t rhs) -> bool {
// caches then this code might produce a sub-optimal ordering, but // sort first by equiv class of cache with highest index,
// it won't crash // direction doesn't matter. If different cpus have
// different numbers of caches then this code might produce
// a sub-optimal ordering, but it won't crash
auto& lhsEquiv = equivClassesByCpu[lhs]; auto& lhsEquiv = equivClassesByCpu[lhs];
auto& rhsEquiv = equivClassesByCpu[rhs]; auto& rhsEquiv = equivClassesByCpu[rhs];
for (int i = std::min(lhsEquiv.size(), rhsEquiv.size()) - 1; i >= 0; --i) { for (int i = std::min(lhsEquiv.size(), rhsEquiv.size()) - 1;
i >= 0;
--i) {
if (lhsEquiv[i] != rhsEquiv[i]) { if (lhsEquiv[i] != rhsEquiv[i]) {
return lhsEquiv[i] < rhsEquiv[i]; return lhsEquiv[i] < rhsEquiv[i];
} }
...@@ -172,7 +178,7 @@ CacheLocality CacheLocality::readFromSysfsTree( ...@@ -172,7 +178,7 @@ CacheLocality CacheLocality::readFromSysfsTree(
} }
return CacheLocality{ return CacheLocality{
cpus.size(), std::move(numCachesByLevel), std::move(indexes) }; cpus.size(), std::move(numCachesByLevel), std::move(indexes)};
} }
CacheLocality CacheLocality::readFromSysfs() { CacheLocality CacheLocality::readFromSysfs() {
...@@ -184,7 +190,6 @@ CacheLocality CacheLocality::readFromSysfs() { ...@@ -184,7 +190,6 @@ CacheLocality CacheLocality::readFromSysfs() {
}); });
} }
CacheLocality CacheLocality::uniform(size_t numCpus) { CacheLocality CacheLocality::uniform(size_t numCpus) {
CacheLocality rv; CacheLocality rv;
...@@ -235,28 +240,26 @@ Getcpu::Func Getcpu::vdsoFunc() { ...@@ -235,28 +240,26 @@ Getcpu::Func Getcpu::vdsoFunc() {
#ifdef FOLLY_TLS #ifdef FOLLY_TLS
/////////////// SequentialThreadId /////////////// SequentialThreadId
template<> template <>
std::atomic<size_t> SequentialThreadId<std::atomic>::prevId(0); std::atomic<size_t> SequentialThreadId<std::atomic>::prevId(0);
template<> template <>
FOLLY_TLS size_t SequentialThreadId<std::atomic>::currentId(0); FOLLY_TLS size_t SequentialThreadId<std::atomic>::currentId(0);
#endif #endif
/////////////// AccessSpreader /////////////// AccessSpreader
template<> template <>
const AccessSpreader<std::atomic> const AccessSpreader<std::atomic> AccessSpreader<std::atomic>::stripeByCore(
AccessSpreader<std::atomic>::stripeByCore(
CacheLocality::system<>().numCachesByLevel.front()); CacheLocality::system<>().numCachesByLevel.front());
template<> template <>
const AccessSpreader<std::atomic> const AccessSpreader<std::atomic> AccessSpreader<std::atomic>::stripeByChip(
AccessSpreader<std::atomic>::stripeByChip(
CacheLocality::system<>().numCachesByLevel.back()); CacheLocality::system<>().numCachesByLevel.back());
template<> template <>
AccessSpreaderArray<std::atomic,128> AccessSpreaderArray<std::atomic, 128>
AccessSpreaderArray<std::atomic,128>::sharedInstance = {}; AccessSpreaderArray<std::atomic, 128>::sharedInstance = {};
/// Always claims to be on CPU zero, node zero /// Always claims to be on CPU zero, node zero
static int degenerateGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) { static int degenerateGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
...@@ -269,7 +272,7 @@ static int degenerateGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) { ...@@ -269,7 +272,7 @@ static int degenerateGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
return 0; return 0;
} }
template<> template <>
Getcpu::Func AccessSpreader<std::atomic>::pickGetcpuFunc(size_t numStripes) { Getcpu::Func AccessSpreader<std::atomic>::pickGetcpuFunc(size_t numStripes) {
if (numStripes == 1) { if (numStripes == 1) {
// there's no need to call getcpu if there is only one stripe. // there's no need to call getcpu if there is only one stripe.
...@@ -282,5 +285,5 @@ Getcpu::Func AccessSpreader<std::atomic>::pickGetcpuFunc(size_t numStripes) { ...@@ -282,5 +285,5 @@ Getcpu::Func AccessSpreader<std::atomic>::pickGetcpuFunc(size_t numStripes) {
return best ? best : &FallbackGetcpuType::getcpu; return best ? best : &FallbackGetcpuType::getcpu;
} }
} }
}
} } // namespace folly::detail } // namespace folly::detail
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
#include <folly/Likely.h> #include <folly/Likely.h>
#include <folly/Portability.h> #include <folly/Portability.h>
namespace folly { namespace detail { namespace folly {
namespace detail {
// This file contains several classes that might be useful if you are // This file contains several classes that might be useful if you are
// trying to dynamically optimize cache locality: CacheLocality reads // trying to dynamically optimize cache locality: CacheLocality reads
...@@ -73,7 +74,6 @@ struct CacheLocality { ...@@ -73,7 +74,6 @@ struct CacheLocality {
/// cache and cpus with a locality index >= 16 will share the other. /// cache and cpus with a locality index >= 16 will share the other.
std::vector<size_t> localityIndexByCpu; std::vector<size_t> localityIndexByCpu;
/// Returns the best CacheLocality information available for the current /// Returns the best CacheLocality information available for the current
/// system, cached for fast access. This will be loaded from sysfs if /// system, cached for fast access. This will be loaded from sysfs if
/// possible, otherwise it will be correct in the number of CPUs but /// possible, otherwise it will be correct in the number of CPUs but
...@@ -88,10 +88,9 @@ struct CacheLocality { ...@@ -88,10 +88,9 @@ struct CacheLocality {
/// that transitively uses it, all components select between the default /// that transitively uses it, all components select between the default
/// sysfs implementation and a deterministic implementation by keying /// sysfs implementation and a deterministic implementation by keying
/// off the type of the underlying atomic. See DeterministicScheduler. /// off the type of the underlying atomic. See DeterministicScheduler.
template <template<typename> class Atom = std::atomic> template <template <typename> class Atom = std::atomic>
static const CacheLocality& system(); static const CacheLocality& system();
/// Reads CacheLocality information from a tree structured like /// Reads CacheLocality information from a tree structured like
/// the sysfs filesystem. The provided function will be evaluated /// the sysfs filesystem. The provided function will be evaluated
/// for each sysfs file that needs to be queried. The function /// for each sysfs file that needs to be queried. The function
...@@ -121,7 +120,8 @@ struct CacheLocality { ...@@ -121,7 +120,8 @@ struct CacheLocality {
kFalseSharingRange = 128 kFalseSharingRange = 128
}; };
static_assert(kFalseSharingRange == 128, static_assert(
kFalseSharingRange == 128,
"FOLLY_ALIGN_TO_AVOID_FALSE_SHARING should track kFalseSharingRange"); "FOLLY_ALIGN_TO_AVOID_FALSE_SHARING should track kFalseSharingRange");
}; };
...@@ -143,7 +143,7 @@ struct Getcpu { ...@@ -143,7 +143,7 @@ struct Getcpu {
}; };
#ifdef FOLLY_TLS #ifdef FOLLY_TLS
template <template<typename> class Atom> template <template <typename> class Atom>
struct SequentialThreadId { struct SequentialThreadId {
/// Returns the thread id assigned to the current thread /// Returns the thread id assigned to the current thread
...@@ -197,7 +197,7 @@ typedef FallbackGetcpu<SequentialThreadId<std::atomic>> FallbackGetcpuType; ...@@ -197,7 +197,7 @@ typedef FallbackGetcpu<SequentialThreadId<std::atomic>> FallbackGetcpuType;
typedef FallbackGetcpu<HashingThreadId> FallbackGetcpuType; typedef FallbackGetcpu<HashingThreadId> FallbackGetcpuType;
#endif #endif
template <template<typename> class Atom, size_t kMaxCpus> template <template <typename> class Atom, size_t kMaxCpus>
struct AccessSpreaderArray; struct AccessSpreaderArray;
/// AccessSpreader arranges access to a striped data structure in such a /// AccessSpreader arranges access to a striped data structure in such a
...@@ -239,7 +239,7 @@ struct AccessSpreaderArray; ...@@ -239,7 +239,7 @@ struct AccessSpreaderArray;
/// testing. See DeterministicScheduler for more. If you aren't using /// testing. See DeterministicScheduler for more. If you aren't using
/// DeterministicScheduler, you can just use the default template parameter /// DeterministicScheduler, you can just use the default template parameter
/// all of the time. /// all of the time.
template <template<typename> class Atom = std::atomic> template <template <typename> class Atom = std::atomic>
struct AccessSpreader { struct AccessSpreader {
/// Returns a never-destructed shared AccessSpreader instance. /// Returns a never-destructed shared AccessSpreader instance.
...@@ -249,8 +249,8 @@ struct AccessSpreader { ...@@ -249,8 +249,8 @@ struct AccessSpreader {
assert(numStripes > 0); assert(numStripes > 0);
// the last shared element handles all large sizes // the last shared element handles all large sizes
return AccessSpreaderArray<Atom,kMaxCpus>::sharedInstance[ return AccessSpreaderArray<Atom, kMaxCpus>::sharedInstance[std::min(
std::min(size_t(kMaxCpus), numStripes)]; size_t(kMaxCpus), numStripes)];
} }
/// Returns the stripe associated with the current CPU, assuming /// Returns the stripe associated with the current CPU, assuming
...@@ -271,19 +271,18 @@ struct AccessSpreader { ...@@ -271,19 +271,18 @@ struct AccessSpreader {
/// to see its width, or stripeByChip.current() to get the current stripe /// to see its width, or stripeByChip.current() to get the current stripe
static const AccessSpreader stripeByChip; static const AccessSpreader stripeByChip;
/// Constructs an AccessSpreader that will return values from /// Constructs an AccessSpreader that will return values from
/// 0 to numStripes-1 (inclusive), precomputing the mapping /// 0 to numStripes-1 (inclusive), precomputing the mapping
/// from CPU to stripe. There is no use in having more than /// from CPU to stripe. There is no use in having more than
/// CacheLocality::system<Atom>().localityIndexByCpu.size() stripes or /// CacheLocality::system<Atom>().localityIndexByCpu.size() stripes or
/// kMaxCpus stripes /// kMaxCpus stripes
explicit AccessSpreader(size_t spreaderNumStripes, explicit AccessSpreader(
const CacheLocality& cacheLocality = size_t spreaderNumStripes,
CacheLocality::system<Atom>(), const CacheLocality& cacheLocality = CacheLocality::system<Atom>(),
Getcpu::Func getcpuFunc = nullptr) Getcpu::Func getcpuFunc = nullptr)
: getcpuFunc_(getcpuFunc ? getcpuFunc : pickGetcpuFunc(spreaderNumStripes)) : getcpuFunc_(getcpuFunc ? getcpuFunc
, numStripes_(spreaderNumStripes) : pickGetcpuFunc(spreaderNumStripes)),
{ numStripes_(spreaderNumStripes) {
auto n = cacheLocality.numCpus; auto n = cacheLocality.numCpus;
for (size_t cpu = 0; cpu < kMaxCpus && cpu < n; ++cpu) { for (size_t cpu = 0; cpu < kMaxCpus && cpu < n; ++cpu) {
auto index = cacheLocality.localityIndexByCpu[cpu]; auto index = cacheLocality.localityIndexByCpu[cpu];
...@@ -300,9 +299,7 @@ struct AccessSpreader { ...@@ -300,9 +299,7 @@ struct AccessSpreader {
/// Returns 1 more than the maximum value that can be returned from /// Returns 1 more than the maximum value that can be returned from
/// current() /// current()
size_t numStripes() const { size_t numStripes() const { return numStripes_; }
return numStripes_;
}
/// Returns the stripe associated with the current CPU /// Returns the stripe associated with the current CPU
size_t current() const { size_t current() const {
...@@ -312,7 +309,6 @@ struct AccessSpreader { ...@@ -312,7 +309,6 @@ struct AccessSpreader {
} }
private: private:
/// If there are more cpus than this nothing will crash, but there /// If there are more cpus than this nothing will crash, but there
/// might be unnecessary sharing /// might be unnecessary sharing
enum { kMaxCpus = 128 }; enum { kMaxCpus = 128 };
...@@ -324,7 +320,6 @@ struct AccessSpreader { ...@@ -324,7 +320,6 @@ struct AccessSpreader {
static_assert(kMaxCpus - 1 <= std::numeric_limits<CompactStripe>::max(), static_assert(kMaxCpus - 1 <= std::numeric_limits<CompactStripe>::max(),
"stripeByCpu element type isn't wide enough"); "stripeByCpu element type isn't wide enough");
/// Points to the getcpu-like function we are using to obtain the /// Points to the getcpu-like function we are using to obtain the
/// current cpu. It should not be assumed that the returned cpu value /// current cpu. It should not be assumed that the returned cpu value
/// is in range. We use a member for this instead of a static so that /// is in range. We use a member for this instead of a static so that
...@@ -343,13 +338,12 @@ struct AccessSpreader { ...@@ -343,13 +338,12 @@ struct AccessSpreader {
static Getcpu::Func pickGetcpuFunc(size_t numStripes); static Getcpu::Func pickGetcpuFunc(size_t numStripes);
}; };
template<> template <>
Getcpu::Func AccessSpreader<std::atomic>::pickGetcpuFunc(size_t); Getcpu::Func AccessSpreader<std::atomic>::pickGetcpuFunc(size_t);
/// An array of kMaxCpus+1 AccessSpreader<Atom> instances constructed /// An array of kMaxCpus+1 AccessSpreader<Atom> instances constructed
/// with default params, with the zero-th element having 1 stripe /// with default params, with the zero-th element having 1 stripe
template <template<typename> class Atom, size_t kMaxStripe> template <template <typename> class Atom, size_t kMaxStripe>
struct AccessSpreaderArray { struct AccessSpreaderArray {
AccessSpreaderArray() { AccessSpreaderArray() {
...@@ -365,18 +359,16 @@ struct AccessSpreaderArray { ...@@ -365,18 +359,16 @@ struct AccessSpreaderArray {
} }
} }
AccessSpreader<Atom> const& operator[] (size_t index) const { AccessSpreader<Atom> const& operator[](size_t index) const {
return *static_cast<AccessSpreader<Atom> const*>( return *static_cast<AccessSpreader<Atom> const*>(
static_cast<void const*>(raw + index)); static_cast<void const*>(raw + index));
} }
private: private:
// AccessSpreader uses sharedInstance // AccessSpreader uses sharedInstance
friend AccessSpreader<Atom>; friend AccessSpreader<Atom>;
static AccessSpreaderArray<Atom,kMaxStripe> sharedInstance; static AccessSpreaderArray<Atom, kMaxStripe> sharedInstance;
/// aligned_storage is uninitialized, we use placement new since there /// aligned_storage is uninitialized, we use placement new since there
/// is no AccessSpreader default constructor /// is no AccessSpreader default constructor
...@@ -384,7 +376,7 @@ struct AccessSpreaderArray { ...@@ -384,7 +376,7 @@ struct AccessSpreaderArray {
CacheLocality::kFalseSharingRange>::type CacheLocality::kFalseSharingRange>::type
raw[kMaxStripe + 1]; raw[kMaxStripe + 1];
}; };
}
} } }
#endif /* FOLLY_DETAIL_CacheLocality_H_ */ #endif /* FOLLY_DETAIL_CacheLocality_H_ */
...@@ -31,272 +31,314 @@ using namespace folly::detail; ...@@ -31,272 +31,314 @@ using namespace folly::detail;
/// think this map is ugly you should see the version of this test that /// think this map is ugly you should see the version of this test that
/// used a real directory tree. To reduce the chance of testing error /// used a real directory tree. To reduce the chance of testing error
/// I haven't tried to remove the common prefix /// I haven't tried to remove the common prefix
static std::unordered_map<std::string,std::string> fakeSysfsTree = { static std::unordered_map<std::string, std::string> fakeSysfsTree = {
{ "/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list", "0,17" }, {"/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list", "0,17"},
{ "/sys/devices/system/cpu/cpu0/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu0/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list", "0,17" }, {"/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list", "0,17"},
{ "/sys/devices/system/cpu/cpu0/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu0/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list", "0,17" }, {"/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list", "0,17"},
{ "/sys/devices/system/cpu/cpu0/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu0/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu0/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu0/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu0/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu0/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list", "1,18" }, {"/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list", "1,18"},
{ "/sys/devices/system/cpu/cpu1/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu1/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list", "1,18" }, {"/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list", "1,18"},
{ "/sys/devices/system/cpu/cpu1/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu1/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list", "1,18" }, {"/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list", "1,18"},
{ "/sys/devices/system/cpu/cpu1/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu1/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu1/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu1/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu1/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu1/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu2/cache/index0/shared_cpu_list", "2,19" }, {"/sys/devices/system/cpu/cpu2/cache/index0/shared_cpu_list", "2,19"},
{ "/sys/devices/system/cpu/cpu2/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu2/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu2/cache/index1/shared_cpu_list", "2,19" }, {"/sys/devices/system/cpu/cpu2/cache/index1/shared_cpu_list", "2,19"},
{ "/sys/devices/system/cpu/cpu2/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu2/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu2/cache/index2/shared_cpu_list", "2,19" }, {"/sys/devices/system/cpu/cpu2/cache/index2/shared_cpu_list", "2,19"},
{ "/sys/devices/system/cpu/cpu2/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu2/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu2/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu2/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu2/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu2/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu3/cache/index0/shared_cpu_list", "3,20" }, {"/sys/devices/system/cpu/cpu3/cache/index0/shared_cpu_list", "3,20"},
{ "/sys/devices/system/cpu/cpu3/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu3/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu3/cache/index1/shared_cpu_list", "3,20" }, {"/sys/devices/system/cpu/cpu3/cache/index1/shared_cpu_list", "3,20"},
{ "/sys/devices/system/cpu/cpu3/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu3/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu3/cache/index2/shared_cpu_list", "3,20" }, {"/sys/devices/system/cpu/cpu3/cache/index2/shared_cpu_list", "3,20"},
{ "/sys/devices/system/cpu/cpu3/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu3/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu3/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu3/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu3/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu3/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu4/cache/index0/shared_cpu_list", "4,21" }, {"/sys/devices/system/cpu/cpu4/cache/index0/shared_cpu_list", "4,21"},
{ "/sys/devices/system/cpu/cpu4/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu4/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu4/cache/index1/shared_cpu_list", "4,21" }, {"/sys/devices/system/cpu/cpu4/cache/index1/shared_cpu_list", "4,21"},
{ "/sys/devices/system/cpu/cpu4/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu4/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu4/cache/index2/shared_cpu_list", "4,21" }, {"/sys/devices/system/cpu/cpu4/cache/index2/shared_cpu_list", "4,21"},
{ "/sys/devices/system/cpu/cpu4/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu4/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu4/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu4/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu4/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu4/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu5/cache/index0/shared_cpu_list", "5-6" }, {"/sys/devices/system/cpu/cpu5/cache/index0/shared_cpu_list", "5-6"},
{ "/sys/devices/system/cpu/cpu5/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu5/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu5/cache/index1/shared_cpu_list", "5-6" }, {"/sys/devices/system/cpu/cpu5/cache/index1/shared_cpu_list", "5-6"},
{ "/sys/devices/system/cpu/cpu5/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu5/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu5/cache/index2/shared_cpu_list", "5-6" }, {"/sys/devices/system/cpu/cpu5/cache/index2/shared_cpu_list", "5-6"},
{ "/sys/devices/system/cpu/cpu5/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu5/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu5/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu5/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu5/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu5/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu6/cache/index0/shared_cpu_list", "5-6" }, {"/sys/devices/system/cpu/cpu6/cache/index0/shared_cpu_list", "5-6"},
{ "/sys/devices/system/cpu/cpu6/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu6/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu6/cache/index1/shared_cpu_list", "5-6" }, {"/sys/devices/system/cpu/cpu6/cache/index1/shared_cpu_list", "5-6"},
{ "/sys/devices/system/cpu/cpu6/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu6/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu6/cache/index2/shared_cpu_list", "5-6" }, {"/sys/devices/system/cpu/cpu6/cache/index2/shared_cpu_list", "5-6"},
{ "/sys/devices/system/cpu/cpu6/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu6/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu6/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu6/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu6/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu6/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu7/cache/index0/shared_cpu_list", "7,22" }, {"/sys/devices/system/cpu/cpu7/cache/index0/shared_cpu_list", "7,22"},
{ "/sys/devices/system/cpu/cpu7/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu7/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu7/cache/index1/shared_cpu_list", "7,22" }, {"/sys/devices/system/cpu/cpu7/cache/index1/shared_cpu_list", "7,22"},
{ "/sys/devices/system/cpu/cpu7/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu7/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu7/cache/index2/shared_cpu_list", "7,22" }, {"/sys/devices/system/cpu/cpu7/cache/index2/shared_cpu_list", "7,22"},
{ "/sys/devices/system/cpu/cpu7/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu7/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu7/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu7/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu7/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu7/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu8/cache/index0/shared_cpu_list", "8,23" }, {"/sys/devices/system/cpu/cpu8/cache/index0/shared_cpu_list", "8,23"},
{ "/sys/devices/system/cpu/cpu8/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu8/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu8/cache/index1/shared_cpu_list", "8,23" }, {"/sys/devices/system/cpu/cpu8/cache/index1/shared_cpu_list", "8,23"},
{ "/sys/devices/system/cpu/cpu8/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu8/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu8/cache/index2/shared_cpu_list", "8,23" }, {"/sys/devices/system/cpu/cpu8/cache/index2/shared_cpu_list", "8,23"},
{ "/sys/devices/system/cpu/cpu8/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu8/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu8/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu8/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu8/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu8/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu9/cache/index0/shared_cpu_list", "9,24" }, {"/sys/devices/system/cpu/cpu9/cache/index0/shared_cpu_list", "9,24"},
{ "/sys/devices/system/cpu/cpu9/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu9/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu9/cache/index1/shared_cpu_list", "9,24" }, {"/sys/devices/system/cpu/cpu9/cache/index1/shared_cpu_list", "9,24"},
{ "/sys/devices/system/cpu/cpu9/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu9/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu9/cache/index2/shared_cpu_list", "9,24" }, {"/sys/devices/system/cpu/cpu9/cache/index2/shared_cpu_list", "9,24"},
{ "/sys/devices/system/cpu/cpu9/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu9/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu9/cache/index3/shared_cpu_list", "9-16,24-31" }, {"/sys/devices/system/cpu/cpu9/cache/index3/shared_cpu_list", "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu9/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu9/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu10/cache/index0/shared_cpu_list", "10,25" }, {"/sys/devices/system/cpu/cpu10/cache/index0/shared_cpu_list", "10,25"},
{ "/sys/devices/system/cpu/cpu10/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu10/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu10/cache/index1/shared_cpu_list", "10,25" }, {"/sys/devices/system/cpu/cpu10/cache/index1/shared_cpu_list", "10,25"},
{ "/sys/devices/system/cpu/cpu10/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu10/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu10/cache/index2/shared_cpu_list", "10,25" }, {"/sys/devices/system/cpu/cpu10/cache/index2/shared_cpu_list", "10,25"},
{ "/sys/devices/system/cpu/cpu10/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu10/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu10/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu10/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu10/cache/index3/type", "Unified" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu11/cache/index0/shared_cpu_list", "11,26" }, {"/sys/devices/system/cpu/cpu10/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu11/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu11/cache/index0/shared_cpu_list", "11,26"},
{ "/sys/devices/system/cpu/cpu11/cache/index1/shared_cpu_list", "11,26" }, {"/sys/devices/system/cpu/cpu11/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu11/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu11/cache/index1/shared_cpu_list", "11,26"},
{ "/sys/devices/system/cpu/cpu11/cache/index2/shared_cpu_list", "11,26" }, {"/sys/devices/system/cpu/cpu11/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu11/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu11/cache/index2/shared_cpu_list", "11,26"},
{ "/sys/devices/system/cpu/cpu11/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu11/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu11/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu11/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu12/cache/index0/shared_cpu_list", "12,27" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu12/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu11/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu12/cache/index1/shared_cpu_list", "12,27" }, {"/sys/devices/system/cpu/cpu12/cache/index0/shared_cpu_list", "12,27"},
{ "/sys/devices/system/cpu/cpu12/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu12/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu12/cache/index2/shared_cpu_list", "12,27" }, {"/sys/devices/system/cpu/cpu12/cache/index1/shared_cpu_list", "12,27"},
{ "/sys/devices/system/cpu/cpu12/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu12/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu12/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu12/cache/index2/shared_cpu_list", "12,27"},
{ "/sys/devices/system/cpu/cpu12/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu12/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu13/cache/index0/shared_cpu_list", "13,28" }, {"/sys/devices/system/cpu/cpu12/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu13/cache/index0/type", "Data" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu13/cache/index1/shared_cpu_list", "13,28" }, {"/sys/devices/system/cpu/cpu12/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu13/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu13/cache/index0/shared_cpu_list", "13,28"},
{ "/sys/devices/system/cpu/cpu13/cache/index2/shared_cpu_list", "13,28" }, {"/sys/devices/system/cpu/cpu13/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu13/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu13/cache/index1/shared_cpu_list", "13,28"},
{ "/sys/devices/system/cpu/cpu13/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu13/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu13/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu13/cache/index2/shared_cpu_list", "13,28"},
{ "/sys/devices/system/cpu/cpu14/cache/index0/shared_cpu_list", "14,29" }, {"/sys/devices/system/cpu/cpu13/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu14/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu13/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu14/cache/index1/shared_cpu_list", "14,29" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu14/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu13/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu14/cache/index2/shared_cpu_list", "14,29" }, {"/sys/devices/system/cpu/cpu14/cache/index0/shared_cpu_list", "14,29"},
{ "/sys/devices/system/cpu/cpu14/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu14/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu14/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu14/cache/index1/shared_cpu_list", "14,29"},
{ "/sys/devices/system/cpu/cpu14/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu14/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu15/cache/index0/shared_cpu_list", "15,30" }, {"/sys/devices/system/cpu/cpu14/cache/index2/shared_cpu_list", "14,29"},
{ "/sys/devices/system/cpu/cpu15/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu14/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu15/cache/index1/shared_cpu_list", "15,30" }, {"/sys/devices/system/cpu/cpu14/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu15/cache/index1/type", "Instruction" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu15/cache/index2/shared_cpu_list", "15,30" }, {"/sys/devices/system/cpu/cpu14/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu15/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu15/cache/index0/shared_cpu_list", "15,30"},
{ "/sys/devices/system/cpu/cpu15/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu15/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu15/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu15/cache/index1/shared_cpu_list", "15,30"},
{ "/sys/devices/system/cpu/cpu16/cache/index0/shared_cpu_list", "16,31" }, {"/sys/devices/system/cpu/cpu15/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu16/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu15/cache/index2/shared_cpu_list", "15,30"},
{ "/sys/devices/system/cpu/cpu16/cache/index1/shared_cpu_list", "16,31" }, {"/sys/devices/system/cpu/cpu15/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu16/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu15/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu16/cache/index2/shared_cpu_list", "16,31" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu16/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu15/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu16/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu16/cache/index0/shared_cpu_list", "16,31"},
{ "/sys/devices/system/cpu/cpu16/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu16/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu17/cache/index0/shared_cpu_list", "0,17" }, {"/sys/devices/system/cpu/cpu16/cache/index1/shared_cpu_list", "16,31"},
{ "/sys/devices/system/cpu/cpu17/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu16/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu17/cache/index1/shared_cpu_list", "0,17" }, {"/sys/devices/system/cpu/cpu16/cache/index2/shared_cpu_list", "16,31"},
{ "/sys/devices/system/cpu/cpu17/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu16/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu17/cache/index2/shared_cpu_list", "0,17" }, {"/sys/devices/system/cpu/cpu16/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu17/cache/index2/type", "Unified" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu17/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu16/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu17/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu17/cache/index0/shared_cpu_list", "0,17"},
{ "/sys/devices/system/cpu/cpu18/cache/index0/shared_cpu_list", "1,18" }, {"/sys/devices/system/cpu/cpu17/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu18/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu17/cache/index1/shared_cpu_list", "0,17"},
{ "/sys/devices/system/cpu/cpu18/cache/index1/shared_cpu_list", "1,18" }, {"/sys/devices/system/cpu/cpu17/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu18/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu17/cache/index2/shared_cpu_list", "0,17"},
{ "/sys/devices/system/cpu/cpu18/cache/index2/shared_cpu_list", "1,18" }, {"/sys/devices/system/cpu/cpu17/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu18/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu17/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu18/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu17/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu18/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu18/cache/index0/shared_cpu_list", "1,18"},
{ "/sys/devices/system/cpu/cpu19/cache/index0/shared_cpu_list", "2,19" }, {"/sys/devices/system/cpu/cpu18/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu19/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu18/cache/index1/shared_cpu_list", "1,18"},
{ "/sys/devices/system/cpu/cpu19/cache/index1/shared_cpu_list", "2,19" }, {"/sys/devices/system/cpu/cpu18/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu19/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu18/cache/index2/shared_cpu_list", "1,18"},
{ "/sys/devices/system/cpu/cpu19/cache/index2/shared_cpu_list", "2,19" }, {"/sys/devices/system/cpu/cpu18/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu19/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu18/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu19/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu18/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu19/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu19/cache/index0/shared_cpu_list", "2,19"},
{ "/sys/devices/system/cpu/cpu20/cache/index0/shared_cpu_list", "3,20" }, {"/sys/devices/system/cpu/cpu19/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu20/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu19/cache/index1/shared_cpu_list", "2,19"},
{ "/sys/devices/system/cpu/cpu20/cache/index1/shared_cpu_list", "3,20" }, {"/sys/devices/system/cpu/cpu19/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu20/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu19/cache/index2/shared_cpu_list", "2,19"},
{ "/sys/devices/system/cpu/cpu20/cache/index2/shared_cpu_list", "3,20" }, {"/sys/devices/system/cpu/cpu19/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu20/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu19/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu20/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu19/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu20/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu20/cache/index0/shared_cpu_list", "3,20"},
{ "/sys/devices/system/cpu/cpu21/cache/index0/shared_cpu_list", "4,21" }, {"/sys/devices/system/cpu/cpu20/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu21/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu20/cache/index1/shared_cpu_list", "3,20"},
{ "/sys/devices/system/cpu/cpu21/cache/index1/shared_cpu_list", "4,21" }, {"/sys/devices/system/cpu/cpu20/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu21/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu20/cache/index2/shared_cpu_list", "3,20"},
{ "/sys/devices/system/cpu/cpu21/cache/index2/shared_cpu_list", "4,21" }, {"/sys/devices/system/cpu/cpu20/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu21/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu20/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu21/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu20/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu21/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu21/cache/index0/shared_cpu_list", "4,21"},
{ "/sys/devices/system/cpu/cpu22/cache/index0/shared_cpu_list", "7,22" }, {"/sys/devices/system/cpu/cpu21/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu22/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu21/cache/index1/shared_cpu_list", "4,21"},
{ "/sys/devices/system/cpu/cpu22/cache/index1/shared_cpu_list", "7,22" }, {"/sys/devices/system/cpu/cpu21/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu22/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu21/cache/index2/shared_cpu_list", "4,21"},
{ "/sys/devices/system/cpu/cpu22/cache/index2/shared_cpu_list", "7,22" }, {"/sys/devices/system/cpu/cpu21/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu22/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu21/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu22/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu21/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu22/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu22/cache/index0/shared_cpu_list", "7,22"},
{ "/sys/devices/system/cpu/cpu23/cache/index0/shared_cpu_list", "8,23" }, {"/sys/devices/system/cpu/cpu22/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu23/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu22/cache/index1/shared_cpu_list", "7,22"},
{ "/sys/devices/system/cpu/cpu23/cache/index1/shared_cpu_list", "8,23" }, {"/sys/devices/system/cpu/cpu22/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu23/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu22/cache/index2/shared_cpu_list", "7,22"},
{ "/sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_list", "8,23" }, {"/sys/devices/system/cpu/cpu22/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu23/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu22/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu23/cache/index3/shared_cpu_list", "0-8,17-23" }, {"/sys/devices/system/cpu/cpu22/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu23/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu23/cache/index0/shared_cpu_list", "8,23"},
{ "/sys/devices/system/cpu/cpu24/cache/index0/shared_cpu_list", "9,24" }, {"/sys/devices/system/cpu/cpu23/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu24/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu23/cache/index1/shared_cpu_list", "8,23"},
{ "/sys/devices/system/cpu/cpu24/cache/index1/shared_cpu_list", "9,24" }, {"/sys/devices/system/cpu/cpu23/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu24/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_list", "8,23"},
{ "/sys/devices/system/cpu/cpu24/cache/index2/shared_cpu_list", "9,24" }, {"/sys/devices/system/cpu/cpu23/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu24/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu23/cache/index3/shared_cpu_list", "0-8,17-23"},
{ "/sys/devices/system/cpu/cpu24/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu23/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu24/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu24/cache/index0/shared_cpu_list", "9,24"},
{ "/sys/devices/system/cpu/cpu25/cache/index0/shared_cpu_list", "10,25" }, {"/sys/devices/system/cpu/cpu24/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu25/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu24/cache/index1/shared_cpu_list", "9,24"},
{ "/sys/devices/system/cpu/cpu25/cache/index1/shared_cpu_list", "10,25" }, {"/sys/devices/system/cpu/cpu24/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu25/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu24/cache/index2/shared_cpu_list", "9,24"},
{ "/sys/devices/system/cpu/cpu25/cache/index2/shared_cpu_list", "10,25" }, {"/sys/devices/system/cpu/cpu24/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu25/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu24/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu25/cache/index3/shared_cpu_list", "9-16,24-31"}, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu25/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu24/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu26/cache/index0/shared_cpu_list", "11,26" }, {"/sys/devices/system/cpu/cpu25/cache/index0/shared_cpu_list", "10,25"},
{ "/sys/devices/system/cpu/cpu26/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu25/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu26/cache/index1/shared_cpu_list", "11,26" }, {"/sys/devices/system/cpu/cpu25/cache/index1/shared_cpu_list", "10,25"},
{ "/sys/devices/system/cpu/cpu26/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu25/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu26/cache/index2/shared_cpu_list", "11,26" }, {"/sys/devices/system/cpu/cpu25/cache/index2/shared_cpu_list", "10,25"},
{ "/sys/devices/system/cpu/cpu26/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu25/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu26/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu25/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu26/cache/index3/type", "Unified" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu27/cache/index0/shared_cpu_list", "12,27" }, {"/sys/devices/system/cpu/cpu25/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu27/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu26/cache/index0/shared_cpu_list", "11,26"},
{ "/sys/devices/system/cpu/cpu27/cache/index1/shared_cpu_list", "12,27" }, {"/sys/devices/system/cpu/cpu26/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu27/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu26/cache/index1/shared_cpu_list", "11,26"},
{ "/sys/devices/system/cpu/cpu27/cache/index2/shared_cpu_list", "12,27" }, {"/sys/devices/system/cpu/cpu26/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu27/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu26/cache/index2/shared_cpu_list", "11,26"},
{ "/sys/devices/system/cpu/cpu27/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu26/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu27/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu26/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu28/cache/index0/shared_cpu_list", "13,28" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu28/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu26/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu28/cache/index1/shared_cpu_list", "13,28" }, {"/sys/devices/system/cpu/cpu27/cache/index0/shared_cpu_list", "12,27"},
{ "/sys/devices/system/cpu/cpu28/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu27/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu28/cache/index2/shared_cpu_list", "13,28" }, {"/sys/devices/system/cpu/cpu27/cache/index1/shared_cpu_list", "12,27"},
{ "/sys/devices/system/cpu/cpu28/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu27/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu28/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu27/cache/index2/shared_cpu_list", "12,27"},
{ "/sys/devices/system/cpu/cpu28/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu27/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu29/cache/index0/shared_cpu_list", "14,29" }, {"/sys/devices/system/cpu/cpu27/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu29/cache/index0/type", "Data" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu29/cache/index1/shared_cpu_list", "14,29" }, {"/sys/devices/system/cpu/cpu27/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu29/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu28/cache/index0/shared_cpu_list", "13,28"},
{ "/sys/devices/system/cpu/cpu29/cache/index2/shared_cpu_list", "14,29" }, {"/sys/devices/system/cpu/cpu28/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu29/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu28/cache/index1/shared_cpu_list", "13,28"},
{ "/sys/devices/system/cpu/cpu29/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu28/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu29/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu28/cache/index2/shared_cpu_list", "13,28"},
{ "/sys/devices/system/cpu/cpu30/cache/index0/shared_cpu_list", "15,30" }, {"/sys/devices/system/cpu/cpu28/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu30/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu28/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu30/cache/index1/shared_cpu_list", "15,30" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu30/cache/index1/type", "Instruction" }, {"/sys/devices/system/cpu/cpu28/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu30/cache/index2/shared_cpu_list", "15,30" }, {"/sys/devices/system/cpu/cpu29/cache/index0/shared_cpu_list", "14,29"},
{ "/sys/devices/system/cpu/cpu30/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu29/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu30/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu29/cache/index1/shared_cpu_list", "14,29"},
{ "/sys/devices/system/cpu/cpu30/cache/index3/type", "Unified" }, {"/sys/devices/system/cpu/cpu29/cache/index1/type", "Instruction"},
{ "/sys/devices/system/cpu/cpu31/cache/index0/shared_cpu_list", "16,31" }, {"/sys/devices/system/cpu/cpu29/cache/index2/shared_cpu_list", "14,29"},
{ "/sys/devices/system/cpu/cpu31/cache/index0/type", "Data" }, {"/sys/devices/system/cpu/cpu29/cache/index2/type", "Unified"},
{ "/sys/devices/system/cpu/cpu31/cache/index1/shared_cpu_list", "16,31" }, {"/sys/devices/system/cpu/cpu29/cache/index3/shared_cpu_list",
{ "/sys/devices/system/cpu/cpu31/cache/index1/type", "Instruction" }, "9-16,24-31"},
{ "/sys/devices/system/cpu/cpu31/cache/index2/shared_cpu_list", "16,31" }, {"/sys/devices/system/cpu/cpu29/cache/index3/type", "Unified"},
{ "/sys/devices/system/cpu/cpu31/cache/index2/type", "Unified" }, {"/sys/devices/system/cpu/cpu30/cache/index0/shared_cpu_list", "15,30"},
{ "/sys/devices/system/cpu/cpu31/cache/index3/shared_cpu_list", "9-16,24-31"}, {"/sys/devices/system/cpu/cpu30/cache/index0/type", "Data"},
{ "/sys/devices/system/cpu/cpu31/cache/index3/type", "Unified" } {"/sys/devices/system/cpu/cpu30/cache/index1/shared_cpu_list", "15,30"},
}; {"/sys/devices/system/cpu/cpu30/cache/index1/type", "Instruction"},
{"/sys/devices/system/cpu/cpu30/cache/index2/shared_cpu_list", "15,30"},
{"/sys/devices/system/cpu/cpu30/cache/index2/type", "Unified"},
{"/sys/devices/system/cpu/cpu30/cache/index3/shared_cpu_list",
"9-16,24-31"},
{"/sys/devices/system/cpu/cpu30/cache/index3/type", "Unified"},
{"/sys/devices/system/cpu/cpu31/cache/index0/shared_cpu_list", "16,31"},
{"/sys/devices/system/cpu/cpu31/cache/index0/type", "Data"},
{"/sys/devices/system/cpu/cpu31/cache/index1/shared_cpu_list", "16,31"},
{"/sys/devices/system/cpu/cpu31/cache/index1/type", "Instruction"},
{"/sys/devices/system/cpu/cpu31/cache/index2/shared_cpu_list", "16,31"},
{"/sys/devices/system/cpu/cpu31/cache/index2/type", "Unified"},
{"/sys/devices/system/cpu/cpu31/cache/index3/shared_cpu_list",
"9-16,24-31"},
{"/sys/devices/system/cpu/cpu31/cache/index3/type", "Unified"}};
/// This is the expected CacheLocality structure for fakeSysfsTree /// This is the expected CacheLocality structure for fakeSysfsTree
static const CacheLocality nonUniformExampleLocality = { static const CacheLocality nonUniformExampleLocality = {32,
32, {16, 16, 2},
{ 16, 16, 2 }, {0,
{ 0, 2, 4, 6, 8, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 2,
30, 1, 3, 5, 7, 9, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 } 4,
}; 6,
8,
10,
11,
12,
14,
16,
18,
20,
22,
24,
26,
28,
30,
1,
3,
5,
7,
9,
13,
15,
17,
19,
21,
23,
25,
27,
29,
31}};
TEST(CacheLocality, FakeSysfs) { TEST(CacheLocality, FakeSysfs) {
auto parsed = CacheLocality::readFromSysfsTree([](std::string name) { auto parsed = CacheLocality::readFromSysfsTree([](std::string name) {
...@@ -359,12 +401,12 @@ static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) { ...@@ -359,12 +401,12 @@ static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
TEST(AccessSpreader, Stubbed) { TEST(AccessSpreader, Stubbed) {
std::vector<std::unique_ptr<AccessSpreader<>>> spreaders(100); std::vector<std::unique_ptr<AccessSpreader<>>> spreaders(100);
for (size_t s = 1; s < spreaders.size(); ++s) { for (size_t s = 1; s < spreaders.size(); ++s) {
spreaders[s].reset(new AccessSpreader<>( spreaders[s].reset(
s, nonUniformExampleLocality, &testingGetcpu)); new AccessSpreader<>(s, nonUniformExampleLocality, &testingGetcpu));
} }
std::vector<size_t> cpusInLocalityOrder = { std::vector<size_t> cpusInLocalityOrder = {
0, 17, 1, 18, 2, 19, 3, 20, 4, 21, 5, 6, 7, 22, 8, 23, 9, 24, 10, 25, 0, 17, 1, 18, 2, 19, 3, 20, 4, 21, 5, 6, 7, 22, 8, 23,
11, 26, 12, 27, 13, 28, 14, 29, 15, 30, 16, 31 }; 9, 24, 10, 25, 11, 26, 12, 27, 13, 28, 14, 29, 15, 30, 16, 31};
for (size_t i = 0; i < 32; ++i) { for (size_t i = 0; i < 32; ++i) {
// extra i * 32 is to check wrapping behavior of impl // extra i * 32 is to check wrapping behavior of impl
testingCpu = cpusInLocalityOrder[i] + i * 64; testingCpu = cpusInLocalityOrder[i] + i * 64;
...@@ -407,8 +449,8 @@ TEST(AccessSpreader, Wrapping) { ...@@ -407,8 +449,8 @@ TEST(AccessSpreader, Wrapping) {
auto observed = spreader.current(); auto observed = spreader.current();
testingCpu = c % numCpus; testingCpu = c % numCpus;
auto expected = spreader.current(); auto expected = spreader.current();
EXPECT_EQ(expected, observed) EXPECT_EQ(expected, observed) << "numCpus=" << numCpus << ", s=" << s
<< "numCpus=" << numCpus << ", s=" << s << ", c=" << c; << ", c=" << c;
} }
} }
} }
...@@ -536,7 +578,9 @@ enum class SpreaderType { GETCPU, SHARED, TLS_RR, PTHREAD_SELF }; ...@@ -536,7 +578,9 @@ enum class SpreaderType { GETCPU, SHARED, TLS_RR, PTHREAD_SELF };
// contentionAtWidth(32_stripe_1000_work_getcpu) 786.56ns 1.27M // contentionAtWidth(32_stripe_1000_work_getcpu) 786.56ns 1.27M
// atomicIncrBaseline(local_incr_1000_work) 784.69ns 1.27M // atomicIncrBaseline(local_incr_1000_work) 784.69ns 1.27M
// ============================================================================ // ============================================================================
static void contentionAtWidth(size_t iters, size_t stripes, size_t work, static void contentionAtWidth(size_t iters,
size_t stripes,
size_t work,
SpreaderType spreaderType, SpreaderType spreaderType,
size_t counterAlignment = 128, size_t counterAlignment = 128,
size_t numThreads = 32) { size_t numThreads = 32) {
...@@ -574,11 +618,11 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work, ...@@ -574,11 +618,11 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work,
std::vector<std::thread> threads; std::vector<std::thread> threads;
while (threads.size() < numThreads) { while (threads.size() < numThreads) {
threads.push_back(std::thread([&,iters,stripes,work]() { threads.push_back(std::thread([&, iters, stripes, work]() {
std::atomic<size_t>* counters[stripes]; std::atomic<size_t>* counters[stripes];
for (size_t i = 0; i < stripes; ++i) { for (size_t i = 0; i < stripes; ++i) {
counters[i] counters[i] =
= new (raw.data() + counterAlignment * i) std::atomic<size_t>(); new (raw.data() + counterAlignment * i) std::atomic<size_t>();
} }
spreader.current(); spreader.current();
...@@ -604,13 +648,10 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work, ...@@ -604,13 +648,10 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work,
} }
})); }));
if (threads.size() == numThreads / 15 || if (threads.size() == numThreads / 15 || threads.size() == numThreads / 5) {
threads.size() == numThreads / 5) {
// create a few dummy threads to wrap back around to 0 mod numCpus // create a few dummy threads to wrap back around to 0 mod numCpus
for (size_t i = threads.size(); i != numThreads; ++i) { for (size_t i = threads.size(); i != numThreads; ++i) {
std::thread([&]() { std::thread([&]() { spreader.current(); }).join();
spreader.current();
}).join();
} }
} }
} }
...@@ -626,7 +667,8 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work, ...@@ -626,7 +667,8 @@ static void contentionAtWidth(size_t iters, size_t stripes, size_t work,
} }
} }
static void atomicIncrBaseline(size_t iters, size_t work, static void atomicIncrBaseline(size_t iters,
size_t work,
size_t numThreads = 32) { size_t numThreads = 32) {
folly::BenchmarkSuspender braces; folly::BenchmarkSuspender braces;
...@@ -659,32 +701,32 @@ static void atomicIncrBaseline(size_t iters, size_t work, ...@@ -659,32 +701,32 @@ static void atomicIncrBaseline(size_t iters, size_t work,
BENCHMARK_DRAW_LINE() BENCHMARK_DRAW_LINE()
BENCHMARK_NAMED_PARAM(contentionAtWidth, 1_stripe_0_work_stub, BENCHMARK_NAMED_PARAM(
1, 0, SpreaderType::GETCPU) contentionAtWidth, 1_stripe_0_work_stub, 1, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 2_stripe_0_work_getcpu, BENCHMARK_NAMED_PARAM(
2, 0, SpreaderType::GETCPU) contentionAtWidth, 2_stripe_0_work_getcpu, 2, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 4_stripe_0_work_getcpu, BENCHMARK_NAMED_PARAM(
4, 0, SpreaderType::GETCPU) contentionAtWidth, 4_stripe_0_work_getcpu, 4, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 8_stripe_0_work_getcpu, BENCHMARK_NAMED_PARAM(
8, 0, SpreaderType::GETCPU) contentionAtWidth, 8_stripe_0_work_getcpu, 8, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 16_stripe_0_work_getcpu, BENCHMARK_NAMED_PARAM(
16, 0, SpreaderType::GETCPU) contentionAtWidth, 16_stripe_0_work_getcpu, 16, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 32_stripe_0_work_getcpu, BENCHMARK_NAMED_PARAM(
32, 0, SpreaderType::GETCPU) contentionAtWidth, 32_stripe_0_work_getcpu, 32, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 64_stripe_0_work_getcpu, BENCHMARK_NAMED_PARAM(
64, 0, SpreaderType::GETCPU) contentionAtWidth, 64_stripe_0_work_getcpu, 64, 0, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 2_stripe_0_work_tls_rr, BENCHMARK_NAMED_PARAM(
2, 0, SpreaderType::TLS_RR) contentionAtWidth, 2_stripe_0_work_tls_rr, 2, 0, SpreaderType::TLS_RR)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 4_stripe_0_work_tls_rr, BENCHMARK_NAMED_PARAM(
4, 0, SpreaderType::TLS_RR) contentionAtWidth, 4_stripe_0_work_tls_rr, 4, 0, SpreaderType::TLS_RR)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 8_stripe_0_work_tls_rr, BENCHMARK_NAMED_PARAM(
8, 0, SpreaderType::TLS_RR) contentionAtWidth, 8_stripe_0_work_tls_rr, 8, 0, SpreaderType::TLS_RR)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 16_stripe_0_work_tls_rr, BENCHMARK_NAMED_PARAM(
16, 0, SpreaderType::TLS_RR) contentionAtWidth, 16_stripe_0_work_tls_rr, 16, 0, SpreaderType::TLS_RR)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 32_stripe_0_work_tls_rr, BENCHMARK_NAMED_PARAM(
32, 0, SpreaderType::TLS_RR) contentionAtWidth, 32_stripe_0_work_tls_rr, 32, 0, SpreaderType::TLS_RR)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 64_stripe_0_work_tls_rr, BENCHMARK_NAMED_PARAM(
64, 0, SpreaderType::TLS_RR) contentionAtWidth, 64_stripe_0_work_tls_rr, 64, 0, SpreaderType::TLS_RR)
BENCHMARK_NAMED_PARAM(contentionAtWidth, BENCHMARK_NAMED_PARAM(contentionAtWidth,
2_stripe_0_work_pthread_self, 2_stripe_0_work_pthread_self,
2, 2,
...@@ -715,49 +757,54 @@ BENCHMARK_NAMED_PARAM(contentionAtWidth, ...@@ -715,49 +757,54 @@ BENCHMARK_NAMED_PARAM(contentionAtWidth,
64, 64,
0, 0,
SpreaderType::PTHREAD_SELF) SpreaderType::PTHREAD_SELF)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 2_stripe_0_work_shared, BENCHMARK_NAMED_PARAM(
2, 0, SpreaderType::SHARED) contentionAtWidth, 2_stripe_0_work_shared, 2, 0, SpreaderType::SHARED)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 4_stripe_0_work_shared, BENCHMARK_NAMED_PARAM(
4, 0, SpreaderType::SHARED) contentionAtWidth, 4_stripe_0_work_shared, 4, 0, SpreaderType::SHARED)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 8_stripe_0_work_shared, BENCHMARK_NAMED_PARAM(
8, 0, SpreaderType::SHARED) contentionAtWidth, 8_stripe_0_work_shared, 8, 0, SpreaderType::SHARED)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 16_stripe_0_work_shared, BENCHMARK_NAMED_PARAM(
16, 0, SpreaderType::SHARED) contentionAtWidth, 16_stripe_0_work_shared, 16, 0, SpreaderType::SHARED)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 32_stripe_0_work_shared, BENCHMARK_NAMED_PARAM(
32, 0, SpreaderType::SHARED) contentionAtWidth, 32_stripe_0_work_shared, 32, 0, SpreaderType::SHARED)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 64_stripe_0_work_shared, BENCHMARK_NAMED_PARAM(
64, 0, SpreaderType::SHARED) contentionAtWidth, 64_stripe_0_work_shared, 64, 0, SpreaderType::SHARED)
BENCHMARK_NAMED_PARAM(atomicIncrBaseline, local_incr_0_work, 0) BENCHMARK_NAMED_PARAM(atomicIncrBaseline, local_incr_0_work, 0)
BENCHMARK_DRAW_LINE() BENCHMARK_DRAW_LINE()
BENCHMARK_NAMED_PARAM(contentionAtWidth, 1_stripe_500_work_stub, BENCHMARK_NAMED_PARAM(
1, 500, SpreaderType::GETCPU) contentionAtWidth, 1_stripe_500_work_stub, 1, 500, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 2_stripe_500_work_getcpu, BENCHMARK_NAMED_PARAM(
2, 500, SpreaderType::GETCPU) contentionAtWidth, 2_stripe_500_work_getcpu, 2, 500, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 4_stripe_500_work_getcpu, BENCHMARK_NAMED_PARAM(
4, 500, SpreaderType::GETCPU) contentionAtWidth, 4_stripe_500_work_getcpu, 4, 500, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 8_stripe_500_work_getcpu, BENCHMARK_NAMED_PARAM(
8, 500, SpreaderType::GETCPU) contentionAtWidth, 8_stripe_500_work_getcpu, 8, 500, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 16_stripe_500_work_getcpu, BENCHMARK_NAMED_PARAM(
16, 500, SpreaderType::GETCPU) contentionAtWidth, 16_stripe_500_work_getcpu, 16, 500, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 32_stripe_500_work_getcpu, BENCHMARK_NAMED_PARAM(
32, 500, SpreaderType::GETCPU) contentionAtWidth, 32_stripe_500_work_getcpu, 32, 500, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(atomicIncrBaseline, local_incr_500_work, 500) BENCHMARK_NAMED_PARAM(atomicIncrBaseline, local_incr_500_work, 500)
BENCHMARK_DRAW_LINE() BENCHMARK_DRAW_LINE()
BENCHMARK_NAMED_PARAM(contentionAtWidth, 1_stripe_1000_work_stub, BENCHMARK_NAMED_PARAM(
1, 1000, SpreaderType::GETCPU) contentionAtWidth, 1_stripe_1000_work_stub, 1, 1000, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 2_stripe_1000_work_getcpu, BENCHMARK_NAMED_PARAM(
2, 1000, SpreaderType::GETCPU) contentionAtWidth, 2_stripe_1000_work_getcpu, 2, 1000, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 4_stripe_1000_work_getcpu, BENCHMARK_NAMED_PARAM(
4, 1000, SpreaderType::GETCPU) contentionAtWidth, 4_stripe_1000_work_getcpu, 4, 1000, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 8_stripe_1000_work_getcpu, BENCHMARK_NAMED_PARAM(
8, 1000, SpreaderType::GETCPU) contentionAtWidth, 8_stripe_1000_work_getcpu, 8, 1000, SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth, 16_stripe_1000_work_getcpu, BENCHMARK_NAMED_PARAM(contentionAtWidth,
16, 1000, SpreaderType::GETCPU) 16_stripe_1000_work_getcpu,
BENCHMARK_NAMED_PARAM(contentionAtWidth, 32_stripe_1000_work_getcpu, 16,
32, 1000, SpreaderType::GETCPU) 1000,
SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(contentionAtWidth,
32_stripe_1000_work_getcpu,
32,
1000,
SpreaderType::GETCPU)
BENCHMARK_NAMED_PARAM(atomicIncrBaseline, local_incr_1000_work, 1000) BENCHMARK_NAMED_PARAM(atomicIncrBaseline, local_incr_1000_work, 1000)
int main(int argc, char** argv) { int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
gflags::ParseCommandLineFlags(&argc, &argv, true); gflags::ParseCommandLineFlags(&argc, &argv, true);
......
...@@ -91,9 +91,10 @@ struct UniformSubset { ...@@ -91,9 +91,10 @@ struct UniformSubset {
void adjustPermSize(size_t numActive) { void adjustPermSize(size_t numActive) {
if (perm_.size() > numActive) { if (perm_.size() > numActive) {
perm_.erase(std::remove_if(perm_.begin(), perm_.end(), [=](size_t x) { perm_.erase(std::remove_if(perm_.begin(),
return x >= numActive; perm_.end(),
}), perm_.end()); [=](size_t x) { return x >= numActive; }),
perm_.end());
} else { } else {
while (perm_.size() < numActive) { while (perm_.size() < numActive) {
perm_.push_back(perm_.size()); perm_.push_back(perm_.size());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment