Skip to content

Commit c1fb116

Browse files
committed
tools: update for memory-side caches
lstopo/graphics: When there's a memcache, we always put memory children inside a dedicated memory box. The cache is placed above its NUMA node(s), without a vertical space between, so that we know which NUMA node is cached. all: --no-caches or --filter cache:... applies to both cpu-side and memory-side caches since both are enabled by default in tools (contrary to the API). Signed-off-by: Brice Goglin <[email protected]>
1 parent 0527f88 commit c1fb116

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

utils/hwloc/hwloc-info.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ hwloc_info_show_obj(hwloc_topology_t topology, hwloc_obj_t obj, const char *type
131131
case HWLOC_OBJ_L1ICACHE:
132132
case HWLOC_OBJ_L2ICACHE:
133133
case HWLOC_OBJ_L3ICACHE:
134+
case HWLOC_OBJ_MEMCACHE:
134135
printf("%s attr cache depth = %u\n", prefix, obj->attr->cache.depth);
135136
switch (obj->attr->cache.type) {
136137
case HWLOC_OBJ_CACHE_UNIFIED: printf("%s attr cache type = Unified\n", prefix); break;
@@ -455,9 +456,10 @@ main (int argc, char *argv[])
455456
hwloc_topology_set_all_types_filter(topology, filter);
456457
else if (allio)
457458
hwloc_topology_set_io_types_filter(topology, filter);
458-
else if (allcaches)
459+
else if (allcaches) {
459460
hwloc_topology_set_cache_types_filter(topology, filter);
460-
else if (allicaches)
461+
hwloc_topology_set_type_filter(topology, HWLOC_OBJ_MEMCACHE, filter);
462+
} else if (allicaches)
461463
hwloc_topology_set_icache_types_filter(topology, filter);
462464
else
463465
hwloc_topology_set_type_filter(topology, type, filter);

utils/hwloc/misc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2018 Inria. All rights reserved.
3+
* Copyright © 2009-2019 Inria. All rights reserved.
44
* Copyright © 2009-2012 Université Bordeaux
55
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
66
* See COPYING in top-level directory.
@@ -389,6 +389,7 @@ hwloc_lstopo_show_summary(FILE *output, hwloc_topology_t topology)
389389
hwloc_lstopo_show_summary_depth(output, prefixmaxlen, topology, depth);
390390
/* FIXME: which order? */
391391
hwloc_lstopo_show_summary_depth(output, prefixmaxlen, topology, HWLOC_TYPE_DEPTH_NUMANODE);
392+
hwloc_lstopo_show_summary_depth(output, prefixmaxlen, topology, HWLOC_TYPE_DEPTH_MEMCACHE);
392393
hwloc_lstopo_show_summary_depth(output, prefixmaxlen, topology, HWLOC_TYPE_DEPTH_BRIDGE);
393394
hwloc_lstopo_show_summary_depth(output, prefixmaxlen, topology, HWLOC_TYPE_DEPTH_PCI_DEVICE);
394395
hwloc_lstopo_show_summary_depth(output, prefixmaxlen, topology, HWLOC_TYPE_DEPTH_OS_DEVICE);

utils/lstopo/lstopo-draw.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
516516
| (parent->io_arity ? LSTOPO_CHILD_KIND_IO : 0)
517517
| (parent->misc_arity ? LSTOPO_CHILD_KIND_MISC : 0);
518518
/* now assign them below or above the parent */
519-
if (loutput->plain_children_order) {
519+
if (loutput->plain_children_order || hwloc_obj_type_is_memory(parent->type)) {
520520
plud->children.kinds = existing_kinds;
521521
plud->above_children.kinds = 0;
522522
} else {
@@ -552,8 +552,8 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
552552
normal_children_separator = 0;
553553

554554
/* add separator between a cache parent and its children */
555-
if (hwloc_obj_type_is_cache(parent->type)) {
556-
if ((unsigned)parent->depth == loutput->depth-2)
555+
if (hwloc_obj_type_is_cache(parent->type) || parent->type == HWLOC_OBJ_MEMCACHE) {
556+
if ((unsigned)parent->depth == loutput->depth-2 || parent->type == HWLOC_OBJ_MEMCACHE)
557557
/* except between cache parent and PU children */
558558
separator_below_cache = 0;
559559
/* update children placement */
@@ -567,14 +567,21 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
567567
/* place children above the parent, if any*/
568568
if (plud->above_children.kinds) {
569569
enum lstopo_orient_e morient = LSTOPO_ORIENT_HORIZ;
570-
unsigned memory_border;
570+
int need_box;
571571

572572
assert(plud->above_children.kinds == LSTOPO_CHILD_KIND_MEMORY);
573-
memory_border = parent->memory_arity > 1 ? border : 0;
574573

575-
place__children(loutput, parent, plud->above_children.kinds, &morient, memory_border, separator, &above_children_width, &above_children_height);
574+
/* we need a memory children box if parent isn't a memory object
575+
* and if there are multiple objects in the box
576+
*/
577+
need_box = !hwloc_obj_type_is_memory(parent->type)
578+
&& (parent->memory_arity + parent->memory_first_child->memory_arity > 1);
579+
580+
place__children(loutput, parent, plud->above_children.kinds, &morient, need_box ? border : 0, separator, &above_children_width, &above_children_height);
581+
if (parent->type == HWLOC_OBJ_MEMCACHE)
582+
above_children_height -= separator;
576583

577-
if (parent->memory_arity > 1) {
584+
if (need_box) {
578585
/* if there are multiple memory children, add a box, as large as the parent */
579586
if (above_children_width < children_width) {
580587
above_children_width = children_width;
@@ -593,7 +600,7 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
593600
}
594601

595602
/* adjust parent size */
596-
if (hwloc_obj_type_is_cache(parent->type)) {
603+
if (hwloc_obj_type_is_cache(parent->type) || parent->type == HWLOC_OBJ_MEMCACHE) {
597604
/* cache children are below */
598605
if (children_width > totwidth)
599606
totwidth = children_width;
@@ -882,6 +889,7 @@ lstopo_set_object_color(struct lstopo_output *loutput,
882889
case HWLOC_OBJ_L1ICACHE:
883890
case HWLOC_OBJ_L2ICACHE:
884891
case HWLOC_OBJ_L3ICACHE:
892+
case HWLOC_OBJ_MEMCACHE:
885893
s->bg = &CACHE_COLOR;
886894
break;
887895

@@ -1505,6 +1513,7 @@ get_type_fun(hwloc_obj_type_t type)
15051513
case HWLOC_OBJ_L1ICACHE: return cache_draw;
15061514
case HWLOC_OBJ_L2ICACHE: return cache_draw;
15071515
case HWLOC_OBJ_L3ICACHE: return cache_draw;
1516+
case HWLOC_OBJ_MEMCACHE: return cache_draw;
15081517
case HWLOC_OBJ_PCI_DEVICE: return pci_device_draw;
15091518
case HWLOC_OBJ_BRIDGE: return bridge_draw;
15101519
default:

utils/lstopo/lstopo.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ main (int argc, char *argv[])
628628
for(i=HWLOC_OBJ_L1CACHE; i<=HWLOC_OBJ_L3ICACHE; i++)
629629
loutput.force_orient[i] = LSTOPO_ORIENT_HORIZ;
630630
loutput.force_orient[HWLOC_OBJ_NUMANODE] = LSTOPO_ORIENT_HORIZ;
631+
loutput.force_orient[HWLOC_OBJ_MEMCACHE] = LSTOPO_ORIENT_HORIZ;
631632
for(i=HWLOC_OBJ_TYPE_MIN; i<HWLOC_OBJ_TYPE_MAX; i++) {
632633
loutput.show_indexes[i] = 1;
633634
loutput.show_attrs[i] = 1;
@@ -742,9 +743,10 @@ main (int argc, char *argv[])
742743
hwloc_topology_set_all_types_filter(topology, filter);
743744
else if (allio)
744745
hwloc_topology_set_io_types_filter(topology, filter);
745-
else if (allcaches)
746+
else if (allcaches) {
746747
hwloc_topology_set_cache_types_filter(topology, filter);
747-
else if (allicaches)
748+
hwloc_topology_set_type_filter(topology, HWLOC_OBJ_MEMCACHE, filter);
749+
} else if (allicaches)
748750
hwloc_topology_set_icache_types_filter(topology, filter);
749751
else
750752
hwloc_topology_set_type_filter(topology, type, filter);
@@ -770,9 +772,11 @@ main (int argc, char *argv[])
770772
}
771773
else if (!strcmp (argv[0], "--no-caches")) {
772774
hwloc_topology_set_cache_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_NONE);
775+
hwloc_topology_set_type_filter(topology, HWLOC_OBJ_MEMCACHE, HWLOC_TYPE_FILTER_KEEP_NONE);
773776
}
774777
else if (!strcmp (argv[0], "--no-useless-caches")) {
775778
hwloc_topology_set_cache_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_STRUCTURE);
779+
hwloc_topology_set_type_filter(topology, HWLOC_OBJ_MEMCACHE, HWLOC_TYPE_FILTER_KEEP_STRUCTURE);
776780
}
777781
else if (!strcmp (argv[0], "--no-icaches")) {
778782
hwloc_topology_set_icache_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_NONE);

0 commit comments

Comments
 (0)