Skip to content

Commit 50efae7

Browse files
committed
memattrs: use a bitmask for memory tier type instead of a simple enum
So that we may combine a CXL type with others. Signed-off-by: Brice Goglin <[email protected]>
1 parent d535c65 commit 50efae7

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

hwloc/memattrs.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,14 +1220,16 @@ hwloc_get_local_numanode_objs(hwloc_topology_t topology,
12201220
* Using memattrs to identify HBM/DRAM
12211221
*/
12221222

1223-
typedef enum hwloc_memory_tier_type_e {
1224-
HWLOC_MEMORY_TIER_UNKNOWN,
1225-
HWLOC_MEMORY_TIER_HBM,
1226-
HWLOC_MEMORY_TIER_DRAM,
1227-
HWLOC_MEMORY_TIER_GPU,
1228-
HWLOC_MEMORY_TIER_SPM, /* Specific-Purpose Memory is usually HBM, we'll use BW to confirm or force*/
1229-
HWLOC_MEMORY_TIER_NVM
1230-
} hwloc_memory_tier_type_t;
1223+
enum hwloc_memory_tier_type_e {
1224+
/* WARNING: the order is important */
1225+
HWLOC_MEMORY_TIER_HBM = 1UL<<0,
1226+
HWLOC_MEMORY_TIER_DRAM = 1UL<<1,
1227+
HWLOC_MEMORY_TIER_GPU = 1UL<<2,
1228+
HWLOC_MEMORY_TIER_SPM = 1UL<<3, /* Specific-Purpose Memory is usually HBM, we'll use BW to confirm or force*/
1229+
HWLOC_MEMORY_TIER_NVM = 1UL<<4
1230+
};
1231+
typedef unsigned long hwloc_memory_tier_type_t;
1232+
#define HWLOC_MEMORY_TIER_UNKNOWN 0UL
12311233

12321234
static const char * hwloc_memory_tier_type_snprintf(hwloc_memory_tier_type_t type)
12331235
{
@@ -1372,7 +1374,7 @@ hwloc__group_memory_tiers(hwloc_topology_t topology,
13721374
hwloc_debug(" node info %u = node L#%u P#%u with info type %lx and local BW %llu lat %llu\n",
13731375
i,
13741376
nodeinfos[i].node->logical_index, nodeinfos[i].node->os_index,
1375-
(unsigned long) nodeinfos[i].type,
1377+
nodeinfos[i].type,
13761378
(unsigned long long) nodeinfos[i].local_bw,
13771379
(unsigned long long) nodeinfos[i].local_lat);
13781380
#endif
@@ -1657,8 +1659,7 @@ hwloc_internal_memattrs_guess_memory_tiers(hwloc_topology_t topology)
16571659
hwloc_bitmap_asprintf(&s, tiers[i].nodeset);
16581660
hwloc_debug(" tier %u = nodes %s with type %lx and local BW %llu-%llu lat %llu-%llu\n",
16591661
i,
1660-
s,
1661-
(unsigned long) tiers[i].type,
1662+
s, tiers[i].type,
16621663
(unsigned long long) tiers[i].local_bw_min,
16631664
(unsigned long long) tiers[i].local_bw_max,
16641665
(unsigned long long) tiers[i].local_lat_min,

0 commit comments

Comments
 (0)