@@ -3481,6 +3481,7 @@ static void
3481
3481
hwloc_linux_knl_add_cluster (struct hwloc_topology * topology ,
3482
3482
hwloc_obj_t ddr , hwloc_obj_t mcdram ,
3483
3483
struct knl_hwdata * knl_hwdata ,
3484
+ int mscache_as_l3 ,
3484
3485
unsigned * failednodes )
3485
3486
{
3486
3487
hwloc_obj_t cluster = NULL ;
@@ -3543,8 +3544,18 @@ hwloc_linux_knl_add_cluster(struct hwloc_topology *topology,
3543
3544
hwloc_obj_add_info (cache , "Inclusive" , knl_hwdata -> mcdram_cache_inclusiveness ? "1" : "0" );
3544
3545
cache -> cpuset = hwloc_bitmap_dup (ddr -> cpuset );
3545
3546
cache -> nodeset = hwloc_bitmap_dup (ddr -> nodeset ); /* only applies to DDR */
3546
- cache -> subtype = strdup ("MemorySideCache" );
3547
- hwloc_insert_object_by_cpuset (topology , cache );
3547
+ if (mscache_as_l3 ) {
3548
+ /* make it a L3 */
3549
+ cache -> subtype = strdup ("MemorySideCache" );
3550
+ hwloc_insert_object_by_cpuset (topology , cache );
3551
+ } else {
3552
+ /* make it a real mscache */
3553
+ cache -> type = HWLOC_OBJ_MEMCACHE ;
3554
+ if (cluster )
3555
+ hwloc__attach_memory_object (topology , cluster , cache , hwloc_report_os_error );
3556
+ else
3557
+ hwloc__insert_object_by_cpuset (topology , NULL , cache , hwloc_report_os_error );
3558
+ }
3548
3559
}
3549
3560
}
3550
3561
@@ -3560,6 +3571,8 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3560
3571
unsigned i ;
3561
3572
char * fallback_env = getenv ("HWLOC_KNL_HDH_FALLBACK" );
3562
3573
int fallback = fallback_env ? atoi (fallback_env ) : -1 ; /* by default, only fallback if needed */
3574
+ char * mscache_as_l3_env = getenv ("HWLOC_KNL_MSCACHE_L3" );
3575
+ int mscache_as_l3 = mscache_as_l3_env ? atoi (mscache_as_l3_env ) : 1 ; /* L3 by default, for backward compat */
3563
3576
3564
3577
if (* failednodes )
3565
3578
goto error ;
@@ -3596,8 +3609,13 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3596
3609
goto error ;
3597
3610
}
3598
3611
3599
- if (!hwloc_filter_check_keep_object_type (topology , HWLOC_OBJ_L3CACHE ))
3600
- hwdata .mcdram_cache_size = 0 ;
3612
+ if (mscache_as_l3 ) {
3613
+ if (!hwloc_filter_check_keep_object_type (topology , HWLOC_OBJ_L3CACHE ))
3614
+ hwdata .mcdram_cache_size = 0 ;
3615
+ } else {
3616
+ if (!hwloc_filter_check_keep_object_type (topology , HWLOC_OBJ_MEMCACHE ))
3617
+ hwdata .mcdram_cache_size = 0 ;
3618
+ }
3601
3619
3602
3620
hwloc_obj_add_info (topology -> levels [0 ][0 ], "ClusterMode" , hwdata .cluster_mode );
3603
3621
hwloc_obj_add_info (topology -> levels [0 ][0 ], "MemoryMode" , hwdata .memory_mode );
@@ -3611,7 +3629,7 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3611
3629
fprintf (stderr , "Found %u NUMA nodes instead of 1 in mode %s-%s\n" , nbnodes , hwdata .cluster_mode , hwdata .memory_mode );
3612
3630
goto error ;
3613
3631
}
3614
- hwloc_linux_knl_add_cluster (topology , nodes [0 ], NULL , & hwdata , failednodes );
3632
+ hwloc_linux_knl_add_cluster (topology , nodes [0 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3615
3633
3616
3634
} else {
3617
3635
/* Quadrant-Flat/Hybrid */
@@ -3621,7 +3639,7 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3621
3639
}
3622
3640
if (!strcmp (hwdata .memory_mode , "Flat" ))
3623
3641
hwdata .mcdram_cache_size = 0 ;
3624
- hwloc_linux_knl_add_cluster (topology , nodes [0 ], nodes [1 ], & hwdata , failednodes );
3642
+ hwloc_linux_knl_add_cluster (topology , nodes [0 ], nodes [1 ], & hwdata , mscache_as_l3 , failednodes );
3625
3643
}
3626
3644
3627
3645
} else if (!strcmp (hwdata .cluster_mode , "SNC2" )) {
@@ -3631,8 +3649,8 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3631
3649
fprintf (stderr , "Found %u NUMA nodes instead of 2 in mode %s-%s\n" , nbnodes , hwdata .cluster_mode , hwdata .memory_mode );
3632
3650
goto error ;
3633
3651
}
3634
- hwloc_linux_knl_add_cluster (topology , nodes [0 ], NULL , & hwdata , failednodes );
3635
- hwloc_linux_knl_add_cluster (topology , nodes [1 ], NULL , & hwdata , failednodes );
3652
+ hwloc_linux_knl_add_cluster (topology , nodes [0 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3653
+ hwloc_linux_knl_add_cluster (topology , nodes [1 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3636
3654
3637
3655
} else {
3638
3656
/* SNC2-Flat/Hybrid */
@@ -3647,8 +3665,8 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3647
3665
}
3648
3666
if (!strcmp (hwdata .memory_mode , "Flat" ))
3649
3667
hwdata .mcdram_cache_size = 0 ;
3650
- hwloc_linux_knl_add_cluster (topology , nodes [ddr [0 ]], nodes [mcdram [0 ]], & hwdata , failednodes );
3651
- hwloc_linux_knl_add_cluster (topology , nodes [ddr [1 ]], nodes [mcdram [1 ]], & hwdata , failednodes );
3668
+ hwloc_linux_knl_add_cluster (topology , nodes [ddr [0 ]], nodes [mcdram [0 ]], & hwdata , mscache_as_l3 , failednodes );
3669
+ hwloc_linux_knl_add_cluster (topology , nodes [ddr [1 ]], nodes [mcdram [1 ]], & hwdata , mscache_as_l3 , failednodes );
3652
3670
}
3653
3671
3654
3672
} else if (!strcmp (hwdata .cluster_mode , "SNC4" )) {
@@ -3658,10 +3676,10 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3658
3676
fprintf (stderr , "Found %u NUMA nodes instead of 4 in mode %s-%s\n" , nbnodes , hwdata .cluster_mode , hwdata .memory_mode );
3659
3677
goto error ;
3660
3678
}
3661
- hwloc_linux_knl_add_cluster (topology , nodes [0 ], NULL , & hwdata , failednodes );
3662
- hwloc_linux_knl_add_cluster (topology , nodes [1 ], NULL , & hwdata , failednodes );
3663
- hwloc_linux_knl_add_cluster (topology , nodes [2 ], NULL , & hwdata , failednodes );
3664
- hwloc_linux_knl_add_cluster (topology , nodes [3 ], NULL , & hwdata , failednodes );
3679
+ hwloc_linux_knl_add_cluster (topology , nodes [0 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3680
+ hwloc_linux_knl_add_cluster (topology , nodes [1 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3681
+ hwloc_linux_knl_add_cluster (topology , nodes [2 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3682
+ hwloc_linux_knl_add_cluster (topology , nodes [3 ], NULL , & hwdata , mscache_as_l3 , failednodes );
3665
3683
3666
3684
} else {
3667
3685
/* SNC4-Flat/Hybrid */
@@ -3676,10 +3694,10 @@ hwloc_linux_knl_numa_quirk(struct hwloc_topology *topology,
3676
3694
}
3677
3695
if (!strcmp (hwdata .memory_mode , "Flat" ))
3678
3696
hwdata .mcdram_cache_size = 0 ;
3679
- hwloc_linux_knl_add_cluster (topology , nodes [ddr [0 ]], nodes [mcdram [0 ]], & hwdata , failednodes );
3680
- hwloc_linux_knl_add_cluster (topology , nodes [ddr [1 ]], nodes [mcdram [1 ]], & hwdata , failednodes );
3681
- hwloc_linux_knl_add_cluster (topology , nodes [ddr [2 ]], nodes [mcdram [2 ]], & hwdata , failednodes );
3682
- hwloc_linux_knl_add_cluster (topology , nodes [ddr [3 ]], nodes [mcdram [3 ]], & hwdata , failednodes );
3697
+ hwloc_linux_knl_add_cluster (topology , nodes [ddr [0 ]], nodes [mcdram [0 ]], & hwdata , mscache_as_l3 , failednodes );
3698
+ hwloc_linux_knl_add_cluster (topology , nodes [ddr [1 ]], nodes [mcdram [1 ]], & hwdata , mscache_as_l3 , failednodes );
3699
+ hwloc_linux_knl_add_cluster (topology , nodes [ddr [2 ]], nodes [mcdram [2 ]], & hwdata , mscache_as_l3 , failednodes );
3700
+ hwloc_linux_knl_add_cluster (topology , nodes [ddr [3 ]], nodes [mcdram [3 ]], & hwdata , mscache_as_l3 , failednodes );
3683
3701
}
3684
3702
}
3685
3703
0 commit comments