@@ -516,7 +516,7 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
516
516
| (parent -> io_arity ? LSTOPO_CHILD_KIND_IO : 0 )
517
517
| (parent -> misc_arity ? LSTOPO_CHILD_KIND_MISC : 0 );
518
518
/* 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 ) ) {
520
520
plud -> children .kinds = existing_kinds ;
521
521
plud -> above_children .kinds = 0 ;
522
522
} else {
@@ -552,8 +552,8 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
552
552
normal_children_separator = 0 ;
553
553
554
554
/* 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 )
557
557
/* except between cache parent and PU children */
558
558
separator_below_cache = 0 ;
559
559
/* update children placement */
@@ -567,14 +567,21 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
567
567
/* place children above the parent, if any*/
568
568
if (plud -> above_children .kinds ) {
569
569
enum lstopo_orient_e morient = LSTOPO_ORIENT_HORIZ ;
570
- unsigned memory_border ;
570
+ int need_box ;
571
571
572
572
assert (plud -> above_children .kinds == LSTOPO_CHILD_KIND_MEMORY );
573
- memory_border = parent -> memory_arity > 1 ? border : 0 ;
574
573
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 ;
576
583
577
- if (parent -> memory_arity > 1 ) {
584
+ if (need_box ) {
578
585
/* if there are multiple memory children, add a box, as large as the parent */
579
586
if (above_children_width < children_width ) {
580
587
above_children_width = children_width ;
@@ -593,7 +600,7 @@ place_children(struct lstopo_output *loutput, hwloc_obj_t parent,
593
600
}
594
601
595
602
/* 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 ) {
597
604
/* cache children are below */
598
605
if (children_width > totwidth )
599
606
totwidth = children_width ;
@@ -882,6 +889,7 @@ lstopo_set_object_color(struct lstopo_output *loutput,
882
889
case HWLOC_OBJ_L1ICACHE :
883
890
case HWLOC_OBJ_L2ICACHE :
884
891
case HWLOC_OBJ_L3ICACHE :
892
+ case HWLOC_OBJ_MEMCACHE :
885
893
s -> bg = & CACHE_COLOR ;
886
894
break ;
887
895
@@ -1505,6 +1513,7 @@ get_type_fun(hwloc_obj_type_t type)
1505
1513
case HWLOC_OBJ_L1ICACHE : return cache_draw ;
1506
1514
case HWLOC_OBJ_L2ICACHE : return cache_draw ;
1507
1515
case HWLOC_OBJ_L3ICACHE : return cache_draw ;
1516
+ case HWLOC_OBJ_MEMCACHE : return cache_draw ;
1508
1517
case HWLOC_OBJ_PCI_DEVICE : return pci_device_draw ;
1509
1518
case HWLOC_OBJ_BRIDGE : return bridge_draw ;
1510
1519
default :
0 commit comments