Skip to content

Commit cfab985

Browse files
committed
darwin: don't forget to filter perflevel caches
Forgotten in f7c9aa8 Thanks to Michel Lesoinne for the report. Closes #564 Signed-off-by: Brice Goglin <[email protected]> (cherry picked from commit aa0ef16)
1 parent f2ec6ef commit cfab985

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ bug fixes (and other actions) for each version of hwloc since version
1919

2020
Version 2.8.1
2121
-------------
22+
* Don't forget to apply filters to "perflevel" caches detected on recent
23+
Mac OS X releases, thanks to Michel Lesoinne for the report.
2224
* Add support for CUDA compute capability up to 9.0.
2325

2426

hwloc/topology-darwin.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2022 Inria. All rights reserved.
3+
* Copyright © 2009-2023 Inria. All rights reserved.
44
* Copyright © 2009-2013 Université Bordeaux
55
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
66
* See COPYING in top-level directory.
@@ -456,23 +456,26 @@ static void hwloc__darwin_look_perflevel_caches(struct hwloc_topology *topology,
456456
int64_t size;
457457

458458
snprintf(name, sizeof(name), "hw.perflevel%u.l1icachesize", level);
459-
if (!hwloc_get_sysctlbyname(name, &size)) {
459+
if (hwloc_filter_check_keep_object_type(topology, HWLOC_OBJ_L1ICACHE)
460+
&& !hwloc_get_sysctlbyname(name, &size)) {
460461
/* hw.perflevel%u.cpusperl1i missing, assume it's per PU */
461462
hwloc_debug("found perflevel %u l1icachesize %ld, assuming width 1\n", level, (long) size);
462463
hwloc__darwin_build_perflevel_cache_level(topology, cpuset, 1, HWLOC_OBJ_L1ICACHE, 1, size, linesize);
463464
gothybrid->l1i++;
464465
}
465466

466467
snprintf(name, sizeof(name), "hw.perflevel%u.l1dcachesize", level);
467-
if (!hwloc_get_sysctlbyname(name, &size)) {
468+
if (hwloc_filter_check_keep_object_type(topology, HWLOC_OBJ_L1CACHE)
469+
&& !hwloc_get_sysctlbyname(name, &size)) {
468470
/* hw.perflevel%u.cpusperl1d missing, assume it's per PU */
469471
hwloc_debug("found perflevel %u l1dcachesize %ld, assuming width 1\n", level, (long) size);
470472
hwloc__darwin_build_perflevel_cache_level(topology, cpuset, 1, HWLOC_OBJ_L1CACHE, 1, size, linesize);
471473
gothybrid->l1d++;
472474
}
473475

474476
snprintf(name, sizeof(name), "hw.perflevel%u.l2cachesize", level);
475-
if (!hwloc_get_sysctlbyname(name, &size)) {
477+
if (hwloc_filter_check_keep_object_type(topology, HWLOC_OBJ_L2CACHE)
478+
&& !hwloc_get_sysctlbyname(name, &size)) {
476479
int64_t cpus;
477480

478481
hwloc_debug("found perflevel %u l2cachesize %ld\n", level, (long) size);
@@ -499,10 +502,11 @@ static void hwloc__darwin_look_perflevel_caches(struct hwloc_topology *topology,
499502
/* assume PUs are contigous for now. */
500503
hwloc__darwin_build_perflevel_cache_level(topology, cpuset, cpus, HWLOC_OBJ_L2CACHE, 2, size, linesize);
501504
gothybrid->l2++;
502-
}
505+
}
503506

504507
snprintf(name, sizeof(name), "hw.perflevel%u.l3cachesize", level);
505-
if (!hwloc_get_sysctlbyname(name, &size)) {
508+
if (hwloc_filter_check_keep_object_type(topology, HWLOC_OBJ_L3CACHE)
509+
&& !hwloc_get_sysctlbyname(name, &size)) {
506510
int64_t cpus;
507511

508512
hwloc_debug("found perflevel %u l3cachesize %ld\n", level, (long) size);

0 commit comments

Comments
 (0)