@@ -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 :
0 commit comments